From: Sébastien Villemot Date: Thu, 26 Aug 2021 17:05:36 +0000 (+0100) Subject: Import ffcall_2.4.orig.tar.gz X-Git-Tag: archive/raspbian/2.4-1+rpi1^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cfb666256075a3a01b292dbbe21e79b18c4143a7;p=ffcall.git Import ffcall_2.4.orig.tar.gz [dgit import orig ffcall_2.4.orig.tar.gz] --- cfb666256075a3a01b292dbbe21e79b18c4143a7 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..a3d1815 --- /dev/null +++ b/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 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 + + Appendix: 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. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +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. + + , 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/ChangeLog b/ChangeLog new file mode 100644 index 0000000..eda04ef --- /dev/null +++ b/ChangeLog @@ -0,0 +1,5856 @@ +2021-06-13 Bruno Haible + + Prepare for 2.4 release. + * VERSION: Set to 2.4. + +2021-06-13 Bruno Haible + + Bump shared library version numbers. + * Makefile.in (LIBFFCALL_VERSION_INFO): Bump to 1:0:1. + * avcall/Makefile.in (LIBAVCALL_VERSION_INFO): Bump to 2:0:1. + * callback/Makefile.in (LIBCALLBACK_VERSION_INFO): Bump to 1:4:0. + +2021-06-13 Bruno Haible + + Port to Solaris 11/SPARC 32-bit. + * avcall/avcall-sparc.c (avcall_call): Use preallocated trampolines + instead of generating a trampoline on the stack, because the stack is + not executable on Solaris 11. + * avcall/Makefile.devel (avcall-sparc-solaris.s, + avcall-sparc-solaris-macro.S): New rules. + * avcall/Makefile.in (SOURCE_FILES): Add avcall-sparc-solaris.s, + avcall-sparc-solaris-macro.S. + (avcall-sparc.s): Use a different input file on Solaris. + * NEWS: Mention the new port. + +2021-06-13 Bruno Haible + + Fix build error on FreeBSD 12/arm. + * common/asm-arm.sh: Eliminate '.syntax divided' pseudo-ops. + * NEWS: Mention the new port. + +2021-06-13 Bruno Haible + + Fix build error on 64-bit MSVC, due to newer libtool. + * avcall/Makefile.in (avcall-x86_64.lo) [IF_MSVC]: Use ml64 directly, + without invoking libtool. + * callback/vacall_r/Makefile.in (vacall-x86_64.lo) [IF_MSVC]: Likewise. + +2021-06-12 Bruno Haible + + Finish port to macOS 11/arm64. + * PLATFORMS, */PLATFORMS: Mention the macOS 11/arm64 port. + * NEWS: Mention it as attained in release 2.4, not 2.3. + +2021-06-12 Bruno Haible + + vacall: Fix regression on Linux/arm64. + * common/asm-arm64.h: Fix mistake. + +2021-06-12 Bruno Haible + + vacall, callback: Add support for macOS 11/arm64. + * vacall/vacall.h (__varword): Define differently on macOS 11/arm64. + * callback/vacall_r/vacall_r.h (__varword): Likewise. + * vacall/vacall-internal.h (_va_arg_double): Update to allow for + sizeof(__vaword) < sizeof(double). + (__va_arg_struct): Compare type size with 2*sizeof(__varword). + * vacall/Makefile.devel (vacall-arm64-macos-macro.S): New rule. + * vacall/Makefile.in (SOURCE_FILES): Add vacall-arm64-macos-macro.S. + (vacall-arm64.s): Use a different input file on macOS. + * callback/vacall_r/Makefile.devel (vacall-arm64-macos-macro.S): New + rule. + * callback/vacall_r/Makefile.in (SOURCE_FILES): Add + vacall-arm64-macos-macro.S. + (vacall-arm64.s): Use a different input file on macOS. + +2021-06-12 Bruno Haible + + vacall, callback: Distinguish a register word from a stack word. + * vacall/vacall.h (__varword): New type. + * callback/vacall_r/vacall_r.h (__varword): Likewise. + * vacall/vacall-alist.h: Use it as as element type of iarg[]. + * vacall/vacall-internal.h: Use it when assigning to an iargs[] element. + * vacall/vacall-*.c: Use it for integer register variables. + +2021-06-12 Bruno Haible + + avcall: Add support for macOS 11/arm64. + * avcall/avcall-arm64.c: Update comment regarding stack words. + * avcall/avcall.h (__avword): Define differently on macOS 11/arm64. + * avcall/avcall-internal.h (__av_long, __av_ulong, __av_ptr): Define + differently on macOS 11/arm64. + (_av_double): Update to allow for sizeof(__avword) < sizeof(double). + (__av_struct): Update to allow for sizeof(__avword) < sizeof(void*). + * avcall/Makefile.devel (avcall-arm64-macos-macro.S): New rule. + * avcall/Makefile.in (SOURCE_FILES): Add avcall-arm64-macos-macro.S. + (avcall-arm64.s): Use a different input file on macOS. + +2021-06-12 Bruno Haible + + avcall: Distinguish a register word from a stack word. + * avcall/avcall.h (__avrword): New type. + (avcall_start, av_start_struct): Use it as return type of func. + * avcall/avcall-libapi.c (avcall_start, av_start_struct): Likewise. + * avcall/avcall-alist.h: Use it as return type of func and as element + type of iargs[]. + * avcall/avcall-internal.h: Use it when assigning to an iargs[] element. + * avcall/avcall-*.c: Use it for integer register variables. + +2021-06-12 Bruno Haible + + avcall: Support calling conventions that pass 'int', 'long' differently. + * avcall/avcall-internal.h (__av_int, __av_uint): New macros. + * avcall/avcall-libapi.c (avcall_arg_int, avcall_arg_uint): New + functions. + * avcall/avcall.h (avcall_arg_int, avcall_arg_uint): New declarations. + (av_char, av_schar, av_short, av_int, av_uchar, av_ushort, av_uint): Use + them. + +2021-06-12 Bruno Haible + + Support assembly language syntax expected by macOS 11/arm64. + * common/asm-arm64.sh: New file, based on common/asm-arm.sh. + * common/asm-arm64.h: New file, based on common/asm-arm.h. + * Makefile.in (SOURCE_FILES): Add them. + * avcall/Makefile.devel (avcall-arm64-macro.S): Use asm-arm64.sh, + asm-arm64.h instead of asm-arm.sh, asm-arm.h. + * vacall/Makefile.devel (vacall-arm64-macro.S): Use asm-arm64.sh, + asm-arm64.h instead of asm-arm.sh, asm-arm.h. + * callback/vacall_r/Makefile.devel (vacall-arm64-macro.S): Use + asm-arm64.sh, asm-arm64.h instead of asm-arm.sh, asm-arm.h. + +2021-06-11 Bruno Haible + + avcall: Remove handling of obsolete enum item '__AVword'. + * avcall/avcall-*.c: Remove handling of '__AVword'. + +2021-06-11 Bruno Haible + + Fix undefined behaviour in the tests. + * testcases.c (us_cdcd): Cast from double (-30.4) to int to ushort, not + directly to ushort. This avoids undefined behaviour (see ISO C 11 + § 6.3.1.4.(2)). + * vacall/tests.c (simulator): Update accordingly. + * callback/tests.c (us_cdcd_simulator): Likewise. + +2021-06-06 Bruno Haible + + Fix test crash with CC="gcc -ftrapv". + * callback/trampoline_r/test1.c (f): Reorder summands, to avoid signed + integer overflow. + +2021-06-06 Bruno Haible + + Bump shared library version numbers. + * Makefile.in (LIBFFCALL_VERSION_INFO): Bump to 0:3:0. + * avcall/Makefile.in (LIBAVCALL_VERSION_INFO): Bump to 1:3:0. + * trampoline/Makefile.in (LIBTRAMPOLINE_VERSION_INFO): Likewise. + * callback/Makefile.in (LIBCALLBACK_VERSION_INFO): Likewise. + +2021-06-06 Bruno Haible + + Add support for xlclang compiler in 64-bit mode on AIX. + * avcall/avcall.h (__AV_FLOAT_ARGS): Add __AV_AIXCC_FLOAT_ARGS on 64-bit + xlclang. + * vacall/vacall.h (__VA_FLOAT_ARGS): Add __VA_AIXCC_FLOAT_ARGS on 64-bit + xlclang. + * callback/vacall_r/vacall_r.h: Likewise. + +2021-06-06 Bruno Haible + + vacall: Fix minitests crash on OpenBSD 6.5 and newer (x86_64). + * vacall/Makefile.devel (vacall-x86_64-linux-pic.s): New target. + (vacall-x86_64-macro.S): On OpenBSD, use the variant compiled with + -fPIC. Needed because without -fPIC, the .eh_frame section has + relocations. + +2021-04-14 Bruno Haible + + build: Fix compilation error on FreeBSD 13.0/x86_64. + * common/asm-x86_64.h (EH_FRAME_SECTION): On FreeBSD, use flags "a" + instead of "aw". + +2021-03-21 Bruno Haible + + trampoline: Work around failing mmap call on macOS 11. + * Makefile.maint (GNULIB_MODULES): Add clean-temp-simple. + * trampoline/trampoline.c: On macOS, define KEEP_TEMP_FILE_VISIBLE. + (for_mmap_init): If KEEP_TEMP_FILE_VISIBLE, don't delete the file here, + but instead register it for deletion when the process terminates. + * callback/trampoline_r/trampoline.c: Likewise. + +2021-02-28 Bruno Haible + + Update DEPENDENCIES. + * DEPENDENCIES: Update some details. + +2021-02-20 Bruno Haible + + build: Support creating shared libraries on MidnightBSD. + * Makefile.maint (libtool-imported-files): Apply the patch from + . + +2021-02-20 Bruno Haible + + Switch to autoconf 2.71. + * autogen.sh: Update comments. + +2020-12-09 Bruno Haible + + Switch to autoconf 2.70. + * configure.ac: Fix AC_CHECK_HEADERS invocation. Don't invoke + AC_HEADER_STDC. + * Makefile.maint (ACLOCAL, AUTOMAKE, AUTOCONF, AUTOHEADER): Remove the + fixed version suffix. + * autogen.sh: Update comments. + * README-hacking: Indicate which versions of autoconf and automake are + supported. + +2020-12-09 Bruno Haible + + build: Fix syntax error in configure.ac (regression from 2020-07-19). + * configure.ac: Fix syntax error. + +2020-07-19 Bruno Haible + + trampoline, callback: Fix another multithread-safety bug. + * trampoline/trampoline.c (alloc_trampoline): Invoke for_mmap_init + before assigning pagesize, not after. + * callback/trampoline_r/trampoline.c (alloc_trampoline_r): Likewise. + +2020-07-19 Bruno Haible + + trampoline, callback: Fix a multithread-safety bug. + * trampoline/trampoline.c (free_trampoline): Take the freelist_lock. + * callback/trampoline_r/trampoline.c (free_trampoline_r): Likewise. + +2020-07-19 Bruno Haible + + Use OS-provided functions for flushing the instruction cache. + * trampoline/trampoline.c (alloc_trampoline): For flushing the + instruction cache, use the OS-provided functions on Windows, macOS, AIX, + IRIX, Solaris. + * callback/trampoline_r/trampoline.c: Likewise. + * configure.ac: Arrange to not build cache-sparc.o or cache-sparc64.o on + Solaris. + +2020-07-12 Bruno Haible + + build: Fix misuse of AC_CACHE_CHECK. + * m4/codeexec.m4 (FFCALL_CODEEXEC): Use two AC_CACHE_CHECK invocations + instead of one. Don't set ffcall_cv_func_mmap_works. + +2020-07-12 Bruno Haible + + build: Avoid possible conflict with the broken AC_FUNC_MMAP. + * trampoline/trampoline.c: Don't test HAVE_MMAP. + * callback/trampoline_r/trampoline.c: Likewise. + * m4/codeexec.m4 (FFCALL_CODEEXEC): Don't define HAVE_MMAP. + +2020-07-12 Bruno Haible + + Drop portability to IRIX 4. + * trampoline/trampoline.c (PROT_EXEC): Remove fallback definition. + * callback/trampoline_r/trampoline.c (PROT_EXEC): Likewise. + +2020-07-12 Bruno Haible + + build: Simplify autoconf macros. + * m4/codeexec.m4: Include the code from m4/mmap.m4 and m4/mprotect.m4. + * m4/mmap.m4: Remove file. + * m4/mprotect.m4: Remove file. + * Makefile.in (SOURCE_FILES): Remove them. + * configure.ac: Invoke just FFCALL_CODEEXEC, instead of FFCALL_MMAP, + FFCALL_MPROTECT, FFCALL_CODEEXEC, FFCALL_CODEEXEC_PAX. + +2020-07-12 Bruno Haible + + build: Use autoconf macros from gnulib. + * Makefile.maint (GNULIB_FILES): New variable. + (gnulib-imported-files): Import the $(GNULIB_FILES) from gnulib. + * Makefile.in (GNULIB_IMPORTED_FILES): Add m4/mmap-anon.m4. + * configure.ac: Invoke gl_FUNC_MMAP_ANON. + * m4/mmap.m4 (FFCALL_MMAP): Require gl_FUNC_MMAP_ANON. Don't test + MAP_ANON. Don't set HAVE_MMAP_ANON. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): Require gl_FUNC_MMAP_ANON. Don't + test HAVE_MMAP_ANON. + +2020-07-12 Bruno Haible + + build: Simplify autoconf macros. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): Assume that all platforms that + have mprotect also have ENOTSUP. + +2020-07-12 Bruno Haible + + build: Use common GNU style in autoconf macros. + * m4/mmap.m4 (FFCALL_MMAP): Define HAVE_MMAP, HAVE_MMAP_ANON, + HAVE_MMAP_ANONYMOUS, HAVE_MMAP_DEVZERO to 1, not empty. + * m4/mprotect.m4 (FFCALL_MPROTECT): Define HAVE_WORKING_MPROTECT to 1, + not empty. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): Define + HAVE_MMAP_SHARED_CAN_EXEC to 1, not empty. + * trampoline/trampoline.c: Test these macros with #if, not #ifdef. + * callback/trampoline_r/trampoline.c: Likewise. + +2020-07-11 Bruno Haible + + build: Modernize autoconf macros. + * m4/mmap.m4 (FFCALL_MMAP): Use AC_RUN_IFELSE instead of AC_TRY_RUN. + * m4/mprotect.m4 (FFCALL_MPROTECT): Likewise. + * m4/codeexec.m4 (FFCALL_CODEEXEC, FFCALL_CODEEXEC_PAX): Likewise. + +2020-07-11 Bruno Haible + + Drop portability to OSF/1. + * trampoline/trampoline.c: Assume HAVE_MACH_VM is not defined. + * callback/trampoline_r/trampoline.c: Likewise. + * configure.ac: Don't invoke CL_MACH_VM. + * m4/mach-vm.m4: Remove file. + * Makefile.in (SOURCE_FILES): Remove it. + +2020-07-11 Bruno Haible + + build: Simplify autoconf macros. + * trampoline/trampoline.c (getpagesize): Declare only on HP-UX. Remove + fallback definition. + * callback/trampoline_r/trampoline.c (getpagesize): Likewise. + * configure.ac: Don't invoke CL_GETPAGESIZE. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): Declare getpagesize only on + HP-UX. Remove its fallback definition. + * m4/mprotect.m4 (FFCALL_MPROTECT): Don't require CL_GETPAGESIZE. + Declare getpagesize only on HP-UX. Remove its fallback definition. + * m4/getpagesize.m4: Remove file. + * m4/proto.m4: Remove file. + * m4/general.m4: Remove file. + * Makefile.in (SOURCE_FILES): Remove them. + +2020-07-11 Bruno Haible + + build: Simplify autoconf macros. + * configure.ac: Don't invoke FFCALL_SMALL_STRUCT_RETURN, + FFCALL_IREG_FLOAT_RETURN. + * m4/ireg.m4: Remove file. + * m4/smallstruct.m4: Remove file. + * Makefile.in (SOURCE_FILES): Remove them. + +2020-07-11 Bruno Haible + + build: Simplify. + * Makefile.maint (GNULIB_MODULES): Remove 'longlong'. + +2020-07-11 Bruno Haible + + build: Simplify autoconf macros. + * m4/codeexec.m4 (CE_DOC): Remove macro. + (FFCALL_CODEEXEC): Inline it. + +2020-07-11 Bruno Haible + + build: Simplify autoconf macros. + * m4/getpagesize.m4 (CL_GETPAGESIZE): Inline CL_LINK_CHECK invocation. + * m4/mach-vm.m4 (CL_MACH_VM): Likewise. + * m4/general.m4 (CL_CHECK, CL_LINK_CHECK): Remove macros. + +2020-07-11 Bruno Haible + + trampoline: Remove option to allocate memory through shared memory. + * trampoline/trampoline.c: Remove EXECUTABLE_VIA_SHM and its uses. + * callback/trampoline_r/trampoline.c: Likewise. + * configure.ac: Don't invoke CL_SHM_H, CL_SHM. + * m4/shm.m4: Remove file. + * Makefile.in (SOURCE_FILES): Remove it. + +2019-10-13 Bruno Haible + + build: Update after armv7l-linux-gnueabihf gcc version changed. + * avcall/Makefile.devel (avcall-armhf-macro.S): Update. + * vacall/Makefile.devel (vacall-armhf-linux.s, + vacall-armhf-linux-pic.s): Likewise. + * callback/vacall_r/Makefile.devel (vacall-armhf-macro.S): Likewise. + +2019-10-13 Bruno Haible + + cross-tools: Fix compilation error of binutils 2.17 with makeinfo-6.x. + * cross-tools/patches/binutils-2.17.patch: Fix sectioning in elf.texi. + +2019-10-13 Bruno Haible + + cross-tools: Fix compilation error of binutils < 2.24 with makeinfo-6.1. + This backports the fix from + . + * cross-tools/patches/binutils-2.12.90.0.7.patch: Escape @ characters + inside @tex. + * cross-tools/patches/binutils-2.16.1.patch: Likewise. + * cross-tools/patches/binutils-2.17.patch: New file. + +2019-10-09 Bruno Haible + + cross-tools: Fix compilation error for armhf CPU. + * cross-tools/cross.conf (armhf): Use GCC version 6.5.0 instead of + 6.3.0. + * cross-tools/cross-build.sh (func_build_gcc): Expect GCC 6.x tarball + in .xz format. + +2019-10-08 Bruno Haible + + cross-tools: Work around error 500 on www.multiprecision.org. + * cross-tools/cross-build.sh (func_build_mpc): Use alternate download + location. + +2019-10-08 Bruno Haible + + cross-tools: Reduce verbosity. + * cross-tools/cross-build.sh (func_ensure_tarball): Use wget option + '-nv'. + +2019-09-01 Bruno Haible + + build: Add support for shallow-cloning of subdirectories. + * gitsub.sh (func_usage): Document allowed git options with 'git pull'. + (func_pull): Accept GIT_OPTIONS argument. + (pull): Parse git options before complaining about too many arguments. + Pass the git options to func_pull. + +2019-08-29 Bruno Haible + + trampoline: Fix "illegal instruction" on mips32r6. + Reported by Luyou Peng + at . + The instruction that, before mips32r6, encoded 'j $25' produces an + "illegal instruction" on mips32r6. + That instruction had the same effects as 'jal $0,$25'; this one works + on mips32r6 and on all other MIPS ISAs. + The assemblers and disassemblers were changed to map 'j $25' to + 'jal $0,$25' and back automatically. + * trampoline/trampoline.c (alloc_trampoline): On MIPS, use instruction + 'jal $0,$25' instead of 'j $25'. + * callback/trampoline_r/trampoline.c (alloc_trampoline_r): Likewise. + +2019-08-28 Helmut Grohne (tiny change) + + Fix configure failure during a cross build. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): Fix AC_TRY_RUN invocations. + +2019-08-24 Bruno Haible + + Bump shared library version numbers. + * Makefile.in (LIBFFCALL_VERSION_INFO): Bump to 0:2:0. + * avcall/Makefile.in (LIBAVCALL_VERSION_INFO): Bump to 1:2:0. + * trampoline/Makefile.in (LIBTRAMPOLINE_VERSION_INFO): Likewise. + * callback/Makefile.in (LIBCALLBACK_VERSION_INFO): Likewise. + +2019-08-24 Bruno Haible + + hppa: Add comments about structure arguments. + * avcall/avcall-hppa.c: Add comment. + * avcall/avcall-internal.h (__av_struct): Likewise. + * vacall/vacall-internal.h (__va_arg_struct): Likewise. + +2019-08-24 Bruno Haible + + Add a test for by-value passing. + * testcases.c (v_clobber_K): New function. + * avcall/tests.c (by_value_tests): New function. + (main): Invoke it. + * vacall/tests.c (simulator, main): Test v_clobber_K. + * callback/tests.c (v_clobber_K_simulator): New function. + (main): Test it. + +2019-08-24 Bruno Haible + + hppa: Implement correct floating-point argument passing on Linux. + * avcall/avcall.h (__AV_ALIST_WORDS): Add comment. + * avcall/avcall-alist.h (__av_alist) [__hppa__]: Add farg_mask, + darg_mask. + * avcall/avcall-internal.h (__av_start1) [__hppa__]: Initialize + farg_mask, darg_mask. + (_av_float) [__hppa__]: Set a bit in farg_mask. + (_av_double) [__hppa__]: Set a bit in darg_mask. + * avcall/avcall-hppa.c (avcall_call): Copy floating-point arguments + among the first 4 words to %fr4L...%fr7L and %fr5,%fr7. + * vacall/vacall-internal.h (_va_arg_float, _va_arg_double) [__hppa__]: + For floating-point arguments among the first 4 words, use the value + passed in floating-point registers. + * PLATFORMS, */PLATFORMS: List the Linux/hppa ABI. + * NEWS: Mention the new port. + +2019-08-24 Bruno Haible + + hppa: Fix stack corruption in avcall. + * avcall/avcall-hppa.c (avcall_call): Don't let GCC optimize away the + stack-allocated array. + * NEWS: Mention the fix. + +2019-08-24 Bruno Haible + + Add another integer test. + * testcases.c (i17, ..., i32): New variables. + (i_i32): New function. + * avcall/tests.c (int_tests): Test it. + * vacall/tests.c (simulator, main): Likewise. + * callback/tests.c (i_i32_simulator): New function. + (main): Test it. + +2019-08-24 Bruno Haible + + cross-tools: Add support for GCC 8 and 9. + * cross-tools/cross-build.sh (func_build_gcc): Handle also GCC 8 and 9. + +2019-08-21 Bruno Haible + + mips: Change the default 32-bit ABI from fp32 to fpxx. + Reported by Sébastien Villemot + at . + He also found the trick with -fno-tree-dce. + * porting-tools/abis/mips-abis.txt: New file. + * cross-tools/cross.conf (mips): Use gcc 5 and binutils 2.27. + * common/asm-mips.sh: Eliminate .nan and .module lines. + * avcall/avcall-mipsn32.c (avcall_call): Use return value of + __builtin_alloca instead of accessing the stack pointer directly. + * avcall/Makefile.devel (avcall-mipseb-linux.s, avcall-mipsel-linux.s): + Build with gcc 5, with option -mfpxx (for compatibility with current + Debian), with -march=mips2 (required by -mfpxx), and -fno-tree-dce + (required to avoid that gcc eliminates the __builtin_alloca call). + (avcall-mipsn32eb-linux.s, avcall-mipsn32el-linux.s, + avcall-mips64eb-linux.s, avcall-mips64el-linux.s): Build with gcc 5. + * vacall/Makefile.devel (vacall-mipseb-linux.s, vacall-mipsel-linux.s): + Build with gcc 5, with option -mfpxx (for compatibility with current + Debian) and -march=mips2 (required by -mfpxx). + (vacall-mipsn32eb-linux.s, vacall-mipsn32el-linux.s, + vacall-mips64eb-linux.s, vacall-mips64el-linux.s): Build with gcc 5. + * callback/vacall_r/Makefile.devel (vacall-mipseb-linux.s, + vacall-mipsel-linux.s): Build with gcc 5, with option -mfpxx (for + compatibility with current Debian) and -march=mips2 (required by + -mfpxx). + (vacall-mipsn32eb-linux.s, vacall-mipsn32el-linux.s, + vacall-mips64eb-linux.s, vacall-mips64el-linux.s): Build with gcc 5. + * NEWS: Mention the change. + +2019-08-20 Bruno Haible + + riscv32: Add support for riscv32-ilp32d ABI. + * cross-tools/cross.conf: Add configuration for riscv32 cross tools. + * porting-tools/emulation/buildroot-riscv-2018-10-20-riscv32.config: New + file. + * porting-tools/emulation/tinyemu-riscv32.txt: New file. + * porting-tools/emulation/README: Refer to it. + * porting-tools/abis/README: Tweaks. + * porting-tools/abis/call-used-registers.txt: Add info about riscv32. + * porting-tools/abis/reg-struct-return.txt: Likewise. + * porting-tools/abis/stack-frame.txt: Likewise. + * porting-tools/execstack/voidfunc.c: Add command for riscv32. + * porting-tools/execstack/voidfunc-riscv32.o: New generated file. + * porting-tools/execstack/README: Add info about riscv32. + * ffcall-abi.h: Add support for riscv32-lp64. + * configure.ac: Check for also on riscv32. + * avcall/avcall.h (__AV_STRUCT_RETURN): Add code for __riscv32__. + * avcall/avcall-alist.h (__av_alist): Likewise. + * avcall/avcall-internal.h: Add code for __riscv32__, especially + __av_start1, __av_reg_struct_return, __av_start_struct4, __av_word, + __av_longlong, __av_ulonglong, __av_arg_longlong, _av_float, _av_double, + __av_struct. + * avcall/avcall-riscv32.c: New file. + * avcall/Makefile.devel (avcall-riscv32-ilp32d-linux.s, + avcall-riscv32-ilp32d-macro.S): New targets. + * avcall/Makefile.in (avcall-riscv32-ilp32d.lo, + avcall-riscv32-ilp32d.s): New targets. + (clean): Remove avcall-riscv32-ilp32d.s. + (SOURCE_FILES): Add avcall-riscv32.c, avcall-riscv32-ilp32d-linux.s, + avcall-riscv32-ilp32d-macro.S. + * vacall/vacall.h (__VA_STRUCT_RETURN): Add code for __riscv32__. + * vacall/vacall-internal.h: Add code for __riscv32__, especially + __va_alist, __va_reg_struct_return, __va_start_struct2, + __va_arg_leftadjusted, __va_arg_adjusted, _va_arg_longlong, + _va_arg_ulonglong, __va_arg_longlong, __va_align_double, _va_arg_float, + _va_arg_double, __va_arg_struct. + * vacall/vacall-riscv32.c: New file. + * vacall/Makefile.devel (vacall-riscv32-ilp32d-linux.s, + vacall-riscv32-ilp32d-macro.S): New targets. + * vacall/Makefile.in (vacall-riscv32-ilp32d.@OBJEXT@, + vacall-riscv32-ilp32d.s): New targets. + (clean): Remove vacall-riscv32-ilp32d.s. + (SOURCE_FILES): Add vacall-riscv32.c, vacall-riscv32-ilp32d-linux.s, + vacall-riscv32-ilp32d-macro.S. + * callback/vacall_r/vacall_r.h (__VA_STRUCT_RETURN): Add code for + __riscv32__. + * callback/vacall_r/Makefile.devel (vacall-riscv32-ilp32d-linux.s, + vacall-riscv32-ilp32d-macro.S): New targets. + * callback/vacall_r/Makefile.in (vacall-riscv32-ilp32d.lo, + vacall-riscv32-ilp32d.s): New targets. + (clean): Remove vacall-riscv32-ilp32d.s. + (SOURCE_FILES): Add vacall-riscv32-ilp32d-linux.s, + vacall-riscv32-ilp32d-macro.S. + * trampoline/Makefile.devel (proto-riscv32.s, tramp-riscv32.o): New + targets. + * trampoline/proto-riscv32.s: New generated file. + * trampoline/tramp-riscv32.old.s: New file. + * trampoline/tramp-riscv32.old.o: New generated file. + * trampoline/tramp-riscv32.s: New file. + * trampoline/tramp-riscv32.o: New generated file. + * trampoline/trampoline.c: Implement for __riscv32__. + * callback/trampoline_r/Makefile.devel (proto-riscv32.s, + tramp-riscv32.o): New targets. + * callback/trampoline_r/proto.c: Add code for __riscv32__. + * callback/trampoline_r/proto-riscv32.s: New generated file. + * callback/trampoline_r/tramp-riscv32.old.s: New file. + * callback/trampoline_r/tramp-riscv32.old.o: New generated file. + * callback/trampoline_r/tramp-riscv32.s: New file. + * callback/trampoline_r/tramp-riscv32.o: New generated file. + * callback/trampoline_r/trampoline.c: Implement for __riscv32__. + * callback/trampoline_r/test1.c: Add support for __riscv32__. + * PLATFORMS, */PLATFORMS: List the 32-bit RISC-V ABI. + * NEWS: Mention the new port. + +2019-08-19 Bruno Haible + + Add some more general-purpose args boundary tests. + * testcases.c (l_l0J, l_l1J, l_l2J, l_l3J, l_l4J, l_l5J, l_l6J, l_l7J): + New functions. + * avcall/tests.c (gpargs_boundary_tests): Test them. + * vacall/tests.c (simulator, main): Likewise. + * callback/tests.c (l_l*J_simulator): New functions. + (main): Test them. + * porting-tools/abis/gpargs*.c: Add a corresponding test here as well. + +2019-08-19 Bruno Haible + + riscv64: Fix bug regarding passing of more than 8 arguments. + * porting-tools/abis/stack-frame.txt: Correct information about riscv64 + ABI. + * avcall/avcall-alist.h (__av_alist) [__riscv64__]: Remove ianum and + iargs. + * avcall/avcall-internal.h (__av_start1, __av_start_struct4, __av_long, + __av_ulong, __av_ptr, _av_float, _av_double, __av_struct) [__riscv64__]: + Change accordingly. + * avcall/avcall-riscv64.c (avcall_call): Likewise. + * vacall/vacall-internal.h (__va_arg_adjusted): Deal with a split struct + that spans the 8th and 9th argument words. + * vacall/vacall-riscv64.c (struct gpargsequence): New type. + (vacall_receiver): Use it to make sure that room is allocated when a + struct is passed that spans the 8th and 9th argument words. + +2019-08-19 Bruno Haible + + arm64: Fix bug regarding passing of more than 8 arguments. + * vacall/vacall-internal.h (__va_arg_adjusted): Bump (LIST)->ianum when + switching from registers to the stack. + * NEWS: Mention it. + +2019-08-19 Bruno Haible + + avcall: Remove unnecessary parentheses. + * avcall/avcall-internal.h (av_double, _av_float, _av_double): Remove + unnecessary level of parentheses. + +2019-05-11 Bruno Haible + + Update bug reporting instructions. + * README: Tell users to report bugs in the bug tracker or by email. + * cross-tools/cross-build.sh (func_usage): Likewise. + +2019-04-01 Bruno Haible + + build: Separate git operations from build operations. + * gitsub.sh: New file, from gnulib. + * .gitmodules: New file. + * autogen.sh: Remove all git operations. Look at GNULIB_SRCDIR + environment variable. Ignore the GNULIB_TOOL environment variable. + * README-hacking: Explain when to use gitsub.sh. + +2019-01-19 Bruno Haible + + Record support for NetBSD/SPARC64. + * PLATFORMS, */PLATFORMS: List this platform. + +2018-05-04 Bruno Haible + + Simplify code. Drop support for Borland C++ on Windows. + * common/asm-x86_64.h, common/asm-x86_64.sh, ffcall-stdint.h: + Simplify 'defined _WIN32 || defined __WIN32__' to just 'defined _WIN32'. + * avcall/avcall.h, avcall/avcall-alist.h: Likewise. + * vacall/vacall.h, vacall/vacall-internal.h: Likewise. + * callback/vacall_r/vacall_r.h: Likewise. + * trampoline/trampoline.c: Likewise. + * callback/trampoline_r/trampoline.c: Likewise. + +2018-04-08 Bruno Haible + + riscv64: Add support for riscv64-lp64d ABI. + * cross-tools/cross-build.sh (func_build_gcc): Add support for GCC 7.2.0 + and 7.3.0. + * cross-tools/cross.conf: Add configuration for riscv64 cross tools. + * porting-tools/emulation/qemu-riscv64.txt: New file. + * porting-tools/emulation/README: Refer to it. + * porting-tools/abis/README: Tweaks. + * porting-tools/abis/call-used-registers.txt: Add info about riscv64. + * porting-tools/abis/reg-struct-return.txt: Likewise. + * porting-tools/abis/stack-frame.txt: Likewise. + * porting-tools/abis/function-pointer.txt: Clarify file locations. + * porting-tools/execstack/voidfunc.c: Add command for riscv64. + * porting-tools/execstack/voidfunc-riscv64.o: New generated file. + * porting-tools/execstack/main.c (voidfunc): Define also for riscv. + * porting-tools/execstack/README: Add info about riscv64. + * ffcall-abi.h: Add support for riscv64-lp64. + * common/asm-riscv.sh: New file. + * Makefile.in (SOURCE_FILES): Add it. + * configure.ac: Check for also on riscv64. + * avcall/avcall.h (__AV_STRUCT_RETURN, __AV_REGISTER_STRUCT_RETURN): Add + code for __riscv64__. + * avcall/avcall-alist.h (__av_alist): Likewise. + * avcall/avcall-internal.h: Add code for __riscv64__, especially + __av_start1, __av_reg_struct_return, __av_start_struct4, __av_word, + __av_long, __av_ulong, __av_ptr, __av_longlong, __av_ulonglong, + _av_float, _av_double, __av_struct. + * avcall/avcall-riscv64.c: New file. + * avcall/Makefile.devel (avcall-riscv64-lp64d-linux.s, + avcall-riscv64-lp64d-macro.S): New targets. + * avcall/Makefile.in (avcall-riscv64-lp64d.lo, avcall-riscv64-lp64d.s): + New targets. + (clean): Remove avcall-riscv64-lp64d.s. + (SOURCE_FILES): Add avcall-riscv64.c, avcall-riscv64-lp64d-linux.s, + avcall-riscv64-lp64d-macro.S. + * vacall/vacall.h (__VA_STRUCT_RETURN, __VA_REGISTER_STRUCT_RETURN): Add + code for __riscv64__. + * vacall/vacall-internal.h: Add code for __riscv64__, especially + __va_alist, __va_reg_struct_return, __va_start_struct2, + __va_arg_leftadjusted, __va_arg_adjusted, _va_arg_longlong, + _va_arg_ulonglong, __va_align_double, _va_arg_float, _va_arg_double, + __va_arg_struct, _va_return_longlong. + * vacall/vacall-riscv64.c: New file. + * vacall/Makefile.devel (vacall-riscv64-lp64d-linux.s, + vacall-riscv64-lp64d-macro.S): New targets. + * vacall/Makefile.in (vacall-riscv64-lp64d.@OBJEXT@, + vacall-riscv64-lp64d.s): New targets. + (clean): Remove vacall-riscv64-lp64d.s. + (SOURCE_FILES): Add vacall-riscv64.c, vacall-riscv64-lp64d-linux.s, + vacall-riscv64-lp64d-macro.S. + * callback/vacall_r/vacall_r.h (__VA_STRUCT_RETURN, + __VA_REGISTER_STRUCT_RETURN): Add code for __riscv64__. + * callback/vacall_r/Makefile.devel (vacall-riscv64-lp64d-linux.s, + vacall-riscv64-lp64d-macro.S): New targets. + * callback/vacall_r/Makefile.in (vacall-riscv64-lp64d.lo, + vacall-riscv64-lp64d.s): New targets. + (clean): Remove vacall-riscv64-lp64d.s. + (SOURCE_FILES): Add vacall-riscv64-lp64d-linux.s, + vacall-riscv64-lp64d-macro.S. + * trampoline/Makefile.devel (proto-riscv64.s, tramp-riscv64.o): New + targets. + * trampoline/proto-riscv64.s: New generated file. + * trampoline/tramp-riscv64.s: New file. + * trampoline/tramp-riscv64.o: New generated file. + * trampoline/trampoline.c: Implement for __riscv64__. + * callback/trampoline_r/Makefile.devel (proto-riscv64.s, + tramp-riscv64.o): New targets. + * callback/trampoline_r/proto64.c: Add code for __riscv64__. + * callback/trampoline_r/proto-riscv64.s: New generated file. + * callback/trampoline_r/tramp-riscv64.s: New file. + * callback/trampoline_r/tramp-riscv64.o: New generated file. + * callback/trampoline_r/trampoline.c: Implement for __riscv64__. + * callback/trampoline_r/test1.c: Add support for __riscv64__. + * PLATFORMS, */PLATFORMS: List the 64-bit RISC-V ABI. + * NEWS: Mention the new port. + +2018-04-08 Bruno Haible + + s390x: Trivial tweak. + * avcall/avcall-s390x.c (avcall_call): Rename result variable from 'i' + to 'iret'. + +2018-02-26 Bruno Haible + + Add support for Linux/arm on Raspberry Pi. + Reported by Simon Dales . + * avcall/Makefile.devel (avcall-armhf-macro.S): Pass option + '-march=armv6' to gcc. + * vacall/Makefile.devel (vacall-arm-linux.s, vacall-arm-linux-pic.s): + Likewise. + * callback/vacall_r/Makefile.devel (vacall-armhf-macro.S): Likewise. + * PLATFORMS, */PLATFORMS: List this platform. + * NEWS: Mention this. + +2018-02-24 Bruno Haible + + Add support for Linux/i386 with PIE-enabled gcc. + * vacall/Makefile.devel (vacall-i386-linux-pic.s): New target. + (vacall-i386-macro.S): Include code for the PIC and the non-PIC case. + * vacall/Makefile.in (SOURCE_FILES): Add vacall-i386-linux-pic.s. + +2018-02-18 Bruno Haible + + Avoid undesired compiler optimizations. + Reported by Jerry James . + * configure.ac (DISABLE_TYPE_BASED_ALIASING): New substituted variable. + * avcall/Makefile.in (avcall-libapi.lo): Use it. + * vacall/Makefile.in (vacall-libapi.o): Likewise. + * callback/vacall_r/Makefile.in (vacall-libapi.lo): Likewise. + +2018-02-17 Bruno Haible + + Bump version number. + * VERSION: Set to 2.2. + * NEWS: Open new section for 2.2. + +2018-02-17 Bruno Haible + + Bump shared library version numbers. + * Makefile.in (LIBFFCALL_VERSION_INFO): Bump to 0:1:0. + * avcall/Makefile.in (LIBAVCALL_VERSION_INFO): Bump to 1:1:0. + * trampoline/Makefile.in (LIBTRAMPOLINE_VERSION_INFO): Likewise. + * callback/Makefile.in (LIBCALLBACK_VERSION_INFO): Likewise. + +2018-02-17 Bruno Haible + + Add support for HardenedBSD. + The fix was done in gnulib today. + * NEWS: Mention this. + +2018-02-17 Bruno Haible + + Add support for Linux/arm with PIE-enabled gcc. + Reported by Nelson Beebe. + * vacall/Makefile.devel (vacall-arm-linux.s, vacall-arm-linux-pic.s, + vacall-armhf-linux.s, vacall-armhf-linux-pic.s): New targets. + (vacall-arm-macro.S, vacall-armhf-macro.S): Include code for the PIC and + the non-PIC case. + * vacall/Makefile.in (SOURCE_FILES): Add vacall-arm*-linux*.s. + +2018-02-17 Bruno Haible + + Add support for OpenBSD 6.1 and newer. + Reported by Nelson Beebe. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): Also test whether mprotect + returns with errno=ENOTSUP. + * NEWS: Mention this. + +2018-01-30 Bruno Haible + + Verify support for Minix/i386. + * PLATFORMS, */PLATFORMS: List this platform. + +2018-01-27 Bruno Haible + + Rename some files. + * INSTALL.windows: Renamed from README.windows. + * INSTALL.os2: Renamed from README.os2. + * Makefile.in (SOURCE_FILES): Update. + +2018-01-09 Bruno Haible + + Make processing of assembly-language files work with GNU clisp. + * common/asm-arm.sh: Don't introduce C() macro in .req lines. + * common/asm-hppa.h (DEF): Don't use token-pasting operator here, since + the result would not be a valid token. + * common/asm-hppa64.h (DEF): Likewise. + * common/asm-i386.h (INSN2SHCL): Omit the cl register only on Solaris. + All other assemblers support it. + (P2ALIGN): Use __SVR4, not __sun, to detect Solaris. + * common/asm-i386.sh: Allow spaces instead of tabs after .type and + .size. Recognize INSN2SHCL without assuming an 'shcl' macro. + +2017-11-28 Bruno Haible + + mips, mipsn32, mips64: Improvement for ELF format. + * common/asm-mips.h (DECLARE_FUNCTION): Test __ELF__, not __GNU__. + +2017-11-25 Bruno Haible + + mips64: Fix crash on some real hardware mips64el (Octeon). + Reported by Sébastien Villemot . + Reminder: Some real MIPS hardware executes the "branch delay slot" + after a branch or jump instruction. See + + + * trampoline/trampoline.c (alloc_trampoline) [__mips64__]: Store the + instructions as 32-bit words, so that the instructions come out as + expected, regardless of the endianness. + * trampoline/tramp-mips*.s: Update comments. + * callback/trampoline_r/tramp-mips*.s: Likewise. + +2017-10-29 Bruno Haible + + Verify support for Haiku/i386. + * PLATFORMS, */PLATFORMS: List this platform. + +2017-10-22 Bruno Haible + + x86_64-x32: Fix passing of pointers. + * avcall/avcall-internal.h (__av_start_struct4, __av_ptr): For pointer + values, use zero-extend instead of cast from 'void*' to '__avword'. + * vacall/vacall-x86_64.c (vacall_receiver): For pointer values, use + zero-extend instead of cast from 'void*' to '__vaword'. + +2017-10-21 Bruno Haible + + Include libtool fix for Solaris 11.3. + Reported at . + * Makefile.maint (libtool-imported-files): Download and apply said fix. + +2017-10-09 Bruno Haible + + Avoid build failures caused by parallel make. + Reported by Riccardo G Corsi . + * Makefile.in (GNUMAKEFLAGS): New variable. + +2017-09-24 Bruno Haible + + Update NEWS. + * NEWS: Mention the API changes in 2.0. + +2017-09-15 Bruno Haible + + tests: Consistency. + * avcall/tests.c (pointer_tests): Move before the mixed_number_tests. + (gpargs_boundary_tests): Fix weakness in the f_f17l3L test. + +2017-09-12 Bruno Haible + + sparc: Verify support for NetBSD. + * PLATFORMS, */PLATFORMS: List this platform. + +2017-09-11 Bruno Haible + + Bump version number. + * VERSION: Set to 2.1. + * NEWS: Open new section for 2.1. + +2017-09-10 Bruno Haible + + Install the libraries as shared libraries by default. + * configure.ac (LT_INIT): Remove option 'disable-shared'. + * README: Remove outdated text. + * NEWS: Mention the change. + +2017-09-10 Bruno Haible + + Install a library named libffcall. + * ffcall-version.c: New file. + * ffcall-version.in.h: Rename double-inclusion guard. + (ffcall_get_version): New declaration. + * Makefile.in: Add variables for using libtool. + (LIBFFCALL_EXPORTED_SYMBOLS_REGEX, LIBFFCALL_VERSION_INFO): New + variables. + (all-subdirs, ffcall-version.lo, libffcall.la): New targets. + (all): Depend on them. + (install): Install also libffcall.la. + (installdirs): Create also $(libdir). + (uninstall): Uninstall also libffcall.la. + (MOSTLYCLEANDIRS, MOSTLYCLEANFILES): New variables. + (mostlyclean, clean, distclean, maintainer-clean): Delete these. + (SOURCE_FILES): Add ffcall-version.c. + * README: Mention libffcall.{a,so}. Mark libavcall and libcallback as + deprecated. + * NEWS: Mention the change. + +2017-09-10 Bruno Haible + + Move the backward compatibility code to separate object files. + * avcall/avcall-compat.c: New file, extracted from + avcall/avcall-libapi.c. + * avcall/Makefile.in (SOURCE_FILES): Add it. + (avcall-compat.lo): New target. + (OBJECTS): Add it. + * avcall/avcall-libapi.c (__builtin_avcall): Remove function. + * callback/callback-compat.c: New file, extracted from + callback/callback-libapi.c. + * callback/Makefile.in (SOURCE_FILES): Add it. + (callback-compat.lo): New target. + (libcallback.la): Include it. + * callback/callback-libapi.c (trampoline_r_data0): Remove function. + +2017-09-10 Bruno Haible + + vacall: Fix build failure with gcc configured with --enable-default-pie. + Works around a GCC bug, reported at + . + * configure.ac (WORKAROUND_BUG_81653): New variable. + * vacall/Makefile.in (vacall-sparc.@OBJEXT@, vacall-sparc.s): Use it. + +2017-09-10 Bruno Haible + + Fix build failure "error: narrowing conversion" with g++ on arm. + * testcases.c (C5): Cast -1 to 'char' explicitly. + +2017-09-10 Bruno Haible + + Fix build failure with --enable-shared on Solaris/x86 with cc. + * common/asm-i386.h: Test __SVR4, not __svr4__. + +2017-09-10 Bruno Haible + + Support building shared libraries on native Windows. + * configure.ac (LT_INIT): Add option 'win32-dll'. + * avcall/Makefile.in (avcall-x86_64.lo): Copy object file into .libs/ + directory. + * callback/vacall_r/Makefile.in (vacall-x86_64.lo): Likewise. + +2017-09-09 Bruno Haible + + i386: Verify support for Hurd. + * NEWS: List this platform. + +2017-09-09 Bruno Haible + + x86_64: Verify support for FreeBSD, NetBSD, OpenBSD. + * PLATFORMS, */PLATFORMS: List these platforms. + * NEWS: Likewise. + +2017-09-09 Bruno Haible + + i386: Restore support for FreeBSD, NetBSD, OpenBSD, DragonFly BSD. + * avcall/avcall.h (__AV_STRUCT_RETURN): Enable __AV_SMALL_STRUCT_RETURN + on FreeBSD/i386, OpenBSD/i386, DragonFly/i386. + * vacall/vacall.h (__VA_STRUCT_RETURN): Enable __VA_SMALL_STRUCT_RETURN + on FreeBSD/i386, OpenBSD/i386, DragonFly/i386. + * callback/vacall_r/vacall_r.h: Likewise. + * avcall/avcall-i386.c: Update comments. + * vacall/vacall-i386.c (vacall_receiver): Return the structure address + in %eax also for other platforms than MSVC. + * PLATFORMS, */PLATFORMS: List these platforms. + * NEWS: Likewise. + +2017-09-09 Bruno Haible + + i386: Assume MSVC struct return convention also on 32-bit mingw. + * avcall/avcall.h (__AV_STRUCT_RETURN): Enable __AV_MSVC_STRUCT_RETURN + on 32-bit mingw. + * vacall/vacall.h (__VA_STRUCT_RETURN): Enable __VA_MSVC_STRUCT_RETURN + on 32-bit mingw. + * callback/vacall_r/vacall_r.h: Likewise. + * NEWS: Mention the fix. + +2017-09-09 Bruno Haible + + vacall: Fix warnings on DragonFly BSD. + * vacall/vacall-internal.h (__va_start, __va_arg): Undefine first. + +2017-09-09 Bruno Haible + + avcall, vacall: Optimize struct return of small structs. + * avcall/avcall-arm64.c (avcall_call): Add alternative optimized code + for struct return. + * avcall/avcall-hppa.c (avcall_call): Likewise. + * avcall/avcall-ia64.c (avcall_call): Likewise. + * avcall/avcall-mipsn32.c (avcall_call): Likewise. + * avcall/avcall-mips64.c (avcall_call): Likewise. + * avcall/avcall-powerpc64.c (avcall_call): Likewise. + * avcall/avcall-sparc64.c (avcall_call): Likewise. + * avcall/avcall-x86_64.c (avcall_call): Likewise. + * avcall/avcall-x86_64-windows.c (avcall_call): Likewise. + * avcall/avcall-hppa64.c (avcall_call): Likewise, but don't enable it. + * vacall/vacall-arm64.c (vacall_receiver): Add alternative optimized + code for struct return. + * vacall/vacall-hppa.c (vacall_receiver): Likewise. + * vacall/vacall-ia64.c (vacall_receiver): Likewise. + * vacall/vacall-mipsn32.c (vacall_receiver): Likewise. + * vacall/vacall-mips64.c (vacall_receiver): Likewise. + * vacall/vacall-powerpc64.c (vacall_receiver): Likewise. + * vacall/vacall-sparc64.c (vacall_receiver): Likewise. + * vacall/vacall-x86_64.c (vacall_receiver): Likewise. + * vacall/vacall-x86_64-windows.c (vacall_receiver): Likewise. + * vacall/vacall-hppa64.c (vacall_receiver): Likewise. + +2017-09-09 Bruno Haible + + avcall, vacall: Align code style. + * avcall/avcall-hppa.c (avcall_call): Use variable name 'iret', like + for the other ABIs. + * avcall/avcall-ia64.c: Likewise. + * avcall/avcall-arm64.c (avcall_call): Use variable names 'iret' and + 'iret2', like for the other ABIs. + * avcall/avcall-x86_64.c: Likewise. + * avcall/avcall-sparc64.c (avcall_call): Use variable names 'iret', + 'iret2', 'iret3', 'iret4', for consistency. + * vacall/vacall-sparc64 (vacall_receiver): Likewise. + +2017-09-09 Bruno Haible + + x86_64: Remove register pressure on gcc. + * avcall/avcall-x86_64.c: Don't declare iarg[1-6]. + (avcall_call): Pass the integer arguments through arguments. + * avcall/avcall-x86_64-windows.c: Don't declare iarg[1-4]. + (avcall_call): Pass the integer arguments through arguments. + * vacall/vacall-x86_64.c: Don't declare iarg[1-6]. + (vacall_receiver): Use another way to save the integer registers. + * vacall/vacall-x86_64-windows.c: Don't declare iarg[1-4]. + +2017-09-09 Bruno Haible + + Fix preprocessor warning "does not give a valid preprocessing token". + * common/asm-i386.h (NUM): Don't use token concatenation between '$' + and a possibly negative number. + * common/asm-x86_64.h (NUM): Likewise. + +2017-09-09 Bruno Haible + + hppa64: Simplify trampoline. + * trampoline/tramp-hppa64-old.s: Renamed from trampoline/tramp-hppa64.s. + * trampoline/tramp-hppa64-old.o: Renamed from trampoline/tramp-hppa64.o. + * trampoline/tramp-hppa64-macro.S: New file. + * trampoline/Makefile.in (tramp-hppa64.lo, tramp-hppa64.s): New targets. + (clean): Remove tramp-hppa64.s. + (SOURCE_FILES): Add tramp-hppa64-macro.S. + * trampoline/trampoline.c: Distinguish __hppa64old__ and __hppa64new__. + Implement trampoline for __hppa64new__. + * callback/trampoline_r/tramp-hppa64-old.s: Renamed from + callback/trampoline_r/tramp-hppa64.s. + * callback/trampoline_r/tramp-hppa64-old.o: Renamed from + callback/trampoline_r/tramp-hppa64.o. + * callback/trampoline_r/tramp-hppa64-macro.S: New file. + * callback/trampoline_r/Makefile.in (tramp-hppa64.lo, tramp-hppa64.s): + New targets. + (clean): Remove tramp-hppa64.s. + (SOURCE_FILES): Add tramp-hppa64-macro.S. + * callback/trampoline_r/trampoline.c: Distinguish __hppa64old__ and + __hppa64new__. Implement trampoline for __hppa64new__. + * configure.ac (CPU_OBJECTS): Augment with tramp-hppa64.lo. + +2017-09-09 Bruno Haible + + hppa64: Add support for HP-PA in 64-bit mode on HP-UX. + * cross-tools/cross.conf: Add configuration for hppa64 cross tools. + * porting-tools/abis/README: Add details about platforms where function + pointers are actually pointers to some struct. + * porting-tools/abis/call-used-registers.txt: Add info about hppa64. + Fix info about hppa. + * porting-tools/abis/reg-struct-return.txt: Add info about hppa64. + * porting-tools/abis/stack-frame.txt: Likewise. + * porting-tools/execstack/voidfunc-hppa64.o: New file. + * common/asm-hppa64.h: New file. + * common/asm-hppa64.sh: New file. + * Makefile.in (SOURCE_FILES): Add them. + * avcall/avcall.h (__AV_REGISTER_STRUCT_RETURN): Add code for + __hppa64__. + * avcall/avcall-alist.h (__av_alist): Likewise. + * avcall/avcall-internal.h: Add code for __hppa64__, especially + __av_start1, __av_reg_struct_return, __av_start_struct4, __av_word, + __av_longlong, __av_ulonglong, _av_float, _av_double, + __av_struct_leftadjusted, __av_struct. + * avcall/avcall-hppa64.c: New file. + * avcall/Makefile.devel (avcall-hppa64-linux.s, avcall-hppa64-macro.S): + New targets. + * avcall/Makefile.in (avcall-hppa64.lo, avcall-hppa64.s): New targets. + (clean): Remove avcall-hppa64.s. + (SOURCE_FILES): Add avcall-hppa64.c, avcall-hppa64-linux.s, + avcall-hppa64-macro.S. + * vacall/vacall.h (__VA_REGISTER_STRUCT_RETURN): Add code for + __hppa64__. + * vacall/vacall-internal.h: Add code for __hppa64__, especially + __va_alist, __va_reg_struct_return, __va_start_struct2, + __va_arg_leftadjusted, __va_arg_rightadjusted, __va_arg_adjusted, + _va_arg_longlong, _va_arg_ulonglong, __va_align_double, _va_arg_float, + _va_arg_double, __va_arg_struct, _va_return_longlong. + * vacall/vacall-hppa64.c: New file. + * vacall/Makefile.devel (vacall-hppa64-linux.s, vacall-hppa64-macro.S): + New targets. + * vacall/Makefile.in (vacall-hppa64.@OBJEXT@, vacall-hppa64.s): New + targets. + (clean): Remove vacall-hppa64.s. + (SOURCE_FILES): Add vacall-hppa64.c, vacall-hppa64-linux.s, + vacall-hppa64-macro.S. + * callback/vacall_r/vacall_r.h (__VA_REGISTER_STRUCT_RETURN): Add code + for __hppa64__. + * callback/vacall_r/Makefile.devel (vacall-hppa64-linux.s, + vacall-hppa64-macro.S): New targets. + * callback/vacall_r/Makefile.in (vacall-hppa64.lo, vacall-hppa64.s): New + targets. + (clean): Remove vacall-hppa64.s. + (SOURCE_FILES): Add vacall-hppa64-linux.s, vacall-hppa64-macro.S. + * trampoline/Makefile.devel (cache-hppa64-linux.s, + cache-hppa64-macro.S): New targets. + (proto-hppa64.s, tramp-hppa64.o): New targets. + * trampoline/proto-hppa64.s: New generated file. + * trampoline/tramp-hppa64.s: New file. + * trampoline/tramp-hppa64.o: New generated file. + * trampoline/tramp-hppa-macro.S: Fix comment. + * trampoline/cache-hppa.c: Add code for __hppa64__. + * trampoline/trampoline.c: Implement for __hppa64__. + * trampoline/Makefile.in (cache-hppa64.lo, cache-hppa64.s): New targets. + (clean): Remove cache-hppa64.s. + (SOURCE_FILES): Add cache-hppa64-linux.s, cache-hppa64-macro.S. + * callback/trampoline_r/Makefile.devel (cache-hppa64-linux.s, + cache-hppa64-macro.S): New targets. + (proto-hppa64.s, tramp-hppa64.o): New targets. + * callback/trampoline_r/proto64.c: Add code for __hppa64__. + * callback/trampoline_r/proto-hppa64.s: New generated file. + * callback/trampoline_r/tramp-hppa64.s: New file. + * callback/trampoline_r/tramp-hppa64.o: New generated file. + * callback/trampoline_r/tramp-hppa-macro.S: Fix comment. + * callback/trampoline_r/trampoline.c: Implement for __hppa64__. + * callback/trampoline_r/test1.c: Add support for __hppa64__. + * callback/trampoline_r/Makefile.in (cache-hppa64.lo, cache-hppa64.s): + New targets. + (clean): Remove cache-hppa64.s. + (SOURCE_FILES): Add cache-hppa64-linux.s, cache-hppa64-macro.S. + * configure.ac (CPU_OBJECTS): Augment also for hppa64 ABI. + * PLATFORMS, */PLATFORMS: List the 64-bit HP-PA machine. + * NEWS: Mention the new port. + +2017-09-09 Bruno Haible + + Don't violate ISO C rules. + * avcall/avcall-internal.h (__av_struct): Don't store an unaligned + pointer in (LIST).aptr. + +2017-09-09 Bruno Haible + + Assume the C preprocessor discards // comments. + * common/asm-i386.h: Renamed from common/asm-i386.hh. + * Makefile.maint (common/asm-i386.h): Remove target. + * Makefile.in (SOURCE_FILES): Add common/asm-i386.h. Remove + common/asm-i386.hh. + (GENERATED_FILES): Remove common/asm-i386.h. + +2017-09-09 Bruno Haible + + avcall: Optimize struct return of small structs. + * avcall/avcall-*.c: Cache l->raddr in a local variable. + +2017-09-09 Bruno Haible + + x86_64: Improve processing of assembly-language files. + * common/asm-x86_64.sh: Eliminate #APP and #NO_APP directives. + In the MEM* patterns, recognize all 64-bit register names. + +2017-09-09 Bruno Haible + + Fix compilation error on HP-UX (regression from 2017-09-03). + * avcall/avcall-libapi.c: Include before ffcall-stdint.h. + +2017-09-03 Bruno Haible + + i386: Align processing of assembly-language files with x86_64 case. + * common/asm-i386.hh (INSN2MOVXL): Renamed from INSN2MOVX. + * common/asm-i386.sh: Generate INSN2MOVXL instead of INSN2MOVX. + +2017-09-03 Bruno Haible + + i386: Provide disambiguating size prefixes in more cases. + * common/asm-i386.sh: Introduce size prefixes also for the second + operand of instructions with two operands. + +2017-09-03 Bruno Haible + + i386: Simplify processing of assembly-language files. + * common/asm-i386.sh: Remove unused introduction of FUNEND. Remove + no-op rule for GLOBL. + +2017-09-03 Bruno Haible + + x86_64: Add support for MSVC 14. + * common/asm-x86_64.h (R, NUM, ADDR, ADDR_PCRELATIVE, X1, X2, X4, X8, + MEM, MEM_DISP, MEM_INDEX, MEM_SHINDEX, MEM_DISP_SHINDEX0, + MEM_DISP_SHINDEX, MEM_PCRELATIVE, INDIR, INSNCONC, INSN1, INSN2, + INSN2S, INSN2MOVXL, INSN2MOVXQ, INSN2MOVXLQ, _): New macros. + (TEXT, P2ALIGN, DECLARE_FUNCTION, FUNBEGIN, FUNEND): Implement for MSVC. + * common/asm-x86_64.sh: Generate instructions as macros that may expand + into AT&T syntax or MSVC syntax. + * avcall/Makefile.in (avcall-x86_64.lo): Use a different rule for MSVC. + (clean): Remove also avcall-x86_64.asm. + * vacall/Makefile.in (vacall-x86_64.@OBJEXT@): Use a different rule for + MSVC. + (clean): Remove also vacall-x86_64.asm. + * callback/vacall_r/Makefile.in (vacall-x86_64.lo): Use a different rule + for MSVC. + (clean): Remove also vacall-x86_64.asm. + * PLATFORMS, */PLATFORMS: List the 64-bit mingw machine. + * NEWS: Mention the new port. + +2017-09-03 Bruno Haible + + x86_64: Add support for mingw. + * avcall/avcall.h (__AV_LLP64): New macro. + (__avword): Use it. + * avcall/avcall-alist.h (__av_alist): Change fields of type + 'unsigned long' to 'uintptr_t'. + * avcall/avcall-internal.h (__av_longlong): Update implementation for + LLP64 platforms. + * vacall/vacall.h (__VA_LLP64): New macro. + (__vaword): Use it. + * callback/vacall_r/vacall_r.h: Likewise. + * vacall/vacall-internal.h (__va_alist): Change fields of type + 'unsigned long' to 'uintptr_t'. Don't assume that 'long long' is the + same as 'long' on x86_64. + (_va_arg_longlong, _va_arg_ulonglong, _va_return_longlong, + _va_return_ulonglong): Update implementation for LLP64 platforms. + * PLATFORMS, */PLATFORMS: List the 64-bit mingw machine. + * NEWS: Mention the new port. + +2017-09-03 Bruno Haible + + Fix warnings on 64-bit native Windows. + * avcall/tests.c (pointer_tests): Use %p to display the value of a + pointer. + * vacall/tests.c (main): Likewise, + * callback/tests.c (main): Likewise, + +2017-09-03 Bruno Haible + + Add support for platforms where sizeof(long) < sizeof(void*). + * ffcall-stdint.h: New file. + * Makefile.in (SOURCE_FILES): Add it. + * avcall/avcall-internal.h: Include ffcall-stdint.h. Use [u]intptr_t + instead of 'long', 'unsigned long', or '__avword' where appropriate. + * vacall/vacall-internal.h: Include ffcall-stdint.h. Use [u]intptr_t + instead of 'long', 'unsigned long', or '__vaword' where appropriate. + * Makefile.maint (GNULIB_MODULES): Add stdint. + * trampoline/trampoline.c: Include . Use [u]intptr_t instead + of 'long' or 'unsigned long' where appropriate. For __x86_64__, use + 'unsigned long long' instead of 'unsigned long'. + * callback/trampoline_r/trampoline.c: Likewise. + * callback/trampoline_r/test1.c (f): Use 'void*' instead of 'long' to + access env. + +2017-09-03 Bruno Haible + + x86_64: Add support for Cygwin. + * porting-tools/abis/call-used-registers.txt: Add info about x86_64-ms + ABI. + * porting-tools/abis/reg-struct-return.txt: Likewise. + * porting-tools/abis/stack-frame.txt: Likewise. + * common/asm-x86_64.h: Add support for compilers on Windows. + (TEXT, GLOBL): New macros. + * common/asm-x86_64.sh: Truncate the EH_FRAME_SECTION also on Windows. + Eliminate .file pseudo-op. Macroize .text, .p2align, .globl directives. + * avcall/avcall-alist.h (__x86_64_ms__, __x86_64_sysv__): New macros. + (__av_alist): Add support for __x86_64_ms__. + * avcall/avcall-internal.h (__av_start1, __av_reg_struct_return, + __av_start_struct3, __av_start_struct4, __av_word, _av_float, + _av_double, __av_struct): Add support for __x86_64_ms__. + * avcall/avcall-x86_64.c: Improve comments. + * avcall/avcall-x86_64-windows.c: New file. + * avcall/Makefile.devel (avcall-x86_64-windows.s, + avcall-x86_64-windows-macro.S): New targets. + * avcall/Makefile.in (avcall-x86_64.s): On Windows, use + avcall-x86_64-windows-macro.S. + (SOURCE_FILES): Add avcall-x86_64-windows.c, avcall-x86_64-windows.s, + avcall-x86_64-windows-macro.S. + * vacall/vacall-internal.h (__x86_64_ms__, __x86_64_sysv__): New macros. + (__VA_FARG_NUM): Define also for __mipsn32__ || __mips64__. + (__va_alist): Add support for __x86_64_ms__. + (__va_reg_struct_return, __va_start_struct1, __va_start_struct2, + __va_arg_leftadjusted, __va_arg_rightadjusted, __va_arg_adjusted, + _va_arg_float, _va_arg_double, __va_arg_struct): Likewise. + * vacall/vacall-x86_64.c: Update comments. + * vacall/vacall-x86_64-windows.c: New file. + * vacall/Makefile.devel (vacall-x86_64-windows.s, + vacall-x86_64-windows-macro.S): New targets. + * vacall/Makefile.in (vacall-x86_64.s): On Windows, use + vacall-x86_64-windows-macro.S. + (SOURCE_FILES): Add vacall-x86_64-windows.c, vacall-x86_64-windows.s, + vacall-x86_64-windows-macro.S. + * callback/vacall_r/Makefile.devel (vacall-x86_64-windows.s, + vacall-x86_64-windows-macro.S): New targets. + * callback/vacall_r/Makefile.in (vacall-x86_64.s): On Windows, use + vacall-x86_64-windows-macro.S. + (SOURCE_FILES): Add vacall-x86_64-windows.s, + vacall-x86_64-windows-macro.S. + * PLATFORMS, */PLATFORMS: List the 64-bit Cygwin machine. + * NEWS: Mention the new port. + +2017-09-03 Bruno Haible + + Remove special build infrastructure for MSVC. The generic one works. + * avcall/Makefile.msvc: Remove file. + * avcall/Makefile.in (SOURCE_FILES): Remove it. + * vacall/Makefile.maint (config.h.msvc): Remove target. + (totally-clean): Don't remove config.h.msvc. + * vacall/Makefile.msvc: Remove file. + * vacall/Makefile.in (SOURCE_FILES): Remove it. + (GENERATED_FILES): Remove config.h.msvc. + * trampoline/Makefile.maint (config.h.msvc): Remove target. + (totally-clean): Don't remove config.h.msvc. + * trampoline/Makefile.msvc: Remove file. + * trampoline/Makefile.in (SOURCE_FILES): Remove it. + (GENERATED_FILES): Remove config.h.msvc. + * callback/vacall_r/Makefile.maint (config.h.msvc): Remove target. + (totally-clean): Don't remove config.h.msvc. + * callback/vacall_r/Makefile.msvc: Remove file. + * callback/vacall_r/Makefile.in (SOURCE_FILES): Remove it. + (GENERATED_FILES): Remove config.h.msvc. + * callback/trampoline_r/Makefile.maint (config.h.msvc): Remove target. + (totally-clean): Don't remove config.h.msvc. + * callback/trampoline_r/Makefile.msvc: Remove file. + * callback/trampoline_r/Makefile.in (SOURCE_FILES): Remove it. + (GENERATED_FILES): Remove config.h.msvc. + * callback/Makefile.maint (vacall_r/config.h.msvc, + trampoline_r/config.h.msvc): Remove targets. + * callback/Makefile.msvc: Remove file. + * callback/Makefile.in (SOURCE_FILES): Remove it. + * Makefile.msvc: Remove file. + * Makefile.in (SOURCE_FILES): Remove it. + +2017-09-03 Bruno Haible + + Make the generic build infrastructure work on MSVC. + * m4/as-underscore.m4: Rely on gl_ASM_SYMBOL_PREFIX from gnulib. Don't + define ASM_UNDERSCORE any more. + * configure.ac: Set IF_MSVC, IFNOT_MSVC. + * common/asm-i386.hh: Fix P2ALIGN parameter list. + * common/asm-i386.sh: Improve handling of indirect calls and jmps. + * avcall/Makefile.in: Use OBJEXT. + (avcall-i386.lo): Use a different rule for MSVC. + * vacall/Makefile.devel: Transform 'vacall_function' before the + asm-i386.sh script, not afterwards. + * vacall/Makefile.in: Use OBJEXT. + (vacall-i386.o): Use a different rule for MSVC. + * trampoline/trampoline.c: On native Windows, when CODE_EXECUTABLE is + not defined, use VirtualAlloc. + * trampoline/Makefile.in: Use OBJEXT. + * callback/vacall_r/get_receiver.c: New file. + * callback/vacall_r/Makefile.maint (vacall-i386-msvc.c): Use the C + source code of callback_get_receiver. + * callback/vacall_r/Makefile.in: Use OBJEXT. + (vacall-i386.lo): Use a different rule for MSVC. + (SOURCE_FILES): Add get_receiver.c. + * callback/trampoline_r/trampoline.c: On native Windows, when + CODE_EXECUTABLE is not defined, use VirtualAlloc. + * callback/trampoline_r/Makefile.in: Use OBJEXT. + * callback/Makefile.in: Use OBJEXT. + * README.win32: Remove file. + * README.windows: New file, from GNU gettext. + * Makefile.in (SOURCE_FILES): Remove README.win32. Add README.windows. + * PLATFORMS, */PLATFORMS: List the 32-bit mingw and MSVC machine. + * NEWS: Mention MSVC support. + +2017-09-03 Bruno Haible + + Don't use symbolic links for .h files. + MSVC 14 does not follow the symbolic links set by Cygwin's 'ln -s'. + * trampoline/Makefile.in (LN_S): Remove variable. + * callback/trampoline_r/Makefile.in (LN_S): Remove variable. + * callback/Makefile.in (INCLUDES): Add an -I option for vacall_r.h. + (LN_S): Remove variable. + (vacall_r.h, trampoline_r.h): Remove targets. + (callback-libapi.lo): Use explicit -I option for trampoline_r.h. Update + dependencies. + (test1.o, minitests.o, minitests.s, minitests-c++.o, tests.o, tests.s): + Update dependencies. + (MOSTLYCLEANFILES): Remove vacall_r.h, trampoline_r.h. + * configure.ac: Don't invoke CL_PROG_LN_S. + +2017-09-03 Bruno Haible + + Remove special build infrastructure for mingw. The generic one works. + * avcall/Makefile.maint (avcall-i386-mingw32.c): Remove target. + (totally-clean): Don't remove avcall-i386-mingw32.c. + * avcall/Makefile.mingw32: Remove file. + * avcall/Makefile.in (SOURCE_FILES): Remove it. + (GENERATED_FILES): Remove avcall-i386-mingw32.c. + * vacall/Makefile.maint (config.h.mingw32, vacall-i386-mingw32.c): + Remove targets. + (totally-clean): Don't remove config.h.mingw32, vacall-i386-mingw32.c. + * vacall/Makefile.mingw32: Remove file. + * vacall/Makefile.in (SOURCE_FILES): Remove it. + (GENERATED_FILES): Remove config.h.mingw32, vacall-i386-mingw32.c. + * trampoline/Makefile.maint (config.h.mingw32): Remove target. + (totally-clean): Don't remove config.h.mingw32. + * trampoline/Makefile.mingw32: Remove file. + * trampoline/Makefile.in (SOURCE_FILES): Remove it. + (GENERATED_FILES): Remove config.h.mingw32. + * callback/vacall_r/Makefile.maint (config.h.mingw32, + vacall-i386-mingw32.c): Remove targets. + (totally-clean): Don't remove config.h.mingw32, vacall-i386-mingw32.c. + * callback/vacall_r/Makefile.mingw32: Remove file. + * callback/vacall_r/Makefile.in (SOURCE_FILES): Remove it. + (GENERATED_FILES): Remove config.h.mingw32, vacall-i386-mingw32.c). + * callback/trampoline_r/Makefile.maint (config.h.mingw32): Remove + target. + (totally-clean): Don't remove config.h.mingw32. + * callback/trampoline_r/Makefile.mingw32: Remove file. + * callback/trampoline_r/Makefile.in (SOURCE_FILES): Remove it. + (GENERATED_FILES): Remove config.h.mingw32. + * callback/Makefile.maint (vacall_r/config.h.mingw32, + vacall_r/vacall-i386-mingw32.c, trampoline_r/config.h.mingw32): Remove + targets. + * callback/Makefile.mingw32: Remove file. + * callback/Makefile.in (SOURCE_FILES): Remove it. + * Makefile.mingw32: Remove file. + * Makefile.in (SOURCE_FILES): Remove it. + +2017-09-03 Bruno Haible + + Fix leftover files after "make distclean" (regression from 2017-08-27). + * avcall/Makefile.in (distclean): Also remove minitests-c++.output.*. + * vacall/Makefile.in (distclean): Likewise. + * callback/Makefile.in (DISTCLEANFILES): Add minitests-c++.output.*. + +2017-08-27 Bruno Haible + + Enable building shared libraries on Windows. + * avcall/Makefile.in (libavcall.la): Pass option '-no-undefined' to + $(LIBTOOL_LINK). + * trampoline/Makefile.in (libtrampoline.la): Likewise. + * callback/vacall_r/Makefile.in (libvacall.la): Likewise. + * callback/trampoline_r/Makefile.in (libtrampoline.la): Likewise. + * callback/Makefile.in (libcallback.la): Likewise. + +2017-08-27 Bruno Haible + + Do proper versioning of shared libraries. + * avcall/Makefile.in (LIBAVCALL_VERSION_INFO): New variable. + (libavcall.la): Use libtool option -version-info. + * trampoline/Makefile.in (LIBTRAMPOLINE_VERSION_INFO): New variable. + (libtrampoline.la): Use libtool option -version-info. + * callback/Makefile.in (LIBCALLBACK_VERSION_INFO): New variable. + (libcallback.la): Use libtool option -version-info. + * README: Remove statement of problem. Update figures about code size. + * NEWS: Mention the change. + +2017-08-27 Bruno Haible + + Fix warnings on 64-bit native Windows. + * testcases.c (vp_vpdpcpsp): Use %p to display the value of a pointer. + * vacall/tests.c (simulator): Likewise. + * callback/tests.c (vp_vpdpcpsp_simulator): Likewise, + +2017-08-27 Bruno Haible + + Remove code duplication of test cases. + * testcases.c: New file, extracted from avcall/tests.c. + * Makefile.in (SOURCE_FILES): Add it. + * avcall/tests.c: Remove testcases functions. Include testcases.c + instead. + * vacall/tests.c: Likewise. + * callback/tests.c: Likewise. + * porting-tools/abis/README: Update. + +2017-08-27 Bruno Haible + + avcall: Fix weakness in tests (added on 2017-01-29). + * avcall/tests.c (ll_l2ll, ll_l3ll, ll_l4ll, ll_l5ll, ll_l6ll, ll_l7ll): + Use a temporary variable of type 'long long'. + +2017-08-27 Bruno Haible + + vacall, callback: Remove workarounds for obsolete platforms. + * vacall/tests.c: Remove workarounds for SunOS 4 cc, gcc-2.5, gcc-2.7.x. + * callback/tests.c: Likewise. + +2017-08-27 Bruno Haible + + Add tests that verify the C++ support. + * Makefile.maint (GNULIB_MODULES): Add ansi-c++-opt. + * configure.ac: Invoke gl_PROG_ANSI_CXX. Set IF_CXX. + * avcall/minitests-c++.cc: New file. + * avcall/Makefile.in (CXX, CXXFLAGS): New variables. + (minitests-c++.o, minitests-c++): New targets. + (check): Optionally, test also minitests-c++. + (clean): Remove minitests-c++.o, minitests-c++, minitests-c++.out. + (SOURCE_FILES): Add minitests-c++.cc. + * vacall/minitests-c++.cc: New file. + * vacall/Makefile.in (CXX, CXXFLAGS): New variables. + (minitests-c++.o, minitests-c++): New targets. + (check): Optionally, test also minitests-c++. + (clean): Remove minitests-c++.o, minitests-c++, minitests-c++.out. + (SOURCE_FILES): Add minitests-c++.cc. + * trampoline/test2-c++.cc: New file. + * trampoline/test2.c (main): Don't test &main in C++ mode. + * trampoline/Makefile.in (CXX, CXXFLAGS): New variables. + (test2-c++.o, test2-c++): New targets. + (check): Optionally, test also test2-c++. + (clean): Remove test2-c++.o, test2-c++. + (SOURCE_FILES): test2-c++.cc. + * callback/minitests-c++.cc: New file. + * callback/Makefile.in (CXX, CXXFLAGS): New variables. + (minitests-c++.o, minitests-c++): New targets. + (check): Optionally, test also minitests-c++. + (MOSTLYCLEANFILES): Add minitests-c++.o, minitests-c++, + minitests-c++.out. + (SOURCE_FILES): Add minitests-c++.cc. + +2017-08-27 Bruno Haible + + Add support for SUNWspro C++ on Solaris. + * avcall/avcall.h: Treat SUNWspro C++ like SUNWspro C. + * vacall/vacall.h: Likewise. + * callback/vacall_r/vacall_r.h: Likewise. + +2017-08-27 Bruno Haible + + Make the include files C++-safe. + * avcall/avcall.h: Add C++ guards. + (__AV_alignof): Test __IBM__ALIGNOF__. Use template-based definition + for C++. + * vacall/vacall.h: Add C++ guards. + (__VA_alignof): Test __IBM__ALIGNOF__. Use template-based definition + for C++. + * callback/vacall_r/vacall_r.h: Add C++ guards. + (__VA_alignof): Test __IBM__ALIGNOF__. Use template-based definition + for C++. + +2017-08-27 Bruno Haible + + Make sure the tests use only the public include files. + * avcall/tests.c: Don't include config.h. + * vacall/tests.c: Don't include config.h. + * callback/tests.c: Likewise. + * callback/trampoline_r/test1.c: Likewise. Include ffcall-abi.h instead. + * avcall/Makefile.in (avcall-libapi.lo): Use $(INCLUDES). + * vacall/Makefile.in (INCLUDES): Remove -I options that reference + gnulib-lib. + (INCLUDES_WITH_GNULIB): New variable. + (vacall-libapi.o): Use INCLUDES_WITH_GNULIB instead of INCLUDES. + * trampoline/Makefile.in (INCLUDES): Remove -I options that reference + gnulib-lib. + (INCLUDES_WITH_GNULIB): New variable. + (trampoline.lo): Use INCLUDES_WITH_GNULIB instead of INCLUDES. + * callback/vacall_r/Makefile.in (INCLUDES): Remove -I options that + reference gnulib-lib. + (INCLUDES_WITH_GNULIB): New variable. + (vacall-libapi.lo): Use INCLUDES_WITH_GNULIB instead of INCLUDES. + * callback/trampoline_r/Makefile.in (INCLUDES): Remove -I options that + reference gnulib-lib. + (INCLUDES_WITH_GNULIB): New variable. + (trampoline.lo): Use INCLUDES_WITH_GNULIB instead of INCLUDES. + +2017-08-27 Bruno Haible + + Make recognition of Solaris more robust. + * avcall/avcall.h: Test for '__sun', not for 'sun'. + * vacall/vacall.h: Likewise. + * callback/vacall_r/vacall_r.h: Likewise. + * vacall/tests.c: Likewise. + * callback/tests.c: Likewise. + +2017-08-27 Bruno Haible + + avcall: Align field names. + * avcall/avcall-alist.h (__av_alist): Rename field 'farg' to 'fargs'. + * avcall/avcall-internal.h (_av_float): Update. + * avcall/avcall-mipsn32.c (avcall_call): Likewise. + * avcall/avcall-mips64.c (avcall_call): Likewise. + +2017-08-27 Bruno Haible + + Remove support for old NeXTstep. + * avcall/avcall.h (__AV_NEXTGCC_STRUCT_RETURN): Remove enum value. + * avcall/avcall-internal.h (__av_start_struct4) [__i386__]: Remove test + for __AV_NEXTGCC_STRUCT_RETURN. + * avcall/avcall-i386.c (avcall_call): Likewise. + * avcall/PLATFORMS: Update. + * vacall/vacall.h (__VA_NEXTGCC_STRUCT_RETURN): Remove enum value. + * callback/vacall_r/vacall_r.h: Likewise. + * vacall/vacall-internal.h (__va_start_struct2) [__i386__]: Remove test + for __VA_NEXTGCC_STRUCT_RETURN. + * vacall/vacall-i386.c (vacall_receiver): Likewise. + * trampoline/trampoline.c: Don't include . + * callback/trampoline_r/trampoline.c: Likewise. + +2017-08-27 Bruno Haible + + hppa: Remove support for old gcc-2.6.3. + * avcall/avcall.h (__AV_OLDGCC_STRUCT_RETURN): Remove enum value. + * avcall/avcall-internal.h (__av_reg_struct_return) [__hppa__]: Remove + test for __AV_OLDGCC_STRUCT_RETURN. + * avcall/avcall-hppa.c (avcall_call): Likewise. + * vacall/vacall.h (__VA_OLDGCC_STRUCT_RETURN): Remove enum value. + * callback/vacall_r/vacall_r.h (__VA_OLDGCC_STRUCT_RETURN): Likewise. + * vacall/vacall-internal.h (__va_reg_struct_return) [__hppa__]: Remove + test for __VA_OLDGCC_STRUCT_RETURN. + * vacall/vacall-hppa.c (vacall_receiver): Likewise. + +2017-08-27 Bruno Haible + + avcall: Evaluate __AV_ALIST_WORDS only during av_start_* macros. Part 2. + * avcall/avcall-alist.h (__av_alist) [__hppa__]: Add 'args_end' field. + * avcall/avcall-internal.h (__av_start1) [__hppa__]: Initialize it. + * avcall/avcall-hppa.c (avcall_call): Use it to reduce the use of + __AV_ALIST_WORDS. + +2017-08-27 Bruno Haible + + avcall: Fix overflow detection bug on hppa. + * avcall/avcall-internal.h (__av_struct) [__hppa__]: Use LIST.eptr + instead of &LIST.args[0]. + +2017-08-27 Bruno Haible + + Fix build failure with --enable-shared on Solaris/SPARC with cc. + * common/asm-sparc.h: Test __SVR4, not __svr4__. + * common/asm-sparc.sh: Fix comment about postprocessing. + * avcall/Makefile.in (avcall-sparc.s, avcall-sparc64.s): Remove space + after '#'. + * vacall/Makefile.in (vacall-sparc.s, vacall-sparc64.s): Likewise. + * trampoline/Makefile.in (cache-sparc.s, cache-sparc64.s): Likewise. + * callback/vacall_r/Makefile.in (vacall-sparc.s, vacall-sparc64.s): + Likewise. + * callback/trampoline_r/Makefile.in (cache-sparc.s, cache-sparc64.s): + Likewise. + +2017-08-27 Bruno Haible + + vacall: Fix build failure with gcc configured with --enable-default-pie. + Works around a GCC bug, reported at + . + * vacall/Makefile.devel (vacall-sparc-linux-pic.s): New target. + (vacall-sparc-macro.S): Combine vacall-sparc-linux.s and + vacall-sparc-linux-pic.s in one file. + (vacall-sparc64-linux-pic.s): New target. + (vacall-sparc64-macro.S): Combine vacall-sparc64-linux.s and + vacall-sparc64-linux-pic.s in one file. + * vacall/Makefile.in (SOURCE_FILES): Add vacall-sparc-linux-pic.s, + vacall-sparc64-linux-pic.s. + +2017-08-27 Bruno Haible + + mips: Avoid warning about undeclared function 'cacheflush' on Linux. + * trampoline/trampoline.c: On Linux, include , not + . + * callback/trampoline_r/trampoline.c: Likewise. + +2017-08-27 Bruno Haible + + vacall: Fix struct returns on mips (o32 ABI). + * vacall/vacall-mips.c (vacall_receiver): Return the struct return + address in register $2. + +2017-08-27 Bruno Haible + + ia64: Test __GNUC__ only in av/va_start_* (regression from 2017-07-30). + * avcall/avcall.h (__AV_OLDGCC_STRUCT_ARGS): New enum item. + (__AV_STRUCT_ARGS): Use it. + * avcall/avcall-internal.h (__av_struct) [__ia64__]: Test flag + __AV_OLDGCC_STRUCT_ARGS, not __GNUC__. + * vacall/vacall.h (__VA_OLDGCC_STRUCT_ARGS): New enum item. + (__VA_STRUCT_ARGS): Use it. + * callback/vacall_r/vacall_r.h: Likewise. + * vacall/vacall-internal.h (__va_arg_struct): Test flag + __VA_OLDGCC_STRUCT_ARGS, not __GNUC__. + +2017-08-27 Bruno Haible + + Fix "make check" failure on Linux/mips (regression from 2017-07-30). + * ffcall-abi.h: For mipsn32, test _MIPS_SIM, because defines + both _ABIO32 and _ABIN32. + +2017-07-31 Bruno Haible + + Fix preprocessor warning "does not give a valid preprocessing token". + Reported by Reini Urban at . + * common/asm-arm.sh: Don't put a colon inside the C() or L() argument. + * common/asm-i386.sh: Likewise. + * common/asm-m68k.sh: Likewise. + * common/asm-sparc.sh: Likewise. + * common/asm-x86_64.sh: Likewise. + * common/asm-arm.h (FUNBEGIN): Don't put a colon inside the C() + argument. + * common/asm-i386.hh (FUNBEGIN): Likewise. + * common/asm-m68k.h (FUNBEGIN): Likewise. + * common/asm-sparc.h (FUNBEGIN): Likewise. + * common/asm-x86_64.h (FUNBEGIN): Likewise. + +2017-07-31 Bruno Haible + + Fix preprocessor warning "Unknown preprocessing directive". + * common/asm-hppa.sh: Eliminate #APP, #NO_APP lines. + * common/asm-powerpc.sh: Likewise. + +2017-07-31 Bruno Haible + + trampoline_r: Rework API. + * callback/trampoline_r/trampoline_r.h (trampoline_r_address, + trampoline_r_data0, trampoline_r_data1): Change signatures. + * callback/trampoline_r/trampoline.c (trampoline_r_address, + trampoline_r_data0, trampoline_r_data1): Update accordingly. + * callback/trampoline_r/test2.c: Update. + * callback/callback-libapi.c (is_callback): Likewise. + +2017-07-31 Bruno Haible + + vacall: Fix build error on IRIX with cc (regression from 2017-07-30). + * vacall/vacall-internal.h (__va_arg_adjusted, __va_arg_struct): Cast + result of __va_arg_leftadjusted and __va_arg_rightadjusted to 'void*'. + +2017-07-31 Bruno Haible + + Fix "make check" failure on arm (regression from 2017-07-30). + * vacall/vacall-internal.h (__va_alist): Move the 'filler1' field right + before the 'tmp' field. + * callback/vacall_r/vacall_r.h (vacall_alist): Add 'filler1' field + between 'flags' and 'tmp' fields. + +2017-07-31 Bruno Haible + + Fix build error (regression from 2017-07-30). + * vacall/Makefile.in (INCLUDES): Add -I options for . + * callback/vacall_r/Makefile.in (INCLUDES): Likewise. + +2017-07-30 Bruno Haible + + vacall: Polish Makefile.in. + * vacall/Makefile.in (vacall-x86_64-x32.o): Remove spurious reference to + LIBTOOL_COMPILE. + +2017-07-30 Bruno Haible + + m68k: Fix callback test crash on Linux. + * avcall/Makefile.in (avcall-m68k.s): Use the .S file in Motorola + syntax (cross-compiled for m68k-linux), not the one in MIT syntax + (cross-compiled for m68k-sun). + * vacall/Makefile.in (vacall-m68k.s): Likewise. + * callback/vacall_r/Makefile.in (vacall-m68k.s): Likewise. + * avcall/PLATFORM, NEWS: Update. + +2017-07-30 Bruno Haible + + m68k: Fix build failure on Linux. + * common/asm-m68k.sh: In mit syntax, recognize 'pc' as a register name. + +2017-07-30 Bruno Haible + + Limit the exported symbols of the installed shared libraries. + * avcall/Makefile.in (LIBAVCALL_EXPORTED_SYMBOLS_REGEX): New variable. + (libavcall.la): Use libtool's -export-symbols-regex option. + * trampoline/Makefile.in (LIBTRAMPOLINE_EXPORTED_SYMBOLS_REGEX): New + variable. + (libtrampoline.la): Use libtool's -export-symbols-regex option. + * callback/Makefile.in (LIBCALLBACK_EXPORTED_SYMBOLS_REGEX): New + variable. + (libcallback.la): Use libtool's -export-symbols-regex option. + +2017-07-30 Bruno Haible + + Ensure source compatibility with existing versions of GNU clisp, part 3. + * vacall/vacall-internal.h (__va_alist): Move the 'flags' and 'tmp' + fields to the beginning. + * callback/vacall_r/vacall_r.h (vacall_alist): When used by GNU clisp, + declare 'flags' and 'tmp' members. + +2017-07-30 Bruno Haible + + Ensure source compatibility with existing versions of GNU clisp, part 2. + * avcall/avcall-alist.h (__av_alist): Move the 'flags' field to the + beginning. + * avcall/avcall.h (av_alist): When used by GNU clisp, declare a 'flags' + member. + +2017-07-30 Bruno Haible + + Ensure source compatibility with existing versions of GNU clisp, part 1. + * avcall/avcall-libapi.c (__builtin_avcall): New dummy function. + * callback/callback-libapi.c (trampoline_r_data0): New dummy function. + +2017-07-30 Bruno Haible + + Remove copied files from callback/vacall_r/. + * callback/vacall_r/Makefile.devel (vacall-*.s): Compile + ../../vacall/vacall-*.c directly. + * autogen.sh: Don't invoke target 'copied-files' in callback/vacall_r/. + * Makefile.devel (precompiled): Likewise. + * Makefile.in (COPIED_FILES): Remove callback/vacall_r/*. + * callback/vacall_r/Makefile.maint (COPIED_FILES): Remove variable. + (copied-files): Remove target. + * callback/vacall_r/Makefile.in (SOURCE_FILES): Remove vacall-*.c. + +2017-07-30 Bruno Haible + + callback: Allow for binary-compatible future changes of main API. + * callback/callback.h: Renamed from callback/callback.h.in. + Don't include trampoline_r.h. + (callback_t, __TR_function): New types. + (callback_function_t): Renamed from __VA_function. + (alloc_callback, free_callback, is_callback, callback_address, + callback_data): Declare as functions, not as macros. + * callback/callback-libapi.c: New file. + * configure.ac: Don't create callback/callback.h. + * callback/Makefile.in (LIBTOOL_COMPILE): New variable. + (callback.h): Remove target + (callback-libapi.lo): New target. + (libcallback.la): Include it. + (install-lib, install, installdirs, uninstall): Don't recurse into + 'trampoline_r' directory. + (test1.o, minitests.o, minitests.s, tests.o, tests.s): Update + dependency. + (MOSTLYCLEANFILES): Remove callback.h. + (SOURCE_FILES): Add callback.h, callback-libapi.c. Remove callback.h.in. + * callback/test1.c (function): Remove type. + (main): Remove a cast. + * callback/tests.c (main): Use the type 'callback_t'. + * Makefile.in (DISTCLEANFILES): Update stamp file list. + * NEWS: Mention the improvement. + +2017-07-30 Bruno Haible + + callback: Remove version number from trampoline_r.h. + Rationale: It is already present in callback.h. + * callback/trampoline_r/trampoline_r.h: Renamed from + callback/trampoline_r/trampoline_r.h.in. + (LIBFFCALL_VERSION): Remove macro. + * configure.ac: Don't create callback/trampoline_r/trampoline_r.h. + * callback/trampoline_r/Makefile.in (trampoline_r.h): Remove target. + (trampoline.lo, test1.o, test2.o): Update dependencies. + (install-lib, install): Update. + (distclean): Don't remove trampoline_r.h. + (SOURCE_FILES): Add trampoline_r.h. Remove trampoline_r.h.in. + * callback/Makefile.in (trampoline_r.h): Link to + $(srcdir)/trampoline_r/trampoline_r.h. + * Makefile.in (DISTCLEANFILES): Update stamp file list. + +2017-07-30 Bruno Haible + + vacall, callback: Allow compiler optimizations regarding noreturn. + * Makefile.maint (GNULIB_MODULES): Add 'stdnoreturn'. + * vacall/vacall-libapi.c: Include . + (__va_struct_buffer_t): Moved to here. + (vacall_struct_buffer): Declare static. + (vacall_error_type_mismatch, vacall_error_struct_too_large): Declare + static and noreturn. + * callback/vacall_r/vacall-libapi.c: Likewise. + * vacall/vacall-internal.h (__va_start_struct, __va_return): Update. + (vacall_error_type_mismatch, vacall_error_struct_too_large, + __va_struct_buffer_t, vacall_struct_buffer): Remove declarations. + +2017-07-30 Bruno Haible + + vacall, callback: Move copyright notice up. + * vacall/vacall.h: Put double-inclusion guard after copyright header. + * callback/vacall_r/vacall_r.h: Likewise. + +2017-07-30 Bruno Haible + + callback: Allow for binary-compatible future changes of __va_* macros. + * callback/vacall_r/vacall_r.h: New file, extracted from + callback/vacall_r/vacall_r.h.in. Include , ffcall-abi.h. + (vacall_*): Define to symbols that start with 'callback_'. + (va_alist): Define als pointer to 'struct vacall_alist'. + (vacall_start, vacall_start_struct, vacall_arg_char, vacall_arg_schar, + vacall_arg_uchar, vacall_arg_short, vacall_arg_ushort, vacall_arg_int, + vacall_arg_uint, vacall_arg_long, vacall_arg_ulong, vacall_arg_longlong, + vacall_arg_ulonglong, vacall_arg_float, vacall_arg_double, + vacall_arg_ptr, vacall_arg_struct, vacall_return_void, + vacall_return_char, vacall_return_schar, vacall_return_uchar, + vacall_return_short, vacall_return_ushort, vacall_return_int, + vacall_return_uint, vacall_return_long, vacall_return_ulong, + vacall_return_longlong, vacall_return_ulonglong, vacall_return_float, + vacall_return_double, vacall_return_ptr, vacall_return_struct): New + declarations. + (va_start_void, va_start_char, va_start_schar, va_start_uchar, + va_start_short, va_start_ushort, va_start_int, va_start_uint, + va_start_long, va_start_ulong, va_start_longlong, va_start_ulonglong, + va_start_float, va_start_double, va_start_ptr, _va_start_struct, + va_arg_char, va_arg_schar, va_arg_uchar, va_arg_short, va_arg_ushort, + va_arg_int, va_arg_uint, va_arg_long, va_arg_ulong, va_arg_longlong, + va_arg_ulonglong, va_arg_float, va_arg_double, va_arg_ptr, + va_arg_struct, _va_arg_struct, va_return_void, va_return_char, + va_return_schar, va_return_uchar, va_return_short, va_return_ushort, + va_return_int, va_return_uint, va_return_long, va_return_ulong, + va_return_longlong, va_return_ulonglong, va_return_float, + va_return_double, va_return_ptr, _va_return_struct): Define in terms of + these functions. + * callback/vacall_r/vacall-libapi.c: Include vacall-internal.h instead + of vacall_r.h.in. + (vacall_start, vacall_start_struct, vacall_arg_char, vacall_arg_schar, + vacall_arg_uchar, vacall_arg_short, vacall_arg_ushort, vacall_arg_int, + vacall_arg_uint, vacall_arg_long, vacall_arg_ulong, vacall_arg_longlong, + vacall_arg_ulonglong, vacall_arg_float, vacall_arg_double, + vacall_arg_ptr, vacall_arg_struct, vacall_return_void, + vacall_return_char, vacall_return_schar, vacall_return_uchar, + vacall_return_short, vacall_return_ushort, vacall_return_int, + vacall_return_uint, vacall_return_long, vacall_return_ulong, + vacall_return_longlong, vacall_return_ulonglong, vacall_return_float, + vacall_return_double, vacall_return_ptr, vacall_return_struct): New + functions. + * vacall/vacall-internal.h: If REENTRANT, include vacall_r.h. + * callback/vacall_r/vacall_r.h.in: Remove file. + * vacall/vacall-*.c: Include vacall-internal.h instead of vacall_r.h.in. + * vacall/vacall-libapi.c: Likewise. + * callback/vacall_r/Makefile.devel (GCCFLAGS): Add -I option for + ffcall-abi.h. + (vacall-*.s): Update dependencies. Pass -I options to gcc. + * configure.ac: Don't create callback/vacall_r/vacall_r.h. + * callback/vacall_r/Makefile.maint (vacall_r.h.msvc, + vacall_r.h.mingw32): Remove targets. + (totally-clean): Don't remove vacall_r.h.msvc, vacall_r.h.mingw32. + * callback/Makefile.maint (vacall_r/vacall_r.h.msvc, + vacall_r/vacall_r.h.mingw32): Remove targets. + * callback/vacall_r/Makefile.in (INCLUDES): Add -I options for + vacall-internal.h and ffcall-abi.h. + (all): Don't depend on vacall_r.h. + (vacall-libapi.lo): Update dependencies. Pass -DREENTRANT option. + (install-lib, install): Update. + (distclean): Don't remove vacall_r.h. + (SOURCE_FILES): Add vacall_r.h. Remove vacall_r.h.in. + (GENERATED_FILES): Remove vacall_r.h.mingw32, vacall_r.h.msvc. + * callback/Makefile.in (INCLUDES): Add -I option for ffcall-abi.h. + (vacall_r.h): Link to $(srcdir)/vacall_r/vacall_r.h. + * Makefile.in (DISTCLEANFILES): Update. + * porting-tools/abis/README: Update. + +2017-07-30 Bruno Haible + + vacall: Allow for binary-compatible future changes of the __va_* macros. + * vacall/vacall.h: New file, extracted from vacall/vacall.h.in. + Include , ffcall-abi.h. + (va_alist): Define als pointer to 'struct vacall_alist'. + (vacall_start, vacall_start_struct, vacall_arg_char, vacall_arg_schar, + vacall_arg_uchar, vacall_arg_short, vacall_arg_ushort, vacall_arg_int, + vacall_arg_uint, vacall_arg_long, vacall_arg_ulong, vacall_arg_longlong, + vacall_arg_ulonglong, vacall_arg_float, vacall_arg_double, + vacall_arg_ptr, vacall_arg_struct, vacall_return_void, + vacall_return_char, vacall_return_schar, vacall_return_uchar, + vacall_return_short, vacall_return_ushort, vacall_return_int, + vacall_return_uint, vacall_return_long, vacall_return_ulong, + vacall_return_longlong, vacall_return_ulonglong, vacall_return_float, + vacall_return_double, vacall_return_ptr, vacall_return_struct): New + declarations. + (va_start_void, va_start_char, va_start_schar, va_start_uchar, + va_start_short, va_start_ushort, va_start_int, va_start_uint, + va_start_long, va_start_ulong, va_start_longlong, va_start_ulonglong, + va_start_float, va_start_double, va_start_ptr, _va_start_struct, + va_arg_char, va_arg_schar, va_arg_uchar, va_arg_short, va_arg_ushort, + va_arg_int, va_arg_uint, va_arg_long, va_arg_ulong, va_arg_longlong, + va_arg_ulonglong, va_arg_float, va_arg_double, va_arg_ptr, + va_arg_struct, _va_arg_struct, va_return_void, va_return_char, + va_return_schar, va_return_uchar, va_return_short, va_return_ushort, + va_return_int, va_return_uint, va_return_long, va_return_ulong, + va_return_longlong, va_return_ulonglong, va_return_float, + va_return_double, va_return_ptr, _va_return_struct): Define in terms of + these functions. + * vacall/vacall-libapi.c: Include vacall-internal.h instead of + vacall.h.in. + (vacall_start, vacall_start_struct, vacall_arg_char, vacall_arg_schar, + vacall_arg_uchar, vacall_arg_short, vacall_arg_ushort, vacall_arg_int, + vacall_arg_uint, vacall_arg_long, vacall_arg_ulong, vacall_arg_longlong, + vacall_arg_ulonglong, vacall_arg_float, vacall_arg_double, + vacall_arg_ptr, vacall_arg_struct, vacall_return_void, + vacall_return_char, vacall_return_schar, vacall_return_uchar, + vacall_return_short, vacall_return_ushort, vacall_return_int, + vacall_return_uint, vacall_return_long, vacall_return_ulong, + vacall_return_longlong, vacall_return_ulonglong, vacall_return_float, + vacall_return_double, vacall_return_ptr, vacall_return_struct): New + functions. + * vacall/vacall-internal.h: New file, extracted from vacall/vacall.h.in. + (__VA_ALIST_WORDS): Fix comment. + (__va_alist): Declare as 'struct vacall_alist'. + (__va_start): Add FLAGS argument. + (__va_start_struct): Renamed from _va_start_struct. Add FLAGS argument. + (_va_arg_*): Renamed from va_arg_*. + (_va_arg_ptr): Renamed from va_arg_ptr. Remove TYPE argument. + (_va_return_*): Renamed from va_return_*. + (_va_return_ptr): Renamed from va_return_ptr. Remove TYPE argument. + (__va_return_struct): Renamed from _va_return_struct. + * vacall/vacall.h.in: Remove file. + * configure.ac: Don't create vacall.h by substitution. + * vacall/vacall-*.c: Include vacall-internal.h instead of vacall.h.in. + * vacall/Makefile.devel (GCCFLAGS): Add -I option for ffcall-abi.h. + (vacall-*.s): Update dependencies. + (tests-*.s): Likewise. No more need to symlink vacall.h. + * vacall/Makefile.maint (vacall.h.msvc, vacall.h.mingw32): Remove + targets. + (totally-clean): Don't remove them. + * vacall/Makefile.in (INCLUDES): Add -I option for ffcall-abi.h. + (vacall-libapi.o): Update dependencies. + (install): Update. + (minitests.o, minitests.s, tests.o, tests.s): Update dependency. + (distclean): Don't remove vacall.h. + (SOURCE_FILES): Add vacall.h, vacall-internal.h. Remove vacall.h.in. + (GENERATED_FILES): Remove vacall.h.mingw32, vacall.h.msvc. + * Makefile.in (DISTCLEANFILES): Update stamp file list. + * vacall/README: Update. + * porting-tools/abis/README: Update. + +2017-07-30 Bruno Haible + + vacall: Remove special optimization of va_return_struct macro. + * vacall/vacall.h.in (va_return_struct): Define through + _va_return_struct. + * callback/vacall_r/vacall_r.h.in: Likewise. + +2017-07-30 Bruno Haible + + vacall, callback: Prefix all exported symbols at linker level. + * vacall/vacall-*.c: Define vacall_receiver instead of __vacall, + callback_receiver instead of __vacall_r, + callback_get_receiver instead of get__vacall_r. + * vacall/vacall-libapi.c: Include config.h first. + (vacall_receiver): Renamed from __vacall. + (vacall_struct_buffer): Renamed from __va_struct_buffer. + (vacall_error_type_mismatch): Renamed from __va_error1. + (vacall_error_struct_too_large): Renamed from __va_error2. + * vacall/vacall.h.in (_va_start_struct, __va_return): Update. + (vacall_error_type_mismatch): Renamed from __va_error1. + (vacall_error_struct_too_large): Renamed from __va_error2. + (vacall_struct_buffer): Renamed from __va_struct_buffer. + * callback/vacall_r/vacall-libapi.c: Include config.h first. + (vacall_struct_buffer): Renamed from __va_struct_buffer. + (vacall_error_type_mismatch): Renamed from __va_error1. + (vacall_error_struct_too_large): Renamed from __va_error2. + * callback/vacall_r/vacall_r.h.in (vacall_error_type_mismatch, + vacall_error_struct_too_large, vacall_structcpy, vacall_struct_buffer): + Define to symbols that start with 'callback_'. + (_va_start_struct, __va_return): Update. + (callback_receiver): Renamed from __vacall_r. + (callback_get_receiver): Renamed from get__vacall_r. + (vacall_error_type_mismatch): Renamed from __va_error1. + (vacall_error_struct_too_large): Renamed from __va_error2. + (vacall_struct_buffer): Renamed from __va_struct_buffer. + * callback/callback.h.in: Update. + * callback/trampoline_r/trampoline_r.h.in (alloc_trampoline_r, + free_trampoline_r, is_trampoline_r, trampoline_r_address, + trampoline_r_data0, trampoline_r_data1): Define to symbols that start + with 'callback_trampoline_'. + * callback/elf-hack.txt: Update. + * porting-tools/abis/call-used-registers.txt: Update. + +2017-07-30 Bruno Haible + + callback: Use distinct object file names in static library. + * callback/vacall_r/vacall-libapi.c: Renamed from + callback/vacall_r/misc.c. + * callback/vacall_r/Makefile.in (OBJECTS, SOURCE_FILES): Update. + (vacall-libapi.lo): Renamed from misc.lo. + * callback/Makefile.in (libcallback.la): Update. + +2017-07-30 Bruno Haible + + vacall: Use distinct object file names in static library. + * vacall/vacall-libapi.c: Renamed from vacall/misc.c. + * vacall/Makefile.in (OBJECTS, SOURCE_FILES): Update. + (vacall-libapi.o): Renamed from misc.o. + * vacall/README: Update. + +2017-07-30 Bruno Haible + + avcall: Modernize. + * avcall/avcall.h: Change double-include guard. Modernize copyright + header. + +2017-07-30 Bruno Haible + + avcall: Allow for binary-compatible future changes of the __av_* macros. + * avcall/avcall.h: New file, extracted from avcall/avcall.h.in. + Include , ffcall-abi.h. + When included from avcall-internal.h, include avcall-alist.h and add + member '_av_m_alist' in av_alist type. + (avcall_overflown, avcall_start, avcall_start_struct, avcall_arg_long, + avcall_arg_ulong, avcall_arg_ptr, avcall_arg_longlong, + avcall_arg_ulonglong, avcall_arg_float, avcall_arg_double, + avcall_arg_struct): New declarations. + (av_overflown, av_start_void, av_start_char, av_start_schar, + av_start_uchar, av_start_short, av_start_ushort, av_start_int, + av_start_uint, av_start_long, av_start_ulong, av_start_longlong, + av_start_ulonglong, av_start_float, av_start_double, av_start_ptr, + _av_start_struct, av_char, av_schar, av_short, av_int, av_long, + av_uchar, av_ushort, av_uint, av_ulong, av_ptr, av_longlong, + av_ulonglong, av_float, av_double, av_struct, _av_struct, av_call): + Define in terms of these functions. + * avcall/avcall-libapi.c: New file. + * avcall/avcall-alist.h: New file, extracted from avcall/avcall.h.in. + * avcall/avcall-internal.h: New file, extracted from avcall/avcall.h.in. + (__av_start): Add LIST_ARGS_END and FLAGS arguments. + (__av_start1, __av_start_init_eptr): Add LIST_ARGS_END argument. + (__av_start_struct): Add LIST_ARGS, LIST_ARGS_END, FLAGS arguments. + (__av_long): Renamed from _av_long. + (__av_ulong): Renamed from _av_ulong. + (__av_ptr): Renamed from _av_ptr. Remove TYPE argument. + (__av_arg_longlong): Renamed from __av_longlong. + (__av_longlong): Renamed from _av_longlong. + (__av_ulonglong): Renamed from _av_ulonglong. + * avcall/avcall.h.in: Remove file. + * configure.ac: Don't create avcall.h by substitution. + * avcall/avcall-*.c: Include avcall-internal.h instead of avcall.h.in. + (avcall_call): Change argument type to 'av_alist*'. + * avcall/Makefile.devel (GCCFLAGS): Add -I option for ffcall-abi.h. + (avcall-*.s): Update dependencies. + (tests-*.s): Likewise. No more need to symlink avcall.h. + * avcall/Makefile.maint (avcall.h.msvc, avcall.h.mingw32): Remove + targets. + (totally-clean): Don't remove them. + * avcall/Makefile.in (INCLUDES): Add -I option for ffcall-abi.h. + (OBJECTS): Add avcall-libapi.lo. + (avcall-libapi.lo): New target. + (install-lib, install): Update. + (minitests.o, minitests.s, tests.o, tests.s): Update dependency. + (distclean): Don't remove avcall.h. + (SOURCE_FILES): Add avcall.h, avcall-internal.h, avcall-alist.h, + avcall-libapi.c. Remove avcall.h.in. + (GENERATED_FILES): Remove avcall.h.mingw32, avcall.h.msvc. + * Makefile.in (DISTCLEANFILES): Update stamp file list. + * avcall/README: Update. + * porting-tools/abis/README: Update. + +2017-07-30 Bruno Haible + + avcall: Allow for binary-compatible future changes of __av_alist. + * avcall/avcall.h.in (__AV_ALIST_SIZE_BOUND): New macro. + (__av_alist_verify): New verification. + (av_alist): Use it to allocate room. + +2017-07-30 Bruno Haible + + avcall: Separate the fixed-size part from the variable part of av_alist. + * avcall/avcall.h.in (__av_alist): Renamed from av_alist. Add 'args' + field as a pointer. + (av_alist): New type. + (_av_overflown): Renamed from av_overflown. + (av_overflown): New macro. + (__av_start): Add LIST_ARGS argument. + (av_start_*, _av_start_struct): Update accordingly. + (_av_long): Renamed from av_long. + (_av_ulong): Renamed from av_ulong. + (_av_ptr): Renamed from av_ptr. + (av_long, av_ulong, av_ptr): New macros. + (_av_longlong): Renamed from av_longlong. + (_av_ulonglong): Renamed from av_ulonglong. + (av_longlong, av_ulonglong): New macros. + (_av_float): Renamed from av_float. + (_av_double): Renamed from av_double. + (av_float, av_double): New macros. + (av_struct, _av_struct, av_call): Update. + (avcall_call): Take an '__av_alist*' parameter. + * avcall/avcall-*.c (avcall_call): Take an '__av_alist*' parameter. + +2017-07-30 Bruno Haible + + avcall: Remove unused macro argument TYPE. + * avcall/avcall.h.in (__av_struct_copy, __av_struct_leftadjusted, + __av_struct_rightadjusted, __av_struct): Remove TYPE argument. + +2017-07-30 Bruno Haible + + avcall: Remove special optimization of av_struct macro. + * avcall/avcall.h.in (av_struct): Take the address of VAL. + (__av_struct_assign): Remove macro. + (__av_struct, __av_struct_leftadjusted, __av_struct_rightadjusted): + Remove ASSIGN argument; use __av_struct_copy instead. + +2017-07-30 Bruno Haible + + avcall: Evaluate __AV_ALIST_WORDS only during av_start_* macros. Part 1. + * avcall/avcall.h.in (av_alist): Enable 'eptr' field on all platforms. + (__av_eptr): Remove macro. Use (LIST).eptr eveywhere instead. + (__av_start_init_eptr): New macro. + (__av_start): Invoke it. + (__av_start1): Don't initialize (LIST).eptr here. + +2017-07-30 Bruno Haible + + avcall: Prefix all exported symbols at linker level with 'avcall_'. + * avcall/avcall.h.in (avcall_call): Renamed from __builtin_avcall. + * avcall/avcall-*.c: Update accordingly. + * avcall/DOC: Likewise. + * avcall/avcall.3: Likewise. + * avcall/avcall.html: Likewise. + +2017-07-30 Bruno Haible + + trampoline: Rework API. + * trampoline/trampoline.h: Add C++ guards. Add comments. + (trampoline_function_t): Renamed from __TR_function. + (alloc_trampoline, trampoline_address, trampoline_variable, + trampoline_data): Change signatures. + * trampoline/trampoline.c: Update accordingly. + * trampoline/test1.c (function): Remove type. + (main): Update. + * trampoline/test2.c (function): Remove type. + (main): Update. + * NEWS: Mention the changes. + +2017-07-30 Bruno Haible + + trampoline: Restructure include file. + * trampoline/trampoline.h: Renamed from trampoline/trampoline.h.in. + * configure.ac: Don't create trampoline.h by substitution. + * trampoline/Makefile.in (trampoline.h): Remove target. + (trampoline.lo, test1.o, test2.o): Update dependency. + (install, SOURCE_FILES): Update. + (distclean): Don't remove trampoline.h. + * trampoline/README: Update. + * Makefile.in (DISTCLEANFILES): Update stamp file list. + +2017-07-30 Bruno Haible + + Move ABI indicator macro definitions to a separate include file. + Rationale: Prepare for getting rid of most .h.in -> .h substitutions. + * ffcall-abi.h: New file. + * Makefile.in (install, uninstall): Install/uninstall ffcall-abi.h. + (SOURCE_FILES): Add ffcall-abi.h. + * porting-tools/abis/predefines.c: New file. + * porting-tools/abis/README: Update. + +2017-07-30 Bruno Haible + + Move libffcall version number to a separate include file. + Rationale: Prepare for getting rid of most .h.in -> .h substitutions. + * ffcall-version.in.h: New file. + * configure.ac: Invoke AC_CONFIG_HEADERS for ffcall-version.h. + * avcall/avcall.h.in (LIBFFCALL_VERSION): Remove definition. Include + ffcall-version.h instead. + * vacall/vacall.h.in: Likewise. + * trampoline/trampoline.h.in: Likewise. + * callback/callback.h.in: Likewise. + * callback/vacall_r/vacall_r.h.in (LIBFFCALL_VERSION): Remove + definition. + * callback/trampoline_r/trampoline_r.h.in (LIBFFCALL_VERSION): Likewise. + * dummy/ffcall-version.h: New file. + * avcall/Makefile.devel (GCCFLAGS): Add -I option to find a dummy + ffcall-version.h. + * vacall/Makefile.devel (GCCFLAGS): Likewise. + * callback/vacall_r/Makefile.devel (GCCFLAGS): Likewise. + * vacall/Makefile.maint (VERSION): Remove macro. + (vacall.h.msvc, vacall.h.mingw32): Don't substitute LIBFFCALL_VERSION. + * callback/vacall_r/Makefile.maint (VERSION): Remove macro. + (vacall_r.h.msvc, vacall_r.h.mingw32): Don't substitute + LIBFFCALL_VERSION. + * Makefile.in (ffcall-version.h): New target. + (install, installdirs, uninstall): Install/uninstall ffcall-version.h. + (DISTCLEANFILES): Add ffcall-version.h. Update stamp file list. + (SOURCE_FILES): Add ffcall-version.in.h, dummy/ffcall-version.h. + +2017-07-30 Bruno Haible + + Remove configure test for 'long long'. Assume the compiler has it. + Rationale: All compilers nowadays have 'long long', for years. + * configure.ac: Don't invoke AC_TYPE_LONG_LONG_INT. + * avcall/avcall.h.in (HAVE_LONG_LONG_INT): Remove macro. + * vacall/vacall.h.in (HAVE_LONG_LONG_INT): Likewise. + * callback/vacall_r/vacall_r.h.in (HAVE_LONG_LONG_INT): Likewise. + * vacall/Makefile.devel (GCCFLAGS): Remove -DHAVE_LONG_LONG_INT. + * callback/vacall_r/Makefile.devel (GCCFLAGS): Likewise. + * avcall/tests.c: Remove test for HAVE_LONG_LONG_INT. + * vacall/tests.c: Likewise. + * callback/tests.c: Likewise. + * porting-tools/abis/README: Update. + +2017-07-30 Bruno Haible + + Remove unused configure test AC_C_CHAR_UNSIGNED. + * vacall/vacall.h.in (__CHAR_UNSIGNED__): Remove unuseed macro. + * callback/vacall_r/vacall_r.h.in (__CHAR_UNSIGNED__): Likewise. + * configure.ac: Don't invoke AC_C_CHAR_UNSIGNED. + +2017-07-30 Bruno Haible + + Don't depend on FFCALL_IREG_FLOAT_RETURN configure result. + Rationale: The installed .h files should be compiler independent. + * avcall/avcall.h.in (__IREG_FLOAT_RETURN__): Remove macro. Assume it is + not defined on m68k. + * vacall/vacall.h.in (__IREG_FLOAT_RETURN__): Likewise. + * callback/vacall_r/vacall_r.h.in (__IREG_FLOAT_RETURN__): Likewise. + +2017-07-30 Bruno Haible + + Don't depend on FFCALL_SMALL_STRUCT_RETURN configure result. + Rationale: The installed .h files should be compiler independent. + * avcall/avcall.h.in (__SMALL_STRUCT_RETURN__): Remove macro. Use + explicit ABI conditional instead. + * vacall/vacall.h.in (__SMALL_STRUCT_RETURN__): Likewise. + * callback/vacall_r/vacall_r.h.in (__SMALL_STRUCT_RETURN__): Likewise. + * avcall/Makefile.maint (avcall.h.msvc, avcall.h.mingw32): Don't + substitute __SMALL_STRUCT_RETURN__. + * vacall/Makefile.maint (vacall.h.msvc, vacall.h.mingw32): Likewise. + * callback/vacall_r/Makefile.maint (vacall_r.h.msvc, + vacall_r.h.mingw32): Likewise. + +2017-07-30 Bruno Haible + + Move a file. + * avcall/port-structs.c: Moved to porting-tools/abis/. + * porting-tools/abis/README: Mention it. + +2017-07-30 Bruno Haible + + Remove support for old PCC struct return convention. + It is not reentrant and therefore a fortiori not multithread-safe. + * m4/pccstruct.m4: Remove file. + * Makefile.in (SOURCE_FILES): Remove it. + * configure.ac: Remove FFCALL_PCC_STRUCT_RETURN invocation. + * avcall/avcall.h.in (__PCC_STRUCT_RETURN__): Remove macro. + (__AV_PCC_STRUCT_RETURN): Remove enum value. + (__av_start_struct1): Remove macro. + (_av_start_struct): Use __av_start_struct2 instead. + * avcall/avcall-*.c: Remove support for __AV_PCC_STRUCT_RETURN flag. + * vacall/vacall.h.in (__PCC_STRUCT_RETURN__): Remove macro. + (__VA_PCC_STRUCT_RETURN): Remove enum value. + (_va_start_struct): Update accordingly. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-*.c: Remove support for __VA_PCC_STRUCT_RETURN flag. + * vacall/misc.c (__va_error2): Update error message. + * callback/vacall_r/misc.c (__va_error2): Likewise. + +2017-07-22 Bruno Haible + + ia64: Make vacall code more robust. + * vacall/vacall-ia64.c: Use a split struct to allocate room for the + 8 leading words in the callee's stack. + * porting-tools/abis/stack-frame.txt: Mention the change. + +2017-07-22 Bruno Haible + + alpha: Make vacall code more robust. + * vacall/vacall-alpha.c: Use a split struct to allocate room for the + 6 leading words in the callee's stack. + * porting-tools/abis/stack-frame.txt: Mention the change. + +2017-07-22 Bruno Haible + + alpha: Make vacall code more maintainable. + * vacall/vacall.h.in (__va_alist, va_arg_double, va_arg_float) [alpha]: + Add fields 'farg_offset', 'farg'. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-alpha.c (__vacall): Don't allocate the fargs in the + 'locals' struct. Initialize 'farg_offset' field. + +2017-07-22 Bruno Haible + + mipsn32, mips64: Remove unused field. + * vacall/vacall.h.in (__va_alist) [__mipsn32__ || __mips64__]: Remove + field 'memargptr'. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-mipsn32.c (__vacall): Update accordingly. + * vacall/vacall-mips64.c (__vacall): Likewise. + +2017-07-22 Bruno Haible + + mipsn32, mips64: Make vacall code more robust. + * vacall/Makefile.devel (vacall-mipsn32eb-macro.S, + vacall-mipsn32el-macro.S, vacall-mips64eb-macro.S, + vacall-mips64el-macro.S): Remove post-processing hack. + * callback/vacall_r/Makefile.devel (vacall-mipsn32eb-macro.S, + vacall-mipsn32el-macro.S, vacall-mips64eb-macro.S, + vacall-mips64el-macro.S): Likewise. + * vacall/vacall-mipsn32.c: Use a split struct to allocate room for the + 8 leading words in the callee's stack. + * vacall/vacall-mips64.c: Likewise. + * porting-tools/abis/stack-frame.txt: Mention the change. + +2017-07-22 Bruno Haible + + mips: Don't store dynamic state in the flags. + * avcall/avcall.h.in (__AV_FLOAT_1, __AV_FLOAT_2, __AV_DOUBLE_1, + __AV_DOUBLE_2): Remove enum values. + (av_alist) [mips]: Store the number of floating-point register arguments + in fanum. Store bitmasks in farg_mask and darg_mask. Rename field + 'floatarg' to 'fargs'. Rename field 'doublearg' to 'dargs'. + (__av_start1, av_float, av_double): Update implementation accordingly. + * avcall/avcall-mips.c (__builtin_avcall): Access farg_mask and + darg_mask instead of the flags. + * vacall/vacall.h.in (__VA_FLOAT_1, __VA_FLOAT_2): Remove enum values. + (__VA_REGISTER_FLOATSTRUCT_RETURN, __VA_REGISTER_DOUBLESTRUCT_RETURN): + Change values. + (__va_alist, va_arg_float, va_arg_double) [mips]: Store the number of + floating-point register arguments in fanum. Use it instead of the + __VA_FLOAT_1 flag. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-mips.c (__vacall): Update accordingly. + +2017-07-22 Bruno Haible + + powerpc, powerpc64, ia64, x86_64: Undo premature optimization. + * vacall/vacall.h.in: Use 'fanum' field instead of 'memfargptr' field. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-ia64.c: Update accordingly. + * vacall/vacall-powerpc.c: Likewise. + * vacall/vacall-powerpc64.c: Likewise. + * vacall/vacall-x86_64.c: Likewise. + +2017-07-22 Bruno Haible + + x86_64: Undo premature optimization. + * vacall/vacall.h.in [__x86_64__]: Use 'ianum' field instead of + 'memiargptr' field. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-x86_64.c (__vacall): Update accordingly. + +2017-07-22 Bruno Haible + + x86_64: Undo premature optimization. + * avcall/avcall.h.in [__x86_64__]: Use 'ianum' field instead of 'iaptr' + field. + +2017-07-22 Bruno Haible + + ia64, x86_64: Use symbolic constants. + * avcall/avcall.h.in (__AV_FARG_NUM) [__ia64__ || __x86_64__]: + New macro. + (av_float, av_double): Use it. + (__av_struct): Use __AV_IARG_NUM. + * vacall/vacall.h.in (__VA_FARG_NUM) [__ia64__ || __x86_64__]: + New macro. + (va_arg_float, va_arg_double): Use it. + * callback/vacall_r/vacall_r.h.in: Likewise. + +2017-07-22 Bruno Haible + + armhf: Fix a bug in vacall (failing tests d_d13i, f_f17l3L, d_d17l3L). + * vacall/vacall.h.in (__va_alist, __va_start_struct2, + __va_arg_leftadjusted, __va_arg_rightadjusted, __va_arg_longlong) + [__armhf__]: Use 'iarg' and 'ianum' fields instead of 'saptr' field. + (va_arg_float, va_arg_double) [__armhf__]: Don't force all remaining + integer arguments to the stack. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-armhf.c (__vacall): Update accordingly. + +2017-07-22 Bruno Haible + + armhf: Fix a bug in avcall (failing tests f_f17l3L, d_d17l3L). + * avcall/avcall.h.in [__armhf__]: Store integer argument count in ianum. + (__av_start1, __av_start_struct4, __av_word, __av_longlong, av_float, + av_double, __av_struct): Update implementation accordingly. + * avcall/avcall-arm.c: Add comment. + * avcall/avcall-armhf.c: Likewise. + * porting-tools/abis/stack-frame.txt: Update information. + * NEWS: Mention the fix. + +2017-07-22 Bruno Haible + + powerpc: Make avcall code more robust. + * avcall/avcall-powerpc.c (__builtin_avcall) [_AIX]: Don't rely on a + particular stack frame layout produced by GCC. Use __builtin_alloca + instead. + * avcall/avcall-powerpc64.c (STACK_OFFSET): Remove unused macro. + +2017-07-22 Bruno Haible + + powerpc: Don't ever access out-of-range array elements. + * avcall/avcall-powerpc.c (__builtin_avcall): Access only 8 fargs when + only 8 exist. + +2017-07-22 Bruno Haible + + powerpc, powerpc64: Use symbolic constants. + * avcall/avcall.h.in (__AV_FARG_NUM) [__powerpc__ || __powerpc64__]: + New macro. + (av_float, av_double): Use it. + * vacall/vacall.h.in (__VA_FARG_NUM) [__powerpc__ || __powerpc64__]: + New macro. + (va_arg_float, va_arg_double): Use it. + * callback/vacall_r/vacall_r.h.in: Likewise. + +2017-07-22 Bruno Haible + + powerpc: Fix a bug (failing tests f_f12i, f_f13i, d_d12i, d_d13i). + * avcall/avcall.h.in [__powerpc_sysv4__]: Store integer register + arguments in iargs[] and their count in ianum. + (__av_start1, __av_start_struct4, av_long, av_ulong, av_ptr, + __av_longlong, __av_struct): Update implementation accordingly. + * avcall/avcall-powerpc.c (__builtin_avcall): Update accordingly. + Ignore farglen in the arg copy loop. + * vacall/vacall.h.in (__va_alist, __va_start_struct2, + __va_arg_leftadjusted, __va_arg_rightadjusted, __va_arg_longlong, + va_arg_float, va_arg_double) [__powerpc_sysv4__]: Use 'ianum' field + instead of 'saptr', 'onstack' fields. Don't bump 'ianum' in + va_arg_float, va_arg_double. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-powerpc.c (__vacall): Update accordingly + * porting-tools/abis/stack-frame.txt: Fix information. + * NEWS: Mention the fix. + +2017-07-22 Bruno Haible + + powerpc: Simplify #if expressions. + * avcall/avcall.h.in (__powerpc_aix__, __powerpc_sysv4__): New macros. + Use them in #if expressions. + * vacall/vacall.h.in: Likewise. + * callback/vacall_r/vacall_r.h.in: Likewise. + * avcall/avcall-powerpc.c: Add comments. + * vacall/vacall-powerpc.c: Likewise. + +2017-07-22 Bruno Haible + + s390, s390x: Merge common code. + * vacall/vacall.h.in (va_arg_float, va_arg_double) [s390,s390x]: Merge. + * callback/vacall_r/vacall_r.h.in: Likewise. + +2017-07-22 Bruno Haible + + s390: Fix a bug (failing tests f_f3i...f_f13i, d_d3i...d_d13i). + * vacall/vacall.h.in (va_arg_float, va_arg_double) [s390]: Don't bump + ianum, + * callback/vacall_r/vacall_r.h.in: Likewise. + * NEWS: Mention the fix. + +2017-07-22 Bruno Haible + + s390: Make vacall code more similar to s390x, arm64 cases. + * vacall/vacall.h.in (__va_alist, __va_start_struct2, + __va_arg_leftadjusted, __va_arg_rightadjusted, __va_arg_adjusted, + va_arg_float, va_arg_double, __va_arg_struct) [s390]: Use 'ianum' + field instead of 'saptr', 'onstack' fields. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-s390.c: Update accordingly. + +2017-07-22 Bruno Haible + + Add some mixed-number args boundary tests. + * avcall/tests.c (f_f17l3L, d_d17l3L): New tests. + * vacall/tests.c: Likewise. + * callback/tests.c: Likewise. + +2017-07-22 Bruno Haible + + Add more mixed-number tests. + * avcall/tests.c (f_fi, ..., f_f13i, d_di, ..., d_d13i): New tests. + * vacall/tests.c: Likewise. + * callback/tests.c: Likewise. + +2017-07-19 Bruno Haible + + s390: Make avcall code more robust. + * avcall/avcall-s390.c (STACK_OFFSET): Remove macro. + (__builtin_avcall): Don't rely on a particular stack frame layout + produced by GCC. Use __builtin_alloca instead. + +2017-07-19 Bruno Haible + + s390: Make avcall code more similar to s390x, arm64, x86_64 cases. + * avcall/avcall.h.in (av_alist, __av_start_struct4, __av_word, av_long, + av_ulong, av_ptr, __av_longlong, __av_struct) [s390]: Use iargs[] array + for the first 5 general-purpose argument words, like on s390x. + (__av_struct_rightadjusted) [s390]: Remove macro. + * avcall/avcall-s390.c (__builtin_avcall): Update accordingly. + +2017-07-19 Bruno Haible + + s390: Simplify avcall code. + * avcall/avcall.h.in (av_alist, __av_start1, __av_start_struct4, + __av_word, __av_longlong, av_float, av_double, + __av_struct_rightadjusted, __av_struct) [s390]: Use 'ianum' field + instead of 'fargwords' field. + * avcall/avcall-s390.c (__builtin_avcall): Update accordingly. + +2017-07-16 Bruno Haible + + Allow building statically linked binaries, through LDFLAGS="-static". + * Makefile.main (libtool-imported-files): Fetch and apply patch from + : + + 2017-07-15 Bruno Haible + + * build-aux/ltmain.sh (func_mode_help, func_mode_link): In the + link mode, accept option '-static-uninstalled-libs' in place of + '-static', and make '-static' an equivalent of '-all-static'. + +2017-07-07 Bruno Haible + + build: Avoid a hanging configure test on FreeBSD/arm64. + Seen with FreeBSD 11.1-RC1 on arm64 (under qemu 2.9.0). + * m4/codeexec.m4 (FFCALL_CODEEXEC): Avoid running the test on + FreeBSD/arm64. + +2017-06-27 Bruno Haible + + build: Fix warning in autoconf test. + * m4/shm.m4 (CL_SHM): Include , to declare exit(). + +2017-06-25 Bruno Haible + + Add doc about ABIs and calling conventions. + * porting-tools/abis: New directory. + * common/reg-struct-return.txt: Moved to porting-tools/abis/. + * callback/call-used-registers.txt: Likewise. + +2017-06-25 Bruno Haible + + Add doc about emulation of target platforms. + * porting-tools/emulation: New directory. + +2017-06-24 Bruno Haible + + s390: Simplify code. + * vacall/vacall.h.in (__va_alist) [s390]: Use a counter instead of + 2 pointers. + (va_arg_float, va_arg_double): Update accordingly; + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-s390.c: Update accordingly. + +2017-06-24 Bruno Haible + + s390: Simplify code. + * avcall/avcall.h.in (av_alist) [s390]: Use a counter instead of + 4 pointers. Use 2 bitmasks instead of 2 int[] arrays. + (__av_start1, av_float, av_double): Update accordingly. + * avcall/avcall-s390.c (__builtin_avcall): Likewise. + +2017-06-24 Bruno Haible + + build: Improve guesses when cross-compiling. + * m4/codeexec.m4 (FFCALL_CODEEXEC, FFCALL_CODEEXEC_PAX): When + cross-compiling, use the known autoconf test results. + * m4/mmap.m4 (FFCALL_MMAP): Likewise. + * m4/mprotect.m4 (FFCALL_MPROTECT): Likewise. + * m4/pccstruct.m4 (FFCALL_PCC_STRUCT_RETURN): Likewise. + * m4/shm.m4 (CL_SHM): Likewise. + * m4/smallstruct.m4 (FFCALL_SMALL_STRUCT_RETURN): Likewise. + +2017-06-24 Bruno Haible + + Bump version number. + * VERSION: Set to 2.0. + * NEWS: Open new section for 2.0. + +2017-06-24 Bruno Haible + + build: Use decimal notation for the version number. + * VERSION: Set to 1.13. + * configure.ac: Simplify AC_CONFIG_HEADERS invocations. Define + LIBFFCALL_VERSION as C macro, based on PACKAGE_VERSION. + * avcall/avcall.h.in (LIBFFCALL_VERSION): Use a plain #define, for + substitution by config.status. + * vacall/vacall.h.in: Likewise. + * trampoline/trampoline.h.in: Likewise. + * callback/callback.h.in: Likewise. + * callback/vacall_r/vacall_r.h.in: Likewise. + * callback/trampoline_r/trampoline_r.h.in: Likewise. + +2017-06-24 Bruno Haible + + trampoline, callback: Make multithread-safe. + * Makefile.maint (AUTOMAKE): New variable. + (all): Depend on Makefile-ins. + (GNULIB_MODULES): Add 'lock'. + (gnulib-m4/gnulib-cache.m4): Don't remove generated gnulib-lib files. + (ALL_MAKEFILE_IN_FROM_AM): New variable. + (Makefile-ins, gnulib-lib/Makefile.in): New targets. + * configure.ac: Invoke AM_INIT_AUTOMAKE. Arrange to generate + gnulib-lib/Makefile. Invoke gl_EARLY earlier. Recurse into gnulib-lib + directory. + * Makefile.in (DISTCLEANFILES): Add the various stamp-h* files created + by config.status at the end of the 'configure' run. + (AUTOMAKE_IMPORTED_FILES): New variable. + (IMPORTED_FILES): Use it. + * trampoline/Makefile.in (INCLUDES): Reference the gnulib build dir and + source dir. + (LTLIBTHREAD): New variable. + (libtrampoline.la): Link against libgnu.la, with options $(LTLIBTHREAD). + (test1, test2): Link against libtrampoline.la. + * trampoline/trampoline.c: Include glthread/lock.h. + (zero_fd, file_fd, file_length): Move to file scope. + (for_mmap_init): New function, extracted from alloc_trampoline. + (for_mmap_once): New variable. + (freelist_lock): New variable. + (alloc_trampoline): Use once-only execution and locking. + * callback/trampoline_r/Makefile.in (INCLUDES): Reference the gnulib + build dir and source dir. + (LTLIBTHREAD): New variable. + (libtrampoline.la): Link against libgnu.la, with options $(LTLIBTHREAD). + (test1, test2): Link against libtrampoline.la. + * callback/trampoline_r/trampoline.c: Include glthread/lock.h. + (zero_fd, file_fd, file_length): Move to file scope. + (for_mmap_init): New function, extracted from alloc_trampoline. + (for_mmap_once): New variable. + (freelist_lock): New variable. + (alloc_trampoline_r): Use once-only execution and locking. + * callback/Makefile.in (LTLIBTHREAD): New variable. + (libcallback.la): Link against libgnu.la, with options $(LTLIBTHREAD). + +2017-06-24 Bruno Haible + + build: Rename glm4 to gnulib-m4. + * autogen.sh: Write gnulib-m4 instead of glm4. + * Makefile.maint: Likewise. + * Makefile.in (GNULIB_IMPORTED_FILES): Likewise. + +2017-06-24 Bruno Haible + + build: Assume a single configure.ac file. + * Makefile.maint (ALL_CONFIGURE_AC, aclocal.m4): Simplify. + +2017-06-24 Bruno Haible + + Merge all autoconf configurations into a single one. + * configure.ac: Include the body of all other configure.ac files. + Use a single config.h file. Inline FFCALL_COMMON_LIBTOOL and + FFCALL_COMMON_TRAMPOLINE. + * avcall/configure.ac: Remove file. + * vacall/configure.ac: Remove file. + * trampoline/configure.ac: Remove file. + * callback/configure.ac: Remove file. + * callback/vacall_r/configure.ac: Remove file. + * callback/trampoline_r/configure.ac: Remove file. + * m4/general.m4 (FFCALL_COMMON_LIBTOOL, FFCALL_COMMON_TRAMPOLINE): + Remove macros. + * build-aux/ac-help.sed: Remove file. + * Makefile.maint (CONFIGURED_SUBDIRS, SUBDIRS_CONFIGURE): Remove + variables. + (ALL_CONFIGURE): Keep only the top-level configure. + (%/configure): Remove rule. + (ALL_CONFIG_H_IN): Set to only the top-level config.h.in. + (config.h.in): Replace the %/config.h.in rule. + * vacall/Makefile.maint (config.h.msvc, config.h.mingw32): Use top-level + config.h.in. + * trampoline/Makefile.maint (config.h.msvc, config.h.mingw32): Use + top-level config.h.in. + * callback/Makefile.maint (vacall_r/config.h.msvc, + vacall_r/config.h.mingw32, trampoline_r/config.h.msvc, + trampoline_r/config.h.mingw32): Update dependencies. + * callback/vacall_r/Makefile.maint (config.h.msvc, config.h.mingw32): + Use top-level config.h.in. + * callback/trampoline_r/Makefile.maint (config.h.msvc, + config.h.mingw32): Use top-level config.h.in. + * Makefile.in (DISTCLEANFILES): Add config.h, libtool. + (SOURCE_FILES): Remove build-aux/ac-help.sed. + (GENERATED_FILES): Add config.h.in. Remove */config* and + callback/*/config*. + * avcall/Makefile.in (INCLUDES): Look also in '..'. + (top_builddir): Set to '..'. + (distclean): Don't remove config* and libtool. + (SOURCE_FILES): Remove configure.ac. + * vacall/Makefile.in (INCLUDES): Look also in '..'. + (misc.o): Update dependency. + (distclean): Don't remove config* and libtool. + (SOURCE_FILES): Remove configure.ac. + * trampoline/Makefile.in (INCLUDES): Look also in '..'. + (top_builddir): Set to '..'. + (distclean): Don't remove config* and libtool. + (SOURCE_FILES): Remove configure.ac. + * callback/Makefile.in (INCLUDES): Look also in '..'. + (top_builddir): Set to '..'. + (DISTCLEANFILES): Remove config* and libtool. + (SOURCE_FILES): Remove configure.ac. + * callback/vacall_r/Makefile.in (INCLUDES): Look also in '../..'. + (top_builddir): Set to '../..'. + (misc.lo): Update dependency. + (distclean): Don't remove config* and libtool. + (SOURCE_FILES): Remove configure.ac. + * callback/trampoline_r/Makefile.in (INCLUDES): Look also in '../..'. + (top_builddir): Set to '../..'. + (distclean): Don't remove config* and libtool. + (SOURCE_FILES): Remove configure.ac. + * README, */README: Update. + +2017-06-24 Bruno Haible + + trampoline: Build library using libtool. + * trampoline/configure.ac: Invoke FFCALL_COMMON_LIBTOOL. + (CPU_OBJECTS): Now contains .lo file names instead of .o file names. + * trampoline/Makefile.in (LIBTOOL*, top_builddir): New variables. + (*.lo): Targets renamed from *.o. + (libtrampoline.la): Replaces target libtrampoline.a. + Use LIBTOOL* variables as appropriate. + (clean): Remove also *.lo, libtrampoline.*, .libs, _libs. + (distclean): Remove also 'libtool'. + +2017-06-24 Bruno Haible + + trampoline: Generate position-independent code. + * trampoline/Makefile.devel (GCCFLAGS): Add -fPIC. + +2017-06-24 Bruno Haible + + vacall: Explain why not using libtool. + * vacall/README: Add comment about libtool. + +2017-06-24 Bruno Haible + + Fix result of an autoconf test on AIX. + * m4/codeexec.m4 (FFCALL_CODEEXEC): Don't actually run the test on + powerpc64 (AIX and Linux) and ia64 (Linux). + +2017-06-24 Bruno Haible + + build: Avoid testing an undefined variable. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): Before testing + cl_cv_func_mprotect_works, test ac_cv_func_mprotect. + +2017-06-24 Bruno Haible + + build: Add necessary AC_REQUIREs. + * m4/codeexec.m4 (FFCALL_CODEEXEC): Require AC_CANONICAL_HOST and + gl_HOST_CPU_C_ABI. + +2017-06-24 Bruno Haible + + Fix build error on Solaris 11 with Oracle Developer Studio 12.5. + * common/asm-x86_64.sh: Clarify the necessary postprocessing. + * common/asm-i386.sh: Document the necessary postprocessing. + * avcall/Makefile.in (avcall-i386.s): Do more postprocessing. + * vacall/Makefile.in (vacall-i386.s): Likewise. + * callback/vacall_r/Makefile.in (vacall-i386.s): Likewise. + +2017-06-24 Bruno Haible + + Fix compilation error on CentOS 5. + * trampoline/trampoline.c (open_noinherit): New function. + (alloc_trampoline): Use it. + * callback/trampoline_r/trampoline.c: Likewise. + +2017-06-24 Bruno Haible + + Prefer https over http URLs. + * autogen.sh: Access ftp.gnu.org through https. + +2017-06-24 Bruno Haible + + Remove obsolete mention of nonexistent file. + * avcall/README: Don't mention underscore.h. + * vacall/README: Likewise. + +2017-06-24 Bruno Haible + + Remove obsolete protexec.c file. + * trampoline/protexec.c: Remove file. + * trampoline/README: Update. + * callback/trampoline_r/Makefile.maint (COPIED_FILES): Remove + protexec.c. + +2017-06-21 Bruno Haible + + Fix list of distributed files. + * Makefile.in (SOURCE_FILES): Add m4/endianness.m4, common/asm-s390.sh. + +2017-06-19 Bruno Haible + + Fix a misnomer. + * vacall/vacall.h.in: Rename 'regarg' to 'iarg'. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-powerpc.c: Update accordingly. + * vacall/vacall-s390.c: Likewise. + +2017-06-18 Bruno Haible + + s390x: Add support for s390x CPU (64-bit S/390). + * cross-tools/cross.conf: Add configuration for s390x cross tools. + * common/reg-struct-return.txt: Add info about s390x. + * callback/call-used-registers.txt: Likewise. + * common/asm-s390.sh: New file. + * avcall/avcall.h.in: Optionally define __s390x__. Add code for + __s390x__, especially __av_start_struct4, av_float, av_double, + __av_struct. + * avcall/avcall-s390x.c: New file. + * avcall/Makefile.devel (avcall-s390-macro.S): Use asm-s390.sh. + (avcall-s390x-linux.s, avcall-s390x-macro.S): New targets. + * avcall/Makefile.in (avcall-s390x.lo, avcall-s390x.s): New targets. + (clean): Remove avcall-s390x.s. + (SOURCE_FILES): Add avcall-s390x.c, avcall-s390x-linux.s, + avcall-s390x-macro.S. + * vacall/vacall.h.in: Optionally define __s390x__. Add code for + __s390x__, especially __va_start_struct2, __va_arg_adjusted, + va_arg_float, va_arg_double, __va_arg_struct. + * vacall/vacall-s390x.c: New file. + * vacall/Makefile.devel (vacall-s390-macro.S): Use asm-s390.sh. + (vacall-s390x-linux.s, vacall-s390x-macro.S): New targets. + * vacall/Makefile.in (vacall-s390x.o, vacall-s390x.s): New targets. + (clean): Remove vacall-s390x.s. + (SOURCE_FILES): Add vacall-s390x.c, vacall-s390x-linux.s, + vacall-s390x-macro.S. + * callback/vacall_r/Makefile.maint (COPIED_FILES): Add vacall-s390x.c. + * Makefile.in (COPIED_FILES): Add callback/vacall_r/vacall-s390x.c. + * callback/vacall_r/vacall_r.h.in: Optionally define __s390x__. Add code + for __s390x__, especially __va_start_struct2, __va_arg_adjusted, + va_arg_float, va_arg_double, __va_arg_struct. + * callback/vacall_r/Makefile.devel (vacall-s390-macro.S): Use + asm-s390.sh. + (vacall-s390x-linux.s, vacall-s390x-macro.S): New targets. + * callback/vacall_r/Makefile.in (vacall-s390x.lo, vacall-s390x.s): New + targets. + (clean): Remove vacall-s390x.s. + (SOURCE_FILES): Add vacall-s390x.c, vacall-s390x-linux.s, + vacall-s390x-macro.S. + * trampoline/Makefile.devel (proto-s390x.s, tramp-s390x.o): New targets. + * trampoline/proto-s390x.s: New generated file. + * trampoline/tramp-s390x.s: New file. + * trampoline/tramp-s390x.o: New generated file. + * trampoline/trampoline.c: Implement for __s390x__. + * callback/trampoline_r/Makefile.devel (proto-s390x.s, tramp-s390x.o): + New targets. + * callback/trampoline_r/proto64.c: Add support for __s390x__. + * callback/trampoline_r/proto-s390x.s: New generated file. + * callback/trampoline_r/tramp-s390x.s: New file. + * callback/trampoline_r/tramp-s390x.o: New generated file. + * callback/trampoline_r/trampoline.c: Implement for __s390x__. + * callback/trampoline_r/test1.c: Add support for __s390x__. + * PLATFORMS, */PLATFORMS: List the s390x machine. + * NEWS: Mention the new port. + +2017-06-18 Bruno Haible + + Small code style improvements. + * avcall/avcall.h.in [__arm64__]: Define and use __AV_FARG_NUM. + [__s390__, __arm64__] (__av_struct): Avoid a boolean negation. + * vacall/vacall.h.in [__arm64__]: Define and use __VA_IARG_NUM, + __VA_FARG_NUM. + [__x86_64__]: Define and use __VA_IARG_NUM. + * callback/vacall_r/vacall_r.h.in: Likewise. + +2017-06-18 Bruno Haible + + s390: Reorder code. + * avcall/avcall.h.in: Move s390 specific code to the end (after ia64 and + x86_64 specific code). + * vacall/vacall.h.in: Likewise. + * callback/vacall_r/vacall_r.h.in: Likewise. + +2017-06-18 Bruno Haible + + s390: Improve trampolines. + * trampoline/Makefile.devel (proto-s390.s): New target. + (tramp-s390.o): Use cross tools. + * trampoline/proto-s390.s: Regenerated with gcc 3.1. + * trampoline/tramp-s390.s: Rewritten from scratch, to not use %r13. + * trampoline/tramp-s390.o: New generated file. + * trampoline/trampoline.c (alloc_trampoline) [__s390__]: Change the + trampoline to not use %r13. + * callback/trampoline_r/Makefile.devel (proto-s390.s): New target. + (tramp-s390.o): Use cross tools. + * callback/trampoline_r/proto-s390.s: Regenerated with gcc 3.1. + * callback/trampoline_r/tramp-s390.s: Rewritten from scratch. Use 'lm' + instruction. + * callback/trampoline_r/tramp-s390.o: Regenerated. + * callback/trampoline_r/trampoline.c (alloc_trampoline_r) [__s390__]: + Change the trampoline accordingly. + +2017-06-17 Bruno Haible + + arm64: Add support for arm64 CPU (a.k.a. aarch64). + * cross-tools/cross.conf: Add configuration for arm64 cross tools. + * common/reg-struct-return.txt: Add info about arm64. + * callback/call-used-registers.txt: Likewise. + * avcall/avcall.h.in: Add code for __arm64__, especially __av_start1, + av_long, av_ulong, av_ptr, av_float, av_double, __av_struct. + * avcall/avcall-arm64.c: New file. + * avcall/Makefile.devel (avcall-arm64-macro.S): New target. + * avcall/Makefile.in (avcall-arm64.lo, avcall-arm64.s): New targets. + (clean): Remove avcall-arm64.s. + (SOURCE_FILES): Add avcall-arm64.c, avcall-arm64-macro.S. + * vacall/vacall.h.in: Add code for __arm64__, especially + __va_arg_adjusted, va_arg_float, va_arg_double, __va_arg_struct. + * vacall/vacall-arm64.c: New file. + * vacall/Makefile.devel (vacall-arm64-macro.S): New target. + * vacall/Makefile.in (vacall-arm64.o, vacall-arm64.s): New targets. + (clean): Remove vacall-arm64.s. + (SOURCE_FILES): Add vacall-arm64.c, vacall-arm64-macro.S. + * callback/vacall_r/Makefile.maint (COPIED_FILES): Add vacall-arm64.c. + * Makefile.in (COPIED_FILES): Add callback/vacall_r/vacall-arm64.c. + * callback/vacall_r/vacall_r.h.in: Add code for __arm64__, especially + __va_arg_adjusted, va_arg_float, va_arg_double, __va_arg_struct. + * callback/vacall_r/Makefile.devel (vacall-arm64-macro.S): New target. + * callback/vacall_r/Makefile.in (vacall-arm64.lo, vacall-arm64.s): New + targets. + (clean): Remove vacall-arm64.s. + (SOURCE_FILES): Add vacall-arm64.c, vacall-arm64-macro.S. + * trampoline/Makefile.devel (proto-arm64.s, tramp-arm64.o): New targets. + * trampoline/proto-arm64.s: New generated file. + * trampoline/tramp-arm64.s: New file. + * trampoline/tramp-arm64.o: New generated file. + * trampoline/trampoline.c: Implement for __arm64__. + * callback/trampoline_r/Makefile.devel (proto-arm64.s, tramp-arm64.o): + New targets. + * callback/trampoline_r/proto64.c: Add support for __arm64__. + * callback/trampoline_r/proto-arm64.s: New generated file. + * callback/trampoline_r/tramp-arm64.s: New file. + * callback/trampoline_r/tramp-arm64.o: New generated file. + * callback/trampoline_r/trampoline.c: Implement for __arm64__. + * callback/trampoline_r/test1.c: Add support for __arm64__. + * PLATFORMS, */PLATFORMS: List the arm64 machine. + * NEWS: Mention the new port. + +2017-06-16 Bruno Haible + + Remove unused fields from __va_alist. + * vacall/vacall.h.in (__va_alist): Don't include _longlong and + _ulonglong on platforms where they are unused. + * callback/vacall_r/vacall_r.h.in: Likewise. + +2017-06-15 Bruno Haible + + Reduce the amount of cache invalidation to the necessary minimum. + * trampoline/trampoline.c (alloc_trampoline): New macro + TRAMP_CODE_LENGTH. Use it instead of TRAMP_LENGTH for cache + invalidation. + * callback/trampoline_r/trampoline.c (alloc_trampoline_r): Likewise. + +2017-06-10 Bruno Haible + + Make the top-level "./configure --help" output complete. + Reported by Karl Berry in + . + * build-aux/ac-help.sed: New file, from GNU gettext with modifications. + * Makefile.in (SOURCE_FILES): Add it. + * configure.ac: Collect the AC_ARG_* options from the subdirectories, + like in GNU gettext. + * callback/configure.ac: Likewise. + * Makefile.maint (aclocal.m4): Disable esyscmd invocations while running + aclocal. + +2017-06-10 Bruno Haible + + In comments, write 'libffcall' instead of 'ffcall'. + +2017-06-10 Bruno Haible + + Add cache invalidation for 64-bit powerpc. + * trampoline/cache-powerpc64.c: New file. + * trampoline/Makefile.devel (cache-powerpc64-elfv2-linux.s, + cache-powerpc64-elfv2-macro.S): New rules. + * trampoline/configure.ac (CPU_OBJECTS): Augment also for + powerpc64-elfv2 ABI. + * trampoline/Makefile.in (cache-powerpc64-elfv2.o, + cache-powerpc64-elfv2.s): New rules. + (clean): Remove also cache-powerpc64-elfv2.s. + (SOURCE_FILES): Add cache-powerpc64.c, cache-powerpc64-elfv2-linux.s, + cache-powerpc64-elfv2-macro.S. + * trampoline/trampoline.c (__TR_clear_cache): Declare also for + powerpc64-elfv2 ABI. + (alloc_trampoline): Invoke __TR_clear_cache also on powerpc64-elfv2 ABI. + * callback/trampoline_r/cache-powerpc64.c: New file. + * callback/trampoline_r/Makefile.devel (cache-powerpc64-elfv2-linux.s, + cache-powerpc64-elfv2-macro.S): New rules. + * trampoline/configure.ac (CPU_OBJECTS): Augment also for + powerpc64-elfv2 ABI. + * callback/trampoline_r/Makefile.in (cache-powerpc64-elfv2.lo, + cache-powerpc64-elfv2.s): New rules. + (clean): Remove also cache-powerpc64-elfv2.s. + (SOURCE_FILES): Add cache-powerpc64.c, cache-powerpc64-elfv2-linux.s, + cache-powerpc64-elfv2-macro.S. + * callback/trampoline_r/trampoline.c (__TR_clear_cache): Declare also + for powerpc64-elfv2 ABI. + (alloc_trampoline_r): Invoke __TR_clear_cache also on powerpc64-elfv2 + ABI. + +2017-06-10 Bruno Haible + + Fix cache invalidation for 32-bit powerpc. + * trampoline/cache-powerpc.c: Add comment. + * callback/trampoline_r/cache-powerpc.c: New file, based on + trampoline/cache-powerpc.c. + * callback/trampoline_r/Makefile.maint (COPIED_FILES): Remove + cache-powerpc.c. + * Makefile.in (COPIED_FILES): Remove + callback/trampoline_r/cache-powerpc.c. + +2017-06-10 Bruno Haible + + Don't declare the need for an executable stack on Linux and FreeBSD. + * porting-tools: New directory. + * common/asm-alpha.sh: New file. + * common/asm-powerpc.sh: New file. + * common/asm-arm.sh: Remove the GNU-stack note line. + * common/asm-sparc.sh: Likewise. + * common/asm-x86_64.sh: Likewise. + * common/noexecstack.h: New file. + * common/noexecstack-arm.h: New file. + * avcall/Makefile.devel (precompiled): Add avcall-alpha-macro.S, + avcall-powerpc-linux-macro.S, avcall-powerpc-sysv4-macro.S, + avcall-powerpc64-linux.S, avcall-powerpc64-elfv2-linux.S, + avcall-ia64-macro.S, avcall-s390-macro.S. Remove avcall-alpha.s, + avcall-powerpc-linux.s, avcall-powerpc-sysv4.s, + avcall-powerpc64-linux.s, avcall-powerpc64-elfv2-linux.s, avcall-ia64.s, + avcall-s390.s. + (avcall-i386-macro.S, avcall-m68k.mit.S, avcall-m68k.motorola.S, + avcall-sparc-macro.S, avcall-sparc64-macro.S, avcall-hppa-macro.S, + avcall-x86_64-macro.S): Include noexecstack.h. + (avcall-alpha-linux.s): Renamed from avcall-alpha.s. + (avcall-alpha-macro.S): New rule. + (avcall-arm-macro.S, avcall-armhf-macro.S): Include noexecstack-arm.h. + (avcall-powerpc-linux-macro.S): New rule. + (avcall-powerpc-sysv4-macro.S): Replaces rule for + avcall-powerpc-sysv4.s. + (avcall-powerpc64-linux.S): Replaces rule for avcall-powerpc64-linux.s. + (avcall-powerpc64-elfv2-linux.S): Replaces rule for + avcall-powerpc64-elfv2-linux.s. + (avcall-ia64-linux.s): Renamed from avcall-ia64.s. + (avcall-ia64-macro.S): New rule. + (avcall-s390-linux.s): Renamed from avcall-s390.s. + (avcall-s390-macro.S): New rule. + * avcall/Makefile.in (avcall-alpha.s): New rule. + (avcall-alpha.lo): Update. + (avcall-powerpc.s): Use avcall-powerpc-linux-macro.S, + avcall-powerpc-sysv4-macro.S instead of avcall-powerpc-linux.s, + avcall-powerpc-sysv4.s. + (avcall-powerpc64.s): Use avcall-powerpc64-linux.S instead of + avcall-powerpc64-linux.s. + (avcall-powerpc64-elfv2.s): Use avcall-powerpc64-elfv2-linux.S instead + of avcall-powerpc64-elfv2-linux.s. + (avcall-ia64.s): New rule. + (avcall-ia64.lo): Update. + (avcall-s390.s): New rule. + (avcall-s390.lo): Update. + (clean): Remove also avcall-alpha.s, avcall-ia64.s, avcall-s390.s. + (SOURCE_FILES): Update. + * vacall/Makefile.devel (precompiled): Add vacall-alpha-macro.S, + vacall-powerpc-linux-macro.S, vacall-powerpc-sysv4-macro.S, + vacall-powerpc64-linux.S, vacall-powerpc64-elfv2-linux.S, + vacall-ia64-macro.S, vacall-s390-macro.S. Remove vacall-alpha.s, + vacall-powerpc-linux.s, vacall-powerpc-sysv4.s, + vacall-powerpc64-linux.s, vacall-powerpc64-elfv2-linux.s, vacall-ia64.s, + vacall-s390.s. + (vacall-i386-macro.S, vacall-m68k.mit.S, vacall-m68k.motorola.S, + vacall-sparc-macro.S, vacall-sparc64-macro.S, vacall-hppa-macro.S, + vacall-x86_64-macro.S): Include noexecstack.h. + (vacall-alpha-linux.s): Renamed from vacall-alpha.s. + (vacall-alpha-macro.S): New rule. + (vacall-arm-macro.S, vacall-armhf-macro.S): Include noexecstack-arm.h. + (vacall-powerpc-linux-macro.S): New rule. + (vacall-powerpc-sysv4-macro.S): Replaces rule for + vacall-powerpc-sysv4.s. + (vacall-powerpc64-linux.S): Replaces rule for vacall-powerpc64-linux.s. + (vacall-powerpc64-elfv2-linux.S): Replaces rule for + vacall-powerpc64-elfv2-linux.s. + (vacall-ia64-linux.s): Renamed from vacall-ia64.s. + (vacall-ia64-macro.S): New rule. + (vacall-s390-linux.s): Renamed from vacall-s390.s. + (vacall-s390-macro.S): New rule. + * vacall/Makefile.in (vacall-alpha.s): New rule. + (vacall-alpha.o): Update. + (vacall-powerpc.s): Use vacall-powerpc-linux-macro.S, + vacall-powerpc-sysv4-macro.S instead of vacall-powerpc-linux.s, + vacall-powerpc-sysv4.s. + (vacall-powerpc64.s): Use vacall-powerpc64-linux.S instead of + vacall-powerpc64-linux.s. + (vacall-powerpc64-elfv2.s): Use vacall-powerpc64-elfv2-linux.S instead + of vacall-powerpc64-elfv2-linux.s. + (vacall-ia64.s): New rule. + (vacall-ia64.o): Update. + (vacall-s390.s): New rule. + (vacall-s390.o): Update. + (clean): Remove also vacall-alpha.s, vacall-ia64.s, vacall-s390.s. + (SOURCE_FILES): Update. + * callback/vacall_r/Makefile.devel (precompiled): Add + vacall-powerpc64-linux.S, vacall-powerpc64-elfv2-linux.S, + vacall-ia64-macro.S. Remove vacall-powerpc64-linux.s, + vacall-powerpc64-elfv2-linux.s, vacall-ia64.s. + (vacall-i386-macro.S, vacall-m68k.mit.S, vacall-m68k.motorola.S, + vacall-sparc-macro.S, vacall-sparc64-macro.S, vacall-alpha-macro.S, + vacall-hppa-macro.S, vacall-powerpc-linux-macro.S, + vacall-powerpc-sysv4-macro.S, vacall-x86_64-macro.S, + vacall-s390-macro.S): Include noexecstack.h. + (vacall-arm-macro.S, vacall-armhf-macro.S): Include noexecstack-arm.h. + (vacall-powerpc64-linux.S): Replaces rule for vacall-powerpc64-linux.s. + (vacall-powerpc64-elfv2-linux.S): Replaces rule for + vacall-powerpc64-elfv2-linux.s. + (vacall-ia64-linux.s): Renamed from vacall-ia64.s. + (vacall-ia64-macro.S): New rule. + * callback/vacall_r/Makefile.in (vacall-powerpc64.s): Use + vacall-powerpc64-linux.S instead of vacall-powerpc64-linux.s. + (vacall-powerpc64-elfv2.s): Use vacall-powerpc64-elfv2-linux.S instead + of vacall-powerpc64-elfv2-linux.s. + (vacall-ia64.s): New rule. + (vacall-ia64.lo): Update. + (vacall-s390.s): New rule. + (vacall-s390.lo): Update. + (clean): Remove also vacall-ia64.s. + (SOURCE_FILES): Update. + * trampoline/cache-alpha.s: Remove file. + * trampoline/cache-hppa.s: Remove file. + * trampoline/cache-powerpc-macos.s, trampoline/cache-powerpc-sysv4.s: + Remove files. + * trampoline/cache-sparc-macro.S: Remove file. + * trampoline/tramp-hppa-macro.S: Renamed from trampoline/tramp-hppa.s. + Include "noexecstack.h". + * trampoline/tramp-ia64-macro.S: Renamed from trampoline/tramp-ia64.s. + Include "noexecstack.h". + * trampoline/tramp-powerpc64-aix.S: Include "noexecstack.h". + * trampoline/Makefile.devel: Rename GCCFLAGS to OLDGCCFLAGS in old + rules. + (cache-*): Remove old rules. + (precompiled): New target. + (cache-sparc-linux.s, cache-sparc-macro.S, cache-sparc64-linux.s, + cache-sparc64-macro.S, cache-alpha-linux.s, cache-alpha-macro.S, + cache-hppa-linux.s, cache-hppa-macro.S, cache-powerpc-linux.s, + cache-powerpc-linux-macro.S, cache-powerpc-macos.s): New rules. + * trampoline/Makefile.in (tramp-hppa.s): New rule. + (tramp-hppa.o): Update. + (tramp-powerpc64.s: Depend on noexecstack.h. + (tramp-ia64.s): New rule. + (tramp-ia64.o): Update. + (cache-sparc64.s): Update. + (cache-alpha.s): New rule. + (cache-alpha.o): Update. + (cache-hppa.s): New rule. + (cache-hppa.o): Update. + (cache-powerpc.s): New rule. + (cache-powerpc.o): Update. + (clean): Remove also tramp-hppa.s, tramp-ia64.s, cache-alpha.s, + cache-hppa.s, cache-powerpc.s. + (SOURCE_FILES): Update. + * callback/trampoline_r/cache-sparc-macro.S: Remove file. + * callback/trampoline_r/tramp-hppa-macro.S: Renamed from + callback/trampoline_r/tramp-hppa.s. Include "noexecstack.h". + * callback/trampoline_r/tramp-ia64-macro.S: Renamed from + callback/trampoline_r/tramp-ia64.s. Include "noexecstack.h". + * callback/trampoline_r/tramp-powerpc64-aix.S: Include "noexecstack.h". + * callback/trampoline_r/Makefile.maint (COPIED_FILES): Remove + cache-alpha.s, cache-hppa.s, cache-powerpc-macos.s, + cache-powerpc-sysv4.s. + * callback/trampoline_r/Makefile.devel: Rename GCCFLAGS to OLDGCCFLAGS + in old rules. + (cache-*): Remove old rules. + (precompiled): New target. + (cache-sparc-linux.s, cache-sparc-macro.S, cache-sparc64-linux.s, + cache-sparc64-macro.S, cache-alpha-linux.s, cache-alpha-macro.S, + cache-hppa-linux.s, cache-hppa-macro.S, cache-powerpc-linux.s, + cache-powerpc-linux-macro.S, cache-powerpc-macos.s): New rules. + * callback/trampoline_r/Makefile.in (tramp-hppa.s): New rule. + (tramp-hppa.lo): Update. + (tramp-powerpc64.s: Depend on noexecstack.h. + (tramp-ia64.s): New rule. + (tramp-ia64.lo): Update. + (cache-sparc64.s): Update. + (cache-alpha.s): New rule. + (cache-alpha.lo): Update. + (cache-hppa.s): New rule. + (cache-hppa.lo): Update. + (cache-powerpc.s): New rule. + (cache-powerpc.lo): Update. + (clean): Remove also tramp-hppa.s, tramp-ia64.s, cache-alpha.s, + cache-hppa.s, cache-powerpc.s. + (SOURCE_FILES): Update. + * Makefile.devel (precompiled): Recurse also into trampoline and + callback/trampoline_r directories. + * Makefile.in (SOURCE_FILES): Update. + (COPIED_FILES): Remove callback/trampoline_r/cache-alpha.s, + callback/trampoline_r/cache-hppa.s, + callback/trampoline_r/cache-powerpc-macos.s, + callback/trampoline_r/cache-powerpc-sysv4.s. + * NEWS: Mention the change. + +2017-06-10 Bruno Haible + + Simplify Makefile.devel. + * avcall/Makefile.devel (HOST, CPU): Remove unused variables. + * vacall/Makefile.devel (HOST, CPU): Likewise. + * trampoline/Makefile.devel (HOST, CPU): Likewise. + * callback/vacall_r/Makefile.devel (HOST, CPU): Likewise. + * callback/trampoline_r/Makefile.devel (HOST, CPU): Likewise. + +2017-06-10 Bruno Haible + + Make the EXECUTABLE_VIA_MMAP_FILE_SHARED support work on i386. + * trampoline/trampoline.c (alloc_trampoline): New local variable + 'function_x'. Use it instead of 'function' for the computation of the + relative address in the i386 trampoline. + * callback/trampoline_r/trampoline.c (alloc_trampoline_r): Likewise. + +2017-06-04 Bruno Haible + + build: Get rid of autom4te.cache directories. + * Makefile.maint (configure, $(SUBDIRS_CONFIGURE), $(ALL_CONFIG_H_IN)): + Remove autom4te.cache subdirectory. + +2017-06-04 Bruno Haible + + Change the license from GPLv2 to GPLv2+. + * **/configure.ac, **/*.3, **/*.html, **/minitests.c, + callback/MIGRATION, common/asm-*: Add copyright notice. + * m4/*.m4: Use GPLv2+ with exception notice. + * Everywhere else: Change GPLv2 copyright notice to GPLv2+ copyright + notice. Update copyright years. + +2017-06-03 Bruno Haible + + Make the cross-build.sh script work with argument 'all'. + * cross-tools/cross-build.sh: Fix typo. + +2017-06-03 Bruno Haible + + Improve support for SELinux. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): On SELinux systems, define + HAVE_MPROTECT_AFTER_MALLOC_CAN_EXEC to -1. + * trampoline/trampoline.c: When HAVE_MPROTECT_AFTER_MALLOC_CAN_EXEC is + -1, assume the worst and don't set EXECUTABLE_VIA_MALLOC_THEN_MPROTECT. + * callback/trampoline_r/trampoline.c: Likewise. + +2017-06-03 Bruno Haible + + Improve support for SELinux. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): On SELinux systems, define + HAVE_MPROTECT_AFTER_MMAP_CAN_EXEC to -1. + * trampoline/trampoline.c: When HAVE_MPROTECT_AFTER_MMAP_CAN_EXEC is -1, + assume the worst and don't set EXECUTABLE_VIA_MMAP_THEN_MPROTECT. + * callback/trampoline_r/trampoline.c: Likewise. + +2017-06-03 Bruno Haible + + Indent the *.m4 files. + * m4/as-underscore.m4: Use reasonable indentation. + * m4/cc-gcc.m4: Likewise. + * m4/codeexec.m4: Likewise. + * m4/endianness.m4: Likewise. + * m4/general.m4: Likewise. + * m4/getpagesize.m4: Likewise. + * m4/ireg.m4: Likewise. + * m4/ln.m4: Likewise. + * m4/mach-vm.m4: Likewise. + * m4/mmap.m4: Likewise. + * m4/mprotect.m4: Likewise. + * m4/pccstruct.m4: Likewise. + * m4/shm.m4: Likewise. + * m4/smallstruct.m4: Likewise. + * m4/proto.m4: Likewise. + (CL_PROTO_TRY, CL_PROTO_CONST, CL_PROTO_MISSING, CONST_VARIANTS, + SIZE_VARIANTS): Remove macros. + +2017-02-26 Bruno Haible + + Document more clearly the maintainer prerequisites. + * Makefile.in (ACLOCAL, AUTOCONF, AUTOHEADER): Add comments. + * README-hacking: Likewise. + Reported by Don Cohen in + + and Sam Steingold . + +2017-02-26 Bruno Haible + + Document the support for GNU Hurd. + * PLATFORMS, */PLATFORMS: List i686-unknown-gnu0.9 (gcc). + +2017-02-19 Bruno Haible + + configuration: Avoid running an unneeded test. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): Require FFCALL_CODEEXEC. Do + nothing if its result is that malloc()ed memory is already executable. + +2017-02-19 Bruno Haible + + Remove useless double-inclusion guard on .c files. + * avcall/tests.c: Remove double-inclusion guard. + * avcall/avcall-*.c: Likewise. Fix comment. + +2017-02-19 Bruno Haible + + powerpc: Fix build failure on MacOS X (regression from 2017-01-29). + 1. + * cross-tools/cross.conf: For powerpc-darwin, go back to gcc 3.3.6. + * cross-tools/patches/gcc-3.3.6.patch: New file. + * avcall/Makefile.devel (avcall-powerpc-macos.s): Use gcc 3.3.6. + * vacall/Makefile.devel (vacall-powerpc-macos.s): Use gcc 3.3.6. + * callback/vacall_r/Makefile.devel (vacall-powerpc-macos.s): Use gcc + 3.3.6. + 2. + * avcall/Makefile.in (avcall-powerpc.s): For MacOS, remove the .machine + pseudo-op. + * vacall/Makefile.in (vacall-powerpc.s): Likewise. + * callback/vacall_r/Makefile.in (vacall-powerpc.s): Likewise. + 3. + * PLATFORMS, */PLATFORMS: List powerpc-apple-darwin9.8.0 (gcc). + * NEWS: Mention the status of MacOS X / powerpc. + +2017-02-12 Bruno Haible + + Make the cross-build.sh script work on an x86_64-linux host. + * cross-tools/cross-build.sh: Remove the binutils-*/gprof directory. + * cross-tools/patches/binutils-*.patch: Backport a buffer overrun bug + fix from binutils-2.17. + +2017-02-12 Bruno Haible + + Make the cross-build.sh script more usable. + * README-hacking: Add more text. + * cross-tools/cross-build.sh: Don't assume the script is run from the + current directory. Accept a relative HOST_CROSS_DIR. + Reported by Don Cohen . + +2017-02-11 Bruno Haible + + Update documentation. + * NEWS: List the progress since version 1.12. + +2017-02-11 Bruno Haible + + powerpc: Add support for OpenBSD. + * avcall/Makefile.in (avcall-powerpc.s): Treat OpenBSD like NetBSD. + * vacall/Makefile.in (vacall-powerpc.s): Likewise. + * callback/vacall_r/Makefile.in (vacall-powerpc.s): Likewise. + +2017-02-11 Bruno Haible + + mips64: Add support for OpenBSD. + On OpenBSD, cacheflush() is declared in , see + openbsd-src/blob/master/lib/libarch/mips64/cacheflush.3 . + * trampoline/trampoline.c [__OpenBSD__]: Include . + * callback/trampoline_r/trampoline.c: Likewise. + +2017-02-11 Bruno Haible + + Support the LDFLAGS configure variable. + * avcall/Makefile.in (LDFLAGS): New variable. + Use it in all linking commands. + * vacall/Makefile.in (LDFLAGS): New variable. + Use it in all linking commands. + * trampoline/Makefile.in (LDFLAGS): New variable. + Use it in all linking commands. + * callback/Makefile.in (LDFLAGS): New variable. + Use it in all linking commands. + * callback/vacall_r/Makefile.in (LDFLAGS): New variable. + Use it in all linking commands. + * callback/trampoline_r/Makefile.in (LDFLAGS): New variable. + Use it in all linking commands. + +2017-02-11 Bruno Haible + + Fix build failure on Mac OS X 10.5 / x86_64. Regression from today. + * common/asm-x86_64.sh: Recognize symbol in symbol(%rip) syntax. + * vacall/Makefile.devel (vacall-x86_64-macro.S): Remove extra + postprocessing, now done by common/asm-x86_64.sh. + +2017-02-11 Bruno Haible + + Fix build failure on Mac OS X 10.5 / i386. Regression from today. + * common/asm-i386.sh: Simplify the function referencing code, originally + for PIC on ELF platforms, so that it works also on non-ELF platforms. + +2017-02-11 Bruno Haible + + x86_64: Add support for the x32 ABI on Linux. + * avcall/avcall.h.in: Optionally define __x86_64_x32__. + (__avword, __av_longlong): Define differently for __x86_64_x32__. + * avcall/Makefile.devel (avcall-x86_64-x32-linux.s): New target. + * avcall/Makefile.in (avcall-x86_64-x32.lo, avcall-x86_64-x32.s): New + targets. + (clean): Remove also avcall-x86_64-x32.s. + (SOURCE_FILES): Add avcall-x86_64-x32-linux.s. + * vacall/vacall-x86_64.c: Don't declare a register variable in %rbp for + GCC >= 4.9. + For __x86_64_x32__, treat return of 'long long' and 'unsigned long long' + differently. + * vacall/vacall.h.in: Optionally define __x86_64_x32__. + (__vaword, va_arg_longlong, va_return_longlong): Define differently for + __x86_64_x32__. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/Makefile.devel (vacall-x86_64-x32-linux.s): New target. + * vacall/Makefile.in (vacall-x86_64-x32.o, vacall-x86_64-x32.s): New + targets. + (clean): Remove also vacall-x86_64-x32.s. + (SOURCE_FILES): Add vacall-x86_64-x32-linux.s. + * trampoline/Makefile.devel (proto-x86_64-x32.s, tramp-x86_64-x32.o): + New targets. + * trampoline/proto-x86_64-x32.s: New generated file. + * trampoline/tramp-x86_64-x32.s: New file. + * trampoline/tramp-x86_64-x32.o: New generated file. + * trampoline/trampoline.c: Add code for __x86_64_x32__. + * callback/vacall_r/Makefile.devel (vacall-x86_64-x32-linux.s): New + target. + * callback/vacall_r/Makefile.in (vacall-x86_64-x32.lo, + vacall-x86_64-x32.s): New targets. + (clean): Remove also vacall-x86_64-x32.s. + (SOURCE_FILES): Add vacall-x86_64-x32-linux.s. + * callback/trampoline_r/Makefile.devel (proto-x86_64-x32.s, + tramp-x86_64-x32.o): New targets. + * callback/trampoline_r/proto.c: Specify env register for + __x86_64_x32__. + * callback/trampoline_r/proto-x86_64-x32.s: New generated file. + * callback/trampoline_r/tramp-x86_64-x32.s: New file. + * callback/trampoline_r/tramp-x86_64-x32.o: New generated file. + * callback/trampoline_r/trampoline.c: Add code for __x86_64_x32__. + * PLATFORMS, */PLATFORMS: List x86_64-unknown-linux (gcc -mx32). + +2017-02-11 Bruno Haible + + Simplify platform defines. Reverts commit from 2010-07-20. + * trampoline/trampoline.h.in: Remove CPU symbol definitions. + * callback/trampoline_r/trampoline_r.h.in: Likewise. + +2017-02-11 Bruno Haible + + powerpc64: Add support for the ELFv2 ABI on Linux. + * avcall/avcall-powerpc64.c: Handle small struct return in registers + when __AV_REGISTER_STRUCT_RETURN is set. + * avcall/avcall.h.in: Optionally define __powerpc64_elfv2__. + (__AV_REGISTER_STRUCT_RETURN): Define also for __powerpc64__. + (__av_reg_struct_return, __av_start_struct3): Define differently for + __powerpc64_elfv2__. + (av_float) [__powerpc64__]: Define in a simplified way if + __AV_AIXCC_FLOAT_ARGS cannot be set. + (__av_struct): Define differently for little-endian __powerpc64__. + * avcall/Makefile.devel (avcall-powerpc64-elfv2-linux.s): New target. + * avcall/Makefile.in (avcall-powerpc64-elfv2.lo, + avcall-powerpc64-elfv2.s): New targets. + (clean): Remove also avcall-powerpc64-elfv2.s. + (SOURCE_FILES): Add avcall-powerpc64-elfv2-linux.s. + * vacall/vacall-powerpc64.c: Handle small struct return in registers + when __VA_REGISTER_STRUCT_RETURN is set. + * vacall/vacall.h.in: Optionally define __powerpc64_elfv2__. + (__VA_REGISTER_STRUCT_RETURN): Define also for __powerpc64__. + (__va_reg_struct_return, __va_start_struct1): Define differently for + __powerpc64_elfv2__. + (__va_arg_adjusted): Define differently for little-endian __powerpc64__. + (va_arg_float) [__powerpc64__]: Define in a simplified way if + __VA_AIXCC_FLOAT_ARGS cannot be set. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/Makefile.devel (vacall-powerpc64-elfv2-linux.s): New target. + * vacall/Makefile.in (vacall-powerpc64-elfv2.o, + vacall-powerpc64-elfv2.s): New targets. + (clean): Remove also vacall-powerpc64-elfv2.s. + (SOURCE_FILES): Add vacall-powerpc64-elfv2-linux.s. + * trampoline/Makefile.devel (proto-powerpc64-elfv2.s, + tramp-powerpc64-elfv2.o): New targets. + * trampoline/proto-powerpc64elfv2.s: New generated file. + * trampoline/tramp-powerpc64elfv2.s: New file. + * trampoline/tramp-powerpc64elfv2.o: New generated file. + * trampoline/trampoline.c: Add code for __powerpc64_elfv2__. + * callback/vacall_r/Makefile.devel (vacall-powerpc64-elfv2-linux.s): + New target. + * callback/vacall_r/Makefile.in (vacall-powerpc64-elfv2.lo, + vacall-powerpc64-elfv2.s): New targets. + (clean): Remove also vacall-powerpc64-elfv2.s. + (SOURCE_FILES): Add vacall-powerpc64-elfv2-linux.s. + * callback/trampoline_r/Makefile.devel (proto-powerpc64-elfv2.s, + tramp-powerpc64-elfv2.o): New targets. + * callback/trampoline_r/proto-powerpc64elfv2.s: New generated file. + * callback/trampoline_r/tramp-powerpc64elfv2.s: New file. + * callback/trampoline_r/tramp-powerpc64elfv2.o: New generated file. + * callback/trampoline_r/trampoline.c: Add code for __powerpc64_elfv2__. + * PLATFORMS, */PLATFORMS: List powerpc64le-unknown-linux (gcc). + +2017-02-11 Bruno Haible + + powerpc64: Add support for AIX in a 64-bit build, with xlc. + * avcall/avcall.h.in (__AV_AIXCC_FLOAT_ARGS, __AV_FLOAT_ARGS): New enum + values. + (__AV_START_FLAGS): Include __AV_FLOAT_ARGS. + (av_float) [__powerpc64__]: Pick word according to whether + __AV_AIXCC_FLOAT_ARGS is set. + * vacall/vacall.h.in (__VA_AIXCC_FLOAT_ARGS, __VA_FLOAT_ARGS): New enum + values. + (__VA_START_FLAGS): Include __VA_FLOAT_ARGS. + (va_arg_float) [__powerpc64__]: Pick word according to whether + __VA_AIXCC_FLOAT_ARGS is set. + * callback/vacall_r/vacall_r.h.in: Likewise. + * PLATFORMS, */PLATFORMS: List powerpc-ibm-aix7.1.3.0 (xlc -q64). + +2017-02-11 Bruno Haible + + powerpc64: Add support for AIX in a 64-bit build, with gcc. + * avcall/avcall.h.in (__AV_AIXCC_STRUCT_ARGS): Define also on + __powerpc64__. + (__AV_STRUCT_ARGS): Set to __AV_AIXCC_STRUCT_ARGS on __powerpc64__ with + AIX. + (__av_struct): Define for __powerpc64__ like for __powerpc__. + * vacall/vacall.h.in (__VA_AIXCC_STRUCT_ARGS): Define also on + __powerpc64__. + (__VA_STRUCT_ARGS): Set to __VA_AIXCC_STRUCT_ARGS on __powerpc64__ with + AIX. + (__va_arg_struct): Define for __powerpc64__ with AIX like for + __powerpc__ with AIX. + * callback/vacall_r/vacall_r.h.in: Likewise. + * PLATFORMS, */PLATFORMS: List powerpc-ibm-aix7.1.3.0 (gcc -maix64). + +2017-02-11 Bruno Haible + + powerpc64: Add support for AIX in a 64-bit build, part 1. + * avcall/Makefile.devel (avcall-powerpc64-aix.s, + avcall-powerpc64-linux.s): New targets. + (avcall-powerpc64.s): Remove target. + * avcall/Makefile.in (avcall-powerpc64.s): New target. + (avcall-powerpc64.lo): Update. + (clean): Remove also avcall-powerpc64.s. + (SOURCE_FILES): Add avcall-powerpc64-aix.s, avcall-powerpc64-linux.s. + Remove avcall-powerpc64.s. + * vacall/Makefile.devel (vacall-powerpc64-aix.s, + vacall-powerpc64-linux.s): New targets. + (vacall-powerpc64.s): Remove target. + * vacall/Makefile.in (vacall-powerpc64.s): New target. + (vacall-powerpc64.o): Update. + (clean): Remove also vacall-powerpc64.s. + (SOURCE_FILES): Add vacall-powerpc64-aix.s, vacall-powerpc64-linux.s. + Remove vacall-powerpc64.s. + * callback/vacall_r/Makefile.devel (vacall-powerpc64-aix.s, + vacall-powerpc64-linux.s): New targets. + (vacall-powerpc64.s): Remove target. + * callback/vacall_r/Makefile.in (vacall-powerpc64.s): New target. + (vacall-powerpc64.lo): Update. + (clean): Remove also vacall-powerpc64.s. + (SOURCE_FILES): Add vacall-powerpc64-aix.s, vacall-powerpc64-linux.s. + Remove vacall-powerpc64.s. + +2017-02-11 Bruno Haible + + powerpc64: Update Makefile.devel rules. + * trampoline/Makefile.devel (CROSS_TOOL): New variable. + (proto-powerpc64-aix.s): Update rule. + * callback/trampoline_r/Makefile.devel (proto-powerpc64-aix.s): Update + rule. + +2017-02-11 Bruno Haible + + hppa: Fix bug with structure return for sizes 5, 6, 7. + * avcall/avcall-hppa.c: For structure return for sizes > 4, get 4 bytes + from iret2. + * vacall/vacall-hppa.c: For structure return for sizes > 4, put 4 bytes + into iret2. + +2017-02-11 Bruno Haible + + x86_64: Fix bug with structure return for sizes < 16, != 1, 2, 4, 8. + * avcall/avcall-x86_64.c: Treat structure returns for all sizes <= 16 + like those with sizes 1, 2, 4, 8, 16. + +2017-02-11 Bruno Haible + + Add some dedicated small structure return tests. + * avcall/tests.c (Size1, Size2, Size3, Size4, Size7, Size8, Size12, + Size15, Size16): New types. + (S1_v, S2_v, S3_v, S4_v, S7_v, S8_v, S12_v, S15_v, S15_v): New tests. + * vacall/tests.c: Likewise. + * callback/tests.c: Likewise. + +2017-02-11 Bruno Haible + + Remove outdated no-op definition. + * vacall/vacall.h.in (__VA_ANSI_FLOAT_ARGS): Remove enum value. + +2017-02-11 Bruno Haible + + powerpc: Don't special-case NetBSD. + * vacall/vacall-powerpc.c: Remove special case of NetBSD. + * callback/vacall_r/Makefile.devel (vacall-powerpc-netbsd-macro.S): + Remove target. + * callback/vacall_r/vacall-powerpc-netbsd.s: Remove file. + * callback/vacall_r/vacall-powerpc-netbsd-macro.S: Remove file. + * callback/vacall_r/Makefile.in (vacall-powerpc.s): Use + vacall-powerpc-linux-macro.S instead of vacall-powerpc-netbsd-macro.S. + (SOURCE_FILES): Remove vacall-powerpc-netbsd.s, + vacall-powerpc-netbsd-macro.S. + * callback/trampoline_r/proto.c: Remove special case of powerpc/NetBSD. + * callback/trampoline_r/trampoline.c: Remove special case of + powerpc/NetBSD. + * callback/trampoline_r/test1.c: Likewise. + +2017-02-11 Bruno Haible + + m68k: Don't special-case NetBSD. + * callback/call-used-registers.txt: Add comment about NetBSD. + * vacall/vacall-m68k.c: Remove special case of NetBSD. + * callback/vacall_r/Makefile.devel (vacall-m68k-netbsd-macro.S): Remove + target. + * callback/vacall_r/Makefile.in (vacall-m68k.s): Always use + vacall-m68k.mit.S. + (SOURCE_FILES): Remove vacall-m68k-netbsd-macro.S. + * callback/trampoline_r/proto.c: Remove special case of m68k/NetBSD. + * callback/trampoline_r/proto-m68k-netbsd.s: Remove file. + * callback/trampoline_r/tramp-m68k-netbsd.s: Remove file. + * callback/trampoline_r/tramp-m68k-netbsd.o: Remove file. + * callback/trampoline_r/Makefile.devel (proto-m68k-netbsd.s, + tramp-m68k-netbsd.o): Remove targets. + * callback/trampoline_r/trampoline.c: Remove special case of + m68k/NetBSD. + * callback/trampoline_r/test1.c: Likewise. + +2017-02-11 Bruno Haible + + Revert BINFMT_ELF hack. + * callback/elf-hack.txt: Explain the new workaround. + * callback/vacall_r/Makefile.devel (vacall-i386-macro.S, + vacall-m68k.mit.S, vacall-m68k.motorola.S, vacall-m68k-netbsd-macro.S, + vacall-mipseb-macro.S, vacall-mipsel-macro.S, vacall-mipsn32eb-macro.S, + vacall-mipsn32el-macro.S, vacall-mips64eb-macro.S, + vacall-mips64el-macro.S, vacall-alpha-macro.S, + vacall-powerpc-linux-macro.S, vacall-powerpc-netbsd-macro.S, + vacall-powerpc-sysv4-macro.S, vacall-x86_64-macro.S, + vacall-s390-macro.S): Don't postprocess through elfhack-*.sed. + * callback/vacall_r/elfhack-alpha.S: Remove file. + * callback/vacall_r/elfhack-alpha.sed: Remove file. + * callback/vacall_r/elfhack-i386.S: Remove file. + * callback/vacall_r/elfhack-i386.sed: Remove file. + * callback/vacall_r/elfhack-m68k.S: Remove file. + * callback/vacall_r/elfhack-m68k.sed: Remove file. + * callback/vacall_r/elfhack-mips.S: Remove file. + * callback/vacall_r/elfhack-mips.sed: Remove file. + * callback/vacall_r/elfhack-mips64.S: Remove file. + * callback/vacall_r/elfhack-mips64.sed: Remove file. + * callback/vacall_r/elfhack-powerpc.S: Remove file. + * callback/vacall_r/elfhack-powerpc.sed: Remove file. + * callback/vacall_r/elfhack-s390.S: Remove file. + * callback/vacall_r/elfhack-s390.sed: Remove file. + * callback/vacall_r/elfhack-x86_64.S: Remove file. + * callback/vacall_r/elfhack-x86_64.sed: Remove file. + * callback/vacall_r/Makefile.in (ASPFLAGS): Don't set BINFMT_ELF. + (SOURCE_FILES): Remove elhack-*.S and elfhack-*.sed. + * callback/vacall_r/configure.ac: Don't invoke FFCALL_BINFMT_ELF. + * callback/trampoline_r/trampoline.c: Remove code for BINFMT_ELF. + * callback/trampoline_r/tramp-alpha.s: Remove trampelf. + * callback/trampoline_r/tramp-alpha.o: Regenerated. + * callback/trampoline_r/tramp-i386.s: Remove trampelf. + * callback/trampoline_r/tramp-i386.o: Regenerated. + * callback/trampoline_r/tramp-m68k-netbsd.s: Remove trampelf. + * callback/trampoline_r/tramp-m68k-netbsd.o: Regenerated. + * callback/trampoline_r/tramp-m68k.s: Remove trampelf. + * callback/trampoline_r/tramp-m68k.o: Regenerated. + * callback/trampoline_r/tramp-mips.s: Remove trampelf. + * callback/trampoline_r/tramp-mips.o: Regenerated. + * callback/trampoline_r/tramp-mips64.s: Remove trampelf. + * callback/trampoline_r/tramp-mips64.o: Regenerated. + * callback/trampoline_r/tramp-powerpc-sysv4.s: Remove trampelf. + * callback/trampoline_r/tramp-powerpc-sysv4.o: Regenerated. + * callback/trampoline_r/tramp-s390.s: Remove trampelf. + * callback/trampoline_r/tramp-s390.o: Regenerated. + * callback/trampoline_r/tramp-x86_64.s: Remove trampelf. + * callback/trampoline_r/tramp-x86_64.o: Regenerated. + * callback/trampoline_r/test1.c: Reenable on ELF platforms. + * callback/trampoline_r/configure.ac: Don't invoke FFCALL_BINFMT_ELF. + * callback/configure.ac: Don't invoke FFCALL_BINFMT_ELF_OPTION. + * configure.ac: Don't invoke FFCALL_BINFMT_ELF_OPTION. + * m4/binfmt-elf.m4: Remove file. + * Makefile.in (SOURCE_FILES): Remove it. + * README: Update regarding the ELF problem. + +2017-02-11 Bruno Haible + + Access __vacall_r through an indirection, except on SPARC. + * callback/vacall_r/vacall_r.h.in (__vacall_r_t): New type. + (get__vacall_r): New declaration. + (__vacall_r): Remove declaration. + * vacall/vacall-alpha.c [REENTRANT]: Make __vacall_r static. + (get__vacall_r): New function. + * vacall/vacall-arm.c: Likewise. + * vacall/vacall-armhf.c: Likewise. + * vacall/vacall-hppa.c: Likewise. + * vacall/vacall-i386.c: Likewise. + * vacall/vacall-ia64.c: Likewise. + * vacall/vacall-m68k.c: Likewise. + * vacall/vacall-mips.c: Likewise. + * vacall/vacall-mipsn32.c: Likewise. + * vacall/vacall-mips64.c: Likewise. + * vacall/vacall-powerpc.c: Likewise. + * vacall/vacall-powerpc64.c: Likewise. + * vacall/vacall-s390.c: Likewise. + * vacall/vacall-x86_64.c: Likewise. + * callback/vacall_r/vacall-powerpc-netbsd-macro.S: Update accordingly. + * callback/vacall_r/Makefile.devel (vacall-mipseb-linux.s, + vacall-mipsel-linux.s): Use option -mno-explicit-relocs. Needed for + IRIX. + * callback/vacall_r/Makefile.in (vacall-i386.s): Remove space after '@'. + Needed on Solaris/x86. + * callback/callback.h.in (alloc_callback, is_callback): Use + get__vacall_r(). + +2017-01-29 Bruno Haible + + s390: Regenerate .s and .S files with known compilers. + * avcall/avcall-s390.c: Fix include statement. + * avcall/Makefile.devel (avcall-s390.s): New target. + * vacall/Makefile.devel (vacall-s390.s): New target. + * callback/vacall_r/Makefile.devel (vacall-s390-linux.s): New target. + * avcall/Makefile.in: Move avcall-s390.lo target. + * vacall/Makefile.in: Move vacall-s390.o target. + * avcall/avcall-s390.s: Remove from version control. + * vacall/vacall-s390.s: Likewise. + * callback/vacall_r/vacall-s390-linux.s: Likewise. + * callback/vacall_r/vacall-s390-macro.S: Likewise. + +2017-01-29 Bruno Haible + + x86_64: Regenerate .s and .S files with known compilers. + * common/asm-x86_64.h (P2ALIGN): New macro. + (ALIGN): Remove macro. + * common/asm-x86_64.sh: Rewritten to consume ELF input. Produce L, + P2ALIGN macros. + * avcall/avcall-x86_64.c: Use __builtin_alloca instead of hacking on the + 'sp' register. + * avcall/Makefile.devel (avcall-x86_64-linux.s): Rewritten. + * vacall/Makefile.devel (vacall-x86_64-linux.s): Rewritten. + * callback/vacall_r/Makefile.devel (vacall-x86_64-linux.s): Rewritten. + * avcall/avcall-x86_64-linux.s: Remove from version control. + * avcall/avcall-x86_64-macro.S: Likewise. + * vacall/vacall-x86_64-linux.s: Likewise. + * vacall/vacall-x86_64-macro.S: Likewise. + * callback/vacall_r/vacall-x86_64-linux.s: Likewise. + * callback/vacall_r/vacall-x86_64-macro.S: Likewise. + +2017-01-29 Bruno Haible + + ia64: Regenerate .s and .S files with known compilers. + * avcall/Makefile.devel (avcall-ia64.s): Rewritten. + * vacall/Makefile.devel (vacall-ia64.s): Rewritten. + * callback/vacall_r/Makefile.devel (vacall-ia64.s): Rewritten. + * vacall/vacall-ia64.c: Put all local variables in a struct. + * avcall/avcall-ia64.s: Remove from version control. + * vacall/vacall-ia64.s: Likewise. + * callback/vacall_r/vacall-ia64.s: Likewise. + +2017-01-29 Bruno Haible + + powerpc, powerpc64: Regenerate .s and .S files with known compilers. + * avcall/avcall-powerpc64.c: Use __builtin_alloca. Use an 'if' cascade + instead of gotos. + * avcall/Makefile.devel (avcall-powerpc-linux.s): New target. + (avcall-powerpc-aix.s, avcall-powerpc-sysv4.s, avcall-powerpc-macos.s, + avcall-powerpc64.s): Rewritten. + * vacall/Makefile.devel (vacall-powerpc-linux.s): New target. + (vacall-powerpc-aix.s, vacall-powerpc-sysv4.s, vacall-powerpc-macos.s, + vacall-powerpc64.s): Rewritten. + * callback/vacall_r/Makefile.devel (vacall-powerpc-linux.s): New target. + (vacall-powerpc-aix.s, vacall-powerpc-sysv4-macro.S, + vacall-powerpc-macos.s, vacall-powerpc64.s): Rewritten. + * avcall/avcall-powerpc-aix.s: Remove from version control. + * avcall/avcall-powerpc-linux.s: Likewise. + * avcall/avcall-powerpc-sysv4.s: Likewise. + * avcall/avcall-powerpc-macos.s: Likewise. + * avcall/avcall-powerpc64.s: Likewise. + * vacall/vacall-powerpc-aix.s: Likewise. + * vacall/vacall-powerpc-linux.s: Likewise. + * vacall/vacall-powerpc-sysv4.s: Likewise. + * vacall/vacall-powerpc-macos.s: Likewise. + * vacall/vacall-powerpc64.s: Likewise. + * callback/vacall_r/vacall-powerpc-aix.s: Likewise. + * callback/vacall_r/vacall-powerpc-linux.s: Likewise. + * callback/vacall_r/vacall-powerpc-linux-macro.S: Likewise. + * callback/vacall_r/vacall-powerpc-sysv4-macro.S: Likewise. + * callback/vacall_r/vacall-powerpc-macos.s: Likewise. + * callback/vacall_r/vacall-powerpc64.s: Likewise. + +2017-02-11 Bruno Haible + + armhf: Add support for arm with -mfloat-abi=hard. + * avcall/avcall.h.in: Add code for __armhf__, especially __av_start1, + __av_start_struct4, av_long, av_ulong, av_ptr, __av_longlong, av_float, + av_double, __av_struct. + * avcall/avcall-armhf.c: New file. + * avcall/Makefile.devel (avcall-armhf-macro.S): New target. + * avcall/Makefile.in (avcall-armhf.lo, avcall-armhf.s): New targets. + (clean): Remove avcall-armhf.s. + (SOURCE_FILES): Add avcall-armhf.c, avcall-armhf-macro.S. + * vacall/vacall.h.in: Add code for __armhf__, especially va_arg_float, + va_arg_double. + * vacall/vacall-armhf.c: New file. + * vacall/Makefile.devel (vacall-armhf-macro.S): New target. + * vacall/Makefile.in (vacall-armhf.o, vacall-armhf.s): New targets. + (clean): Remove vacall-armhf.s. + (SOURCE_FILES): Add vacall-armhf.c, vacall-armhf-macro.S. + * callback/vacall_r/Makefile.maint (COPIED_FILES): Add vacall-armhf.c. + * Makefile.in (COPIED_FILES): Add callback/vacall_r/vacall-armhf.c. + * callback/vacall_r/vacall_r.h.in: Add code for __armhf__, especially + va_arg_float, va_arg_double. + * callback/vacall_r/Makefile.devel (vacall-armhf-macro.S): New target. + * callback/vacall_r/Makefile.in (vacall-armhf.lo, vacall-armhf.s): New + targets. + (clean): Remove vacall-armhf.s. + (SOURCE_FILES): Add vacall-armhf.c, vacall-armhf-macro.S. + * trampoline/trampoline.h.in: Optionally define __armhf__. + * trampoline/trampoline.c: Treat __armhf__ like __arm__. + * callback/trampoline_r/trampoline_r.h.in: Optionally define __armhf__. + * callback/trampoline_r/trampoline.c: Treat __armhf__ like __arm__. + * PLATFORMS, */PLATFORMS: List the armv7 machine with 'hard' floats. + +2017-02-11 Bruno Haible + + arm: Make callback work, for -mfloat-abi=soft. + * callback/trampoline_r/Makefile.devel (CROSS_TOOL): New variable. + (proto-arm.s): Use known cross-compiler and -fno-omit-frame-pointer. + (tramp-arm.o): Use known cross-assembler. + * callback/trampoline_r/proto-arm.s: Regenerated. + * callback/trampoline_r/tramp-arm.s: Try three different trampolines. + The third one, trampcallwithframe, works. + * callback/trampoline_r/tramp-arm.o: Regenerated. + * callback/call-used-registers.txt: Add comments about arm. + * callback/trampoline_r/trampoline.c: For arm, use a trampoline with + standard prologue with struct args and standard epilogue. + * callback/trampoline_r/test1.c: On arm platforms, don't check the + passing of env. + * vacall/vacall-arm.c [REENTRANT]: Expect to find env on the stack, not + in r12. + * callback/vacall_r/Makefile.devel (vacall-arm-macro.S): Don't + postprocess through elfhack-arm.sed. + * callback/vacall_r/elfhack-arm.S: Remove file. + * callback/vacall_r/elfhack-arm.sed: Remove file. + * callback/vacall_r/Makefile.in (SOURCE_FILES): Remove elfhack-arm.S, + elfhack-arm.sed. + * PLATFORMS: List the arm5 machine with 'soft' floats. + * callback/PLATFORMS: Likewise. + +2017-01-31 Bruno Haible + + arm: Make vacall work, for -mfloat-abi=soft. + * vacall/vacall.h.in [__arm__] (__va_alist): Enable the filler word. + * callback/vacall_r/vacall_r.h.in: Likewise. + * vacall/vacall-arm.c: Use a split struct to convince GCC to allocate + room on the stack for the first 4 general-purpose argument words. + * vacall/PLATFORMS: List the arm5 machine with 'soft' floats. + * avcall/PLATFORMS: Likewise. + +2017-01-29 Bruno Haible + + arm: Fulfil the constraint that the sp register must be 8-bytes-aligned. + * avcall/avcall-arm.c: Enforce 8-bytes-alignment of the stack pointer. + * vacall/vacall-arm.c: Likewise. + + arm: Remove support for old arm platforms without the ARM EABI. + * avcall/avcall.h.in: Revisit all __arm__ and __ARMEL__ conditionals. + * vacall/vacall.h.in: Likewise. + * callback/vacall_r/vacall_r.h.in: Likewise. + * avcall/avcall-arm.c: Renamed from avcall/avcall-armel.c. + * avcall/Makefile.devel (avcall-arm-macro.S): Make sure it's usable for + both endiannesses. + (avcall-armel.s): Remove target. + * avcall/Makefile.in (avcall-armel.lo): Remove target. + (SOURCE_FILES): Remove avcall-armel.[cs]. + * vacall/vacall-arm.c: Renamed from vacall/vacall-armel.c. + * vacall/Makefile.devel (vacall-arm-macro.S): Make sure it's usable for + both endiannesses. + (vacall-armel.s): Remove target. + * vacall/Makefile.in (vacall-armel.o): Remove target. + (SOURCE_FILES): Remove vacall-armel.[cs]. + * Makefile.in (COPIED_FILES): Remove callback/vacall_r/vacall-armel.c. + * callback/vacall_r/Makefile.devel (vacall-arm-macro.S): Make sure it's + usable for both endiannesses. + (vacall-armel-macro.S): Remove target. + * callback/vacall_r/Makefile.maint (COPIED_FILES): Remove + vacall-armel.c. + * callback/vacall_r/Makefile.in (vacall-armel.lo, vacall-armel.s): + Remove targets. + (clean): Don't remove vacall-armel.s. + (SOURCE_FILES): Remove vacall-armel.c, vacall-armel-macro.S. + + arm: Regenerate .s and .S files with known compilers. + * common/asm-arm.h (L, FUNBEGIN, FUNEND): New macros. + * common/asm-arm.sh: Rewritten to consume ELF input. Produce L, + FUNBEGIN, FUNEND macros. + * avcall/Makefile.devel (avcall-arm-macro.S, avcall-armel.s): Rewritten. + * vacall/Makefile.devel (vacall-arm-macro.S, vacall-armel.s): Rewritten. + * callback/vacall_r/Makefile.devel (vacall-arm-macro.S, + vacall-armel-macro.S): Rewritten. + * avcall/avcall-arm-macro.S: Remove from version control. + * avcall/avcall-armel.s: Likewise. + * vacall/vacall-arm-macro.S: Likewise. + * vacall/vacall-armel.s: Likewise. + * callback/vacall_r/vacall-arm-macro.S: Likewise. + * callback/vacall_r/vacall-armel-macro.S: Likewise. + +2017-01-29 Bruno Haible + + hppa: Regenerate .s and .S files with known compilers. + * common/asm-hppa.sh: New file. + * common/asm-hppa.h: New file. + * Makefile.in (SOURCE_FILES): Add them. + * avcall/Makefile.devel (avcall-hppa-linux.s, avcall-hppa-macro.S): New + targets. + (avcall-hppa.s): Remove target. + * avcall/Makefile.in (avcall-hppa.s): New target. + (avcall-hppa.lo): Update. + (clean): Remove also avcall-hppa.s. + (SOURCE_FILES): Add avcall-hppa-linux.s, avcall-hppa-macro.S. Remove + avcall-hppa.s. + * vacall/vacall-hppa.c: Use explicit assignments to move the arguments + to their stack locations. + * vacall/Makefile.devel (vacall-hppa-linux.s, vacall-hppa-macro.S): New + targets. + (vacall-hppa.s): Remove target. + * vacall/Makefile.in (vacall-hppa.s): New target. + (vacall-hppa.o): Update. + (clean): Remove also vacall-hppa.s. + (SOURCE_FILES): Add vacall-hppa-linux.s, vacall-hppa-macro.S. Remove + vacall-hppa.s. + * callback/vacall_r/Makefile.devel (vacall-hppa-linux.s, + vacall-hppa-macro.S): New targets. + (vacall-hppa.s): Remove target. + * callback/vacall_r/Makefile.in (vacall-hppa.s): New target. + (vacall-hppa.lo): Update. + (clean): Remove also vacall-hppa.s. + (SOURCE_FILES): Add vacall-hppa-linux.s, vacall-hppa-macro.S. Remove + vacall-hppa.s. + * avcall/avcall-hppa.s: Remove from version control. + * vacall/vacall-hppa.s: Likewise. + * callback/vacall_r/vacall-hppa.s: Likewise. + * PLATFORMS, */PLATFORMS: List hppa2.0w-hp-hpux11.31 (cc). + +2017-01-29 Bruno Haible + + alpha: Regenerate .s and .S files with known compilers. + * avcall/avcall-alpha.c: Use __builtin_alloca. + * avcall/Makefile.devel (precompiled): Depend on avcall-alpha.s. + (avcall-alpha.s): Rewritten. + * vacall/vacall-alpha.c: Put all local variables in a struct. + * vacall/Makefile.devel (precompiled): Depend on vacall-alpha.s. + (vacall-alpha.s): Rewritten. + * callback/vacall_r/Makefile.devel (precompiled): Depend on + vacall-alpha-macro.S. + (vacall-alpha-linux.s): New target. + (vacall-alpha-macro.S): Rewritten. + * callback/vacall_r/Makefile.in (SOURCE_FILES): Add + vacall-alpha-linux.s. + * avcall/avcall-alpha.s: Remove from version control. + * vacall/vacall-alpha.s: Likewise. + * callback/vacall_r/vacall-alpha-macro.S: Likewise. + +2017-01-29 Bruno Haible + + sparc64: Fix for Solaris. + * vacall/Makefile.devel (vacall-sparc64-linux.s): Produce code that does + not make assumptions about the address space. + * PLATFORMS, */PLATFORMS: List sparc64-sun-solaris2.10 (gcc -m64, + cc -xarch=generic64). + +2017-01-29 Bruno Haible + + sparc, sparc64: Regenerate .s and .S files with known compilers. + * common/asm-sparc.h (L, FUNBEGIN, FUNEND): New macros. + * common/asm-sparc.sh: Rewritten to consume ELF input. Produce L, + FUNBEGIN, FUNEND macros. + * common/asm-sparc64.sh: Remove file. + * Makefile.in (SOURCE_FILES): Remove common/asm-sparc64.sh. + * avcall/Makefile.devel (precompiled): Depend on avcall-sparc-macro.S + and avcall-sparc64-macro.S. + (avcall-sparc-linux.s, avcall-sparc64-linux.s): New target. + (avcall-sparc-macro.S, avcall-sparc64-macro.S): Rewritten. + * avcall/Makefile.in (SOURCE_FILES): Add avcall-sparc-linux.s, + avcall-sparc64-linux.s. + * vacall/Makefile.devel (precompiled): Depend on vacall-sparc-macro.S + and vacall-sparc64-macro.S. + (vacall-sparc-linux.s, vacall-sparc64-linux.s): New target. + (vacall-sparc-macro.S, vacall-sparc64-macro.S): Rewritten. + * vacall/Makefile.in (SOURCE_FILES): Add vacall-sparc-linux.s, + vacall-sparc64-linux.s. + * callback/vacall_r/Makefile.devel (precompiled): Depend on + vacall-sparc-macro.S and vacall-sparc64-macro.S. + (vacall-sparc-linux.s, vacall-sparc64-linux.s): New target. + (vacall-sparc-macro.S, vacall-sparc64-macro.S): Rewritten. + * callback/vacall_r/Makefile.in (SOURCE_FILES): Add + vacall-sparc-linux.s, vacall-sparc64-linux.s. + * avcall/avcall-sparc-macro.S: Remove from version control. + * avcall/avcall-sparc64-macro.S: Likewise. + * vacall/vacall-sparc-macro.S: Likewise. + * vacall/vacall-sparc64-macro.S: Likewise. + * callback/vacall_r/vacall-sparc-macro.S: Likewise. + * callback/vacall_r/vacall-sparc64-macro.S: Likewise. + +2017-01-29 Bruno Haible + + mips64: Make it work on Linux (mips64, mips64el) with "gcc -mabi=64". + * avcall/avcall-mips64.c: Add code for struct returns on _MIPSEL. + * avcall/Makefile.devel (avcall-mips64eb-linux.s, + avcall-mips64eb-macro.S, avcall-mips64el-linux.s, + avcall-mips64el-macro.S): New targets. + (avcall-mips64-linux.s, avcall-mips64-macro.S): Remove targets. + * avcall/Makefile.in (avcall-mips64.s): Take into account the + ENDIANNESS. + (SOURCE_FILES): Add avcall-mips64eb-linux.s, avcall-mips64el-linux.s, + avcall-mips64eb-macro.S, avcall-mips64el-macro.S. + Remove avcall-mips64-linux.s, avcall-mips64-macro.S. + * vacall/vacall-mips64.c: Add code for struct returns on _MIPSEL. + * vacall/Makefile.devel (vacall-mips64eb-linux.s, + vacall-mips64eb-macro.S, vacall-mips64el-linux.s, + vacall-mips64el-macro.S): New targets. + (vacall-mips64-linux.s, vacall-mips64-macro.S): Remove targets. + * vacall/Makefile.in (vacall-mips64.s): Take into account the + ENDIANNESS. + (SOURCE_FILES): Add vacall-mips64eb-linux.s, vacall-mips64el-linux.s, + vacall-mips64eb-macro.S, vacall-mips64el-macro.S. + Remove vacall-mips64-linux.s, vacall-mips64-macro.S. + * callback/vacall_r/Makefile.devel (vacall-mips64eb-linux.s, + vacall-mips64eb-macro.S, vacall-mips64el-linux.s, + vacall-mips64el-macro.S): New targets. + (vacall-mips64-linux.s, vacall-mips64-macro.S): Remove targets. + * callback/vacall_r/Makefile.in (vacall-mips64.s): Take into account the + ENDIANNESS. + (SOURCE_FILES): Add vacall-mips64eb-linux.s, vacall-mips64el-linux.s, + vacall-mips64eb-macro.S, vacall-mips64el-macro.S. + Remove vacall-mips64-linux.s, vacall-mips64-macro.S. + * PLATFORMS, */PLATFORMS: List mips64-unknown-linux (gcc -mabi=64). + +2017-01-29 Bruno Haible + + mipsn32: Make it work on Linux (mips64, mips64el) with "gcc -mabi=n32". + * avcall/avcall-mipsn32.c: Add code for struct returns on _MIPSEL. + * avcall/Makefile.devel (avcall-mipsn32eb-linux.s, + avcall-mipsn32eb-macro.S, avcall-mipsn32el-linux.s, + avcall-mipsn32el-macro.S): New targets. + (avcall-mipsn32-linux.s, avcall-mipsn32-macro.S): Remove targets. + * avcall/Makefile.in (avcall-mipsn32.s): Take into account the + ENDIANNESS. + (SOURCE_FILES): Add avcall-mipsn32eb-linux.s, + avcall-mipsn32el-linux.s, avcall-mipsn32eb-macro.S, + avcall-mipsn32el-macro.S. + Remove avcall-mipsn32-linux.s, avcall-mipsn32-macro.S. + * vacall/vacall-mipsn32.c: Add code for struct returns on _MIPSEL. + * vacall/Makefile.devel (vacall-mipsn32eb-linux.s, + vacall-mipsn32eb-macro.S, vacall-mipsn32el-linux.s, + vacall-mipsn32el-macro.S): New targets. + (vacall-mipsn32-linux.s, vacall-mipsn32-macro.S): Remove targets. + * vacall/Makefile.in (vacall-mipsn32.s): Take into account the + ENDIANNESS. + (SOURCE_FILES): Add vacall-mipsn32eb-linux.s, vacall-mipsn32el-linux.s, + vacall-mipsn32eb-macro.S, vacall-mipsn32el-macro.S. + Remove vacall-mipsn32-linux.s, vacall-mipsn32-macro.S. + * callback/vacall_r/Makefile.devel (vacall-mipsn32eb-linux.s, + vacall-mipsn32eb-macro.S, vacall-mipsn32el-linux.s, + vacall-mipsn32el-macro.S): New targets. + (vacall-mipsn32-linux.s, vacall-mipsn32-macro.S): Remove targets. + * callback/vacall_r/Makefile.in (vacall-mipsn32.s): Take into account + the ENDIANNESS. + (SOURCE_FILES): Add vacall-mipsn32eb-linux.s, vacall-mipsn32el-linux.s, + vacall-mipsn32eb-macro.S, vacall-mipsn32el-macro.S. + Remove vacall-mipsn32-linux.s, vacall-mipsn32-macro.S. + * PLATFORMS, */PLATFORMS: List mips64-unknown-linux (gcc -mabi=n32). + +2017-01-29 Bruno Haible + + mips: Make it work on Linux (mips, mipsel) with "gcc -mabi=32". + * m4/endianness.m4: New file. + * avcall/Makefile.devel (avcall-mipseb-linux.s, avcall-mipseb-macro.S, + avcall-mipsel-linux.s, avcall-mipsel-macro.S): New targets. + (avcall-mips-linux.s, avcall-mips-macro.S): Remove targets. + * avcall/configure.ac: Invoke FFCALL_ENDIANNESS. + * avcall/Makefile.in (avcall-mips.s): Take into account the ENDIANNESS. + (SOURCE_FILES): Add avcall-mipseb-linux.s, avcall-mipsel-linux.s, + avcall-mipseb-macro.S, avcall-mipsel-macro.S. + Remove avcall-mips-linux.s, avcall-mips-macro.S. + * vacall/Makefile.devel (vacall-mipseb-linux.s, vacall-mipseb-macro.S, + vacall-mipsel-linux.s, vacall-mipsel-macro.S): New targets. + (vacall-mips-linux.s, vacall-mips-macro.S): Remove targets. + * vacall/configure.ac: Invoke FFCALL_ENDIANNESS. + * vacall/Makefile.in (vacall-mips.s): Take into account the ENDIANNESS. + (SOURCE_FILES): Add vacall-mipseb-linux.s, vacall-mipsel-linux.s, + vacall-mipseb-macro.S, vacall-mipsel-macro.S. + Remove vacall-mips-linux.s, vacall-mips-macro.S. + * callback/vacall_r/Makefile.devel (vacall-mipseb-linux.s, + vacall-mipseb-macro.S, vacall-mipsel-linux.s, vacall-mipsel-macro.S): + New targets. + * callback/vacall_r/configure.ac: Invoke FFCALL_ENDIANNESS. + * callback/vacall_r/Makefile.in (vacall-mips.s): Take into account the + ENDIANNESS. + (SOURCE_FILES): Add vacall-mipseb-linux.s, vacall-mipsel-linux.s, + vacall-mipseb-macro.S, vacall-mipsel-macro.S. + Remove vacall-mips-linux.s, vacall-mips-macro.S. + * PLATFORMS, */PLATFORMS: List mips-unknown-linux (gcc -mabi=32). + +2017-01-29 Bruno Haible + + mips, mipsn32, mips64: Regenerate .s and .S files with known compilers. + This restores support for IRIX with cc -32 (regression from 2008-09-26). + * common/asm-mips.sh: Rewritten to consume ELF input. + * avcall/avcall-mips.c: Rely on the compiler to set $25 at each + function call. Add comment about broken GCC 3.3.x and 3.4.x. Avoid + 'switch' statements, to make the generated code position-independent. + Declare iret2 as single __avword. + * avcall/avcall-mipsn32.c: Use __builtin_alloca. Rely on the compiler + to set $25 at each function call. + * avcall/avcall-mips64.c: Likewise. + * avcall/Makefile.devel (precompiled): Depend on avcall-mips-macro.S, + avcall-mipsn32-macro.S, avcall-mips64-macro.S. + (avcall-mips-linux.s, avcall-mipsn32-linux.s, avcall-mips64-linux.s): + New targets. + (avcall-mips-macro.S, avcall-mipsn32-macro.S, avcall-mips64-macro.S): + Rewritten. + * avcall/Makefile.in (SOURCE_FILES): Add avcall-mips-linux.s, + avcall-mipsn32-linux.s, avcall-mips64-linux.s. + * vacall/vacall-mips.c: Rely on the compiler to set $25 at each + function call. + * vacall/vacall-mipsn32.c: Likewise. + * vacall/vacall-mips64.c: Likewise. Add offset to references of + arguments in the stack. + * vacall/Makefile.devel (precompiled): Depend on vacall-mips-macro.S, + vacall-mipsn32-macro.S, vacall-mips64-macro.S. + (vacall-mips-linux.s, vacall-mipsn32-linux.s, vacall-mips64-linux.s): + New targets. + (vacall-mips-macro.S): Rewritten. + (vacall-mipsn32-macro.S): Rewritten. Update the postprocessing hack. + (vacall-mips64-macro.S): Rewritten. Add a postprocessing hack. + * vacall/Makefile.in (SOURCE_FILES): Add vacall-mips-linux.s, + vacall-mipsn32-linux.s, vacall-mips64-linux.s. + * callback/vacall_r/Makefile.devel (precompiled): Depend on + vacall-mips-macro.S, vacall-mipsn32-macro.S, vacall-mips64-macro.S. + (vacall-mips-linux.s, vacall-mipsn32-linux.s, vacall-mips64-linux.s): + New targets. + (vacall-mips-macro.S): Rewritten. + (vacall-mipsn32-macro.S): Rewritten. Update the postprocessing hack. + (vacall-mips64-macro.S): Rewritten. Add a postprocessing hack. + * callback/vacall_r/Makefile.in (SOURCE_FILES): Add vacall-mips-linux.s, + vacall-mipsn32-linux.s, vacall-mips64-linux.s. + * avcall/avcall-mips-macro.S: Remove from version control. + * avcall/avcall-mipsn32-macro.S: Likewise. + * avcall/avcall-mips64-macro.S: Likewise. + * vacall/vacall-mips-macro.S: Likewise. + * vacall/vacall-mipsn32-macro.S: Likewise. + * vacall/vacall-mips64-macro.S: Likewise. + * callback/vacall_r/vacall-mips-macro.S: Likewise. + * callback/vacall_r/vacall-mipsn32-macro.S: Likewise. + * callback/vacall_r/vacall-mips64-macro.S: Likewise. + * PLATFORMS, */PLATFORMS: List mips-sgi-irix6.5 (cc -32). + +2017-01-29 Bruno Haible + + m68k: Regenerate .s and .S files with known compilers. + * common/asm-m68k.h (L, FUNBEGIN, FUNEND): New macros. + * common/asm-m68k.sh: Expect a syntax argument. Produce L, FUNBEGIN, + FUNEND macros. + * avcall/avcall-m68k.c: Use __builtin_alloca instead of hacking on the + 'sp' register. + * avcall/Makefile.devel (precompiled): Depend on avcall-m68k.mit.S and + avcall-m68k.motorola.S. + (avcall-m68k-linux.s, avcall-m68k-sun.s): New targets. + (avcall-m68k.mit.S, avcall-m68k.motorola.S): Rewritten. + * avcall/Makefile.in (avcall-m68k.s): Depend on avcall-m68k.motorola.S + instead of avcall-m68k.mot.s. + (SOURCE_FILES): Add avcall-m68k-linux.s, avcall-m68k-sun.s. + Replace avcall-m68k.mot.s with avcall-m68k.motorola.S. + * vacall/Makefile.devel (precompiled): Depend on vacall-m68k.mit.S and + vacall-m68k.motorola.S. + (vacall-m68k-linux.s, vacall-m68k-sun.s): New targets. + (vacall-m68k.mit.S, vacall-m68k.motorola.S): Rewritten. + * vacall/Makefile.in (vacall-m68k.s): Depend on vacall-m68k.motorola.S + instead of vacall-m68k.mot.s. + (SOURCE_FILES): Add vacall-m68k-linux.s, + vacall-m68k-sun.s, vacall-mips-linux.s, vacall-mipsn32-linux.s, + Replace vacall-m68k.mot.s with vacall-m68k.motorola.S. + * callback/vacall_r/Makefile.devel (precompiled): Depend on + vacall-m68k.mit.S, vacall-m68k.motorola.S, vacall-m68k-netbsd-macro.S. + (vacall-m68k-linux.s, vacall-m68k-sun.s): New targets. + (vacall-m68k.mit.S, vacall-m68k.motorola.S, vacall-m68k-netbsd-macro.S): + Rewritten. + * callback/vacall_r/Makefile.in (vacall-m68k.s): Depend on + vacall-m68k.motorola.S instead of vacall-m68k.mot.s. + (SOURCE_FILES): Add vacall-m68k-linux.s, vacall-m68k-sun.s. + Replace vacall-m68k.mot.s with vacall-m68k.motorola.S. + * avcall/avcall-m68k.mit.S: Remove from version control. + * avcall/avcall-m68k.mot.s: Likewise. + * callback/vacall_r/vacall-m68k-netbsd-macro.S: Likewise. + * callback/vacall_r/vacall-m68k.mit.S: Likewise. + * callback/vacall_r/vacall-m68k.mot.s: Likewise. + * vacall/vacall-m68k.mit.S: Likewise. + * vacall/vacall-m68k.mot.s: Likewise. + +2017-01-29 Bruno Haible + + i386: Regenerate .s and .S files with known compilers. + * common/asm-i386.hh (P2ALIGN): New macro. + (FUNEND): Take two arguments. + * common/asm-i386.sh: Rewritten to consume ELF input. Produce P2ALIGN + macro. Handle indirect call statements. + * avcall/avcall-i386.c: Use __builtin_alloca instead of hacking on the + 'sp' register. + * avcall/Makefile.devel (precompiled): Depend on avcall-i386-macro.S. + (avcall-i386-linux.s): New target. + (avcall-i386-macro.S): Rewritten. + * avcall/Makefile.in (SOURCE_FILES): Add avcall-i386-linux.s. + * vacall/vacall-i386.c: Insert the appropriate stack cleanup before + 'ret $4'. + * vacall/Makefile.devel (precompiled): Depend on vacall-i386-macro.S. + (vacall-i386-linux.s): New target. + (vacall-i386-macro.S): Rewritten. + * vacall/Makefile.in (SOURCE_FILES): Add vacall-i386-linux.s. + * callback/vacall_r/Makefile.devel (precompiled): Depend on + vacall-i386-macro.S. + (vacall-i386-linux.s): New target. + (vacall-i386-macro.S): Rewritten. + * callback/vacall_r/Makefile.in (SOURCE_FILES): Add vacall-i386-linux.s. + * avcall/avcall-i386-macro.S: Remove from version control. + * vacall/vacall-i386-macro.S: Likewise. + * callback/vacall_r/vacall-i386-macro.S: Likewise. + +2017-02-11 Bruno Haible + + Prepare for regenerating .s and .S files with known compilers. + This serves three purposes: + 1. Being able to regenerate everything if avcall.h.in or vacall.h.in + changes. + 2. Allow safe stack unwinding across avcall and vacall invocations. + 3. Allow distributing libavcall and libcallback as shared libraries. + * README-hacking: Document the cross compilers. + * cross-tools/cross.conf: New file. + * cross-tools/cross-build.sh: New file. + * cross-tools/cross.in: New file. + * cross-tools/patches/*.patch: New files. + * avcall/Makefile.devel (GCCFLAGS): Add -fno-omit-frame-pointer, -fPIC. + (CROSS_TOOL): New variable. + * vacall/Makefile.devel (GCCFLAGS): Add -fno-omit-frame-pointer. + (CROSS_TOOL): New variable. + * callback/vacall_r/Makefile.devel (GCCFLAGS): Add + -fno-omit-frame-pointer, -fPIC. + (CROSS_TOOL): New variable. + +2017-01-29 Bruno Haible + + s390: Fix long long args. + * avcall/avcall.h.in (__av_longlong): Align only on a 4-bytes boundary, + not on an 8-bytes boundary. Fix condition for switching from register + args to stack args. + * vacall/vacall.h.in (__va_arg_leftadjusted, __va_arg_rightadjusted): + Fix condition for switching from register args to stack args. + (__va_arg_longlong): Use __va_arg. + * callback/vacall_r/vacall_r.h.in (__va_arg_leftadjusted, + __va_arg_rightadjusted): Fix condition for switching from register args + to stack args. + (__va_arg_longlong): Use __va_arg. + * PLATFORMS, */PLATFORMS: List s390x-ibm-linux with "gcc -m31". + +2017-01-29 Bruno Haible + + s390: Fix trampoline. + * trampoline/trampoline.c [__s390__]: Fix is_tramp macro. + +2017-01-29 Bruno Haible + + ia64: Fix struct args. + * avcall/avcall.h.in (__av_struct): Tweak #if. + * avcall/avcall-ia64.c: Fix comment. + * vacall/vacall.h.in (__va_arg_struct): Change #if to match + callback/vacall_r/vacall_r.h.in. + * callback/call-used-registers.txt: Fix info about ia64. + * callback/vacall_r/vacall_r.h.in (__va_arg_struct): Tweak #if. + * callback/trampoline_r/trampoline.c [__ia64__]: Fix is_tramp macro. + +2017-01-29 Bruno Haible + + powerpc64: Make trampoline work on AIX in a 64-bit build. + * trampoline/tramp-powerpc64-aix.S: Add assembler pseudo-ops for AIX. + * callback/trampoline_r/tramp-powerpc64-aix.S: Likewise. + +2017-01-29 Bruno Haible + + arm: Comments. + * avcall/avcall-arm.c: Add comments. + * avcall/avcall.h.in: Fix comment. + +2017-01-29 Bruno Haible + + arm: Make trampoline work on real ARM harware. + The cache flushing code in cache-arm.c and cache-armel.c are for old + Linux versions. Nowadays the best way is through the GCC builtin + function __clear_cache (which makes the appropriate Linux system call). + * trampoline/trampoline.c (alloc_trampoline) [__arm__]: Invoke GCC + builtin function __clear_cache. Remove call to __TR_clear_cache. + * callback/trampoline_r/trampoline.c (alloc_trampoline_r) [__arm__]: + Likewise. + * trampoline/cache-arm.[cs]: Remove files. + * trampoline/cache-armel.[cs]: Remove files. + * callback/trampoline_r/Makefile.maint (COPIED_FILES): Remove + cache-arm*. + * Makefile.in (COPIED_FILES): Remove callback/trampoline_r/cache-arm*. + * trampoline/Makefile.devel (cache-armel.s): Remove target. + * trampoline/configure.ac (CPU_OBJECTS): Leave empty for arm and armel. + * trampoline/Makefile.in (cache-arm.o, cache-armel.o): Remove targets. + (SOURCE_FILES): Remove cache-arm.[cs], cache-armel.[cs]. + * callback/trampoline_r/Makefile.devel (cache-armel.s): Remove target. + * callback/trampoline_r/configure.ac (CPU_OBJECTS): Leave empty for arm + and armel. + * callback/trampoline_r/Makefile.in (cache-arm.lo, cache-armel.lo): + Remove targets. + (SOURCE_FILES): Remove cache-arm.[cs], cache-armel.[cs]. + * trampoline/PLATFORMS: Add two ARM platforms. + +2017-01-29 Bruno Haible + + hppa: Fix struct returns. + * avcall/avcall.h.in [__hppa__]: Don't set __AV_PCC_STRUCT_RETURN by + default. + * avcall/avcall-hppa.c: Fix comment. + * vacall/vacall.h.in [__hppa__]: Don't set __VA_PCC_STRUCT_RETURN by + default. + * callback/vacall_r/vacall_r.h.in [__hppa__]: Don't set + __VA_PCC_STRUCT_RETURN by default. + +2017-01-29 Bruno Haible + + sparc64: Fix the passing of 'float' arguments. + * vacall/vacall.h.in (va_arg_float): Expect the float in the upper half + of the 8-bytes word. + * callback/vacall_r/vacall_r.h.in (va_arg_float): Likewise. + * PLATFORMS, */PLATFORMS: List sparc64-unknown-linux (gcc). + +2017-01-29 Bruno Haible + + sparc64: Fix a compiler warning. + * vacall/vacall.h.in (__va_arg_struct): Add a cast to pointer. + * callback/vacall_r/vacall_r.h.in: Likewise. + +2017-01-29 Bruno Haible + + mips64: Fix trampoline_r. + * callback/trampoline_r/trampoline.c: Fix conditionals that involve + __mips64__. + * callback/trampoline_r/test1.c: Fix duplicate declaration of 'env' on + mips64. + +2017-01-29 Bruno Haible + + mipsn32, mips64: Fix for little-endian platforms. + * vacall/vacall.h.in (__va_arg_adjusted): Use same conditional on + _MIPSEB and _MIPSEL as in callback/vacall_r/vacall_r.h.in. + * callback/vacall_r/vacall_r.h.in: Reorder parts of a #if condition. + +2017-01-29 Bruno Haible + + mips: Fix for Linux with "gcc -mabi=32". + * trampoline/tramp-mips.old.o: Renamed from trampoline/tramp-mips.o. + * trampoline/tramp-mips.old.s: Renamed from trampoline/tramp-mips.s. + * trampoline/tramp-mips.s: New file, based on + trampoline/tramp-mipsn32.s. + * trampoline/tramp-mips.o: New generated file. + * trampoline/trampoline.c: For __mips__, use the same trampoline as for + __mipsn32__. + +2017-01-29 Bruno Haible + + mips: Fix for Linux with "gcc -mabi=32". + * vacall/vacall.h.in (__va_arg_adjusted): Use same conditional on + _MIPSEB as in callback/vacall_r/vacall_r.h.in. + +2017-01-29 Bruno Haible + + mipsn32, mips64: Fix struct args and struct returns with newer GCC. + * avcall/avcall.h.in: For mipsn32 and mips64 in gcc >= 3.4: + 1. Don't set __AV_GCC_STRUCT_RETURN. + 2. Use __AV_SGICC_STRUCT_ARGS. + * vacall/vacall.h.in: For mipsn32 and mips64 in gcc >= 3.4: + 1. Don't set __VA_GCC_STRUCT_RETURN. + 2. Use __VA_SGICC_STRUCT_ARGS. + * callback/vacall_r/vacall_r.h.in: Likewise. + * PLATFORMS, */PLATFORMS: List mips-sgi-irix6.5 (gcc -mabi=n32). + +2017-01-29 Bruno Haible + + x86_64: Fix bug with structure arguments larger than 16 bytes. + * avcall/avcall.h.in (__av_struct): Pass structures > 16 bytes on the + stack. + * vacall/vacall.h.in (__va_arg_adjusted): Expect types > 16 bytes passed + on the stack. + * callback/vacall_r/vacall_r.h.in (__va_arg_adjusted): Likewise. + +2017-01-29 Bruno Haible + + i386, x86_64, sparc, sparc64: Fix for the Sun Studio 11 compiler. + When preprocessing a .S file, "cc -E" activates some other preprocessor + than the usual C preprocessor. + * avcall/Makefile.in (avcall-i386.s, avcall-sparc.s, avcall-sparc64.s, + avcall-x86_64.s): Feed the input to the preprocessor through standard + input. Postprocess to remove space after '.' and '@'. + * vacall/Makefile.in (vacall-i386.s, vacall-sparc.s, vacall-sparc64.s, + vacall-x86_64.s): Likewise. + * trampoline/Makefile.in (cache-sparc.s, cache-sparc64.s): Likewise. + * callback/vacall_r/Makefile.in (vacall-i386.s, vacall-sparc.s, + vacall-sparc64.s, vacall-x86_64.s): Likewise. + * callback/trampoline_r/Makefile.in (cache-sparc.s, cache-sparc64.s): + Likewise. + +2017-01-29 Bruno Haible + + List platforms on which libffcall is known to work. + * PLATFORMS, */PLATFORMS: List i386-pc-solaris2.10 (gcc), + mips-sgi-irix6.5 (cc -n32), sparc-unknown-linux (gcc), + alphaev67-unknown-linux (gcc), powerpc-ibm-aix7.1.3.0 (xlc, gcc). + +2017-01-29 Bruno Haible + + Don't violate ISO C rules. + * avcall/avcall.h.in (__av_struct): Don't store an unaligned pointer + in (LIST).aptr. + +2017-01-29 Bruno Haible + + Don't make side-effects before overflow checking. + * avcall/avcall.h.in: In most macro definitions, modify (LIST).aptr + after checking that it will remain within range, not before. But + continue to modify (LIST).aptr before storing the argument, as this + makes it easier w.r.t. to the alignment. This produces some more + duplicate expressions that the compiler will eliminate. But the code + is clearer this way. + +2017-01-29 Bruno Haible + + Add more floating-point, mixed-number, general-purpose args tests. + * avcall/tests.c (f_f24, d_iiidi, d_fdi, ll_iiilli, D_Dfd, + l_l0K, ..., l_l6K, ll_l2ll, ..., ll_l7ll, d_l2d, ... d_l7d): New tests. + * vacall/tests.c: Likewise. + * callback/tests.c: Likewise. + +2017-01-29 Bruno Haible + + Enable the 'long long' tests in callback. + * callback/configure.ac: Invoke AC_TYPE_LONG_LONG_INT. + * callback/tests.c: Test HAVE_LONG_LONG_INT, not HAVE_LONG_LONG. + * avcall/avcall.h.in: Fix comment. + * vacall/vacall.h.in: Likewise. + +2017-01-29 Bruno Haible + + devel: Make it easy to keep the autogenerated files up-to-date. + * avcall/Makefile.devel: Make all *.[sS] files depend on this file. + (precompiled): Comment out all dependencies. + * vacall/Makefile.devel: Likewise. + * callback/vacall_r/Makefile.devel: Likewise. + * callback/vacall_r/Makefile.maint (copied-files): New target. + * callback/trampoline_r/Makefile.maint (copied-files): New target. + * autogen.sh: To copy the files, just invoke these targets. + * Makefile.devel (precompiled): New target. + +2017-01-29 Bruno Haible + + configuration: Support the AR configure variable. + Needed for a 64-bit build on AIX. + * vacall/configure.ac: Invoke gl_PROG_AR_RANLIB instead of + AC_PROG_RANLIB. + * trampoline/configure.ac: Likewise. + * vacall/Makefile.in (AR): Use value determined by gl_PROG_AR_RANLIB. + * trampoline/Makefile.in (AR): Likewise. + * avcall/Makefile.in (AR): Use value determined by libtool. + * callback/Makefile.in (AR): Likewise. + * callback/vacall_r/Makefile.in (AR): Likewise. + * callback/trampoline_r/Makefile.in (AR): Likewise. + * avcall/configure.ac: Reorder (a no-op). + * callback/configure.ac: Likewise. + * callback/vacall_r/configure.ac: Likewise. + * callback/trampoline_r/configure.ac: Likewise. + +2017-01-29 Bruno Haible + + configuration: Simplification. + * m4/general.m4 (CL_CONFIG_SUBDIRS): Remove macro. + * configure.ac: Use AC_CONFIG_SUBDIRS instead of CL_CONFIG_SUBDIRS. + * callback/configure.ac: Likewise. + +2017-01-29 Bruno Haible + + Revert the addition of a powerpc64le port by Masanori Mitsugi + (commit from 2015-08-23). + +2017-01-29 Bruno Haible + + Add support for some Linux+PaX or SELinux kernels and for HardenedBSD. + Reported + - by Gerard Milmeister in https://sourceforge.net/p/clisp/bugs/356/, + - by Pradeep Kumar in https://sourceforge.net/p/clisp/bugs/415/, + - by Don Cohen in + https://lists.gnu.org/archive/html/libffcall/2016-12/msg00002.html, + - by Nelson Beebe. + * m4/codeexec.m4 (FFCALL_CODEEXEC_PAX): New macro. + * m4/general.m4 (FFCALL_COMMON_TRAMPOLINE): Require it. + * trampoline/trampoline.c (EXECUTABLE_VIA_MALLOC_THEN_MPROTECT, + EXECUTABLE_VIA_MMAP_THEN_MPROTECT, EXECUTABLE_VIA_MMAP_FILE_SHARED): + New macros. + (EXECUTABLE_VIA_MPROTECT, EXECUTABLE_VIA_MMAP_ANONYMOUS, + EXECUTABLE_VIA_MMAP_DEVZERO): Remove macros. + (MAP_FILE, MAP_VARIABLE): Define fallbacks. + (pagesize): Define outside of functions. + (alloc_trampoline): If EXECUTABLE_VIA_MMAP_FILE_SHARED is defined, + create separate mappings of a file, for writing and for executing. + If EXECUTABLE_VIA_MMAP_THEN_MPROTECT is defined, use mmap of an + anonymous page, then mprotect. + (free_trampoline): Convert back from executable address to writable + address. + * callback/trampoline_r/trampoline.c + (EXECUTABLE_VIA_MALLOC_THEN_MPROTECT, EXECUTABLE_VIA_MMAP_THEN_MPROTECT, + EXECUTABLE_VIA_MMAP_FILE_SHARED): New macros. + (EXECUTABLE_VIA_MPROTECT, EXECUTABLE_VIA_MMAP_ANONYMOUS, + EXECUTABLE_VIA_MMAP_DEVZERO): Remove macros. + (MAP_FILE, MAP_VARIABLE): Define fallbacks. + (pagesize): Define outside of functions. + (alloc_trampoline_r): If EXECUTABLE_VIA_MMAP_FILE_SHARED is defined, + create separate mappings of a file, for writing and for executing. + If EXECUTABLE_VIA_MMAP_THEN_MPROTECT is defined, use mmap of an + anonymous page, then mprotect. + (free_trampoline_r, is_trampoline_r): Convert back from executable + address to writable address. + +2017-01-29 Bruno Haible + + Fix "Generic workaround against the ELF symbol resolving routine". + * callback/vacall_r/elfhack-alpha.S: Put env in register $1, not $2. + * callback/vacall_r/elfhack-alpha.sed: Make it find the correct line. + * callback/trampoline_r/trampoline.c [__ia64__]: Fix code for + BINFMT_ELF. + [__mips64__]: Fix a typo in the trampoline for BINFMT_ELF. + [__s390__]: Fix typo in is_tramp macro for BINFMT_ELF. + +2017-01-10 Bruno Haible + + Update documentation. + * README: Refer to the git repository, not to the last release. + * DEPENDENCIES: New file. + * Makefile.in (SOURCE_FILES): Add it. + * README-hacking: New file. + +2017-01-09 Bruno Haible + + Remove support for m68k/HP-UX, m68k/NeXT, apollo, mips/Ultrix. + * trampoline/trampoline.c: Remove hpux, NeXT, apollo, ultrix + conditionals. + * trampoline/cache.c: Likewise. + * callback/trampoline_r/trampoline.c: Likewise. + +2017-01-09 Bruno Haible + + Remove support for m68k/AmigaOS. + * avcall/Makefile.devel (avcall-m68k-amiga.s): Remove target. + * avcall/avcall-m68k-amiga.c: Remove file. + * avcall/avcall-m68k-amiga.s: Remove file. + * avcall/Makefile.in (SOURCE_FILES): Remove them. + * avcall/avcall.h.in: Remove AMIGA conditionals. + * avcall/tests.c: Likewise. + * trampoline/trampoline.c: Likewise. + * callback/trampoline_r/trampoline.c: Likewise. + +2017-01-09 Bruno Haible + + Remove support for the AIX 3 operating system. + * avcall/Makefile.devel (avcall-powerpc-aix.s): Renamed from + avcall-powerpc-aix.new.s. + (avcall-powerpc-aix.old.s): Remove target. + * avcall/avcall-powerpc-aix.s: Renamed from + avcall/avcall-powerpc-aix.new.s. + * avcall/avcall-powerpc-aix.old.s: Remove file. + * avcall/Makefile.in (avcall-powerpc.s): No longer use + avcall-powerpc-aix.old.s. + (SOURCE_FILES): Add avcall-powerpc-aix.s. Remove + avcall-powerpc-aix.new.s, avcall-powerpc-aix.old.s. + * vacall/Makefile.devel (vacall-powerpc-aix.s): Renamed from + vacall-powerpc-aix.new.s. + (vacall-powerpc-aix.old.s): Remove target. + * vacall/vacall-powerpc-aix.s: Renamed from + vacall/vacall-powerpc-aix.new.s. + * vacall/vacall-powerpc-aix.old.s: Remove file. + * vacall/Makefile.in (vacall-powerpc.s): No longer use + vacall-powerpc-aix.old.s. + (SOURCE_FILES): Add vacall-powerpc-aix.s. Remove + vacall-powerpc-aix.new.s, vacall-powerpc-aix.old.s. + * callback/vacall_r/Makefile.devel (vacall-powerpc-aix.s): Renamed from + vacall-powerpc-aix.new.s. + (vacall-powerpc-aix.old.s): Remove target. + * callback/vacall_r/vacall-powerpc-aix.s: Renamed from + callback/vacall_r/vacall-powerpc-aix.new.s. + * callback/vacall_r/vacall-powerpc-aix.old.s: Remove file. + * callback/vacall_r/Makefile.in (vacall-powerpc.s): No longer use + vacall-powerpc-aix.old.s. + (SOURCE_FILES): Add vacall-powerpc-aix.s. Remove + vacall-powerpc-aix.new.s, vacall-powerpc-aix.old.s. + * trampoline/Makefile.devel (proto-powerpc-aix.s): Renamed from + proto-powerpc-aix.new.s. + (proto-powerpc-aix.old.s): Remove target. + * trampoline/proto-powerpc-aix.s: Renamed from + trampoline/proto-powerpc-aix.new.s. + * trampoline/proto-powerpc-aix.old.s: Remove file. + * trampoline/tramp-powerpc-aix.S: Renamed from + trampoline/tramp-powerpc.new.S. + * trampoline/tramp-powerpc.old.S: Remove file. + * trampoline/tramp-powerpc64-aix.S: Renamed from + trampoline/tramp-powerpc64.new.S. + * trampoline/Makefile.in (tramp-powerpc.s): No longer use + tramp-powerpc.old.S. + (tramp-powerpc64.s): Update. + (SOURCE_FILES): Add tramp-powerpc-aix.S, tramp-powerpc64-aix.S. Remove + tramp-powerpc.old.S, tramp-powerpc.new.S tramp-powerpc64.new.S. + * callback/trampoline_r/Makefile.devel (proto-powerpc-aix.s): Renamed + from proto-powerpc-aix.new.s. + (proto-powerpc-aix.old.s): Remove target. + * callback/trampoline_r/proto-powerpc-aix.s: Renamed from + callback/trampoline_r/proto-powerpc-aix.new.s. + * callback/trampoline_r/proto-powerpc-aix.old.s: Remove file. + * callback/trampoline_r/tramp-powerpc-aix.S: Renamed from + callback/trampoline_r/tramp-powerpc.new.S. + * callback/trampoline_r/tramp-powerpc.old.S: Remove file. + * callback/trampoline_r/tramp-powerpc64-aix.S: Renamed from + callback/trampoline_r/tramp-powerpc64.new.S. + * callback/trampoline_r/Makefile.in (tramp-powerpc.s): No longer use + tramp-powerpc.old.S. + (tramp-powerpc64.s): Update. + (SOURCE_FILES): Add tramp-powerpc-aix.S, tramp-powerpc64-aix.S. Remove + tramp-powerpc.old.S, tramp-powerpc.new.S tramp-powerpc64.new.S. + * PLATFORMS, **/PLATFORMS: Update. + +2017-01-08 Bruno Haible + + Remove support for the m88k CPU. + The only place where this CPU is still used is in the OpenBSD 5.8 + luna88k port. The luna88k is museum hardware. They use the ELF binary + format, through an inofficial port of the 10-years old binutils-2.17. + * avcall/Makefile.devel (avcall-m88k.s, tests-m88k.s): Remove targets. + * avcall/avcall-m88k.[cs]: Remove files. + * avcall/Makefile.in (avcall-m88k.lo): Remove target. + (SOURCE_FILES): Remove avcall-m88k.[cs]. + * avcall/avcall.h.in: Remove defined(__m88k__) conditionals. + * vacall/Makefile.devel (vacall-m88k.s, tests-m88k.s): Remove targets. + * vacall/vacall-m88k.[cs]: Remove files. + * vacall/Makefile.in (vacall-m88k.o): Remove target. + (SOURCE_FILES): Remove vacall-m88k.[cs]. + * vacall/vacall.h.in: Remove defined(__m88k__) conditionals. + * trampoline/Makefile.devel (proto-m88k.s, tramp-m88k.s): Remove targets. + * trampoline/proto-m88k.s: Remove file. + * trampoline/tramp-m88k.s: Remove file. + * trampoline/protexec.c: Remove __DOLPHIN__ conditionals. + * trampoline/trampoline.c: Remove defined(__m88k__), HAVE_SYS_M88KBCS_H conditionals. + * trampoline/trampoline.h.in: Don't test for m88k host. + * trampoline/configure.ac: Don't test for m88k host. + * callback/vacall_r/Makefile.devel (vacall-m88k.s): Remove target. + * callback/vacall_r/vacall-m88k.s: Remove file. + * callback/vacall_r/Makefile.in (vacall-m88k.lo): Remove target. + (SOURCE_FILES): Remove vacall-m88k.[cs]. + * callback/vacall_r/vacall_r.h.in: Remove defined(__m88k__) conditionals. + * callback/trampoline_r/Makefile.devel (proto-m88k.s, tramp-m88k.s): Remove targets. + * callback/trampoline_r/proto-m88k.s: Remove file. + * callback/trampoline_r/tramp-m88k.s: Remove file. + * callback/trampoline_r/proto.c: Remove defined(__m88k__) conditional. + * callback/trampoline_r/trampoline.c: Remove defined(__m88k__), HAVE_SYS_M88KBCS_H conditionals. + * callback/trampoline_r/trampoline_r.h.in: Don't test for m88k host. + * callback/trampoline_r/test1.c: Remove defined(__m88k__) conditionals. + * callback/trampoline_r/configure.ac: Don't test for m88k host. + * callback/call-used-registers.txt: Update. + * callback/elf-hack.txt: Update. + * common/reg-struct-return.txt: Update. + * PLATFORMS, **/PLATFORMS: Update. + * README: Update. + * autogen.sh: Don't copy vacall-m88k.c. + * Makefile.in (COPIED_FILES): Remove callback/vacall_r/vacall-m88k.c. + +2017-01-08 Bruno Haible + + Fix last commit. + * common/asm-x86_64.sh: Escape '&' characters in replacement string. + +2017-01-03 Bruno Haible + + Add support for the Mac OS X 10.5 / x86_64 platform. + * common/asm-x86_64.sh: Disable the frame info for exception handlers + on Mac OS X. + * avcall/avcall-x86_64-macro.S: Regenerated. + * vacall/vacall-x86_64-macro.S: Likewise. + * callback/vacall_r/vacall-x86_64-macro.S: Likewise. + * m4/mmap.m4 (FFCALL_MMAP): Renamed from CL_MMAP. Remove AC_BEFORE + invocations. Test mmap without MAP_FIXED only. Don't define + HAVE_MMAP_DEVZERO_SUN4_29. + * m4/mprotect.m4 (FFCALL_MPROTECT): Renamed from CL_MPROTECT. Update + dependency. + * m4/getpagesize.m4 (CL_GETPAGESIZE): Remove AC_BEFORE invocations. + * m4/general.m4 (FFCALL_COMMON_TRAMPOLINE): Update dependencies. + +2017-01-02 Bruno Haible + + Ensure the alignment of trampolines when we use the free-list approach. + * trampoline/trampoline.c (alloc_trampoline): Consider TRAMP_ALIGN + when allocating a page of trampolines. + * callback/trampoline_r/trampoline.c (alloc_trampoline_r): Likewise. + +2017-01-02 Bruno Haible + + Fix a build failure on Solaris/SPARC with newer gcc. + * trampoline/trampoline.c: Remove 'extern inline' declarations. + * callback/trampoline_r/trampoline.c: Likewise. For SPARC, declare + __TR_clear_cache_2, not __TR_clear_cache_4. + * PLATFORMS: Update. + * avcall/PLATFORMS: Likewise. + * vacall/PLATFORMS: Likewise. + * trampoline/PLATFORMS: Likewise. + * callback/PLATFORMS: Likewise. + +2017-01-02 Bruno Haible + + Add support for the Solaris/x86 platform with cc. + * common/asm-i386.sh: Remove the whitespace in the second argument of + INSN2MOVX. + * vacall/vacall-i386-macro.S: Regenerated. + * callback/vacall_r/vacall-i386-macro.S: Likewise. + * avcall/Makefile.in (avcall-i386.s): Eliminate ##. + * vacall/Makefile.in (vacall-i386.s): Likewise. + * callback/vacall_r/Makefile.in (vacall-i386.s): Likewise. + * PLATFORMS: Update. + * avcall/PLATFORMS: Likewise. + * vacall/PLATFORMS: Likewise. + * trampoline/PLATFORMS: Likewise. + * callback/PLATFORMS: Likewise. + +2017-01-02 Bruno Haible + + Add support for the Solaris/x86_64 platform. + * common/asm-x86_64.sh: Introduce ALIGN macro. Disable the frame info + for exception handlers on Solaris. + * common/asm-x86_64.h (ALIGN): New macro. + (FUNEND, EH_FRAME_SECTION): Define differently for Solaris. + * vacall/Makefile.devel (vacall-x86_64-macro.S): Don't use a #define + that assumes an ANSI C preprocessor. + * avcall/avcall-x86_64-macro.S: Regenerated. + * vacall/vacall-x86_64-macro.S: Likewise. + * callback/vacall_r/vacall-x86_64-macro.S: Likewise. + * avcall/Makefile.in (avcall-x86_64.s): Eliminate ##. + * vacall/Makefile.in (vacall-x86_64.s): Likewise. + * callback/vacall_r/Makefile.in (vacall-x86_64.s): Likewise. + * PLATFORMS: Update. + * avcall/PLATFORMS: Likewise. + * vacall/PLATFORMS: Likewise. + * trampoline/PLATFORMS: Likewise. + * callback/PLATFORMS: Likewise. + +2017-01-01 Bruno Haible + + Assume ANSI C in the documentation. + * vacall/vacall.{3,html}: Use ANSI C declaration syntax. Stop + mentioning . Reference stdarg(3). + * trampoline/trampoline.{3,html}: Reference stdarg(3). + * callback/callback.{3,html}: Use ANSI C declaration syntax. Stop + mentioning . + * callback/trampoline_r/trampoline_r.{3,html}: Reference stdarg(3). + +2017-01-01 Bruno Haible + + Support the CPPFLAGS configure variable. + * avcall/Makefile.in (CPPFLAGS): New variable. + Use it in all .c file compilations. + * vacall/Makefile.in (CPPFLAGS): New variable. + Use it in all .c file compilations. + * trampoline/Makefile.in (CPPFLAGS): New variable. + Use it in all .c file compilations. + * callback/Makefile.in (CPPFLAGS): New variable. + Use it in all .c file compilations. + * callback/vacall_r/Makefile.in (CPPFLAGS): New variable. + Use it in all .c file compilations. + * callback/trampoline_r/Makefile.in (CPPFLAGS): New variable. + Use it in all .c file compilations. + +2017-01-01 Bruno Haible + + Add option --disable-elf-hack to disable the ELF workaround. + * m4/binfmt-elf.m4 (FFCALL_BINFMT_ELF_OPTION): New macro. + (FFCALL_BINFMT_ELF): Require it. Set BINFMT_ELF to false and define + BINFMT_ELF to 0 if --disable-elf-hack was specified. + * configure.ac: Invoke FFCALL_BINFMT_ELF_OPTION. + * callback/configure.ac: Likewise. + * callback/elf-hack.txt: Explain how to use --disable-elf-hack for + testing. + +2017-01-01 Bruno Haible + + Generic workaround against the ELF symbol resolving routine. + Reported for x86_64 by Andrey Kutejko + at https://savannah.gnu.org/bugs/?32466 . + * m4/binfmt-elf.m4: New file. + * Makefile.in (SOURCE_FILES): Add it. + * callback/elf-hack.txt: New file. + * callback/test1.c: New file. + * callback/Makefile.in (SOURCE_FILES): Add both. + (test1.o, test1): New targets. + (check): Also run test1. + (MOSTLYCLEANFILES): Add test1.o, test1. + * callback/trampoline_r/configure.ac: Invoke FFCALL_BINFMT_ELF. + * callback/trampoline_r/Makefile.devel: Update the paths to the cross + assemblers. + * callback/trampoline_r/tramp-*.s: Add a 'trampelf' function. + * callback/trampoline_r/tramp-*.S: Likewise. + * callback/trampoline_r/tramp-*.o: Regenerated. + * callback/trampoline_r/trampoline.c: Implement alternate trampolines on + platforms with BINFMT_ELF. + * callback/trampoline_r/test1.c: Skip the test if BINFMT_ELF. + * callback/vacall_r/configure.ac: Invoke FFCALL_BINFMT_ELF. + * callback/vacall_r/elfhack-alpha.S: New file. + * callback/vacall_r/elfhack-alpha.sed: New file. + * callback/vacall_r/elfhack-arm.S: New file. + * callback/vacall_r/elfhack-arm.sed: New file. + * callback/vacall_r/elfhack-i386.S: New file. + * callback/vacall_r/elfhack-i386.sed: New file. + * callback/vacall_r/elfhack-m68k.S: New file. + * callback/vacall_r/elfhack-m68k.sed: New file. + * callback/vacall_r/elfhack-mips.S: New file. + * callback/vacall_r/elfhack-mips.sed: New file. + * callback/vacall_r/elfhack-mips64.S: New file. + * callback/vacall_r/elfhack-mips64.sed: New file. + * callback/vacall_r/elfhack-powerpc.S: New file. + * callback/vacall_r/elfhack-powerpc.sed: New file. + * callback/vacall_r/elfhack-powerpc64le.S: New file. + * callback/vacall_r/elfhack-powerpc64le.sed: New file. + * callback/vacall_r/elfhack-s390.S: New file. + * callback/vacall_r/elfhack-s390.sed: New file. + * callback/vacall_r/elfhack-x86_64.S: New file. + * callback/vacall_r/elfhack-x86_64.sed: New file. + * callback/vacall_r/Makefile.devel (vacall-i386-macro.S): Insert an + include of elfhack-i386.S. + (vacall-m68k.mit.S, vacall-m68k-netbsd-macro.S): Insert an include of + elfhack-m68k.S. + (vacall-mips-macro.S, vacall-mipsn32-macro.S): Insert an include of + elfhack-mips.S. + (vacall-mips64-macro.S): Insert an include of elfhack-mips64.S. + (vacall-alpha-macro.S): Renamed from vacall-alpha.s. Insert an include + of elfhack-alpha.S. + (vacall-arm-macro.S): Insert an include of elfhack-arm.S. + (vacall-armel-macro.S): Renamed from vacall-armel.s. Insert an include + of asm-arm.h and elfhack-arm.S. + (vacall-powerpc-linux-macro.S, vacall-powerpc-netbsd-macro.S): New + targets. + (vacall-powerpc-sysv4-macro.S): Renamed from vacall-powerpc-sysv4.s. + Insert an include of elfhack-powerpc.S. + (vacall-powerpc64le-macro.S): Renamed from vacall-powerpc64le.s. Insert + an include of elfhack-powerpc64.S. + (vacall-x86_64-macro.S): Insert an include of elfhack-x86_64.S. + (vacall-s390-macro.S): New target. + * callback/vacall_r/vacall-alpha-macro.S: Renamed from + callback/vacall_r/vacall-alpha.s. Include elfhack-alpha.S. + * callback/vacall_r/vacall-arm-macro.S: Include elfhack-arm.S. + * callback/vacall_r/vacall-armel-macro.S: Renamed from + callback/vacall_r/vacall-armel.s. Include asm-arm.h and elfhack-arm.S. + * callback/vacall_r/vacall-i386-macro.S: Include elfhack-i386.S. + * callback/vacall_r/vacall-m68k.mit.S: Include elfhack-m68k.S. + * callback/vacall_r/vacall-m68k-netbsd-macro.S: Likewise. + * callback/vacall_r/vacall-mips-macro.S: Include elfhack-mips.S. + * callback/vacall_r/vacall-mipsn32-macro.S: Likewise. + * callback/vacall_r/vacall-mips64-macro.S: Include elfhack-mips64.S. + * callback/vacall_r/vacall-powerpc-linux-macro.S: Generated, to include + elfhack-powerpc.S. + * callback/vacall_r/vacall-powerpc-netbsd-macro.S: Generated, to include + elfhack-powerpc.S. + * callback/vacall_r/vacall-powerpc-sysv4-macro.S: Renamed from + callback/vacall_r/vacall-powerpc-sysv4.s. Include elfhack-powerpc.S. + * callback/vacall_r/vacall-powerpc64le-macro.S: Renamed from + callback/vacall_r/vacall-powerpc64le.s. Include elfhack-powerpc64le.S. + * callback/vacall_r/vacall-s390-linux.s: Renamed from + callback/vacall_r/vacall-s390.s. + * callback/vacall_r/vacall-s390-macro.S: Generated, to include + elfhack-s390.S. + * callback/vacall_r/vacall-x86_64-macro.S: Include elfhack-x86_64.S. + * callback/vacall_r/Makefile.in (ASPFLAGS): Conditionally define + BINFMT_ELF. + (vacall-i386.s, vacall-m68k.s, vacall-mips.s, vacall-mipsn32.s, + vacall-mips64.s): Add a -I option for elfhack-*.S. + (vacall-alpha.s): New target. + (vacall-alpha.lo): Depend on it. + (vacall-arm.s): Add a -I option for elfhack-*.S. + (vacall-armel.s): New target. + (vacall-armel.lo): Depend on it. + (vacall-powerpc.s): For the linux, netbsd, sysv4 syntaxes, use the + corresponding *.S file. + (vacall-powerpc64le.s): New target. + (vacall-powerpc64le.lo): Depend on it. + (vacall-x86_64.s): Add a -I option for elfhack-*.S. + (vacall-s390.s): New target. + (vacall-s390.lo): Depend on it. + (clean): Remove also vacall-alpha.s, vacall-armel.s, + vacall-powerpc64le.s, vacall-s390.s. + (SOURCE_FILES): Update for the renamed files. Add + vacall-powerpc-linux-macro.S, vacall-powerpc-netbsd-macro.S, + vacall-s390-macro.S, elfhack-*.S, elfhack-*.sed. + * README: Clarify on which platforms the problem with the ELF symbol + resolving routine still exists. + +2016-12-31 Bruno Haible + + Update doc about available registers. + * callback/call-used-registers.txt: Clarify call-used registers versus + registers available for use in trampolines. + * trampoline/tramp-powerpc-old.s: Mark as obsolete. + * callback/trampoline_r/tramp-powerpc-old.s: Likewise. + * trampoline/tramp-x86_64.s: Fix comment about available registers. + * callback/trampoline_r/tramp-x86_64.s: Likewise. + * trampoline/tramp-powerpc-sysv4.s: Likewise. + * callback/trampoline_r/tramp-powerpc-sysv4.s: Likewise. + * trampoline/tramp-*.s: Update comment about available registers. + * trampoline/tramp-*.S: Likewise. + * callback/trampoline_r/tramp-*.s: Likewise. + * callback/trampoline_r/tramp-*.S: Likewise. + +2016-12-31 Bruno Haible + + Simplify powerpc compilation rules. + * avcall/Makefile.in (avcall-powerpc.s): New rule. + (avcall-powerpc.lo): Depend on it. Remove libtool specific workaround. + (clean): Remove also avcall-powerpc.s. + * vacall/Makefile.in (vacall-powerpc.s): New rule. + (vacall-powerpc.o): Depend on it. + (clean): Remove also vacall-powerpc.s. + * callback/vacall_r/Makefile.in (vacall-powerpc.s): New rule. + (vacall-powerpc.lo): Depend on it. Remove libtool specific workaround. + (clean): Remove also vacall-powerpc.s. + +2016-12-29 Bruno Haible + + Revert "Pass the environment argument through the stack, not in a + register." commit from 1999-06-01. + * vacall/vacall-i386.c: Revert: Allow use of registers %esi, %edi, %ebp. + Expect env in %ecx, not as first stack argument. + * vacall/vacall-i386-macro.S: Revert. + * callback/vacall_r/vacall-i386-macro.S: Revert. + * callback/trampoline_r/proto.c (tramp2): Remove function. + * callback/trampoline_r/proto-i386.s: Revert accordingly. + * callback/trampoline_r/tramp-i386.s: Put the data in %ecx, not as + first stack argument. + * callback/trampoline_r/trampoline.c [i386]: Revert to simple + trampoline. + * callback/trampoline_r/test1.c (f) [i386]: Expect env in %ecx, not as + first stack argument. + +2016-12-29 Bruno Haible + + Revert "Never build shared libraries: --enable-shared has no effect." + commit from 2012-04-24. + * README: Revert, but still recommend --disable-shared. + * avcall/Makefile.in (libavcall.la): Don't pass -static to libtool. + * callback/Makefile.in (libcallback.la): Likewise. + * callback/vacall_r/Makefile.in (libvacall.la): Likewise. + * callback/trampoline_r/Makefile.in (libtrampoline.la): Likewise. + +2016-12-30 Bruno Haible + + Rename text files. + * common/reg-struct-return.txt: Renamed from common/reg-struct-return. + * callback/call-used-registers.txt: Renamed from + callback/call-used-registers. + * trampoline/PORTING: Update. + * callback/README: Likewise. + +2016-12-29 Bruno Haible + + Update documentation about register usage. + * callback/call-used-registers: Update regarding powerpc/NetBSD. + +2016-12-29 Bruno Haible + + Remove support for the 'convex' CPU. + * avcall/Makefile.devel (avcall-convex.s, tests-convex.s): Remove + targets. + * avcall/avcall-convex.[cs]: Remove files. + * avcall/Makefile.in (avcall-convex.lo): Remove target. + (SOURCE_FILES): Remove avcall-convex.[cs]. + * avcall/avcall.h.in: Remove defined(__convex__) conditionals. + * vacall/Makefile.devel (vacall-convex.s, tests-convex.s): Remove + targets. + * vacall/vacall-convex.[cs]: Remove files. + * vacall/Makefile.in (vacall-convex.o): Remove target. + (SOURCE_FILES): Remove vacall-convex.[cs]. + * vacall/vacall.h.in: Remove defined(__convex__) conditionals. + * trampoline/Makefile.devel (proto-convex.s, cache-convex.s, + tramp-convex.s): Remove targets. + * trampoline/proto-convex.s: Remove file. + * trampoline/cache-convex.[cs]: Remove files. + * trampoline/tramp-convex.s: Remove file. + * trampoline/Makefile.in (cache-convex.o): Remove target. + (SOURCE_FILES): Remove cache-convex.[cs]. + * trampoline/cache.c: Remove defined(__convex__) conditionals. + * trampoline/protexec.c: Remove defined(__convex__) conditionals. + * trampoline/trampoline.c: Remove defined(__convex__) conditionals. + * trampoline/trampoline.h.in: Don't test for convex host. + * trampoline/configure.ac: Don't test for convex host. + * callback/vacall_r/Makefile.devel (vacall-convex.s): Remove target. + * callback/vacall_r/vacall-convex.s: Remove file. + * callback/vacall_r/Makefile.in (vacall-convex.lo): Remove target. + (SOURCE_FILES): Remove vacall-convex.[cs]. + * callback/vacall_r/vacall_r.h.in: Remove defined(__convex__) + conditionals. + * callback/trampoline_r/Makefile.devel (proto-convex.s, cache-convex.s, + tramp-convex.s): Remove targets. + * callback/trampoline_r/proto-convex.s: Remove file. + * callback/trampoline_r/tramp-convex.s: Remove file. + * callback/trampoline_r/Makefile.in (cache-convex.lo): Remove target. + (SOURCE_FILES): Remove cache-convex.[cs]. + * callback/trampoline_r/proto.c: Remove defined(__convex__) + conditionals. + * callback/trampoline_r/trampoline.c: Remove defined(__convex__) + conditionals. + * callback/trampoline_r/trampoline_r.h.in: Don't test for convex host. + * callback/trampoline_r/test1.c: Remove defined(__convex__) + conditionals. + * callback/trampoline_r/configure.ac: Don't test for convex host. + * callback/call-used-registers: Update. + * common/reg-struct-return: Update. + * PLATFORMS, **/PLATFORMS: Update. + * autogen.sh: Don't copy vacall-convex.c, cache-convex.[cs]. + * Makefile.in (COPIED_FILES): Remove callback/vacall_r/vacall-convex.c, + callback/trampoline_r/cache-convex.[cs]. + +2016-12-29 Bruno Haible + + Fix collision between different copies of __structcpy. + Reported in https://savannah.gnu.org/bugs/?23474 . + * avcall/avcall-structcpy.c: New file. + * avcall/Makefile.in (avcall-structcpy.lo): Renamed from structcpy.lo. + (SOURCE_FILES): Add avcall-structcpy.c. + * avcall/Makefile.mingw32 (avcall-structcpy.o): Renamed from + structcpy.o. + * avcall/Makefile.msvc (avcall-structcpy.obj): Renamed from + structcpy.obj. + * avcall/avcall.h.in: Declare and use avcall_structcpy instead of + __structcpy. + * avcall/README: Update. + * vacall/vacall-structcpy.c: New file. + * vacall/Makefile.in (vacall-structcpy.o): Renamed from structcpy.o. + (SOURCE_FILES): Add vacall-structcpy.c. + * vacall/Makefile.mingw32 (vacall-structcpy.o): Renamed from + structcpy.o. + * vacall/Makefile.msvc (vacall-structcpy.obj): Renamed from + structcpy.obj. + * vacall/vacall.h.in: Declare and use vacall_structcpy instead of + __structcpy. + * callback/vacall_r/vacall-structcpy.c: New file. + * callback/vacall_r/Makefile.in (vacall-structcpy.lo): Renamed from + structcpy.lo. + (SOURCE_FILES): Add vacall-structcpy.c. + * callback/vacall_r/Makefile.mingw32 (vacall-structcpy.o): Renamed from + structcpy.o. + * callback/vacall_r/Makefile.msvc (vacall-structcpy.obj): Renamed from + structcpy.obj. + * callback/vacall_r/vacall_r.h.in: Declare and use callback_structcpy + instead of __structcpy. + * callback/Makefile.in (libcallback.la): Use vacall-structcpy.lo, not + structcpy.lo. + * callback/Makefile.mingw32 (OBJECTS): Use vacall-structcpy.o, not + structcpy.o. + * callback/Makefile.msvc (OBJECTS): Use vacall-structcpy.obj, not + structcpy.obj. + (vacall_r/vacall-structcpy.obj): Renamed from vacall_r/structcpy.obj. + (clean): Update accordingly. + +2016-12-29 Bruno Haible + + Put duplicated files under version control only once, part 2. + * vacall/vacall-powerpc.c: Update with the 'REENTRANT' code from + callback/vacall_r/. + * vacall/vacall-s390.c: Likewise. + * callback/vacall_r/vacall-alpha.c: Remove file. + * callback/vacall_r/vacall-arm.c: Remove file. + * callback/vacall_r/vacall-armel.c: Remove file. + * callback/vacall_r/vacall-convex.c: Remove file. + * callback/vacall_r/vacall-hppa.c: Remove file. + * callback/vacall_r/vacall-i386.c: Remove file. + * callback/vacall_r/vacall-ia64.c: Remove file. + * callback/vacall_r/vacall-m68k.c: Remove file. + * callback/vacall_r/vacall-m88k.c: Remove file. + * callback/vacall_r/vacall-mips.c: Remove file. + * callback/vacall_r/vacall-mipsn32.c: Remove file. + * callback/vacall_r/vacall-mips64.c: Remove file. + * callback/vacall_r/vacall-powerpc.c: Remove file. + * callback/vacall_r/vacall-powerpc64.c: Remove file. + * callback/vacall_r/vacall-powerpc64le.c: Remove file. + * callback/vacall_r/vacall-s390.c: Remove file. + * callback/vacall_r/vacall-sparc.c: Remove file. + * callback/vacall_r/vacall-sparc64.c: Remove file. + * callback/vacall_r/vacall-x86_64.c: Remove file. + * autogen.sh: Copy these files from vacall/. + * Makefile.in (COPIED_FILES): Add these files. + +2016-12-28 Bruno Haible + + More robust quoting in Autoconf macros. + * configure.ac: Add brackets around Autoconf macro arguments. + * avcall/configure.ac: Likewise. + * vacall/configure.ac: Likewise. + * trampoline/configure.ac: Likewise. + * callback/configure.ac: Likewise. + * callback/vacall_r/configure.ac: Likewise. + * callback/trampoline_r/configure.ac: Likewise. + * m4/as-underscore.m4: Likewise. + * m4/cc-gcc.m4: Likewise. + * m4/codeexec.m4: Likewise. + * m4/general.m4: Likewise. + * m4/getpagesize.m4: Likewise. + * m4/ireg.m4: Likewise. + * m4/ln.m4: Likewise. + * m4/mach-vm.m4: Likewise. + * m4/mmap.m4: Likewise. + * m4/mprotect.m4: Likewise. + * m4/pccstruct.m4: Likewise. + * m4/proto.m4: Likewise. + * m4/shm.m4: Likewise. + * m4/smallstruct.m4: Likewise. + +2016-12-28 Bruno Haible + + Update list of contributors. + * README: List all contributors. + +2016-12-28 Bruno Haible + + Add support for 64-bit mode (x86_64) on Mac OS X. + * common/asm-x86_64.sh: New file. + * common/asm-x86_64.h: New file. + * Makefile.in (SOURCE_FILES): Add them. + * avcall/avcall-x86_64-linux.s: Renamed from avcall/avcall-x86_64.s. + * avcall/Makefile.devel (avcall-x86_64-linux.s): Renamed from avcall-x86_64.s. + (avcall-x86_64-macro.S): New target. + * avcall/avcall-x86_64-macro.S: New file, generated through avcall/Makefile.devel. + * avcall/Makefile.in (avcall-x86_64.s): New target. + (avcall-x86_64.lo): Use it, in the build dir. + (clean): Remove it. + (SOURCE_FILES): Add avcall-x86_64-linux.s, avcall-x86_64-macro.S. Remove avcall-x86_64.s. + * vacall/vacall-x86_64-linux.s: Renamed from vacall/vacall-x86_64.s. + * vacall/Makefile.devel (vacall-x86_64-linux.s): Renamed from vacall-x86_64.s. + (vacall-x86_64-macro.S): New target. + * vacall/vacall-x86_64-macro.S: New file, generated through vacall/Makefile.devel. + * vacall/Makefile.in (vacall-x86_64.s): New target. + (vacall-x86_64.o): Use it, in the build dir. + (clean): Remove it. + (SOURCE_FILES): Add vacall-x86_64-linux.s, vacall-x86_64-macro.S. Remove vacall-x86_64.s. + * callback/vacall_r/vacall-x86_64-linux.s: Renamed from callback/vacall_r/vacall-x86_64.s. + * callback/vacall_r/Makefile.devel (vacall-x86_64-linux.s): Renamed from vacall-x86_64.s. + (vacall-x86_64-macro.S): New target. + * callback/vacall_r/vacall-x86_64-macro.S: New file, generated through callback/vacall_r/Makefile.devel. + * callback/vacall_r/Makefile.in (vacall-x86_64.s): New target. + (vacall-x86_64.lo): Use it, in the build dir. + (clean): Remove it. + (SOURCE_FILES): Add vacall-x86_64-linux.s, vacall-x86_64-macro.S. Remove vacall-x86_64.s. + * callback/trampoline_r/test1.c (CHECK_ENV_REGISTER): New macro. + (f, main): Use it instead of __GNUC__. + * NEWS: Mention the change. + +2016-12-28 Bruno Haible + + Rename the asm* files. + * common/asm-arm.h: Renamed from common/asmarm.h. + * common/asm-arm.sh: Renamed from common/asmarm.sh. + * common/asm-i386.hh: Renamed from common/asmi386.hh. + * common/asm-i386.sh: Renamed from common/asmi386.sh. + * common/asm-m68k.h: Renamed from common/asmm68k.h. + * common/asm-m68k.sh: Renamed from common/asmm68k.sh. + * common/asm-mips.h: Renamed from common/asmmips.h. + * common/asm-mips.sh: Renamed from common/asmmips.sh. + * common/asm-sparc.h: Renamed from common/asmsparc.h. + * common/asm-sparc.sh: Renamed from common/asmsparc.sh. + * common/asm-sparc64.sh: Renamed from common/asmsparc64.sh. + * **/Makefile.devel, **/*.S: Update. + * Makefile.maint (common/asm-i386.h): Renamed from common/asmi386.h. + * Makefile.in (SOURCE_FILES, GENERATED_FILES): Update. + +2016-12-27 Bruno Haible + + Add the real source of asmi386.h. + * common/asmi386.hh: New file, from GNU clisp. + * common/asmi386.h: Remove file. + * Makefile.maint (common/asmi386.h): New target. Rule copied from + GNU clisp's Makefile.devel. + (all): Depend on it. + * Makefile.in (SOURCE_FILES): Add common/asmi386.hh. Remove + common/asmi386.h. + (GENERATED_FILES): Add common/asmi386.h. + +2016-12-27 Bruno Haible + + Modernize Cygwin detection. + * common/asmi386.h: Test __CYGWIN__, not __CYGWIN32__. + From Ken Brown on 2015-03-05. + +2016-12-27 Bruno Haible + + Create tarballs through an Automake-like "make dist" command. + * Makefile.in (SOURCE_FILES, LIBTOOL_IMPORTED_FILES, + GNULIB_IMPORTED_FILES, IMPORTED_FILES, COPIED_FILES, GENERATED_FILES, + DISTFILES): New macros. + (distdir): New target. + (PACKAGE, VERSION, TAR, GZIP): New macros. + (dist): New target. + * avcall/Makefile.in (SOURCE_FILES, GENERATED_FILES, DISTFILES): New + macros. + (distdir): New target. + * vacall/Makefile.in (SOURCE_FILES, GENERATED_FILES, DISTFILES): New + macros. + (distdir): New target. + * trampoline/Makefile.in (SOURCE_FILES, GENERATED_FILES, DISTFILES): + New macros. + (distdir): New target. + * callback/Makefile.in (SOURCE_FILES, GENERATED_FILES, DISTFILES): New + macros. + (distdir): New target. + * callback/vacall_r/Makefile.in (SOURCE_FILES, GENERATED_FILES, + DISTFILES): New macros. + (distdir): New target. + * callback/trampoline_r/Makefile.in (SOURCE_FILES, GENERATED_FILES, + DISTFILES): New macros. + (distdir): New target. + * configure.ac (extrasub): Replace all occurrences of @subdir@. + * callback/configure.ac (extrasub): Likewise. + +2016-12-27 Bruno Haible + + Bump version number. + * VERSION: Set to 0x010D (= 1.13). + +2016-12-27 Bruno Haible + + Rename each configure.in to configure.ac. + * configure.ac: Renamed from configure.in. + * avcall/configure.ac: Renamed from avcall/configure.in. + * vacall/configure.ac: Renamed from vacall/configure.in. + * trampoline/configure.ac: Renamed from trampoline/configure.in. + * callback/configure.ac: Renamed from callback/configure.in. + * callback/vacall_r/configure.ac: Renamed from + callback/vacall_r/configure.in. + * callback/trampoline_r/configure.ac: Renamed from + callback/trampoline_r/configure.in. + * Makefile.maint (ALL_CONFIGURE_AC): Renamed from ALL_CONFIGURE_IN. + (aclocal.m4, configure, %/configure, %/config.h.in): Update. + * README, */README: Update. + +2016-12-27 Bruno Haible + + Modernize quoting. + * NEWS: Quote ‘like this’, not `like this'. + * README.os2: Likewise. + * common/uniq-u.c: Likewise. + * avcall/DOC: Likewise. + * avcall/avcall-i386.c: Likewise. + * avcall/avcall-sparc.c: Likewise. + * avcall/avcall-sparc64.c: Likewise. + * avcall/avcall.h.in: Likewise. + * avcall/avcall.html: Likewise. + * vacall/vacall.h.in: Likewise. + * callback/trampoline_r/trampoline.c: Likewise. + * callback/trampoline_r/trampoline_r.h.in: Likewise. + * trampoline/PORTING: Likewise. + * trampoline/trampoline.c: Likewise. + * trampoline/trampoline.h.in: Likewise. + * callback/vacall_r/vacall_r.h.in: Likewise. + * configurations/README: Likewise. + * avcall/Makefile.maint (ROFF_MAN): Produce UTF-8 output instead of + ASCII output. + * vacall/Makefile.maint (ROFF_MAN): Likewise. + * trampoline/Makefile.maint (ROFF_MAN): Likewise. + * callback/Makefile.maint (ROFF_MAN): Likewise. + * callback/trampoline_r/Makefile.maint (ROFF_MAN): Likewise. + +2016-12-27 Bruno Haible + + Avoid unnecessary recursion in "make maintainer-clean". + * Makefile.in (DISTCLEANFILES): New variable. + (distclean, maintainer-clean): Use it. + * callback/Makefile.in (DISTCLEANFILES): New variable. + (distclean): Use it. Don't depend on 'clean'. Instead, use + MOSTLYCLEANDIRS, MOSTLYCLEANFILES. + (maintainer-clean): Don't depend on 'distclean'. Instead, use + MOSTLYCLEANDIRS, MOSTLYCLEANFILES, DISTCLEANFILES. + (distclean-subdirs, maintainerclean-subdirs): Inline and remove targets. + +2016-12-27 Bruno Haible + + Make "make mostlyclean" act like "make clean". + * callback/Makefile.in (MOSTLYCLEANDIRS, MOSTLYCLEANFILES): New + variables. + (mostlyclean, clean): Use them. + (clean-subdirs): Inline and remove target. + +2016-12-27 Bruno Haible + + Fix Makefile rules for powerpc64, from 2006-04-27. + * trampoline/Makefile.in (clean): Also remove tramp-powerpc64.s. + * callback/trampoline_r/Makefile.in (clean): Likewise. + +2016-12-26 Bruno Haible + + Reorder Makefile targets. + * trampoline/Makefile.in: Reorder. + * callback/trampoline_r/Makefile.in: Reorder. + +2016-12-26 Bruno Haible + + Fix Makefile rules for powerpc64le, from 2015-08-23. + * trampoline/Makefile.devel (CPP): New variable. + (tramp-powerpc64le.o, tramp-powerpc64le.s): New targets. + * trampoline/Makefile.in (tramp-powerpc64le.o, tramp-powerpc64le.s): + Remove targets. + * callback/trampoline_r/Makefile.devel (CPP): New variable. + (tramp-powerpc64le.o, tramp-powerpc64le.s): New targets. + * callback/trampoline_r/Makefile.in (tramp-powerpc64le.lo, + tramp-powerpc64le.s): Remove targets. + +2016-12-26 Bruno Haible + + Fix Makefile rules for s390, from 2002-03-24. + * trampoline/Makefile.devel (tramp-s390.o): New target. + * trampoline/Makefile.in (tramp-s390.o): Remove target. + * callback/trampoline_r/Makefile.devel (tramp-s390.o): New target. + * callback/trampoline_r/Makefile.in (tramp-s390.lo): Remove target. + +2016-12-26 Bruno Haible + + Fix "make distclean". + * avcall/Makefile.in (distclean): Also remove config.h. + * callback/Makefile.in (distclean): Likewise. + +2016-12-26 Bruno Haible + + Make it possible to build in $(srcdir) on case-insensitive file systems. + * avcall/avcall-${cpu}-macro.S: Renamed from avcall/avcall-${cpu}.S. + * avcall/Makefile.devel: Update accordingly. + * avcall/Makefile.in: Likewise. + * vacall/vacall-${cpu}-macro.S: Renamed from vacall/vacall-${cpu}.S. + * vacall/Makefile.devel: Update accordingly. + * vacall/Makefile.in: Likewise. + * trampoline/cache-sparc-macro.S: Renamed from trampoline/cache-sparc.S. + * trampoline/Makefile.devel: Update accordingly. + * trampoline/Makefile.in: Update accordingly. + * callback/vacall_r/vacall-${cpu}-macro.S: Renamed from + callback/vacall_r/vacall-${cpu}.S. + * callback/vacall_r/Makefile.devel: Update accordingly. + * callback/vacall_r/Makefile.in: Likewise. + * callback/trampoline_r/cache-sparc-macro.S: Renamed from + callback/trampoline_r/cache-sparc.S. + * callback/trampoline_r/Makefile.devel: Update accordingly. + * callback/trampoline_r/Makefile.in: Update accordingly. + +2016-12-26 Bruno Haible + + Simplify armel build rule. + * avcall/Makefile.devel (avcall-armel.s): Renamed from avcall-armel.S. + Simplify. + * avcall/Makefile.in (avcall-armel.lo): Use $(srcdir)/avcall-armel.s. + (avcall-armel.s): Remove target. + +2016-12-26 Bruno Haible + + Put duplicated files under version control only once. + * autogen.sh: Copy some files from trampoline/ to callback/trampoline_r. + * common/asm*.sh: Moved here from avcall/, vacall/, callback/vacall_r. + * common/asm*.h: Likewise. + * common/reg-struct-return: Likewise. + * common/structcpy.c: Likewise. + * common/uniq-u.c: Moved here from avcall/, vacall/, callback/. + * avcall/Makefile.devel: Update paths of asm*.sh. + * avcall/Makefile.in: Add -I options for asm*.h. Update path of structcpy.c. + * avcall/Makefile.mingw32: Likewise. + * avcall/Makefile.msvc: Likewise. Update path of uniq-u.c. + * vacall/Makefile.devel: Update paths of asm*.sh. + * vacall/Makefile.in: Add -I options for asm*.h. Update path of structcpy.c. + * vacall/Makefile.mingw32: Likewise. + * vacall/Makefile.msvc: Likewise. Update path of uniq-u.c. + * trampoline/Makefile.devel: Update paths of asm*.sh. + * trampoline/Makefile.in: Add -I options for asm*.h. + * callback/Makefile.msvc: Update path of uniq-u.c. + * callback/vacall_r/Makefile.devel: Update paths of asm*.sh. + * callback/vacall_r/Makefile.in: Add -I options for asm*.h. Update path of structcpy.c. + * callback/vacall_r/Makefile.mingw32: Likewise. + * callback/vacall_r/Makefile.msvc: Likewise. + * callback/trampoline_r/Makefile.devel: Update paths of asm*.sh. + * callback/trampoline_r/Makefile.in: Add -I options for asm*.h. + +2016-12-26 Bruno Haible + + Fix dependencies. + * avcall/Makefile.devel (avcall-sparc64.S): Depend on asmsparc64.sh, + not asmsparc.sh. + * vacall/Makefile.devel (vacall-sparc64.S): Likewise. + * callback/vacall_r/Makefile.devel (vacall-sparc64.S): Likewise. + * callback/Makefile.maint (vacall_r/vacall-i386-*.c): Don't depend on + vacall_r/asmi386.sh. + +2016-12-26 Bruno Haible + + Add missing dependency. + * callback/vacall_r/Makefile.devel (vacall-m68k-netbsd.S): Depend on + asmm68k.sh. + +2016-12-26 Bruno Haible + + Switch to libtool-2.4.6. + * autogen.sh (LIBTOOL_VERSION): Set to 2.4.6. + * Makefile.maint (libtool-imported-files): Import also m4/ltoptions.m4, + m4/ltsugar.m4, m4/ltversion.m4, m4/lt~obsolete.m4. + * m4/general.m4 (FFCALL_COMMON_LIBTOOL): Invoke LT_INIT. + +2016-12-26 Bruno Haible + + Switch to autoconf 2.69 and automake 1.15. + * Makefile.maint (ACLOCAL, AUTOCONF, AUTOHEADER): Bump version numbers. + +2016-12-26 Bruno Haible + + Remove files that can easily be autogenerated from version control. + * autogen.sh: New file. + * Makefile.maint: New file, partially inspired by Makefile.devel. + * Makefile.devel (all): Remove target and its subtargets. + * avcall/Makefile.maint: New file, extracted from avcall/Makefile.devel. + * avcall/Makefile.devel (precompiled): Renamed from 'all'. + Remove all targets that are moved to avcall/Makefile.maint. + * vacall/Makefile.maint: New file, extracted from vacall/Makefile.devel. + * vacall/Makefile.devel (precompiled): Renamed from 'all'. + Remove all targets that are moved to vacall/Makefile.maint. + * trampoline/Makefile.maint: New file, extracted from + trampoline/Makefile.devel. + * trampoline/Makefile.devel (precompiled): Renamed from 'all'. + Remove all targets that are moved to trampoline/Makefile.maint. + * callback/Makefile.maint: Renamed from callback/Makefile.devel. + (trampoline_r/trampoline_r.man): New target. + (totally-clean, force): New targets. + * callback/vacall_r/Makefile.maint: New file, extracted from + callback/vacall_r/Makefile.devel. + * callback/vacall_r/Makefile.devel (precompiled): Renamed from 'all'. + Remove all targets that are moved to callback/vacall_r/Makefile.maint. + (vacall_r.man): Remove target. + * callback/trampoline_r/Makefile.maint: New file, extracted from + callback/trampoline_r/Makefile.devel. + * callback/trampoline_r/Makefile.devel (precompiled): Renamed from + 'all'. + Remove all targets that are moved to + callback/trampoline_r/Makefile.maint. + +2016-12-26 Bruno Haible + + Remove test result files from version control. + * callback/trampoline_r/tests.passed.i386-pc-win32-gcc: Remove file. + +2015-08-23 Hernán Erasmo + + Added compatibility with ppc64le architecture. Credit goes + to Masanori Mitsugi + +2012-04-24 Sam Steingold + + Never build shared libraries: --enable-shared has no effect. + * avcall/Makefile.in (libavcall.la): pass -static to LIBTOOL_LINK + * callback/Makefile.in (libcallback.la): ditto + * callback/trampoline_r/Makefile.in (libtrampoline.la): ditto + * callback/vacall_r/Makefile.in (libvacall.la): ditto + +2010-09-03 Sam Steingold + + * configure.in: call AC_CONFIG_AUX_DIR(build-aux) + +2010-09-03 Sam Steingold + + * Makefile.devel (gnulib-imported): also import host-cpu-c-abi + * avcall/configure.in, callback/configure.in: + * callback/trampoline_r/configure.in, callback/vacall_r/configure.in: + * trampoline/configure.in, vacall/configure.in: + use gl_HOST_CPU_C_ABI instead of FFCALL_CANONICAL_HOST_CPU + * m4/general.m4: remove FFCALL_CANONICAL_HOST_CPU, + FFCALL_CACHE_EGREP_CPP, FFCALL_SET_CPU_ABI + * glm4/host-cpu-c-abi.m4: add + * avcall/Makefile.in, callback/Makefile.in: + * callback/trampoline_r/Makefile.in, callback/vacall_r/Makefile.in: + * trampoline/Makefile.in, vacall/Makefile.in, + use @HOST_CPU_C_ABI@ instead of @host_cpu_abi@ + * callback/trampoline_r/configure.in, trampoline/configure.in: + * m4/codeexec.m4: use $HOST_CPU_C_ABI instead of $host_cpu_abi + +2010-07-20 Sam Steingold + + * callback/trampoline_r/trampoline_r.h.in, trampoline/trampoline.h.in: + add autoconf CPU detection block; this fixes trampoline on sparc64/linux + Suggested by Valeriy E. Ushakov + +2010-07-20 Valeriy E. Ushakov + + https://savannah.gnu.org/bugs/?22081 + support sparc64 for solaris & *bsd + * avcall/avcall-sparc64.c, avcall/avcall.h.in: + Kill callee (%g2). Sparc64 doesn't need that code. + Delete space[] - gcc optimizes it away anyway, and it doesn't + guarantee correct operation even if it's not removed - if compiler + allocs it below other local vars on the stack, then calling + function with enough arguments will clobber local vars. + Instead i've changed the code to use alloca, see the comment in + the code for details on why this works. It also doesn't waste 2K + of stack on each call, we only grab the space we actually need. + I nuked farg_mask. It's not necessary for float args, marking + them in darg_mask does the right thing (new av_float). And they + just hurt structure passing, where, again, marking up darg_mask + does the right thing. + * avcall/avcall-saprc64.S: Regenerated with NetBSD gcc4 + * vacall/vacall-sparc64.S, callback/vacall_r/vacall-sparc64.S: + New binutils on sparc64 insist on having global registers properly + declared with .register. I've just added the declarations manually + w/out actually regenerating the files to demonstrate that's the + only change needed there. IF the files are regenerated with a + newer compiler you will get them automatically. + +2009-11-10 Sam Steingold + + * vacall/Makefile.in (vacall-armel.o): vacall-armel.s is in $(srcdir) + * callback/vacall_r/Makefile.in (vacall-armel.lo): ditto + +2009-10-16 Sam Steingold + + the final fix for LIBFFCALL_VERSION + * Makefile.devel (vacall/vacall.h.msvc, vacall/vacall.h.mingw32) + (callback/vacall_r/vacall_r.h.msvc) + (callback/vacall_r/vacall_r.h.mingw32): depend on VERSION + * avcall/avcall.h.in, callback/callback.h.in, + * callback/trampoline_r/trampoline_r.h.in, vacall/vacall.h.in, + * callback/vacall_r/vacall_r.h.in, trampoline/trampoline.h.in: + use @LIBFFCALL_VERSION@ instead of @PACKAGE_VERSION@ + * avcall/configure.in: additional processing for avcall.h to + substitute @LIBFFCALL_VERSION@ + * callback/configure.in: ditto for callback.h + * callback/trampoline_r/configure.in: ditto for trampoline_r.h + * callback/vacall_r/configure.in: ditto for vacall_r.h + * trampoline/configure.in: ditto for trampoline.h + * vacall/configure.in: ditto for vacall.h + * callback/vacall_r/Makefile.devel (vacall_r.h.msvc) + (vacall_r.h.mingw32): depend on ../../VERSION; + substitute @LIBFFCALL_VERSION@ + * vacall/Makefile.devel (vacall.h.msvc, vacall.h.mingw32): depend + on ../VERSION; substitute @LIBFFCALL_VERSION@ + +2009-10-16 Sam Steingold + + * glm4/longlong.m4, glm4/nocrash.m4: update from gnulib + +2009-10-16 Sam Steingold + + * Makefile.devel (update-gnulib): use git when available + +2009-10-16 Sam Steingold + + * avcall/configure.in, callback/configure.in, + * callback/trampoline_r/configure.in, callback/vacall_r/configure.in, + * trampoline/configure.in, vacall/configure.in: list the main generated + header (avcall.h et al) in AC_CONFIG_HEADERS, not in AC_CONFIG_FILES + fixes the bug#27706 (introduced on 2009-04-24) + +2009-04-28 Sam Steingold + + * m4/general.m4 (FFCALL_CACHE_EGREP_CPP, FFCALL_SET_CPU_ABI): + abstracted out of FFCALL_CANONICAL_HOST_CPU + (FFCALL_CANONICAL_HOST_CPU): use them + +2009-04-27 Max Lapan + Sam Steingold + + * avcall/Makefile.devel, avcall/Makefile.in, avcall/avcall.h.in, + * callback/trampoline_r/Makefile.devel, + * callback/trampoline_r/Makefile.in, + * callback/trampoline_r/configure.in, + * callback/vacall_r/Makefile.devel, callback/vacall_r/Makefile.in, + * callback/vacall_r/vacall_r.h.in, trampoline/Makefile.devel, + * trampoline/Makefile.in, trampoline/configure.in, + * vacall/Makefile.devel, vacall/Makefile.in, vacall/vacall.h.in: + Add ARMel support + * m4/general.m4 (FFCALL_CANONICAL_HOST_CPU): use AC_EGREP_CPP to + distinguish between arm and armel + * avcall/avcall-armel.S, avcall/avcall-armel.c, + * callback/trampoline_r/cache-armel.c, + * callback/trampoline_r/cache-armel.s, + * callback/vacall_r/vacall-armel.c, callback/vacall_r/vacall-armel.s, + * trampoline/cache-armel.c, trampoline/cache-armel.s, + * vacall/vacall-armel.c, vacall/vacall-armel.s: + new files + +2009-04-27 Max Lapan + + * avcall/tests.c, callback/tests.c, vacall/tests.c: + #include "config.h" for HAVE_LONG_LONG_INT + +2009-04-27 Max Lapan + + * callback/trampoline_r/trampoline.c (is_tramp) [__arm__]: + fix bug in the last patch + +2009-04-24 Sam Steingold + + * avcall/configure.in, callback/configure.in, + * callback/trampoline_r/configure.in, callback/vacall_r/configure.in, + * trampoline/configure.in, vacall/configure.in: + use AC_CONFIG_FILES instead of AC_OUTPUT with argument + * Makefile.devel (aclocal.m4): adjust the grep regexp + +2009-04-24 Sam Steingold + + * Makefile.in, avcall/Makefile.in, callback/Makefile.in, + * callback/trampoline_r/Makefile.in, callback/vacall_r/Makefile.in, + * trampoline/Makefile.in, vacall/Makefile.in (datarootdir): + set to @datarootdir@ to avoid a configure warning + +2009-04-24 Sam Steingold + + * Makefile.devel (SUBDIRS_CONFIG_H): add avcall and callback + +2009-04-24 Sam Steingold + + * VERSION: new file + * configure.in: use AC_INIT with the version argument + * avcall/Makefile.mingw32: use sed to set LIBFFCALL_VERSION in avcall.h + * callback/vacall_r/Makefile.mingw32: + use sed to set LIBFFCALL_VERSION in vacall_r.h + * vacall/Makefile.mingw32: use sed to set LIBFFCALL_VERSION in vacall.h + * avcall/avcall.h.in, callback/callback.h.in, + * callback/trampoline_r/trampoline_r.h.in, + * callback/vacall_r/vacall_r.h.in, + * trampoline/trampoline.h.in, vacall/vacall.h.in: + (LIBFFCALL_VERSION): define to @PACKAGE_VERSION@ + * avcall/configure.in, callback/configure.in, + * callback/trampoline_r/configure.in, callback/vacall_r/configure.in, + * trampoline/configure.in, vacall/configure.in: + use AC_INIT with the version argument, + pass [config.h] to AC_CONFIG_HEADERS + +2009-04-23 Sam Steingold + + * m4/codeexec.m4, m4/ireg.m4, m4/pccstruct.m4, m4/smallstruct.m4: + all 3 arguments of AC_DEFINE are now required + +2009-04-21 Sam Steingold + + * m4/as-underscore.m4, m4/codeexec.m4, m4/general.m4: + * m4/getpagesize.m4, m4/ireg.m4, m4/mach-vm.m4, m4/mmap.m4: + * m4/mprotect.m4, m4/pccstruct.m4, m4/shm.m4, m4/smallstruct.m4: + quote AC_DEFINE arguments + +2008-09-28 Sam Steingold + + * Makefile.devel (aclocal.m4): include glm4 (this defined gl_EARLY + and gl_INIT and fixes make check on x86_64) + +2008-09-26 Sam Steingold + + * avcall/avcall-ia64.s, avcall/avcall.h.in: + * callback/vacall_r/vacall_r.h.in: + support IA64 on Linux (kernel 2.6.16+ and gcc 4.1.0+) + https://savannah.gnu.org/bugs/index.php?22130 + https://sourceforge.net/tracker/index.php?func=detail&aid=1528895&group_id=1355&atid=301355 + +2008-09-26 Sam Steingold + + * callback/trampoline_r/Makefile.in, callback/trampoline_r/cache-arm.c: + * callback/trampoline_r/cache-arm.s, callback/trampoline_r/configure.in: + * callback/trampoline_r/tramp-arm.s, callback/trampoline_r/tramp-mips.s: + * callback/trampoline_r/trampoline.c, trampoline/cache-arm.c: + * trampoline/cache-arm.s, trampoline/configure.in: + * trampoline/tramp-arm.s, trampoline/trampoline.c: + add arm support from Jonathan Olson (debian 1.10-2) + https://savannah.gnu.org/bugs/?func=detailitem&item_id=9468 + +2008-09-26 Sam Steingold + + * avcall/avcall-mips.S, avcall/avcall-mips.c, avcall/avcall.h.in: + * callback/trampoline_r/trampoline.c, callback/vacall_r/vacall_r.h.in: + * m4/general.m4, trampoline/trampoline.c, vacall/vacall.h.in: + add mipsel support from Thiemo Seufer (debian 1.10-2) + +2008-09-26 Sam Steingold + + * Makefile.devel, Makefile.in, callback/Makefile.devel, + * callback/Makefile.in: use "&&" instead of ";" for all targets + +2008-07-13 Sam Steingold + + * glm4/gnulib-cache.m4, glm4/gnulib-common.m4, glm4/gnulib-comp.m4: + * glm4/gnulib-tool.m4, glm4/onceonly.m4: add from gnulib + * glm4/nocrash.m4: update from gnulib + * Makefile.devel (gnulib-imported): remove gllib + * configure.ac: call gl_EARLY and gl_INIT + +2008-07-08 Sam Steingold + + * Makefile.devel (SUBDIRS_CONFIGURE): use $(CURDIR) instead of . + (%/configure): use "&&" instead of ";" + +2008-07-03 Sam Steingold + + * Makefile.devel (all): split into a few manageable targets + (config-h-in, woe32-h, woe32-c): new targets + (configure): use patterns + +2008-07-03 Sam Steingold + + * m4/smallstruct.m4 (FFCALL_SMALL_STRUCT_RETURN): rename from + CL_SMALL_STRUCT_RETURN; use ffcall_cv_* instead of cl_cv_*; + use return instead of exit() + * m4/pccstruct.m4 (FFCALL_PCC_STRUCT_RETURN): rename from + CL_PCC_STRUCT_RETURN; use ffcall_cv_* instead of cl_cv_*; + use return instead of exit() + * m4/ireg.m4 (FFCALL_IREG_FLOAT_RETURN): remame from + CL_IREG_FLOAT_RETURN; use ffcall_cv_* instead of cl_cv_*; + use return instead of exit() + * m4/codeexec.m4 (FFCALL_CODEEXEC): rename from CL_CODEEXEC + use ffcall_cv_* instead of cl_cv_*; use return instead of exit() + * m4/general.m4: remove non-FFCALL code + (FFCALL_COMMON_LIBTOOL): rename from CL_FFCALL_COMMON_LIBTOOL + (FFCALL_COMMON_TRAMPOLINE): rename from CL_FFCALL_COMMON_TRAMPOLINE + (FFCALL_CANONICAL_HOST_CPU): <- CL_CANONICAL_HOST_CPU_FOR_FFCALL + +2008-07-03 Sam Steingold + + * Makefile.devel (build-aux-update): new target + +2008-07-02 Sam Steingold + + * Makefile.devel (gnulib-imported, update-gnulib): new targets + * glm4: new directory + * longlong.m4, nocrash.m4: move from m4 to glm4 + +2008-07-02 Sam Steingold + + * m4/ln.m4: update from clisp + * m4/cp.m4: remove + * m4/getpagesize.m4: update from clisp + * m4/general.m4: update from clisp + * m4/mmap.m4: update from clisp + * m4/mprotect.m4: update from clisp + * m4/proto.m4: update from clisp + * m4/openflags.m4: remove + * m4/cc-void.m4: remove + +2008-07-02 Sam Steingold + + * Makefile.devel, aclocal.m4: move autoconf/aclocal.m4 to aclocal.m4 + * aclocal/autoconf.m4: remove + * Makefile.devel (CLISP_DIR): remove + +2008-07-02 Sam Steingold + + * m4/ffcall-pccstruct.m4, m4/ffcall-smallstruct.m4, m4/ffcall-ireg.m4: + * m4/ffcall-codeexec.m4: remove "ffcall-" prefix + * Makefile.devel: update + +See clisp ChangeLog for earlier changes. diff --git a/DEPENDENCIES b/DEPENDENCIES new file mode 100644 index 0000000..53e34a4 --- /dev/null +++ b/DEPENDENCIES @@ -0,0 +1,76 @@ +The following packages should be installed before GNU libffcall is installed +(runtime dependencies that are also build dependencies): + +None. + + +The following packages should be installed when GNU libffcall is installed +(runtime dependencies, but not build dependencies): + +None. + + +The following should be installed when GNU libffcall is built, but are not +needed later, once it is installed (build dependencies, but not runtime +dependencies): + +* A C runtime, compiler, linker, etc. + + Mandatory. + Either the platform's native 'cc', or GCC 3.1 or newer. + + GCC Homepage: + https://gcc.gnu.org/ + + Download: + https://ftp.gnu.org/gnu/gcc/ + +* A 'make' utility. + + Mandatory. + Either the platform's native 'make' (for in-tree builds only), + or GNU Make 3.79.1 or newer. + + GNU Make Homepage: + https://www.gnu.org/software/make/ + + Download: + https://ftp.gnu.org/gnu/make/ + +* A shell + + Mandatory. + Either the platform's native 'sh', or Bash. + + Homepage: + https://www.gnu.org/software/bash/ + + Download: + https://ftp.gnu.org/gnu/bash/ + +* Core POSIX utilities, including: + [ basename cat chgrp chmod chown cp dd echo expand expr + false hostname install kill ln ls md5sum mkdir mkfifo + mknod mv printenv pwd rm rmdir sleep sort tee test touch + true uname + + Mandatory. + Either the platform's native utilities, or GNU coreutils. + + Homepage: + https://www.gnu.org/software/coreutils/ + + Download: + https://ftp.gnu.org/gnu/coreutils/ + +* The comparison utilities 'cmp' and 'diff'. + + Mandatory. + Either the platform's native utilities, or GNU diffutils. + + Homepage: + https://www.gnu.org/software/diffutils/ + + Download: + https://ftp.gnu.org/gnu/diffutils/ + +* Grep. + + Mandatory. + Either the platform's native grep, or GNU grep. + + Homepage: + https://www.gnu.org/software/grep/ + + Download: + https://ftp.gnu.org/gnu/grep/ + +* Awk. + + Mandatory. + Either the platform's native awk, mawk, or nawk, or GNU awk. + + Homepage: + https://www.gnu.org/software/gawk/ + + Download: + https://ftp.gnu.org/gnu/gawk/ diff --git a/INSTALL.os2 b/INSTALL.os2 new file mode 100644 index 0000000..0c804fe --- /dev/null +++ b/INSTALL.os2 @@ -0,0 +1,10 @@ +Installation on OS/2: + +- Requires emx+gcc and a working shell (Bourne shell, Korn shell or GNU bash). + +- Set the environment variables CC=gcc CFLAGS="-Zexe" before calling + ‘configure’. + +- Must build in a separate directory and pass the --srcdir option to + ‘configure’, otherwise avcall-i386.s will overwrite avcall-i386.S. + diff --git a/INSTALL.windows b/INSTALL.windows new file mode 100644 index 0000000..6892f36 --- /dev/null +++ b/INSTALL.windows @@ -0,0 +1,263 @@ +Installation on Microsoft Windows: + +There are three ways to create binaries of this package for Microsoft Windows: +1) Native binaries, built using the mingw tool chain. +2) Native binaries, built using the MS Visual C/C++ tool chain. +3) Binaries for the Cygwin environment. + +=============================================================================== +1) Native binaries, built using the mingw tool chain. + + I recommend to use the Cygwin environment as the development environment + and mingw only as the target (runtime, deployment) environment. + For this, you need to install + * Cygwin (from https://cygwin.com/), + * some packages available from the Cygwin package installer: + make + * the mingw cross-compilation tools and runtime package, available from + the Cygwin package installer (setup-x86_64.exe): + - for creating 32-bit binaries: packages + mingw64-i686-gcc-core, + mingw64-i686-gcc-g++, + mingw64-i686-headers, + mingw64-i686-runtime + - for creating 64-bit binaries: packages + mingw64-x86_64-gcc-core, + mingw64-x86_64-gcc-g++, + mingw64-x86_64-headers, + mingw64-x86_64-runtime + + Building 32-bit binaries for mingw is achieved through the following + preparation, configure, and build commands: + + PATH=/usr/local/mingw32/bin:/usr/i686-w64-mingw32/sys-root/mingw/bin:$PATH + export PATH + ./configure --host=i686-w64-mingw32 --prefix=/usr/local/mingw32 \ + CC=i686-w64-mingw32-gcc \ + CXX=i686-w64-mingw32-g++ \ + CPPFLAGS="-I/usr/local/mingw32/include -Wall" \ + LDFLAGS="-L/usr/local/mingw32/lib" + make + make check + + Building 64-bit binaries for mingw is achieved through the following + preparation, configure, and build commands: + + PATH=/usr/local/mingw64/bin:/usr/x86_64-w64-mingw32/sys-root/mingw/bin:$PATH + export PATH + ./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/mingw64 \ + CC=x86_64-w64-mingw32-gcc \ + CXX=x86_64-w64-mingw32-g++ \ + CPPFLAGS="-I/usr/local/mingw64/include -Wall" \ + LDFLAGS="-L/usr/local/mingw64/lib" + make + make check + + Installation: + + make install + +=============================================================================== +2) Native binaries, built using the MS Visual C/C++ tool chain. + + Note that binaries created with MSVC have a distribution constraint: They + depend on a closed-source library ('msvcr90.dll' for MSVC 9.0, + 'vcruntime140.dll' for MSVC 14.0, and so on) which is not normally part of + a Windows installation. + You cannot distribute 'vcruntime*.dll' with the binaries - this would be a + violation of the GPL and of the Microsoft EULA. + You can distribute the binaries without including 'vcruntime*.dll'. Users + who don't have this library on their system will require to pull some files + (api-ms-win*.dll) through the Windows Update mechanism, see + https://support.microsoft.com/en-us/kb/2999226 . + + This recipe requires MS Visual C/C++ 9.0 or newer. + You don't need the Visual Studio IDE, just the C/C++ tool chain. + As of 2016, you can install the MS Visual C/C++ 14.0 tool chain from + http://landinghub.visualstudio.com/visual-cpp-build-tools (it's the file + visualcppbuildtools_full.exe). + + This recipe requires also a Cygwin environment (with 'bash', the common POSIX + commands, and 'make') as a build environment. Building with 'nmake' is not + supported. + For this, you need to install + * Cygwin (from https://cygwin.com/), + * some packages available from the Cygwin package installer: + make + + You also need the scripts 'ar-lib' and 'compile' from + https://git.savannah.gnu.org/gitweb/?p=automake.git;a=blob_plain;f=lib/ar-lib;hb=HEAD + https://git.savannah.gnu.org/gitweb/?p=automake.git;a=blob_plain;f=lib/compile;hb=HEAD + respectively. + They may also be included in this package, in directory 'build-aux/'. + Save them; the instructions below assume that you stored them in $HOME/msvc/. + Make them executable: + chmod a+x ar-lib compile + + Start a bash (from Cygwin). + + Make sure that the MSVC tools ("cl" etc.) are found in PATH and the + environment variables INCLUDE and LIB are set appropriately. + In a typical MSVC 9.0 installation, it can be achieved by running + C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat + In a typical MSVC 14.0 installation on Windows 10, it can be achieved + - for creating 32-bit binaries: through the following bash commands: + + # Set environment variables for using MSVC 14, + # for creating native 32-bit Windows executables. + + # Windows C library headers and libraries. + WindowsCrtIncludeDir='C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt' + WindowsCrtLibDir='C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\' + INCLUDE="${WindowsCrtIncludeDir};$INCLUDE" + LIB="${WindowsCrtLibDir}x86;$LIB" + + # Windows API headers and libraries. + WindowsSdkIncludeDir='C:\Program Files (x86)\Windows Kits\8.1\Include\' + WindowsSdkLibDir='C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\' + INCLUDE="${WindowsSdkIncludeDir}um;${WindowsSdkIncludeDir}shared;$INCLUDE" + LIB="${WindowsSdkLibDir}x86;$LIB" + + # Visual C++ tools, headers and libraries. + VSINSTALLDIR='C:\Program Files (x86)\Microsoft Visual Studio 14.0' + VCINSTALLDIR="${VSINSTALLDIR}"'\VC' + PATH=`cygpath -u "${VCINSTALLDIR}"`/bin:"$PATH" + INCLUDE="${VCINSTALLDIR}"'\include;'"${INCLUDE}" + LIB="${VCINSTALLDIR}"'\lib;'"${LIB}" + + export INCLUDE LIB + + - for creating 64-bit binaries: through the following bash commands: + + # Set environment variables for using MSVC 14, + # for creating native 64-bit Windows executables. + + # Windows C library headers and libraries. + WindowsCrtIncludeDir='C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt' + WindowsCrtLibDir='C:\Program Files (x86)\Windows Kits\10\Lib\10.0.10240.0\ucrt\' + INCLUDE="${WindowsCrtIncludeDir};$INCLUDE" + LIB="${WindowsCrtLibDir}x64;$LIB" + + # Windows API headers and libraries. + WindowsSdkIncludeDir='C:\Program Files (x86)\Windows Kits\8.1\Include\' + WindowsSdkLibDir='C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\' + INCLUDE="${WindowsSdkIncludeDir}um;${WindowsSdkIncludeDir}shared;$INCLUDE" + LIB="${WindowsSdkLibDir}x64;$LIB" + + # Visual C++ tools, headers and libraries. + VSINSTALLDIR='C:\Program Files (x86)\Microsoft Visual Studio 14.0' + VCINSTALLDIR="${VSINSTALLDIR}"'\VC' + PATH=`cygpath -u "${VCINSTALLDIR}"`/bin/amd64:"$PATH" + INCLUDE="${VCINSTALLDIR}"'\include;'"${INCLUDE}" + LIB="${VCINSTALLDIR}"'\lib\amd64;'"${LIB}" + + export INCLUDE LIB + + Building 32-bit binaries with MSVC is achieved through the following + preparation, configure, and build commands: + + PATH=/usr/local/msvc32/bin:$PATH + export PATH + + win32_target=_WIN32_WINNT_WINXP # for MSVC 9.0 + win32_target=_WIN32_WINNT_VISTA # possibly for MSVC >= 10.0 + win32_target=_WIN32_WINNT_WIN7 # possibly for MSVC >= 10.0 + win32_target=_WIN32_WINNT_WIN8 # possibly for MSVC >= 10.0 + + ./configure --host=i686-w64-mingw32 --prefix=/usr/local/msvc32 \ + CC="$HOME/msvc/compile cl -nologo" \ + CFLAGS="-MD" \ + CXX="$HOME/msvc/compile cl -nologo" \ + CXXFLAGS="-MD" \ + CPPFLAGS="-D_WIN32_WINNT=$win32_target -I/usr/local/msvc32/include" \ + LDFLAGS="-L/usr/local/msvc32/lib" \ + LD="link" \ + NM="dumpbin -symbols" \ + STRIP=":" \ + AR="$HOME/msvc/ar-lib lib" \ + RANLIB=":" + make + make check + + Building 64-bit binaries with MSVC is achieved through the following + preparation, configure, and build commands: + + PATH=/usr/local/msvc64/bin:$PATH + export PATH + + win32_target=_WIN32_WINNT_WINXP # for MSVC 9.0 + win32_target=_WIN32_WINNT_VISTA # possibly for MSVC >= 10.0 + win32_target=_WIN32_WINNT_WIN7 # possibly for MSVC >= 10.0 + win32_target=_WIN32_WINNT_WIN8 # possibly for MSVC >= 10.0 + + ./configure --host=x86_64-w64-mingw32 --prefix=/usr/local/msvc64 \ + CC="$HOME/msvc/compile cl -nologo" \ + CFLAGS="-MD" \ + CXX="$HOME/msvc/compile cl -nologo" \ + CXXFLAGS="-MD" \ + CPPFLAGS="-D_WIN32_WINNT=$win32_target -I/usr/local/msvc64/include" \ + LDFLAGS="-L/usr/local/msvc64/lib" \ + LD="link" \ + NM="dumpbin -symbols" \ + STRIP=":" \ + AR="$HOME/msvc/ar-lib lib" \ + RANLIB=":" + make + make check + + Installation: + + make install + +=============================================================================== +3) Binaries for the Cygwin environment. + + The generic instructions in the INSTALL file apply. But here are more + specific ones. + + You need to install + * Cygwin (from https://cygwin.com/), + * some packages available from the Cygwin package installer: + make + * the Cygwin [cross-]compilation tools package, available from + the Cygwin package installer (setup-x86_64.exe): + - for creating 32-bit binaries: packages + cygwin32-gcc-core, + cygwin32-gcc-g++, + cygwin32 + - for creating 64-bit binaries: packages + gcc-core, + gcc-g++ + + Building 32-bit binaries for Cygwin must be done in a directory *outside* + the Cygwin /home and /usr hierarchies. It is achieved through the following + preparation, configure, and build commands: + + PATH=/usr/local/cygwin32/bin:/usr/i686-pc-cygwin/sys-root/usr/bin:$PATH + export PATH + ./configure --host=i686-pc-cygwin --prefix=/usr/local/cygwin32 \ + CC=i686-pc-cygwin-gcc \ + CXX=i686-pc-cygwin-g++ \ + CPPFLAGS="-I/usr/local/cygwin32/include -Wall" \ + LDFLAGS="-L/usr/local/cygwin32/lib" + make + make check + + Building 64-bit binaries for Cygwin is achieved through the following + preparation, configure, and build commands: + + PATH=/usr/local/cygwin64/bin:$PATH + export PATH + ./configure --host=x86_64-pc-cygwin --prefix=/usr/local/cygwin64 \ + CC=x86_64-pc-cygwin-gcc \ + CXX=x86_64-pc-cygwin-g++ \ + CPPFLAGS="-I/usr/local/cygwin64/include -Wall" \ + LDFLAGS="-L/usr/local/cygwin64/lib" + make + make check + + Installation: + + make install + +=============================================================================== diff --git a/Makefile.devel b/Makefile.devel new file mode 100644 index 0000000..ae8d87f --- /dev/null +++ b/Makefile.devel @@ -0,0 +1,29 @@ +# This is the developer's -*-Makefile-*-, not the user's makefile. +# Do not use it unless you know exactly what you do! + +# ============ Rules that require cross-compilation tools ============ + +precompiled : force + cd avcall && $(MAKE) -f Makefile.devel precompiled + cd vacall && $(MAKE) -f Makefile.devel precompiled + cd trampoline && $(MAKE) -f Makefile.devel precompiled + cd callback/vacall_r \ + && $(MAKE) -f Makefile.devel precompiled + cd callback/trampoline_r \ + && $(MAKE) -f Makefile.maint copied-files \ + && $(MAKE) -f Makefile.devel precompiled + +# ==================== Targets for testing ==================== + +COMPILERS="cc -O" "gcc -freg-struct-return" "gcc -fpcc-struct-return" + +multibuild : force + for compiler in $(COMPILERS) ; do \ + dir=build-`echo $$compiler | sed -e 's, ,,g' -e 's,/,_,g'`; \ + mkdir $$dir; cd $$dir; \ + CC="$$compiler" ../configure --srcdir=.. && make && make check; \ + cd ..; \ + done + + +force : diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..05a83dd --- /dev/null +++ b/Makefile.in @@ -0,0 +1,232 @@ +# Makefile for libffcall + +#### Start of system configuration section. #### + +# Directories used by "make": +srcdir = @srcdir@ + +# Directories used by "make install": +prefix = @prefix@ +local_prefix = /usr/local +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +mandir = @mandir@ +datadir = @datadir@ +datarootdir = @datarootdir@ + +# Programs used by "make": +# C compiler +CC = @CC@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +# Both C and C++ compiler +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I. -I$(srcdir) -I.. -I$(srcdir)/.. -I$(srcdir)/vacall_r +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile +LIBTOOL_LINK = $(LIBTOOL) --mode=link +LIBTOOL_INSTALL = $(LIBTOOL) --mode=install +LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall +AR = @AR@ +AR_FLAGS = rc +RANLIB = @RANLIB@ +RM = rm -f +@SET_MAKE@ + +# Programs used by "make install": +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +#### End of system configuration section. #### + +SHELL = /bin/sh + +# This package does not support parallel make. +# So, turn off parallel execution (at least in GNU make >= 4.0). +GNUMAKEFLAGS = -j1 + +# Needed by $(LIBTOOL). +top_builddir = . + +# Limit the set of exported symbols, on those platforms where libtool supports it. +# Currently this excludes the symbols from gnulib modules. +LIBFFCALL_EXPORTED_SYMBOLS_REGEX = '^ffcall_|^avcall_|^callback_|_callback$$' + +# Before making a release, change this according to the libtool documentation, +# section "Library interface versions". +LIBFFCALL_VERSION_INFO = 1:0:1 + +all : all-subdirs libffcall.la + +all-subdirs : ffcall-version.h force + cd @subdir@ && $(MAKE) all + +ffcall-version.h : $(srcdir)/ffcall-version.in.h + cd .. && ./config.status --header=ffcall-version.h:ffcall-version.in.h + +ffcall-version.lo : $(srcdir)/ffcall-version.c ffcall-version.h config.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/ffcall-version.c + +libffcall.la : ffcall-version.lo avcall/avcall.lo avcall/avcall-libapi.lo avcall/avcall-structcpy.lo callback/vacall_r/libvacall.la callback/trampoline_r/libtrampoline.la callback/callback-libapi.lo + $(LIBTOOL_LINK) $(CC) -o libffcall.la -rpath $(libdir) -no-undefined -export-symbols-regex $(LIBFFCALL_EXPORTED_SYMBOLS_REGEX) -version-info $(LIBFFCALL_VERSION_INFO) ffcall-version.lo avcall/avcall.lo avcall/avcall-libapi.lo avcall/avcall-structcpy.lo callback/vacall_r/vacall.lo callback/vacall_r/vacall-libapi.lo callback/vacall_r/vacall-structcpy.lo callback/trampoline_r/*.lo callback/callback-libapi.lo gnulib-lib/libgnu.la $(LDFLAGS) $(LTLIBTHREAD) + +install : force + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(libdir) + $(LIBTOOL_INSTALL) $(INSTALL_DATA) libffcall.la $(DESTDIR)$(libdir)/libffcall.la + mkdir -p $(DESTDIR)$(includedir) + $(INSTALL_DATA) ffcall-version.h $(DESTDIR)$(includedir)/ffcall-version.h + $(INSTALL_DATA) $(srcdir)/ffcall-abi.h $(DESTDIR)$(includedir)/ffcall-abi.h + cd @subdir@ && $(MAKE) install + +installdirs : force + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(libdir) + mkdir -p $(DESTDIR)$(includedir) + cd @subdir@ && $(MAKE) installdirs + +uninstall : force + cd @subdir@ && $(MAKE) uninstall + $(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libffcall.la + $(RM) $(DESTDIR)$(includedir)/ffcall-abi.h + $(RM) $(DESTDIR)$(includedir)/ffcall-version.h + +check : force + cd @subdir@ && $(MAKE) check + +extracheck : force + cd @subdir@ && $(MAKE) extracheck + +MOSTLYCLEANDIRS = .libs _libs +MOSTLYCLEANFILES = \ + *.@OBJEXT@ *.lo core \ + libffcall.* + +mostlyclean : force + cd @subdir@ && $(MAKE) mostlyclean + $(RM) -r $(MOSTLYCLEANDIRS) + $(RM) $(MOSTLYCLEANFILES) + +clean : force + cd @subdir@ && $(MAKE) clean + $(RM) -r $(MOSTLYCLEANDIRS) + $(RM) $(MOSTLYCLEANFILES) + +DISTCLEANFILES = \ + config.status config.log config.cache Makefile config.h ffcall-version.h libtool \ + stamp-h1 stamp-h2 + +distclean : force + cd @subdir@; if test -f Makefile; then $(MAKE) distclean; fi + $(RM) -r $(MOSTLYCLEANDIRS) + $(RM) $(MOSTLYCLEANFILES) + $(RM) $(DISTCLEANFILES) + +maintainer-clean : force + cd @subdir@; if test -f Makefile; then $(MAKE) maintainer-clean; fi + $(RM) -r $(MOSTLYCLEANDIRS) + $(RM) $(MOSTLYCLEANFILES) + $(RM) $(DISTCLEANFILES) + + +# List of source files (committed in version control). +SOURCE_FILES = \ + COPYING DEPENDENCIES INSTALL.os2 INSTALL.windows NEWS PLATFORMS README \ + ChangeLog \ + VERSION \ + Makefile.devel \ + Makefile.maint \ + Makefile.in \ + configure.ac \ + m4/as-underscore.m4 \ + m4/cc-gcc.m4 \ + m4/codeexec.m4 \ + m4/endianness.m4 \ + m4/ln.m4 \ + common/asm-alpha.sh \ + common/asm-arm.sh common/asm-arm.h \ + common/asm-arm64.sh common/asm-arm64.h \ + common/asm-hppa.sh common/asm-hppa.h \ + common/asm-hppa64.sh common/asm-hppa64.h \ + common/asm-i386.sh common/asm-i386.h \ + common/asm-m68k.sh common/asm-m68k.h \ + common/asm-mips.sh common/asm-mips.h \ + common/asm-powerpc.sh \ + common/asm-riscv.sh \ + common/asm-s390.sh \ + common/asm-sparc.sh common/asm-sparc.h \ + common/asm-x86_64.sh common/asm-x86_64.h \ + common/noexecstack.h common/noexecstack-arm.h \ + common/structcpy.c \ + common/uniq-u.c \ + ffcall-version.in.h dummy/ffcall-version.h \ + ffcall-abi.h \ + ffcall-stdint.h \ + ffcall-version.c \ + testcases.c +# List of distributed files imported from other packages or directories. +LIBTOOL_IMPORTED_FILES = \ + build-aux/ltmain.sh \ + m4/libtool.m4 \ + m4/lt~obsolete.m4 \ + m4/ltoptions.m4 \ + m4/ltsugar.m4 \ + m4/ltversion.m4 +GNULIB_IMPORTED_FILES = \ + build-aux/ar-lib \ + build-aux/compile \ + build-aux/config.guess \ + build-aux/config.sub \ + build-aux/install-sh \ + gnulib-m4/*.m4 \ + m4/mmap-anon.m4 +AUTOMAKE_IMPORTED_FILES = \ + build-aux/missing +IMPORTED_FILES = \ + $(LIBTOOL_IMPORTED_FILES) $(GNULIB_IMPORTED_FILES) $(AUTOMAKE_IMPORTED_FILES) +# List of files copied by autogen.sh. +COPIED_FILES = \ + callback/trampoline_r/PORTING \ + callback/trampoline_r/cache.c \ + callback/trampoline_r/cache-alpha.c \ + callback/trampoline_r/cache-hppa.c +# List of distributed files generated by Makefile.maint. +GENERATED_FILES = \ + aclocal.m4 \ + configure \ + config.h.in +# List of distributed files. +DISTFILES = $(SOURCE_FILES) $(IMPORTED_FILES) $(COPIED_FILES) $(GENERATED_FILES) + +distdir : $(DISTFILES) + for file in $(DISTFILES); do \ + if test -f $$file; then dir='.'; else dir='$(srcdir)'; fi; \ + destdir=`echo '$(distdir)'/$$file | sed -e 's|//*[^/]*$$||'`; \ + test -d "$$destdir" || mkdir -p "$$destdir"; \ + cp -p "$$dir/$$file" '$(distdir)'/$$file || exit 1; \ + done + test -d '$(distdir)'/@subdir@ || mkdir '$(distdir)'/@subdir@; cd @subdir@ && $(MAKE) distdir distdir='$(distdir)'/@subdir@ + + +# Creating a distribution tarball. +# Example: make dist VERSION=1.13-pre-20161227 +PACKAGE = @PACKAGE_TARNAME@ +VERSION = @VERSION@ +TAR = tar +GZIP = gzip + +dist : force + tmpdistdir=$(PACKAGE)-$(VERSION); \ + abstmpdistdir=`pwd`/$$tmpdistdir; \ + rm -rf $$tmpdistdir $$tmpdistdir.tar $$tmpdistdir.tar.gz \ + && mkdir $$tmpdistdir \ + && $(MAKE) distdir distdir="$$abstmpdistdir" \ + && $(TAR) chof $$tmpdistdir.tar --owner=root --group=root $$tmpdistdir \ + && $(GZIP) -9 $$tmpdistdir.tar \ + && rm -rf $$tmpdistdir + + +force : + diff --git a/Makefile.maint b/Makefile.maint new file mode 100644 index 0000000..c232432 --- /dev/null +++ b/Makefile.maint @@ -0,0 +1,181 @@ +# maintainer -*-Makefile-*- + +SHELL = /bin/sh +MAKE = make + +ACLOCAL = aclocal +AUTOMAKE = automake +AUTOCONF = autoconf +AUTOHEADER = autoheader +CP = cp +RM = rm -f + +# ==================== Easily regeneratable files ==================== + +.PHONY : all +all : aclocal.m4 configures check-configures config-h-in Makefile-ins force + cd avcall && $(MAKE) -f Makefile.maint all + cd vacall && $(MAKE) -f Makefile.maint all + cd trampoline && $(MAKE) -f Makefile.maint all + cd callback && $(MAKE) -f Makefile.maint all + + +# Files originating from GNU libtool. + +# It is important to get ltmain.sh and libtool.m4 from the same version of +# libtool. Don't rely on what's installed in /usr/share or similar. + +.PHONY : libtool-imported-files +libtool-imported-files : force + test -n "$(LIBTOOL_RELEASE)" || { echo "Variable LIBTOOL_RELEASE not set." 1>&2; exit 1; } + test -f "$(LIBTOOL_RELEASE)" || { echo "File $(LIBTOOL_RELEASE) does not exist." 1>&2; exit 1; } + rm -rf libtool.tmp + mkdir libtool.tmp + gzip -d -c < "$(LIBTOOL_RELEASE)" | (cd libtool.tmp && tar -xf -) + test -d build-aux || mkdir build-aux + for destfile in m4/libtool.m4 m4/ltoptions.m4 m4/ltsugar.m4 m4/ltversion.m4 m4/lt~obsolete.m4 build-aux/ltmain.sh; do \ + name=`echo $$destfile | sed -e 's|^.*/||'`; \ + srcfile=`find libtool.tmp -name $$name -print | sed 1q`; \ + if test -n "$$srcfile"; then \ + if test -f $$destfile && cmp "$$srcfile" $$destfile > /dev/null; then \ + : ; \ + else \ + mv "$$srcfile" $$destfile; \ + fi; \ + else \ + echo "File $(LIBTOOL_RELEASE) does not contain the expected files of a libtool release." 1>&2; \ + exit 1; \ + fi; \ + done + rm -rf libtool.tmp + : "Allow building statically linked binaries, through LDFLAGS=-static ." + wget --execute netrc=off --no-verbose --retry-connrefused --timeout=60 -O libtool-allow-static.diff https://lists.gnu.org/archive/html/bug-libtool/2017-07/txt7Q9LRXv6HS.txt + chmod u+w build-aux/ltmain.sh + patch build-aux/ltmain.sh < libtool-allow-static.diff + rm -f libtool-allow-static.diff + : "Fix -export-symbols and -export-symbols-regex support on Solaris 11.3" + wget --execute netrc=off --no-verbose --retry-connrefused --timeout=60 -O libtool-solaris11-fix.diff 'https://savannah.gnu.org/patch/download.php?file_id=42205' + chmod u+w m4/libtool.m4 + patch -p1 < libtool-solaris11-fix.diff + rm -f libtool-solaris11-fix.diff + : "Support creating shared libraries on MidnightBSD" + wget --execute netrc=off --no-verbose --retry-connrefused --timeout=60 -O libtool-midnightbsd-fix.diff 'https://savannah.gnu.org/patch/download.php?file_id=50595' + chmod u+w build-aux/ltmain.sh m4/libtool.m4 + head -n 60 < libtool-midnightbsd-fix.diff | patch -p0 build-aux/ltmain.sh + tail -n +227 < libtool-midnightbsd-fix.diff | head -n 56 | patch -p0 m4/libtool.m4 + rm -f libtool-midnightbsd-fix.diff + +.PHONY : libtool-clean +libtool-clean : force + $(RM) m4/libtool.m4 build-aux/ltmain.sh + + +# Files brought in by gnulib-tool. + +GNULIB_MODULES = \ + ansi-c++-opt \ + clean-temp-simple \ + host-cpu-c-abi \ + lock \ + nocrash \ + stdint \ + stdnoreturn + +gnulib-m4/gnulib-cache.m4 : + if test -n "$$GNULIB_TOOL"; then \ + $$GNULIB_TOOL --source-base=gnulib-lib --m4-base=gnulib-m4 --aux-dir=build-aux --libtool --no-changelog \ + --import $(GNULIB_MODULES); \ + fi + +GNULIB_FILES = \ + m4/mmap-anon.m4 + +.PHONY : gnulib-imported-files +gnulib-imported-files : force + if test -n "$$GNULIB_TOOL"; then \ + for file in $(GNULIB_FILES); do \ + $$GNULIB_TOOL --copy-file $$file || exit $$?; \ + done; \ + fi +# Get up-to-date versions of files imported from https://git.savannah.gnu.org/gitweb/?p=automake.git;a=tree;f=lib via gnulib. + if test -n "$$GNULIB_TOOL"; then \ + for file in ar-lib compile install-sh; do \ + $$GNULIB_TOOL --copy-file build-aux/$$file || exit $$?; \ + chmod a+x build-aux/$$file || exit $$?; \ + done; \ + fi +# Get up-to-date versions of files imported from https://git.savannah.gnu.org/gitweb/?p=config.git;a=tree via gnulib. + if test -n "$$GNULIB_TOOL"; then \ + for file in config.guess config.sub; do \ + $$GNULIB_TOOL --copy-file build-aux/$$file || exit $$?; \ + chmod a+x build-aux/$$file || exit $$?; \ + done; \ + fi + +.PHONY : gnulib-clean +gnulib-clean : force +# Move gnulib-m4/gnulib-cache.m4 away, so that the target 'gnulib-m4/gnulib-cache.m4' will actually do something. + if test -f gnulib-m4/gnulib-cache.m4; then \ + mv gnulib-m4/gnulib-cache.m4 gnulib-m4/gnulib-cache.m4~; \ + fi +# No need to remove the stale files. gnulib-tool does this itself, thanks to gnulib-m4/gnulib-comp.m4. +# rm -rf gnulib-m4 + + +# Files generated by GNU Autoconf and GNU Automake. + +AUTOCONF_CACHE = autom4te.cache + +ALL_CONFIGURE = configure +ALL_CONFIGURE_AC = configure.ac + +aclocal.m4 : $(ALL_CONFIGURE_AC) $(wildcard m4/*.m4) $(wildcard gnulib-m4/*.m4) + $(ACLOCAL) --output=aclocal.m4 -I m4 -I gnulib-m4 + +.PHONY : configures +configures : $(ALL_CONFIGURE) + +AUTOCONF_FILES = aclocal.m4 $(wildcard m4/*.m4) $(wildcard gnulib-m4/*.m4) + +configure : configure.ac $(AUTOCONF_FILES) + $(AUTOCONF) && rm -rf autom4te.cache + +.PHONY : check-configures +check-configures : $(ALL_CONFIGURE) + set -e; for f in $(ALL_CONFIGURE); do bash -x -n $$f; done + + +ALL_CONFIG_H_IN = config.h.in + +.PHONY : config-h-in +config-h-in : $(ALL_CONFIG_H_IN) + +config.h.in : configure.ac $(AUTOCONF_FILES) + srcdir=`pwd`; $(AUTOHEADER) --include="$$srcdir" && rm -rf autom4te.cache + + +ALL_MAKEFILE_IN_FROM_AM = gnulib-lib/Makefile.in + +.PHONY: Makefile-ins +Makefile-ins : $(ALL_MAKEFILE_IN_FROM_AM) + +gnulib-lib/Makefile.in : gnulib-lib/Makefile.am configure.ac $(AUTOCONF_FILES) + : "Make sure we get new versions of files brought in by automake." + (cd build-aux && rm -f depcomp missing) + $(AUTOMAKE) --add-missing --copy && rm -rf autom4te.cache + + +# ==================== Cleanup ==================== + +.PHONY : totally-clean +totally-clean : force + cd avcall && $(MAKE) -f Makefile.maint totally-clean + cd vacall && $(MAKE) -f Makefile.maint totally-clean + cd trampoline && $(MAKE) -f Makefile.maint totally-clean + cd callback && $(MAKE) -f Makefile.maint totally-clean + rm -f $(ALL_CONFIGURE) $(ALL_CONFIG_H_IN) + rm -f aclocal.m4 + rm -rf `find . -name $(AUTOCONF_CACHE) -print` + + +force : diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..5911682 --- /dev/null +++ b/NEWS @@ -0,0 +1,240 @@ +New in 2.4: + +* Added support for the following platforms: + (Previously, a build on these platforms failed.) + - arm64: macOS 11. + - arm: FreeBSD 12. + - sparc: Solaris 11 32-bit. + +New in 2.3: + +* Added support for the following platforms: + (Previously, a build on these platforms failed.) + - x86_64: FreeBSD 13, OpenBSD 6.5 and newer. + - powerpc64: AIX 7 with xlclang compiler. + +* Fixed a couple of multithread-safety bugs in the trampoline and callback + packages. + +New in 2.2: + +* Added support for the following platforms: + (Previously, a build on these platforms failed.) + - armv6 (Raspberry Pi): Linux. + - hppa: Linux 32-bit. + - riscv32: Linux with ilp32d ABI. + - riscv64: Linux with lp64d ABI. + +* The build for the mips 32-bit ABI is now compatible with toolchains for + the 'fpxx' ABI variant. The downside is that the mips1 architecture is + no longer supported. + +* Fixed a bug regarding passing of more than 8 arguments on the following + platforms: + - arm64: Linux 64-bit. + +* Fixed a stack corruption bug on the following platforms: + - hppa: HP-UX 32-bit. + +New in 2.1: + +* Added support for the following platforms: + (Previously, a build on these platforms failed.) + - arm: Linux with PIE-enabled gcc. + - x86_64: Solaris 11.3. + - OpenBSD 6.1. + - HardenedBSD 10 and 11. + +* Fixed a bug regarding passing of pointers on the following platforms: + - x86_64: Linux with x32 ABI: CC="gcc -mx32". + +* Fixed a crash in trampoline on the following platforms: + - mips: Linux with CC="gcc -mabi=64", little endian. + +New in 2.0: + +* The package now installs a library libffcall.{a,so}. It contains the + 'avcall' and 'callback' packages. The libraries libavcall.{a,so} and + libcallback.{a,so} are still installed as well, but are deprecated. + +* The installed libraries are now installed as shared libraries by default + (except for libvacall, which is still a static library only). + +* The installed shared libraries are now properly versioned. This means that + when installing with --enable-shared, upgrading to a newer version of + libffcall will not break existing binaries. + +* The installed include files are now platform independent. This means that + you can now install libffcall for different ABIs on the same system, using + the same --prefix option but different --exec-prefix options for each ABI. + +* API changes in : + - The second argument of alloc_trampoline() is now a 'void**', rather + than a 'void*'. + - The return value of trampoline_variable() is now a 'void**', rather + than a 'void*'. + - The argument of trampoline_address(), trampoline_variable(), + trampoline_data() is now a function pointer instead of a 'void*'. + +* API changes in : + - The argument of callback_address(), callback_data() is now a function + pointer instead of a 'void*'. + +* Fixed a bug regarding floating-point arguments followed by + non-floating-point arguments on the following platforms: + - arm: Linux 32-bit, with hardware floats. + - powerpc: Linux 32-bit. + - s390: Linux. + +* Fixed a bug regarding structure returns on the following platforms: + - i386: FreeBSD. + - i386: MinGW. + - mips: old 32-bit ABI (Linux, IRIX). + +* Added support for the following platforms: + (Previously, a build on these platforms failed.) + - i386: MSVC 14. + - x86_64: Cygwin. + - x86_64: MinGW. + - x86_64: MSVC 14. + - hppa64: HP-UX 11. + - m68k: Linux. + +* Verified support for the following platforms: + (A build on these platforms worked and still works.) + - i386: FreeBSD, NetBSD, OpenBSD, DragonFly BSD. + - i386: Hurd. + - x86_64: FreeBSD, NetBSD, OpenBSD. + +New in 1.13: + +* The license has been changed from GPLv2 to GPLv2+. + +* Added support for the following platforms: + (Previously, a build on these platforms failed.) + - x86_64: Mac OS X 64-bit. + - x86_64: Solaris 64-bit. + - x86_64: Linux with x32 ABI: CC="gcc -mx32". + - arm: Linux 32-bit, without hardware floats. + - arm64: Linux 64-bit. + - s390x: Linux 64-bit. + - powerpc: AIX 64-bit. + - mips: IRIX 6.5 with CC="cc -32". + - sparc: Solaris 64-bit. + +* Fixed support for the following platforms: + (Previously, a build on these platforms appeared to succeed but was buggy.) + - x86_64: Linux. + - arm: Linux 32-bit, with hardware floats. + - powerpc: Linux 64-bit. + - mips: Linux with CC="gcc -mabi=32". + - mips: Linux with CC="gcc -mabi=n32". + - mips: Linux with CC="gcc -mabi=64". + - mips: IRIX 6.5 with CC="gcc -mabi=n32". + - s390: Linux. + - sparc: Linux 64-bit. + - ia64: Linux. + - hppa: HP-UX 32-bit. + +* Verified support for the following platforms: + (A build on these platforms worked and still works.) + - i386: Linux, Solaris, Mac OS X. + - powerpc: Linux 32-bit. + - powerpc: AIX 32-bit. + - powerpc: MacOS X. + - mips: IRIX 6.5 with CC="cc -n32". + - sparc: Solaris 32-bit. + - sparc: Linux 32-bit: CC="gcc -m32". + - alpha: Linux. + +* Support for a security feature: On Linux and FreeBSD platforms, linking with + the libffcall libraries no longer causes the stack to become executable. + +New in 1.12: + +* Added ppc64le to the list of supported architectures. + +New in 1.11: + +* Header now define LIBFFCALL_VERSION (to 0x010B). +* Better support for IA64 on Linux (kernel 2.6.16+ and gcc 4.1.0+). +* Added ARM support from Jonathan Olson (debian 1.10-2). +* Added MIPSel support from Thiemo Seufer (debian 1.10-2). +* Added ARMel support from Max Lapan. + +New in 1.10: + +* Added support for PowerPC NetBSD. + +New in 1.9: + +* Added support for x86_64 (AMD64) Linux. +* Added support for PowerPC MacOS X. + +New in 1.8: + +* Added support for IA64 Linux. + +New in 1.7: + +* Struct types containing elements other than int, long, long long, pointer + are not supported any more. Passing them as arguments and results is too + hairy. +* Added support for PowerPC Linux. + +New in 1.6: + +* The avcall and callback packages are compiled as position-independent code, + if CC="gcc -fPIC". +* The avcall and callback packages are built as shared libraries, if + the option "--enable-shared" is passed to configure. +* The package can now be built with CC="gcc -x c++". +* Improved RS6000/PowerPC support. +* Improved support for gcc on Irix6 (-n32 ABI). +* Added preliminary support for 64-bit SPARC. + +New in 1.5: + +* Added support for m68k Linux. + +New in 1.4: + +* Added support for the two new ABIs on Irix6 (-n32, -64). +* A fix for DEC Alpha. + +New in 1.3.1: + +* Added support for Mingw32 on Win32. +* Fixed a compilation problem in trampoline on m68k NetBSD. +* Fixed an installation problem with clisp: When configured outside the source + directory, callback.h would not be copied into the build directory. + +New in 1.3: + +* Added the callback package, a reentrant combination of vacall and trampoline. +* The avcall and callback packages are multithread-safe. +* Fixed bugs in trampoline on hppa and rs6000. +* On hppa, added support for gcc-2.7.2, although its calling convention is + different from gcc-2.6.3. + +New in 1.2.1: + +* Added support for MSVC5 on Win32. + +New in 1.2: + +* Support passing/returning values of type ‘long long’ and ‘unsigned long long’ + on platforms which have these types. +* Support for "stdcall" calling convention on i386. +* Added support for Cygwin32 and MSVC4 on Win32. +* Added support for EMX on OS/2. +* Added support for m68k AmigaOS (Jörg Höhle). +* Added support for m68k SunOS 4.0.3. +* More reliable cache-flushing in trampoline. + +New in 1.1: + +* Added support for SUNWspro cc on Sparc Solaris. +* Added support for AIX 4. +* Added preliminary support for 64-bit MIPS. + diff --git a/PLATFORMS b/PLATFORMS new file mode 100644 index 0000000..b7dc0c8 --- /dev/null +++ b/PLATFORMS @@ -0,0 +1,52 @@ +Supported CPUs: (Put the GNU config.guess values here.) + i386 i486-unknown-linux (gcc), i686-unknown-gnu0.9 (gcc), + i386-unknown-sysv4.0 (gcc, /usr/bin/cc, /usr/ucb/cc), + i386-pc-solaris2.6 (gcc), i386-pc-solaris2.10 (gcc, cc), + i486-unknown-sco3.2v4.2 (gcc, cc -Of), + i486-unknown-os2emx (gcc), i386-pc-cygwin32 (gcc), + i386-w64-mingw32 (gcc, MSVC 14), + i586-unknown-freebsd11.0 (cc), i386-unknown-dragonfly3.8 (gcc), + i386-unknown-netbsdelf7.0 (gcc), i386-unknown-openbsd6.0 (gcc), + i586-pc-haiku (gcc-x86), i386-pc-minix (clang) + m68k m68k-next-nextstep3 (cc), m68k-sun-sunos4.0 (cc), + m68k-unknown-linux (gcc) + mips mips-sgi-irix4.0.5 (gcc, cc -ansi, cc -D__STDC__, cc -cckr), + mips-sgi-irix5.2 (gcc, cc -ansi, cc -D__STDC__, cc -cckr), + mips-sgi-irix5.3 (gcc, cc -ansi, cc -D__STDC__, cc -cckr), + mips-sgi-irix6.2 (cc -32), + mips-sgi-irix6.4 (cc -32, cc -n32, cc -64), + mips-sgi-irix6.5 (cc -32, cc -n32, gcc -mabi=n32), + mips-unknown-linux (gcc -mabi=32), + mips64-unknown-linux (gcc -mabi=n32, gcc -mabi=64) + sparc sparc-sun-sunos4.1.1 (gcc, cc), sparc-sun-solaris2.3 (gcc) + sparc-sun-solaris2.4 (gcc, cc), sparc-sun-solaris2.10 (gcc, cc), + sparc64-sun-solaris2.10 (gcc -m64, cc -xarch=generic64), + sparc-unknown-linux (gcc), sparc64-unknown-linux (gcc), + sparc-unknown-netbsdelf7.1 (gcc), + sparc64-unknown-netbsd8.0 (gcc) + alpha alpha-dec-osf3.0 (gcc, cc), alpha-dec-osf4.0 (gcc, cc), + alphaev67-unknown-linux (gcc) + hppa hppa1.0-hp-hpux8.00 (gcc, cc), hppa1.1-hp-hpux9.05 (cc), + hppa1.1-hp-hpux10.01 (cc), hppa2.0-hp-hpux10.20 (cc +DA1.1), + hppa2.0w-hp-hpux11.31 (cc), hppa-unknown-linux (gcc) + hppa64 hppa64-hp-hpux11.31 (cc +DD64) + arm armv5tejl-unknown-linux (gcc), armv6l-unknown-linux (gcc), + armv7l-unknown-linux (gcc) + arm64 aarch64-unknown-linux (gcc), aarch64-apple-darwin20.4.0 (cc) + powerpc powerpc-ibm-aix4.1.4.0 (cc), powerpc-ibm-aix7.1.3.0 (xlc, gcc), + powerpc-unknown-linux (gcc), powerpc-apple-darwin6.8 (gcc), + powerpc-apple-darwin9.8.0 (gcc) + powerpc64 powerpc-ibm-aix7.1.3.0 (gcc -maix64, xlc -q64; AR="ar -X 64"), + powerpc64-unknown-linux (gcc -m64), + powerpc64le-unknown-linux (gcc) + ia64 ia64-unknown-linux (gcc) + x86_64 x86_64-suse-linux (gcc), x86_64-unknown-linux (gcc -mx32), + x86_64-pc-solaris2.10 (gcc -m64, cc -xarch=generic64), + x86_64-pc-cygwin (gcc), x86_64-w64-mingw32 (gcc, MSVC 14), + x86_64-unknown-freebsd11.0 (cc), x86_64-unknown-netbsd7.0 (gcc), + x86_64-unknown-openbsd6.0 (gcc) + s390 s390x-ibm-linux (gcc -m31) + s390x s390x-ibm-linux (gcc) + riscv32 riscv32-unknown-linux (gcc -mabi=ilp32d) + riscv64 riscv64-unknown-linux (gcc -mabi=lp64d) + diff --git a/README b/README new file mode 100644 index 0000000..a0d2599 --- /dev/null +++ b/README @@ -0,0 +1,112 @@ +libffcall - foreign function call libraries + +This is a library which can be used to build foreign function call interfaces +in embedded interpreters. + + +Installed libraries and header files: + + It installs a library libffcall.{a,so}; to link with it, use the compiler + option '-lffcall'. + + It consists of two parts: + * avcall - calling C functions with variable arguments. + Its include file is . + * callback - closures with variable arguments as first-class C functions. + Its include file is . + + Additionally, you can determine the libffcall version by including + . + + For backward compatibility with versions 1.x, libraries libavcall.{a,so} + and libcallback.{a,so} are installed as well. But they are deprecated; + use libffcall.{a,so} instead. + + +Installation instructions: + + mkdir builddir + cd builddir + ../configure --cache-file=config.cache + make + make check + make install + + +Files in this package: + + Documentation: + + README this text + COPYING free software license + PLATFORMS list of supported platforms + + Source: + + avcall/* the avcall package + (compiled into libffcall) + + vacall/* the vacall package + Implements C functions accepting variable argument + prototypes. + This is a non-reentrant variant of part of 'callback'. + *Not* compiled into libffcall. + + trampoline/* the trampoline package + Implements closures as first-class C functions. + This is a non-reentrant variant of part of 'callback'. + *Not* compiled into libffcall. + + callback/* the callback package + (compiled into libffcall) + + Building: + + configure configuration script + configure.ac autoconf source for the configuration script + m4/* auxiliary configuration scripts + Makefile.in Makefile master + + +Copyright notice: + +Copyright 1993-1995 Bill Triggs (original avcall) +Copyright 1995-2021 Bruno Haible (everything) +Copyright 1997 Jörg Höhle (m68k AmigaOS support) +Copyright 2000 Adam Fedor (PowerPC MacOS support) +Copyright 2001-2012 Sam Steingold (build infrastructure) +Copyright 2001-2002 Gerhard Tonn (s390 support) +Copyright 2004 Paul Guyot (PowerPC MacOS support) +Copyright 2005 Thiemo Seufer (MIPS EL support) +Copyright 2009 Max Lapan (ARM EL support) +Copyright 2010 Valery Ushakov (SPARC64 improvements) + +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, see . + + +Distribution: + +git: +$ git clone git://git.savannah.gnu.org/libffcall.git +See https://savannah.gnu.org/git/?group=libffcall for more info. + +Bug reports: + +Report bugs + - in the bug tracker at + - or by email to . + +Homepage: + + https://www.gnu.org/software/libffcall/ diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..6b4950e --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +2.4 diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..96a014d --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1211 @@ +# generated automatically by aclocal 1.16.3 -*- Autoconf -*- + +# Copyright (C) 1996-2020 Free Software Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.71],, +[m4_warning([this file was generated for autoconf 2.71. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically 'autoreconf'.])]) + +# Copyright (C) 2002-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.16' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.16.3], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.16.3])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to +# '$srcdir', '$srcdir/..', or '$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is '.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ([2.52])dnl + m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + + +# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], + [$1], [CXX], [depcc="$CXX" am_compiler_list=], + [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], + [$1], [UPC], [depcc="$UPC" am_compiler_list=], + [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES. +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE([dependency-tracking], [dnl +AS_HELP_STRING( + [--enable-dependency-tracking], + [do not reject slow dependency extractors]) +AS_HELP_STRING( + [--disable-dependency-tracking], + [speeds up one-time build])]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +AC_SUBST([am__nodep])dnl +_AM_SUBST_NOTMAKE([am__nodep])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + AS_CASE([$CONFIG_FILES], + [*\'*], [eval set x "$CONFIG_FILES"], + [*], [set x $CONFIG_FILES]) + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`AS_DIRNAME(["$am_mf"])` + am_filepart=`AS_BASENAME(["$am_mf"])` + AM_RUN_LOG([cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles]) || am_rc=$? + done + if test $am_rc -ne 0; then + AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE="gmake" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking).]) + fi + AS_UNSET([am_dirpart]) + AS_UNSET([am_filepart]) + AS_UNSET([am_mf]) + AS_UNSET([am_rc]) + rm -f conftest-deps.mk +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking is enabled. +# This creates each '.Po' and '.Plo' makefile fragment that we'll need in +# order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. +m4_define([AC_PROG_CC], +m4_defn([AC_PROG_CC]) +[_AM_PROG_CC_C_O +]) + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.65])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[AC_DIAGNOSE([obsolete], + [$0: two- and three-arguments forms are deprecated.]) +m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if( + m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), + [ok:ok],, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) + AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) +AM_MISSING_PROG([AUTOCONF], [autoconf]) +AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) +AM_MISSING_PROG([AUTOHEADER], [autoheader]) +AM_MISSING_PROG([MAKEINFO], [makeinfo]) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +AC_SUBST([mkdir_p], ['$(MKDIR_P)']) +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES([CC])], + [m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES([CXX])], + [m4_define([AC_PROG_CXX], + m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES([OBJC])], + [m4_define([AC_PROG_OBJC], + m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], + [_AM_DEPENDENCIES([OBJCXX])], + [m4_define([AC_PROG_OBJCXX], + m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl +]) +AC_REQUIRE([AM_SILENT_RULES])dnl +dnl The testsuite driver may need to know about EXEEXT, so add the +dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This +dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) + fi +fi +dnl The trailing newline in this macro's definition is deliberate, for +dnl backward compatibility and to allow trailing 'dnl'-style comments +dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. +]) + +dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST([install_sh])]) + +# Copyright (C) 2003-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MAKE_INCLUDE() +# ----------------- +# Check whether make has an 'include' directive that can support all +# the idioms we need for our automatic dependency tracking code. +AC_DEFUN([AM_MAKE_INCLUDE], +[AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) + AS_CASE([$?:`cat confinc.out 2>/dev/null`], + ['0:this is the am__doit target'], + [AS_CASE([$s], + [BSD], [am__include='.include' am__quote='"'], + [am__include='include' am__quote=''])]) + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +AC_MSG_RESULT([${_am_result}]) +AC_SUBST([am__include])]) +AC_SUBST([am__quote])]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it is modern enough. +# If it is, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + AC_MSG_WARN(['missing' script is too old or missing]) +fi +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# -------------------- +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) + +# _AM_SET_OPTIONS(OPTIONS) +# ------------------------ +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Copyright (C) 1999-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_CC_C_O +# --------------- +# Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC +# to automatically call this. +AC_DEFUN([_AM_PROG_CC_C_O], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +AC_LANG_PUSH([C])dnl +AC_CACHE_CHECK( + [whether $CC understands -c and -o together], + [am_cv_prog_cc_c_o], + [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i]) +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +AC_LANG_POP([C])]) + +# For backward compatibility. +AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) + +# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_RUN_LOG(COMMAND) +# ------------------- +# Run COMMAND, save the exit status in ac_status, and log it. +# (This has been adapted from Autoconf's _AC_RUN_LOG macro.) +AC_DEFUN([AM_RUN_LOG], +[{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD + ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + (exit $ac_status); }]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken + alias in your environment]) + fi + if test "$[2]" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT([yes]) +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi +AC_CONFIG_COMMANDS_PRE( + [AC_MSG_CHECKING([that generated files are newer than configure]) + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + AC_MSG_RESULT([done])]) +rm -f conftest.file +]) + +# Copyright (C) 2009-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_SILENT_RULES([DEFAULT]) +# -------------------------- +# Enable less verbose build rules; with the default set to DEFAULT +# ("yes" being less verbose, "no" or empty being verbose). +AC_DEFUN([AM_SILENT_RULES], +[AC_ARG_ENABLE([silent-rules], [dnl +AS_HELP_STRING( + [--enable-silent-rules], + [less verbose build output (undo: "make V=1")]) +AS_HELP_STRING( + [--disable-silent-rules], + [verbose build output (undo: "make V=0")])dnl +]) +case $enable_silent_rules in @%:@ ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; +esac +dnl +dnl A few 'make' implementations (e.g., NonStop OS and NextStep) +dnl do not support nested variable expansions. +dnl See automake bug#9928 and bug#10237. +am_make=${MAKE-make} +AC_CACHE_CHECK([whether $am_make supports nested variables], + [am_cv_make_support_nested_variables], + [if AS_ECHO([['TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi]) +if test $am_cv_make_support_nested_variables = yes; then + dnl Using '$V' instead of '$(V)' breaks IRIX make. + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AC_SUBST([AM_V])dnl +AM_SUBST_NOTMAKE([AM_V])dnl +AC_SUBST([AM_DEFAULT_V])dnl +AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl +AC_SUBST([AM_DEFAULT_VERBOSITY])dnl +AM_BACKSLASH='\' +AC_SUBST([AM_BACKSLASH])dnl +_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl +]) + +# Copyright (C) 2001-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor 'install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in "make install-strip", and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# -------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004-2020 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of 'v7', 'ustar', or 'pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +# +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AC_SUBST([AMTAR], ['$${TAR-tar}']) + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' + +m4_if([$1], [v7], + [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], + + [m4_case([$1], + [ustar], + [# The POSIX 1988 'ustar' format is defined with fixed-size fields. + # There is notably a 21 bits limit for the UID and the GID. In fact, + # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 + # and bug#13588). + am_max_uid=2097151 # 2^21 - 1 + am_max_gid=$am_max_uid + # The $UID and $GID variables are not portable, so we need to resort + # to the POSIX-mandated id(1) utility. Errors in the 'id' calls + # below are definitely unexpected, so allow the users to see them + # (that is, avoid stderr redirection). + am_uid=`id -u || echo unknown` + am_gid=`id -g || echo unknown` + AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) + if test $am_uid -le $am_max_uid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi + AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) + if test $am_gid -le $am_max_gid; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + _am_tools=none + fi], + + [pax], + [], + + [m4_fatal([Unknown tar format])]) + + AC_MSG_CHECKING([how to create a $1 tar archive]) + + # Go ahead even if we have the value already cached. We do so because we + # need to set the values for the 'am__tar' and 'am__untar' variables. + _am_tools=${am_cv_prog_tar_$1-$_am_tools} + + for _am_tool in $_am_tools; do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works. + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi + done + rm -rf conftest.dir + + AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) + AC_MSG_RESULT([$am_cv_prog_tar_$1])]) + +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([gnulib-m4/00gnulib.m4]) +m4_include([gnulib-m4/absolute-header.m4]) +m4_include([gnulib-m4/alloca.m4]) +m4_include([gnulib-m4/ansi-c++.m4]) +m4_include([gnulib-m4/asm-underscore.m4]) +m4_include([gnulib-m4/close.m4]) +m4_include([gnulib-m4/double-slash-root.m4]) +m4_include([gnulib-m4/dup2.m4]) +m4_include([gnulib-m4/eealloc.m4]) +m4_include([gnulib-m4/errno_h.m4]) +m4_include([gnulib-m4/error.m4]) +m4_include([gnulib-m4/extensions.m4]) +m4_include([gnulib-m4/extern-inline.m4]) +m4_include([gnulib-m4/fatal-signal.m4]) +m4_include([gnulib-m4/fcntl-o.m4]) +m4_include([gnulib-m4/fcntl.m4]) +m4_include([gnulib-m4/fcntl_h.m4]) +m4_include([gnulib-m4/fstat.m4]) +m4_include([gnulib-m4/getdtablesize.m4]) +m4_include([gnulib-m4/getprogname.m4]) +m4_include([gnulib-m4/gnulib-common.m4]) +m4_include([gnulib-m4/gnulib-comp.m4]) +m4_include([gnulib-m4/host-cpu-c-abi.m4]) +m4_include([gnulib-m4/include_next.m4]) +m4_include([gnulib-m4/largefile.m4]) +m4_include([gnulib-m4/limits-h.m4]) +m4_include([gnulib-m4/lock.m4]) +m4_include([gnulib-m4/malloca.m4]) +m4_include([gnulib-m4/mode_t.m4]) +m4_include([gnulib-m4/msvc-inval.m4]) +m4_include([gnulib-m4/msvc-nothrow.m4]) +m4_include([gnulib-m4/multiarch.m4]) +m4_include([gnulib-m4/nocrash.m4]) +m4_include([gnulib-m4/off_t.m4]) +m4_include([gnulib-m4/open-cloexec.m4]) +m4_include([gnulib-m4/open-slash.m4]) +m4_include([gnulib-m4/open.m4]) +m4_include([gnulib-m4/pathmax.m4]) +m4_include([gnulib-m4/pthread_rwlock_rdlock.m4]) +m4_include([gnulib-m4/raise.m4]) +m4_include([gnulib-m4/rmdir.m4]) +m4_include([gnulib-m4/sig_atomic_t.m4]) +m4_include([gnulib-m4/sigaction.m4]) +m4_include([gnulib-m4/signal_h.m4]) +m4_include([gnulib-m4/signalblocking.m4]) +m4_include([gnulib-m4/size_max.m4]) +m4_include([gnulib-m4/sparcv8+.m4]) +m4_include([gnulib-m4/ssize_t.m4]) +m4_include([gnulib-m4/stat-time.m4]) +m4_include([gnulib-m4/stat.m4]) +m4_include([gnulib-m4/stdbool.m4]) +m4_include([gnulib-m4/stddef_h.m4]) +m4_include([gnulib-m4/stdint.m4]) +m4_include([gnulib-m4/stdio_h.m4]) +m4_include([gnulib-m4/stdnoreturn.m4]) +m4_include([gnulib-m4/strerror.m4]) +m4_include([gnulib-m4/string_h.m4]) +m4_include([gnulib-m4/sys_socket_h.m4]) +m4_include([gnulib-m4/sys_stat_h.m4]) +m4_include([gnulib-m4/sys_types_h.m4]) +m4_include([gnulib-m4/threadlib.m4]) +m4_include([gnulib-m4/time_h.m4]) +m4_include([gnulib-m4/unistd_h.m4]) +m4_include([gnulib-m4/warn-on-use.m4]) +m4_include([gnulib-m4/wchar_t.m4]) +m4_include([gnulib-m4/wint_t.m4]) +m4_include([gnulib-m4/xsize.m4]) +m4_include([gnulib-m4/zzgnulib.m4]) +m4_include([m4/as-underscore.m4]) +m4_include([m4/cc-gcc.m4]) +m4_include([m4/codeexec.m4]) +m4_include([m4/endianness.m4]) +m4_include([m4/libtool.m4]) +m4_include([m4/ln.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) +m4_include([m4/mmap-anon.m4]) diff --git a/avcall/COPYING b/avcall/COPYING new file mode 100644 index 0000000..a3d1815 --- /dev/null +++ b/avcall/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 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 + + Appendix: 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. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +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. + + , 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/avcall/DOC b/avcall/DOC new file mode 100644 index 0000000..255618e --- /dev/null +++ b/avcall/DOC @@ -0,0 +1,133 @@ +---------------------------------------------------------------------- + AVCALL --- a foreign function interface to ANSI-C +---------------------------------------------------------------------- + +This library allows arbitrary C functions to be called from embedded +interpreters, debuggers, RPC calls, etc, by building up a C argument +list incrementally from explicitly typed arguments. This considerably +reduces the amount of boilerplate glue code required for such +applications. + +The interface is like stdargs/varargs in reverse and is intended to be as +portable as possible, however the details of function calling are highly +machine-dependent so your mileage may vary. At the very least there are +typically built-in limits on the size of the argument-list. The +argument-pushing macros all return 0 for success, < 0 for error (eg, +arg-list overflow). + +Installation instructions are in the Makefile. + +---------------------------------------------------------------------- +DECLARE ALIST -> OPEN ALIST -> SET FLAGS -> PUSH ARGS -> CALL FUNCTION +---------------------------------------------------------------------- + +1) Declare the argument list structure: + + #include "avcall.h" + { + av_alist alist; + +2) Set any special flags. This is architecture and compiler dependent. +Sometimes, compiler options must be flagged by #defines before the +#include . Usually, however, the ‘configure’ script should +have determined which #defines are needed and put them at the head of +avcall.h. + +3) Initialise the alist with the function address and return type. +There is a separate macro for each built-in C type (char, int, float, etc). +Eg, + av_start_int(alist,&func,&return_addr); +or + av_start_double(alist,&func,&return_addr); +etc. +Functions returning a structure or pointer take an extra type argument: +Eg, + av_start_struct(alist,&func,STRUCT_OR_UNION_TYPE,SPLITTABLE,&return_addr); +or + av_start_ptr(alist,&func,POINTER_TYPE,&return_addr); + + +4) Push the arguments one by one in order. There is a macro for each +built-in C type, eg: + av_int(alist,value); +or + av_double(alist,value); + +Structure and pointer arguments require an extra type argument: + + av_struct(alist,STRUCT_TYPE,value); +or + av_ptr(alist,POINTER_TYPE,value); + +5) Call the function, set the return value, and tidy up: + + av_call(alist); + +---------------------------------------------------------------------- + NOTES + +1) Functions declared in K&R style (ie, without a typed arglist) must +use default K&R expression promotions (char,short-->int; float-->double) +whether they are compiled by a K&R or an ANSI compiler, because the +true arg types may not be known at the call point. Such functions +back-convert their arguments to the declared types on function entry. +The only way to pass a true char, short or float (eg, from K&R C to an +ANSI or varargs function) is by an explicit cast: foo((char)c,(float)f). + + !! Hence, for args of functions declared in K&R style you should use + !! av_int() and av_double() instead of av_{char,short}() and av_float(). + +If you use a K&R compiler, the avcall header files may detect this and +define av_float, etc, appropriately, but with an ANSI compiler there's +no way avcall can know how a function was declared, so you have to +correct the argument types yourself. Similarly, some K&R compilers (such +as Sun cc on the sparc) actually return a float as a double. + +2) There are too many possible structure and pointer types to have a +separate macro for each, so the pointer and structure macros take an +explicit type argument which may be used (eg) to calculate the size of +the structure. On most architectures this provides enough information +for the compiler to make the proper call, but there will always be +machines with odd alignment requirements or argument passing +conventions, unusual reprentations for function, char, or void pointers, +etc, for which this scheme will not suffice. These machines may define +additional av_start_TYPE and av_TYPE macros. + +3) The current implementations are pretty flakey in places. I'm happy to +accept new ports and (properly tested) fixes and enhancements. In +particular, many of the routines waste a lot of stack space and generally +do hairy things with stack frames - a bit more assembly code would probably +help things along quite a bit, but I don't speak assembler at all well. + +4) The macros required for all this are pretty grungy, but it does seem +to be possible to port avcall to many machines. Some of the grunge is +usually handled by a C or assembly level glue routine that actually +pushes the arguments, calls the function and unpacks any return value. +This is called avcall_call(). A precompiled assembler version for +people without gcc is also made available. The routine should ideally +have flags for the passing conventions of other compilers. +---------------------------------------------------------------------- + ACKNOWLEDGEMENTS + +I was aware of two similar but rather more restricted foreign function +interfaces when the initial version of this library was written, although +(I believe) all of the present code is my own: the C interface in the zelk +extensions to Oliver Laumann's Elk scheme interpreter +by J.P.Lewis, NEC C&C Research, (for Sun4 and SGI); +and Roy Featherstone's personal C interface +library for Sun3,4 and SGI. I also looked at the comments and some of the +code in the machine-dependent parts of the GCC and GDB distributions, and +put the GCC __asm__ extensions to good use. Thanks guys! + +This work was partly supported by EC-ESPRIT Basic Research Action SECOND. +---------------------------------------------------------------------- + +================================================================================ +Copyright 1993 Bill Triggs +Copyright 1995-2017 Bruno Haible + +This manual is covered by the GNU GPL. You can redistribute it and/or +modify it under the terms of the GNU General Public License (GPL), either +version 2 of the License, or (at your option) any later version published +by the Free Software Foundation (FSF). +A copy of the license is at . diff --git a/avcall/Makefile.devel b/avcall/Makefile.devel new file mode 100644 index 0000000..db392b6 --- /dev/null +++ b/avcall/Makefile.devel @@ -0,0 +1,278 @@ +# This is the developer's -*-Makefile-*-, not the user's makefile. +# Do not use it unless you know exactly what you do! + +THISFILE = Makefile.devel +LN = ln -s +RM = rm -f + +# ============ Rules that require cross-compilation tools ============ + +GCC = gcc +GCCFLAGS = -I.. -I../dummy -O2 -fno-omit-frame-pointer -fPIC +SED = sed +CROSS_TOOL = cross + +precompiled : \ + avcall-i386-macro.S \ + avcall-m68k.mit.S avcall-m68k.motorola.S \ + avcall-mipseb-macro.S avcall-mipsel-macro.S avcall-mipsn32eb-macro.S avcall-mipsn32el-macro.S avcall-mips64eb-macro.S avcall-mips64el-macro.S \ + avcall-sparc-macro.S avcall-sparc-solaris-macro.S avcall-sparc64-macro.S \ + avcall-alpha-macro.S \ + avcall-hppa-macro.S avcall-hppa64-macro.S \ + avcall-arm-macro.S avcall-armhf-macro.S \ + avcall-arm64-macro.S avcall-arm64-macos-macro.S \ + avcall-powerpc-aix.s avcall-powerpc-linux-macro.S avcall-powerpc-sysv4-macro.S avcall-powerpc-macos.s avcall-powerpc64-aix.s avcall-powerpc64-linux.S avcall-powerpc64-elfv2-linux.S \ + avcall-ia64-macro.S \ + avcall-x86_64-macro.S avcall-x86_64-x32-linux.s avcall-x86_64-windows-macro.S \ + avcall-s390-macro.S avcall-s390x-macro.S \ + avcall-riscv32-ilp32d-macro.S avcall-riscv64-lp64d-macro.S + + +avcall-i386-linux.s : avcall-i386.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) i386-linux gcc -V 3.1 $(GCCFLAGS) -D__i386__ -fno-omit-frame-pointer -S avcall-i386.c -o avcall-i386-linux.s + +avcall-i386-macro.S : avcall-i386-linux.s ../common/asm-i386.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-i386.h"' ; sed -e '/\.align.*,0x90$$/d' < avcall-i386-linux.s | ../common/asm-i386.sh ; cat ../common/noexecstack.h) > avcall-i386-macro.S + + +avcall-m68k-linux.s : avcall-m68k.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) m68k-linux gcc -V 3.1 $(GCCFLAGS) -D__m68k__ -S avcall-m68k.c -o avcall-m68k-linux.s + +avcall-m68k-sun.s : avcall-m68k.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) m68k-sun gcc -V 3.1 $(GCCFLAGS) -D__m68k__ -S avcall-m68k.c -o avcall-m68k-sun.s + +avcall-m68k.mit.S : avcall-m68k-sun.s ../common/asm-m68k.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-m68k.h"' ; ../common/asm-m68k.sh mit < avcall-m68k-sun.s ; cat ../common/noexecstack.h) > avcall-m68k.mit.S + +avcall-m68k.motorola.S : avcall-m68k-linux.s ../common/asm-m68k.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-m68k.h"' ; ../common/asm-m68k.sh motorola < avcall-m68k-linux.s ; cat ../common/noexecstack.h) > avcall-m68k.motorola.S + + +avcall-mipseb-linux.s : avcall-mips.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=32 -mfpxx -march=mips2 -meb $(GCCFLAGS) -D__mips__ -fno-tree-dce -S avcall-mips.c -o avcall-mipseb-linux.s + +avcall-mipseb-macro.S : avcall-mipseb-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < avcall-mipseb-linux.s) > avcall-mipseb-macro.S + +avcall-mipsel-linux.s : avcall-mips.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=32 -mfpxx -march=mips2 -mel $(GCCFLAGS) -D__mips__ -fno-tree-dce -S avcall-mips.c -o avcall-mipsel-linux.s + +avcall-mipsel-macro.S : avcall-mipsel-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < avcall-mipsel-linux.s) > avcall-mipsel-macro.S + +avcall-mipsn32eb-linux.s : avcall-mipsn32.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=n32 -meb $(GCCFLAGS) -D__mipsn32__ -S avcall-mipsn32.c -o avcall-mipsn32eb-linux.s + +avcall-mipsn32eb-macro.S : avcall-mipsn32eb-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < avcall-mipsn32eb-linux.s) > avcall-mipsn32eb-macro.S + +avcall-mipsn32el-linux.s : avcall-mipsn32.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=n32 -mel $(GCCFLAGS) -D__mipsn32__ -S avcall-mipsn32.c -o avcall-mipsn32el-linux.s + +avcall-mipsn32el-macro.S : avcall-mipsn32el-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < avcall-mipsn32el-linux.s) > avcall-mipsn32el-macro.S + +avcall-mips64eb-linux.s : avcall-mips64.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=64 -meb $(GCCFLAGS) -D__mips64__ -S avcall-mips64.c -o avcall-mips64eb-linux.s + +avcall-mips64eb-macro.S : avcall-mips64eb-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < avcall-mips64eb-linux.s) > avcall-mips64eb-macro.S + +avcall-mips64el-linux.s : avcall-mips64.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=64 -mel $(GCCFLAGS) -D__mips64__ -S avcall-mips64.c -o avcall-mips64el-linux.s + +avcall-mips64el-macro.S : avcall-mips64el-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < avcall-mips64el-linux.s) > avcall-mips64el-macro.S + + +avcall-sparc-linux.s : avcall-sparc.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) sparc-linux gcc -V 3.1 $(GCCFLAGS) -D__sparc__ -S avcall-sparc.c -o avcall-sparc-linux.s + +avcall-sparc-macro.S : avcall-sparc-linux.s ../common/asm-sparc.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-sparc.h"' ; ../common/asm-sparc.sh < avcall-sparc-linux.s ; cat ../common/noexecstack.h) > avcall-sparc-macro.S + +avcall-sparc-solaris.s : avcall-sparc.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) sparc-linux gcc -V 3.1 $(GCCFLAGS) -O1 -D__sparc__ -D__sun -S avcall-sparc.c -o avcall-sparc-solaris.s + +avcall-sparc-solaris-macro.S : avcall-sparc-solaris.s ../common/asm-sparc.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-sparc.h"' ; ../common/asm-sparc.sh < avcall-sparc-solaris.s ; cat ../common/noexecstack.h) > avcall-sparc-solaris-macro.S + +avcall-sparc64-linux.s : avcall-sparc64.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) +# This compiler produces useless instructions with -fPIC. The result is PIC even without -fPIC. + $(CROSS_TOOL) sparc64-linux gcc -V 4.0.2 $(GCCFLAGS) -fno-PIC -D__sparc64__ -S avcall-sparc64.c -o avcall-sparc64-linux.s + +avcall-sparc64-macro.S : avcall-sparc64-linux.s ../common/asm-sparc.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-sparc.h"' ; ../common/asm-sparc.sh < avcall-sparc64-linux.s ; cat ../common/noexecstack.h) > avcall-sparc64-macro.S + + +avcall-alpha-linux.s : avcall-alpha.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) alpha-linux gcc -V 4.0.2 $(GCCFLAGS) -D__alpha__ -S avcall-alpha.c -o avcall-alpha-linux.s + +avcall-alpha-macro.S : avcall-alpha-linux.s ../common/asm-alpha.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-alpha.sh < avcall-alpha-linux.s ; cat ../common/noexecstack.h) > avcall-alpha-macro.S + + +avcall-hppa-linux.s : avcall-hppa.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) hppa-linux gcc -V 3.1 $(GCCFLAGS) -D__hppa__ -S avcall-hppa.c -o avcall-hppa-linux.s + +avcall-hppa-macro.S : avcall-hppa-linux.s ../common/asm-hppa.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-hppa.h"' ; ../common/asm-hppa.sh < avcall-hppa-linux.s ; cat ../common/noexecstack.h) > avcall-hppa-macro.S + +avcall-hppa64-linux.s : avcall-hppa64.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) hppa64-linux gcc -V 3.1 $(GCCFLAGS) -D__hppa64__ -S avcall-hppa64.c -o avcall-hppa64-linux.s + +avcall-hppa64-macro.S : avcall-hppa64-linux.s ../common/asm-hppa64.sh ../common/noexecstack.h $(THISFILE) +# Need to remove the gcc-generated instructions that clobber %r29 right before each of the calls. + (echo '#include "asm-hppa64.h"' ; grep -v 'ldo -16(%r30),%r29' < avcall-hppa64-linux.s | ../common/asm-hppa64.sh ; cat ../common/noexecstack.h) > avcall-hppa64-macro.S + + +avcall-arm-macro.S : avcall-arm.c avcall-internal.h avcall.h avcall-alist.h ../common/asm-arm.sh ../common/noexecstack-arm.h $(THISFILE) + $(CROSS_TOOL) arm-linux gcc -V 3.1 -mlittle-endian $(GCCFLAGS) -D__arm__ -S avcall-arm.c -o avcall-armel.s + $(CROSS_TOOL) arm-linux gcc -V 3.1 -mbig-endian $(GCCFLAGS) -D__arm__ -S avcall-arm.c -o avcall-armeb.s + cmp avcall-armel.s avcall-armeb.s > /dev/null + (echo '#include "asm-arm.h"' ; ../common/asm-arm.sh < avcall-armel.s ; cat ../common/noexecstack-arm.h) > avcall-arm-macro.S + $(RM) avcall-armel.s avcall-armeb.s + +avcall-armhf-macro.S : avcall-armhf.c avcall-internal.h avcall.h avcall-alist.h ../common/asm-arm.sh ../common/noexecstack-arm.h $(THISFILE) +# The option -mabi=aapcs ensures an 8-bytes-aligned stack pointer. + $(CROSS_TOOL) armv7l-linux-gnueabihf gcc-6.5.0 -march=armv6 -mabi=aapcs -mfloat-abi=hard -mlittle-endian $(GCCFLAGS) -D__armhf__ -S avcall-armhf.c -o avcall-armhfel.s + $(CROSS_TOOL) armv7l-linux-gnueabihf gcc-6.5.0 -march=armv6 -mabi=aapcs -mfloat-abi=hard -mbig-endian $(GCCFLAGS) -D__armhf__ -S avcall-armhf.c -o avcall-armhfeb.s + cmp avcall-armhfel.s avcall-armhfeb.s > /dev/null + (echo '#include "asm-arm.h"' ; ../common/asm-arm.sh < avcall-armhfel.s ; cat ../common/noexecstack-arm.h) > avcall-armhf-macro.S + $(RM) avcall-armhfel.s avcall-armhfeb.s + + +avcall-arm64-macro.S : avcall-arm64.c avcall-internal.h avcall.h avcall-alist.h ../common/asm-arm64.sh ../common/noexecstack-arm.h $(THISFILE) + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 -mlittle-endian $(GCCFLAGS) -D__arm64__ -S avcall-arm64.c -o avcall-arm64el.s + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 -mbig-endian $(GCCFLAGS) -D__arm64__ -S avcall-arm64.c -o avcall-arm64eb.s + cmp avcall-arm64el.s avcall-arm64eb.s > /dev/null + (echo '#include "asm-arm64.h"' ; ../common/asm-arm64.sh < avcall-arm64el.s ; cat ../common/noexecstack-arm.h) > avcall-arm64-macro.S + $(RM) avcall-arm64el.s avcall-arm64eb.s + + +avcall-arm64-macos-macro.S : avcall-arm64.c avcall-internal.h avcall.h avcall-alist.h ../common/asm-arm64.sh ../common/noexecstack-arm.h $(THISFILE) + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 -mlittle-endian $(GCCFLAGS) -D__arm64__ -D__APPLE__ -D__MACH__ -S avcall-arm64.c -o avcall-arm64-macos.s + (echo '#include "asm-arm64.h"' ; ../common/asm-arm64.sh < avcall-arm64-macos.s ; cat ../common/noexecstack-arm.h) > avcall-arm64-macos-macro.S + $(RM) avcall-arm64-macos.s + + +avcall-powerpc-aix.s : avcall-powerpc.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) rs6000-aix gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc -mnew-mnemonics $(GCCFLAGS) -D__powerpc__ -S avcall-powerpc.c -o avcall-powerpc-aix.s + +avcall-powerpc-linux.s : avcall-powerpc.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) powerpc-linux gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc $(GCCFLAGS) -D__powerpc__ -S avcall-powerpc.c -o avcall-powerpc-linux.s + +avcall-powerpc-linux-macro.S : avcall-powerpc-linux.s ../common/asm-powerpc.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-powerpc.sh < avcall-powerpc-linux.s ; cat ../common/noexecstack.h) > avcall-powerpc-linux-macro.S + +avcall-powerpc-sysv4-macro.S : avcall-powerpc.c avcall-internal.h avcall.h avcall-alist.h ../common/asm-powerpc.sh ../common/noexecstack.h $(THISFILE) + $(CROSS_TOOL) powerpc-linux gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc $(GCCFLAGS) -D__powerpc__ -S avcall-powerpc.c -o avcall-powerpc-sysv4.s + (../common/asm-powerpc.sh < avcall-powerpc-sysv4.s ; cat ../common/noexecstack.h) > avcall-powerpc-sysv4-macro.S + $(RM) avcall-powerpc-sysv4.s + +avcall-powerpc-macos.s : avcall-powerpc.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) powerpc-darwin gcc -V 3.3.6 $(GCCFLAGS) -D__powerpc__ -S avcall-powerpc.c -o avcall-powerpc-macos.s + +avcall-powerpc64-aix.s : avcall-powerpc64.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) rs6000-aix6.1 gcc-5.4.0 -maix64 $(GCCFLAGS) -D__powerpc64__ -S avcall-powerpc64.c -o avcall-powerpc64-aix.s + +avcall-powerpc64-linux.S : avcall-powerpc64.c avcall-internal.h avcall.h avcall-alist.h ../common/asm-powerpc.sh ../common/noexecstack.h $(THISFILE) + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv1 -mcpu=power4 -mlittle-endian $(GCCFLAGS) -D__powerpc64__ -S avcall-powerpc64.c -o avcall-powerpc64-linux-le.s + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv1 -mcpu=power4 -mbig-endian $(GCCFLAGS) -D__powerpc64__ -S avcall-powerpc64.c -o avcall-powerpc64-linux-be.s + cmp avcall-powerpc64-linux-le.s avcall-powerpc64-linux-be.s > /dev/null + (../common/asm-powerpc.sh < avcall-powerpc64-linux-be.s ; cat ../common/noexecstack.h) > avcall-powerpc64-linux.S + $(RM) avcall-powerpc64-linux-le.s avcall-powerpc64-linux-be.s + +avcall-powerpc64-elfv2-linux.S : avcall-powerpc64.c avcall-internal.h avcall.h avcall-alist.h ../common/asm-powerpc.sh ../common/noexecstack.h $(THISFILE) + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv2 -mcpu=power4 -mlittle-endian $(GCCFLAGS) -D__powerpc64__ -D__powerpc64_elfv2__ -S avcall-powerpc64.c -o avcall-powerpc64-elfv2-linux-le.s + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv2 -mcpu=power4 -mbig-endian $(GCCFLAGS) -D__powerpc64__ -D__powerpc64_elfv2__ -S avcall-powerpc64.c -o avcall-powerpc64-elfv2-linux-be.s + cmp avcall-powerpc64-elfv2-linux-le.s avcall-powerpc64-elfv2-linux-be.s > /dev/null + (../common/asm-powerpc.sh < avcall-powerpc64-elfv2-linux-be.s ; cat ../common/noexecstack.h) > avcall-powerpc64-elfv2-linux.S + $(RM) avcall-powerpc64-elfv2-linux-le.s avcall-powerpc64-elfv2-linux-be.s + + +avcall-ia64-linux.s : avcall-ia64.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) ia64-linux gcc -V 4.0.1 $(GCCFLAGS) -D__ia64__ -S avcall-ia64.c -o avcall-ia64-linux.s + +avcall-ia64-macro.S : avcall-ia64-linux.s ../common/noexecstack.h $(THISFILE) + cat avcall-ia64-linux.s ../common/noexecstack.h > avcall-ia64-macro.S + + +avcall-x86_64-linux.s : avcall-x86_64.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) x86_64-linux gcc-4.0.2 $(GCCFLAGS) -D__x86_64__ -S avcall-x86_64.c -o avcall-x86_64-linux.s + +avcall-x86_64-macro.S : avcall-x86_64-linux.s ../common/asm-x86_64.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-x86_64.h"' ; ../common/asm-x86_64.sh < avcall-x86_64-linux.s ; cat ../common/noexecstack.h) > avcall-x86_64-macro.S + +avcall-x86_64-x32-linux.s : avcall-x86_64.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) x86_64-linux gcc-5.4.0 -mx32 $(GCCFLAGS) -D__x86_64__ -D__x86_64_x32__ -S avcall-x86_64.c -o avcall-x86_64-x32-linux.s + +avcall-x86_64-windows.s : avcall-x86_64-windows.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) x86_64-linux gcc-5.4.0 -mabi=ms $(GCCFLAGS) -fno-reorder-blocks-and-partition -D__x86_64__ -D_WIN32 -S avcall-x86_64-windows.c -o avcall-x86_64-windows.s + +avcall-x86_64-windows-macro.S : avcall-x86_64-windows.s ../common/asm-x86_64.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-x86_64.h"' ; ../common/asm-x86_64.sh < avcall-x86_64-windows.s ; cat ../common/noexecstack.h) > avcall-x86_64-windows-macro.S + + +avcall-s390-linux.s : avcall-s390.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) s390-linux gcc -V 3.1 $(GCCFLAGS) -D__s390__ -S avcall-s390.c -o avcall-s390-linux.s + +avcall-s390-macro.S : avcall-s390-linux.s ../common/asm-s390.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-s390.sh < avcall-s390-linux.s ; cat ../common/noexecstack.h) > avcall-s390-macro.S + + +avcall-s390x-linux.s : avcall-s390x.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) s390x-linux gcc-5.4.0 $(GCCFLAGS) -D__s390x__ -S avcall-s390x.c -o avcall-s390x-linux.s + +avcall-s390x-macro.S : avcall-s390x-linux.s ../common/asm-s390.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-s390.sh < avcall-s390x-linux.s ; cat ../common/noexecstack.h) > avcall-s390x-macro.S + + +avcall-riscv32-ilp32d-linux.s : avcall-riscv32.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) riscv32-linux gcc-7.3.0 $(GCCFLAGS) -D__riscv32__ -S avcall-riscv32.c -o avcall-riscv32-ilp32d-linux.s + +avcall-riscv32-ilp32d-macro.S : avcall-riscv32-ilp32d-linux.s ../common/asm-riscv.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-riscv.sh < avcall-riscv32-ilp32d-linux.s ; cat ../common/noexecstack.h) > avcall-riscv32-ilp32d-macro.S + + +avcall-riscv64-lp64d-linux.s : avcall-riscv64.c avcall-internal.h avcall.h avcall-alist.h $(THISFILE) + $(CROSS_TOOL) riscv64-linux gcc-7.3.0 $(GCCFLAGS) -D__riscv64__ -S avcall-riscv64.c -o avcall-riscv64-lp64d-linux.s + +avcall-riscv64-lp64d-macro.S : avcall-riscv64-lp64d-linux.s ../common/asm-riscv.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-riscv.sh < avcall-riscv64-lp64d-linux.s ; cat ../common/noexecstack.h) > avcall-riscv64-lp64d-macro.S + + +# --------------- Rules for debugging test failures --------------- + +tests : tests-i386.s tests-m68k.s tests-mips.s tests-sparc.s tests-alpha.s tests-hppa.s tests-arm.s tests-powerpc.s tests-ia64.s tests-x86_64.s + true + +tests-i386.s : tests.c avcall.h + $(GCC) -V 2.7.2 -b i486-linuxaout $(GCCFLAGS) -I/usr/include -D__i386__ -S tests.c -o tests-i386.s + +tests-m68k.s : tests.c avcall.h + $(GCC) -V 2.95.2 -b m68k-sun $(GCCFLAGS) -I/usr/include -D__m68k__ -S tests.c -o tests-m68k.s + +tests-mips.s : tests.c avcall.h + $(GCC) -V 2.95.2 -b mips-sgi $(GCCFLAGS) -I/usr/include -D__mips__ -S tests.c -o tests-mips.s + +tests-sparc.s : tests.c avcall.h + $(GCC) -V 2.95.2 -b sparc-sun $(GCCFLAGS) -I/usr/include -D__sparc__ -S tests.c -o tests-sparc.s + +tests-alpha.s : tests.c avcall.h + $(GCC) -V 2.7.2 -b alpha-dec-osf $(GCCFLAGS) -I/usr/include -D__alpha__ -S tests.c -o tests-alpha.s + +tests-hppa.s : tests.c avcall.h + $(GCC) -V 2.6.3 -b hppa1.0-hpux $(GCCFLAGS) -I/usr/include -D__hppa__ -S tests.c -o tests-hppa.s + +tests-arm.s : tests.c avcall.h + $(GCC) -V 2.6.3 -b arm-acorn-riscix $(GCCFLAGS) -I/usr/include -D__arm__ -S tests.c -o tests-arm.s + +tests-powerpc.s : tests.c avcall.h + $(GCC) -V 2.95.2 -b rs6000 $(GCCFLAGS) -I/usr/include -D__powerpc__ -S tests.c -o tests-powerpc.s + +tests-ia64.s : tests.c avcall.h + $(GCC) -V 2.9-ia64-000216 -b ia64-hp-linux $(GCCFLAGS) -I/usr/include -D__ia64__ -S tests.c -o tests-ia64.s + +tests-x86_64.s : tests.c avcall.h + $(GCC) -V 3.2.2 -b x86_64-suse-linux $(GCCFLAGS) -I/usr/include -D__x86_64__ -S tests.c -o tests-x86_64.s diff --git a/avcall/Makefile.in b/avcall/Makefile.in new file mode 100644 index 0000000..466023d --- /dev/null +++ b/avcall/Makefile.in @@ -0,0 +1,419 @@ +# Makefile for avcall + +#### Start of system configuration section. #### + +HOST = @host@ +CPU = @HOST_CPU_C_ABI@ +OS = @host_os@ + +# Directories used by "make": +srcdir = @srcdir@ + +# Directories used by "make install": +prefix = @prefix@ +local_prefix = /usr/local +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +mandir = @mandir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +htmldir = $(datadir)/html + +# Programs used by "make": +# C compiler +CC = @CC@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +# C++ compiler +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +# Both C and C++ compiler +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I. -I$(srcdir) -I.. -I$(srcdir)/.. +ASPFLAGS = `if test @AS_UNDERSCORE@ = true; then echo '-DASM_UNDERSCORE'; fi` +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile +LIBTOOL_LINK = $(LIBTOOL) --mode=link +LIBTOOL_INSTALL = $(LIBTOOL) --mode=install +LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall +AR = @AR@ +AR_FLAGS = rc +RANLIB = @RANLIB@ +MV = mv +LN = @LN@ +RM = rm -f +@SET_MAKE@ + +# Programs used by "make install": +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +#### End of system configuration section. #### + +SHELL = /bin/sh + +# Needed by $(LIBTOOL). +top_builddir = .. + +OBJECTS = avcall.lo avcall-libapi.lo avcall-structcpy.lo avcall-compat.lo + +# Limit the set of exported symbols, on those platforms where libtool supports it. +# Currently this does not exclude any symbol; maybe sometime in the future... +LIBAVCALL_EXPORTED_SYMBOLS_REGEX = '^avcall_|^__builtin_avcall$$' + +# Before making a release, change this according to the libtool documentation, +# section "Library interface versions". +LIBAVCALL_VERSION_INFO = 2:0:1 + +all : $(OBJECTS) libavcall.la $(srcdir)/avcall.3 $(srcdir)/avcall.html + +avcall.lo : avcall-$(CPU).lo + $(RM) avcall.lo avcall.@OBJEXT@ + $(LN) avcall-$(CPU).lo avcall.lo + if test -f avcall-$(CPU).@OBJEXT@; then $(LN) avcall-$(CPU).@OBJEXT@ avcall.@OBJEXT@; fi + +@IFNOT_MSVC@avcall-i386.lo : avcall-i386.s +@IFNOT_MSVC@ $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-i386.s + +@IFNOT_MSVC@avcall-i386.s : $(srcdir)/avcall-i386-macro.S +@IFNOT_MSVC@ $(CPP) $(ASPFLAGS) -I$(srcdir)/../common - < $(srcdir)/avcall-i386-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,@ ,@,g' -e 's,//.*$$,,' -e 's/##//g' > avcall-i386.s + +@IF_MSVC@avcall-i386.lo : $(srcdir)/avcall-i386-msvc.c +@IF_MSVC@ $(LIBTOOL_COMPILE) $(CC) -I$(srcdir)/../common $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/avcall-i386-msvc.c -o avcall-i386.lo + +avcall-sparc.lo : avcall-sparc.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-sparc.s + +avcall-sparc.s : $(srcdir)/avcall-sparc-macro.S $(srcdir)/avcall-sparc-solaris-macro.S + case "$(OS)" in \ + solaris*) input=avcall-sparc-solaris-macro.S ;; \ + *) input=avcall-sparc-macro.S ;; \ + esac; \ + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common - < $(srcdir)/$${input} | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//.*$$,,' -e 's,\$$,#,g' -e 's,# ,#,g' > avcall-sparc.s + +avcall-sparc64.lo : avcall-sparc64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-sparc64.s + +avcall-sparc64.s : $(srcdir)/avcall-sparc64-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common - < $(srcdir)/avcall-sparc64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//.*$$,,' -e 's,\$$,#,g' -e 's,# ,#,g' > avcall-sparc64.s + +avcall-m68k.lo : avcall-m68k.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-m68k.s + +avcall-m68k.s : $(srcdir)/avcall-m68k.mit.S $(srcdir)/avcall-m68k.motorola.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/avcall-m68k.motorola.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' | if test @AS_UNDERSCORE@ = true; then sed -e 's/\$$//g'; else sed -e 's/\$$/%/g'; fi > avcall-m68k.s + +avcall-mips.lo : avcall-mips.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-mips.s + +avcall-mips.s : $(srcdir)/avcall-mips@ENDIANNESS@-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/avcall-mips@ENDIANNESS@-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-mips.s + +avcall-mipsn32.lo : avcall-mipsn32.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-mipsn32.s + +avcall-mipsn32.s : $(srcdir)/avcall-mipsn32@ENDIANNESS@-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/avcall-mipsn32@ENDIANNESS@-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-mipsn32.s + +avcall-mips64.lo : avcall-mips64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-mips64.s + +avcall-mips64.s : $(srcdir)/avcall-mips64@ENDIANNESS@-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/avcall-mips64@ENDIANNESS@-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-mips64.s + +avcall-alpha.lo : avcall-alpha.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-alpha.s + +avcall-alpha.s : $(srcdir)/avcall-alpha-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/avcall-alpha-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-alpha.s + +avcall-hppa.lo : avcall-hppa.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-hppa.s + +avcall-hppa.s : $(srcdir)/avcall-hppa-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/avcall-hppa-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > avcall-hppa.s + +avcall-hppa64.lo : avcall-hppa64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-hppa64.s + +avcall-hppa64.s : $(srcdir)/avcall-hppa64-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/avcall-hppa64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > avcall-hppa64.s + +avcall-arm.lo : avcall-arm.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-arm.s + +avcall-arm.s : $(srcdir)/avcall-arm-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/avcall-arm-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > avcall-arm.s + +avcall-armhf.lo : avcall-armhf.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-armhf.s + +avcall-armhf.s : $(srcdir)/avcall-armhf-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/avcall-armhf-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > avcall-armhf.s + +avcall-arm64.lo : avcall-arm64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-arm64.s + +avcall-arm64.s : $(srcdir)/avcall-arm64-macro.S $(srcdir)/avcall-arm64-macos-macro.S + case "$(OS)" in \ + macos* | darwin*) input=avcall-arm64-macos-macro.S ;; \ + *) input=avcall-arm64-macro.S ;; \ + esac; \ + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/$${input} | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > avcall-arm64.s + +avcall-powerpc.lo : avcall-powerpc.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-powerpc.s + +avcall-powerpc.s : $(srcdir)/avcall-powerpc-aix.s $(srcdir)/avcall-powerpc-linux-macro.S $(srcdir)/avcall-powerpc-macos.s $(srcdir)/avcall-powerpc-sysv4-macro.S + case "$(OS)" in \ + aix*) syntax=aix;; \ + linux* | netbsd* | openbsd*) syntax=linux;; \ + macos* | darwin*) syntax=macos;; \ + *) syntax=sysv4;; \ + esac; \ + case $${syntax} in \ + macos) \ + grep -v '\.machine' $(srcdir)/avcall-powerpc-$${syntax}.s > avcall-powerpc.s || exit 1 ;; \ + linux | sysv4) \ + $(CPP) $(ASPFLAGS) $(srcdir)/avcall-powerpc-$${syntax}-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-powerpc.s || exit 1 ;; \ + *) \ + cp $(srcdir)/avcall-powerpc-$${syntax}.s avcall-powerpc.s || exit 1 ;; \ + esac + +avcall-powerpc64.lo : avcall-powerpc64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-powerpc64.s + +avcall-powerpc64.s : $(srcdir)/avcall-powerpc64-aix.s $(srcdir)/avcall-powerpc64-linux.S + case "$(OS)" in \ + aix*) syntax=aix;; \ + *) syntax=linux;; \ + esac; \ + case $${syntax} in \ + linux) \ + $(CPP) $(ASPFLAGS) $(srcdir)/avcall-powerpc64-$${syntax}.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-powerpc64.s || exit 1 ;; \ + *) \ + cp $(srcdir)/avcall-powerpc64-$${syntax}.s avcall-powerpc64.s || exit 1 ;; \ + esac + +avcall-powerpc64-elfv2.lo : avcall-powerpc64-elfv2.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-powerpc64-elfv2.s + +avcall-powerpc64-elfv2.s : $(srcdir)/avcall-powerpc64-elfv2-linux.S + $(CPP) $(ASPFLAGS) $(srcdir)/avcall-powerpc64-elfv2-linux.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-powerpc64-elfv2.s + +avcall-ia64.lo : avcall-ia64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-ia64.s + +avcall-ia64.s : $(srcdir)/avcall-ia64-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/avcall-ia64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-ia64.s + +@IFNOT_MSVC@avcall-x86_64.lo : avcall-x86_64.s +@IFNOT_MSVC@ $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-x86_64.s + +@IFNOT_MSVC@avcall-x86_64.s : $(srcdir)/avcall-x86_64-macro.S $(srcdir)/avcall-x86_64-windows-macro.S +@IFNOT_MSVC@ case "$(OS)" in \ +@IFNOT_MSVC@ cygwin* | mingw*) variant='-windows';; \ +@IFNOT_MSVC@ *) variant='';; \ +@IFNOT_MSVC@ esac; \ +@IFNOT_MSVC@ $(CPP) $(ASPFLAGS) -I$(srcdir)/../common - < $(srcdir)/avcall-x86_64$${variant}-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,@ ,@,g' -e 's,//.*$$,,' -e 's/##//g' > avcall-x86_64.s + +@IF_MSVC@avcall-x86_64.lo : avcall-x86_64.asm avcall-libapi.lo +@IF_MSVC@ ml64 -c -nologo avcall-x86_64.asm +@IF_MSVC@ mkdir -p .libs; cp avcall-x86_64.@OBJEXT@ .libs/avcall-x86_64.@OBJEXT@ +@IF_MSVC@ sed -e 's/avcall-libapi/avcall-x86_64/g' < avcall-libapi.lo > avcall-x86_64.lo + +@IF_MSVC@avcall-x86_64.asm : $(srcdir)/avcall-x86_64-windows-macro.S +@IF_MSVC@ { $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/avcall-x86_64-windows-macro.S | grep -v '^#'; echo 'END'; } > avcall-x86_64.asm + +avcall-x86_64-x32.lo : avcall-x86_64-x32.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-x86_64-x32.s + +avcall-x86_64-x32.s : $(srcdir)/avcall-x86_64-x32-linux.s + cp $(srcdir)/avcall-x86_64-x32-linux.s avcall-x86_64-x32.s + +avcall-s390.lo : avcall-s390.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-s390.s + +avcall-s390.s : $(srcdir)/avcall-s390-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/avcall-s390-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-s390.s + +avcall-s390x.lo : avcall-s390x.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-s390x.s + +avcall-s390x.s : $(srcdir)/avcall-s390x-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/avcall-s390x-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-s390x.s + +avcall-riscv32-ilp32d.lo : avcall-riscv32-ilp32d.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-riscv32-ilp32d.s + +avcall-riscv32-ilp32d.s : $(srcdir)/avcall-riscv32-ilp32d-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/avcall-riscv32-ilp32d-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-riscv32-ilp32d.s + +avcall-riscv64-lp64d.lo : avcall-riscv64-lp64d.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c avcall-riscv64-lp64d.s + +avcall-riscv64-lp64d.s : $(srcdir)/avcall-riscv64-lp64d-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/avcall-riscv64-lp64d-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > avcall-riscv64-lp64d.s + +avcall-libapi.lo : $(srcdir)/avcall-libapi.c ../config.h $(srcdir)/avcall-internal.h $(srcdir)/avcall.h $(srcdir)/avcall-alist.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) @DISABLE_TYPE_BASED_ALIASING@ -c $(srcdir)/avcall-libapi.c + +avcall-structcpy.lo : $(srcdir)/avcall-structcpy.c $(srcdir)/../common/structcpy.c + $(LIBTOOL_COMPILE) $(CC) -I$(srcdir)/../common $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/avcall-structcpy.c + +avcall-compat.lo : $(srcdir)/avcall-compat.c ../config.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/avcall-compat.c + +libavcall.la : $(OBJECTS) + $(LIBTOOL_LINK) $(CC) -o libavcall.la -rpath $(libdir) -no-undefined -export-symbols-regex $(LIBAVCALL_EXPORTED_SYMBOLS_REGEX) -version-info $(LIBAVCALL_VERSION_INFO) $(OBJECTS) $(LDFLAGS) + +# Installs the library and include files only. Typically called with only +# $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here. +install-lib : all force + mkdir -p $(libdir) + $(LIBTOOL_INSTALL) $(INSTALL_DATA) libavcall.la $(libdir)/libavcall.la + mkdir -p $(includedir) + $(INSTALL_DATA) $(srcdir)/avcall.h $(includedir)/avcall.h + +install : all force + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(exec_prefix) + mkdir -p $(DESTDIR)$(libdir) + $(LIBTOOL_INSTALL) $(INSTALL_DATA) libavcall.la $(DESTDIR)$(libdir)/libavcall.la + mkdir -p $(DESTDIR)$(includedir) + $(INSTALL_DATA) $(srcdir)/avcall.h $(DESTDIR)$(includedir)/avcall.h + mkdir -p $(DESTDIR)$(mandir) + mkdir -p $(DESTDIR)$(mandir)/man3 + $(INSTALL_DATA) $(srcdir)/avcall.3 $(DESTDIR)$(mandir)/man3/avcall.3 + mkdir -p $(DESTDIR)$(datadir) + mkdir -p $(DESTDIR)$(htmldir) + $(INSTALL_DATA) $(srcdir)/avcall.html $(DESTDIR)$(htmldir)/avcall.html + +installdirs : force + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(exec_prefix) + mkdir -p $(DESTDIR)$(libdir) + mkdir -p $(DESTDIR)$(includedir) + mkdir -p $(DESTDIR)$(mandir) + mkdir -p $(DESTDIR)$(mandir)/man3 + mkdir -p $(DESTDIR)$(datadir) + mkdir -p $(DESTDIR)$(htmldir) + +uninstall : force + $(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libavcall.la + $(RM) $(DESTDIR)$(includedir)/avcall.h + $(RM) $(DESTDIR)$(mandir)/man3/avcall.3 + $(RM) $(DESTDIR)$(htmldir)/avcall.html + +minitests.@OBJEXT@ : $(srcdir)/minitests.c $(srcdir)/tests.c $(srcdir)/avcall.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/minitests.c + +minitests.s : $(srcdir)/minitests.c $(srcdir)/tests.c $(srcdir)/avcall.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -S $(srcdir)/minitests.c + +minitests : minitests.@OBJEXT@ libavcall.la + $(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ minitests.@OBJEXT@ libavcall.la $(LDFLAGS) -o minitests + +minitests-c++.@OBJEXT@ : $(srcdir)/minitests-c++.cc $(srcdir)/minitests.c $(srcdir)/tests.c $(srcdir)/avcall.h + $(CXX) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) -c $(srcdir)/minitests-c++.cc + +minitests-c++ : minitests-c++.@OBJEXT@ libavcall.la + $(LIBTOOL_LINK) $(CXX) $(CXXFLAGS) @GCC_X_NONE@ minitests-c++.@OBJEXT@ libavcall.la $(LDFLAGS) -o minitests-c++ + +check : all minitests + ./minitests > minitests.out + LC_ALL=C uniq -u < minitests.out > minitests.output.$(HOST) + test '!' -s minitests.output.$(HOST) +@IF_CXX@# minitests-c++ crashes on HP-UX HPPA 32-bit with aCC, even without "-O". +@IF_CXX@ test $(CPU) = 'hppa' || { \ +@IF_CXX@ ./minitests-c++ > minitests-c++.out \ +@IF_CXX@ && LC_ALL=C uniq -u < minitests-c++.out > minitests-c++.output.$(HOST) \ +@IF_CXX@ && test '!' -s minitests-c++.output.$(HOST); \ +@IF_CXX@ } +@IF_CXX@check : minitests-c++ + +tests.@OBJEXT@ : $(srcdir)/tests.c $(srcdir)/avcall.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/tests.c + +tests.s : $(srcdir)/tests.c $(srcdir)/avcall.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -S $(srcdir)/tests.c + +tests : tests.@OBJEXT@ libavcall.la + $(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ tests.@OBJEXT@ libavcall.la $(LDFLAGS) -o tests + +extracheck : all tests + ./tests > tests.out + LC_ALL=C uniq -u < tests.out > tests.output.$(HOST) + test '!' -s tests.output.$(HOST) + +mostlyclean : clean + +clean : force + $(RM) *.@OBJEXT@ *.lo *.a libavcall.* core + $(RM) avcall-i386.s avcall-sparc.s avcall-sparc64.s avcall-m68k.s avcall-mips.s avcall-mipsn32.s avcall-mips64.s avcall-alpha.s avcall-hppa.s avcall-hppa64.s avcall-arm.s avcall-armhf.s avcall-arm64.s avcall-powerpc.s avcall-powerpc64.s avcall-powerpc64-elfv2.s avcall-ia64.s avcall-x86_64.s avcall-x86_64.asm avcall-x86_64-x32.s avcall-s390.s avcall-s390x.s avcall-riscv32-ilp32d.s avcall-riscv64-lp64d.s + $(RM) -r .libs _libs + $(RM) minitests.@OBJEXT@ minitests.s minitests minitests.out + $(RM) minitests-c++.@OBJEXT@ minitests-c++ minitests-c++.out + $(RM) tests.@OBJEXT@ tests.s tests tests.out + +distclean : clean + $(RM) Makefile minitests.output.* minitests-c++.output.* tests.output.* + +maintainer-clean : distclean + + +# List of source files (committed in version control or generated by Makefile.devel). +SOURCE_FILES = \ + COPYING \ + DOC PLATFORMS README avcall.3 avcall.html \ + Makefile.devel \ + Makefile.maint \ + Makefile.in \ + avcall.h avcall-internal.h avcall-alist.h \ + avcall-alpha.c avcall-alpha-linux.s avcall-alpha-macro.S \ + avcall-arm.c avcall-arm-macro.S \ + avcall-armhf.c avcall-armhf-macro.S \ + avcall-arm64.c avcall-arm64-macro.S avcall-arm64-macos-macro.S \ + avcall-hppa.c avcall-hppa-linux.s avcall-hppa-macro.S \ + avcall-hppa64.c avcall-hppa64-linux.s avcall-hppa64-macro.S \ + avcall-i386.c avcall-i386-linux.s avcall-i386-macro.S \ + avcall-ia64.c avcall-ia64-linux.s avcall-ia64-macro.S \ + avcall-m68k.c avcall-m68k-linux.s avcall-m68k-sun.s avcall-m68k.mit.S avcall-m68k.motorola.S \ + avcall-mips.c avcall-mipseb-linux.s avcall-mipsel-linux.s avcall-mipseb-macro.S avcall-mipsel-macro.S \ + avcall-mipsn32.c avcall-mipsn32eb-linux.s avcall-mipsn32el-linux.s avcall-mipsn32eb-macro.S avcall-mipsn32el-macro.S \ + avcall-mips64.c avcall-mips64eb-linux.s avcall-mips64el-linux.s avcall-mips64eb-macro.S avcall-mips64el-macro.S \ + avcall-powerpc.c \ + avcall-powerpc-aix.s \ + avcall-powerpc-linux.s avcall-powerpc-linux-macro.S avcall-powerpc-macos.s avcall-powerpc-sysv4-macro.S \ + avcall-powerpc64.c avcall-powerpc64-aix.s avcall-powerpc64-linux.S avcall-powerpc64-elfv2-linux.S \ + avcall-riscv32.c avcall-riscv32-ilp32d-linux.s avcall-riscv32-ilp32d-macro.S \ + avcall-riscv64.c avcall-riscv64-lp64d-linux.s avcall-riscv64-lp64d-macro.S \ + avcall-s390.c avcall-s390-linux.s avcall-s390-macro.S \ + avcall-s390x.c avcall-s390x-linux.s avcall-s390x-macro.S \ + avcall-sparc.c avcall-sparc-linux.s avcall-sparc-macro.S avcall-sparc-solaris.s avcall-sparc-solaris-macro.S \ + avcall-sparc64.c avcall-sparc64-linux.s avcall-sparc64-macro.S \ + avcall-x86_64.c avcall-x86_64-linux.s avcall-x86_64-macro.S avcall-x86_64-x32-linux.s \ + avcall-x86_64-windows.c avcall-x86_64-windows.s avcall-x86_64-windows-macro.S \ + avcall-libapi.c \ + avcall-structcpy.c \ + avcall-compat.c \ + minitests.c minitests-c++.cc \ + tests.c +# List of distributed files generated by Makefile.maint. +GENERATED_FILES = \ + avcall.man \ + avcall-i386-msvc.c +# List of distributed files. +DISTFILES = $(SOURCE_FILES) $(GENERATED_FILES) + +distdir : $(DISTFILES) + for file in $(DISTFILES); do \ + if test -f $$file; then dir='.'; else dir='$(srcdir)'; fi; \ + cp -p "$$dir/$$file" '$(distdir)'/$$file || exit 1; \ + done + + +force : diff --git a/avcall/Makefile.maint b/avcall/Makefile.maint new file mode 100644 index 0000000..dbfa663 --- /dev/null +++ b/avcall/Makefile.maint @@ -0,0 +1,24 @@ +# maintainer -*-Makefile-*- + +LN = ln -s +RM = rm -f + +# ==================== Easily regeneratable files ==================== + +ROFF_MAN = groff -Tutf8 -mandoc + +all : avcall.man \ + avcall-i386-msvc.c + +avcall.man : avcall.3 + $(ROFF_MAN) avcall.3 > avcall.man + +avcall-i386-msvc.c : avcall-i386-macro.S + cp -p avcall-i386-macro.S avcall-i386-msvc.c + +totally-clean : force + $(RM) avcall.man + $(RM) avcall-i386-msvc.c + + +force : diff --git a/avcall/PLATFORMS b/avcall/PLATFORMS new file mode 100644 index 0000000..a823a51 --- /dev/null +++ b/avcall/PLATFORMS @@ -0,0 +1,81 @@ +Supported CPUs: (Put the GNU config.guess values here.) + + CPU GNU config.guess value machine OS + + i386 i486-unknown-linux (gcc) i386/486/586 Linux + i686-unknown-gnu0.9 (gcc) i686 GNU Hurd + i386-unknown-sysv4.0 (gcc, i386 Consensys + /usr/bin/cc, /usr/ucb/cc) + i386-pc-solaris2.6 (gcc) i386/486/586 Solaris + i386-pc-solaris2.10 (gcc, cc) i386/486/586 Solaris + i486-unknown-sco3.2v4.2 (gcc, cc -Of) i386/486/586 SCO + i386-pc-cygwin32 (gcc) i386/486/586 Cygwin32 + i386-w64-mingw32 (gcc, MSVC 14) i386/486/586 Win32 + i586-unknown-freebsd11.0 (cc) i386/486/586 FreeBSD 11 + i386-unknown-dragonfly3.8 (gcc) i386/486/586 DragonFly BSD + i386-unknown-netbsdelf7.0 (gcc) i386/486/586 NetBSD 7 + i386-unknown-openbsd6.0 (gcc) i386/486/586 OpenBSD 6 + i586-pc-haiku (gcc-x86) i586 Haiku 2017 + i386-pc-minix (clang) i386/486/586 Minix 3.3 + m68k m68k-sun-sunos4.0 (cc) Sun3 SunOS 4.0.3 + m68k-unknown-linux (gcc) emulated Linux + mips mips-sgi-irix4.0.5 (gcc, SGI mips Irix 4.0.x + cc -ansi, cc -D__STDC__, cc -cckr) + mips-sgi-irix5.2 (gcc, cc -ansi, ...) SGI mips Irix 5.2 + mips-sgi-irix5.3 (gcc, cc -ansi, ...) SGI mips Irix 5.3 + mips-sgi-irix6.2 (cc -32) SGI mips3 Irix 6.2 + mips-sgi-irix6.4 (cc -32, -n32, -64) SGI mips3 Irix 6.4 + mips-sgi-irix6.5 (cc -32, -n32, SGI mips3 Irix 6.5 + gcc -mabi=n32) + mips-unknown-linux (gcc -mabi=32) emulated Linux + mips64-unknown-linux (gcc -mabi=n32,64)emulated Linux + sparc sparc-sun-sunos4.1.1 (gcc, cc) Sun4 Sparc SunOS 4.x + sparc-sun-solaris2.3 (gcc) Sun4 Sparc SunOS 5.x + sparc-sun-solaris2.4 (gcc, cc) Sun4 Sparc SunOS 5.x + sparc-sun-solaris2.10 (gcc, cc) Sun4 Sparc Solaris 10 + sparc64-sun-solaris2.10 (gcc -m64, Sun4 Sparc Solaris 10 + cc -xarch=generic64) + sparc-unknown-linux (gcc) emulated Linux + sparc64-unknown-linux (gcc) emulated Linux + sparc-unknown-netbsdelf7.1 (gcc) emulated NetBSD 7.1 + sparc64-unknown-netbsd8.0 (gcc) emulated NetBSD 8.0 + alpha alpha-dec-osf3.0 (gcc, cc) DEC Alpha OSF/1 3.0 + alpha-dec-osf4.0 (gcc, cc) DEC Alpha OSF/1 4.0 + alphaev67-unknown-linux (gcc) emulated Linux + hppa hppa1.0-hp-hpux8.00 (gcc, HP 9000/8xx HP-UX 8.0x + cc, c89, cc -Aa) + hppa1.1-hp-hpux9.05 (cc) HP 9000/8xx HP-UX 9.0x + hppa1.1-hp-hpux10.01 (cc) HP 9000/8xx HP-UX 10.0x + hppa2.0-hp-hpux10.20 (cc +DA1.1) HP 9000/8xx HP-UX 10.20 + hppa2.0w-hp-hpux11.31 (cc) HP 9000/8xx HP-UX 11.31 + hppa-unknown-linux (gcc) emulated Linux + hppa64 hppa64-hp-hpux11.31 (cc +DD64) HP 9000/8xx HP-UX 11.31 + arm armv5tejl-unknown-linux (gcc) emulated Linux + armv6l-unknown-linux (gcc) emulated Linux + armv7l-unknown-linux (gcc) emulated Linux + arm64 aarch64-unknown-linux (gcc) APM X-Gene Linux + aarch64-apple-darwin20.4.0 (cc) Mac mini macOS 11 + powerpc powerpc-ibm-aix4.1.4.0 (cc) IBM RS/6000 AIX 4.1.4 + powerpc-ibm-aix7.1.3.0 (xlc, gcc) IBM POWER AIX 7.1.3 + powerpc-unknown-linux (gcc) Apple PPC LinuxPPC + powerpc-apple-darwin6.8 (gcc) Apple PPC MacOS X + powerpc-apple-darwin9.8.0 (gcc) Apple PPC MacOS X + powerpc64 powerpc-ibm-aix7.1.3.0 (gcc -maix64, IBM POWER AIX 7.1.3 + xlc -q64) + powerpc64-unknown-linux (gcc -m64) IBM POWER Linux + powerpc64le-unknown-linux (gcc) IBM POWER Linux + ia64 ia64-unknown-linux (gcc) Intel Linux + x86_64 x86_64-suse-linux (gcc) AMD64 Linux + x86_64-unknown-linux (gcc -mx32) AMD64 Linux + x86_64-pc-solaris2.10 (gcc -m64) AMD64 Solaris + x86_64-pc-solaris2.10 (cc -xarch=generic64) AMD64 Solaris + x86_64-pc-cygwin (gcc) AMD64 Windows 10 + x86_64-w64-mingw32 (gcc, MSVC 14) AMD64 Windows 10 + x86_64-unknown-freebsd11.0 (cc) AMD64 FreeBSD 11 + x86_64-unknown-netbsd7.0 (gcc) AMD64 NetBSD 7 + x86_64-unknown-openbsd6.0 (gcc) AMD64 OpenBSD 6 + s390 s390x-ibm-linux (gcc -m31) emulated Linux + s390x s390x-ibm-linux (gcc) emulated Linux + riscv32 riscv32-unknown-linux (gcc -mabi=ilp32d) emulated Linux + riscv64 riscv64-unknown-linux (gcc -mabi=lp64d) emulated Linux + diff --git a/avcall/README b/avcall/README new file mode 100644 index 0000000..b85a718 --- /dev/null +++ b/avcall/README @@ -0,0 +1,73 @@ +avcall - calling C functions with variable arguments + +This library allows arbitrary C functions to be called from embedded +interpreters, debuggers, RPC calls, etc, by building up a C +argument-list incrementally from explicitly typed arguments. This +considerably reduces the amount of boilerplate glue code required +for such applications. + +The interface is like stdargs/varargs in reverse and is intended to be as +portable as possible, however the details of function calling are highly +machine-dependent so your mileage may vary. At the very least there are +typically built-in limits on the size of the argument-list. The +argument-pushing macros all return 0 for success, < 0 for error (eg, +arg-list overflow). + + +Installation instructions: + + Configure the parent directory. Then: + cd avcall + make + make check + make install + + +Files in this package: + + Documentation: + + README this text + COPYING free software license + PLATFORMS list of supported platforms + avcall.3 manual page in Unix man format + avcall.man manual page + avcall.html manual page in HTML format + DOC documentation + + Source: + + avcall.h main include file + avcall-*.c source for the main interface function + avcall-*.[sS] its translation to assembly language + avcall-libapi.c implementation of other library API + avcall-structcpy.c auxiliary function + tests.c test program + + Building: + + Makefile.in Makefile master + + Porting: + + Makefile.devel developer's Makefile + + +Copyright notice: + +Copyright 1993-1995 Bill Triggs +Copyright 1995-2017 Bruno Haible + +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, see . + diff --git a/avcall/avcall-alist.h b/avcall/avcall-alist.h new file mode 100644 index 0000000..797f730 --- /dev/null +++ b/avcall/avcall-alist.h @@ -0,0 +1,209 @@ +/* + * Copyright 1993-1995 Bill Triggs + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#ifndef _AVCALL_INTERNAL_H +#error "Never use directly; include instead." +#endif + +/* The platform indicator symbols (__i386__, etc.) come from + - "config.h" when compiling avcall-libapi.c, + - the GCC command line options when compiling avcall-$(CPU).c. + */ + +/* These two variants of powerpc ABIs are quite different. */ +#if defined(__powerpc__) && !defined(__powerpc64__) +#if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)) +#define __powerpc_aix__ 1 +#else +#define __powerpc_sysv4__ 1 +#endif +#endif + +/* The Unix and Windows variants of x86_64 ABIs are quite different. */ +#if defined(__x86_64__) +#if defined(_WIN32) || defined(__CYGWIN__) +#define __x86_64_ms__ 1 +#else +#define __x86_64_sysv__ 1 +#endif +#endif + +/* + * Definition of the ‘__av_alist’ type. + */ +/* Note: This struct must not contain members of type 'long' or 'unsigned long', + because in the mingw port we use precompiled code that assumes 'long' is + 64-bit whereas avcall-libapi.c is then compiled by a compiler that has a + 32-bit 'long' type. */ +typedef struct +{ + /* some av_... macros need these flags */ + int flags; + /* function to be called */ + __avrword (*func)(); + /* return type, address for the result */ + void* raddr; + enum __AVtype rtype; + uintptr_t rsize; + /* current pointer into the args[] array */ + __avword* aptr; + /* beginning of the args[] array */ + __avword* args; +#if defined(__hppa__) && !defined(__hppa64__) + /* end of the args[] array */ + __avword* args_end; +#endif + /* limit pointer into the args[] array */ + __avword* eptr; +#if defined(__i386__) && 0 + /* Filler word, needed if the numbers of words up to now in this structure */ + /* is odd (because on MSVC, alignof(double) = 8, normally = 4). */ + __avword filler1; +#endif +#if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || (defined(__hppa__) && !defined(__hppa64__)) || defined(__arm__) || defined(__armhf__) || (defined(__powerpc__) && !defined(__powerpc64__)) || (defined(__s390__) && !defined(__s390x__)) || defined(__riscv32__) + /* temporary storage, used to split doubles into two words */ + union { + double _double; +#if defined(__sparc__) && !defined(__sparc64__) + long long _longlong; +#endif + __avword words[2]; + } tmp; +#endif +#if defined(__x86_64_sysv__) +#define __AV_IARG_NUM 6 + /* store the integer arguments in an extra array */ + unsigned int ianum; + __avrword iargs[__AV_IARG_NUM]; +#endif +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) +#define __AV_FARG_NUM 2 + /* store the floating-point arguments in an extra array */ + unsigned int anum; + unsigned int fanum; + unsigned int farg_mask; /* bitmask of those entries in fargs[] which have a float value */ + unsigned int darg_mask; /* bitmask of those entries in dargs[] which have a double value */ + float fargs[__AV_FARG_NUM]; + double dargs[__AV_FARG_NUM]; +#endif +#if defined(__mipsn32__) || defined(__mips64__) + /* store the floating-point arguments in an extra array */ + int anum; /* redundant: (LIST).aptr = &(LIST).args[(LIST).anum] */ + unsigned int farg_mask; /* bitmask of those entries in farg[] which have a value */ + unsigned int darg_mask; /* bitmask of those entries in args[] which have a double value */ + float fargs[8]; +#endif +#if defined(__sparc64__) + /* store the floating-point arguments in an extra array */ + int anum; /* redundant: (LIST).aptr = &(LIST).args[(LIST).anum] */ + unsigned int darg_mask; /* bitmask of those entries in args[] which have a float or double value */ +#endif +#if defined(__hppa__) || defined(__hppa64__) + unsigned int farg_mask; /* bitmask of those entries in args[] which have a float value */ + unsigned int darg_mask; /* bitmask of those entries in args[] which have a double value */ +#endif +#if defined(__armhf__) +#define __AV_IARG_NUM 4 + /* The first __AV_IARG_NUM integer arguments are passed in registers, even if + some floating-point arguments have already been allocated on the stack. */ + unsigned int ianum; + /* store the floating-point arguments in an extra array */ + unsigned int fanum; /* number of fargs[] words that are occupied so far */ + unsigned int farg_mask; /* bitmask of those entries in fargs[] which have a float value */ + unsigned int darg_mask; /* bitmask of those entries in dargs[] which have a double value */ + float fargs[16]; + double dargs[8]; +#endif +#if defined(__arm64__) +#define __AV_IARG_NUM 8 + /* store the integer arguments in an extra array */ + unsigned int ianum; + __avrword iargs[__AV_IARG_NUM]; +#define __AV_FARG_NUM 8 + /* store the floating-point arguments in an extra array */ + unsigned int fanum; /* number of fargs[] words that are occupied so far */ + unsigned int farg_mask; /* bitmask of those entries in fargs[] which have a float value */ + unsigned int darg_mask; /* bitmask of those entries in dargs[] which have a double value */ + float fargs[__AV_FARG_NUM]; + double dargs[__AV_FARG_NUM]; +#endif +#if defined(__ia64__) || defined(__x86_64_sysv__) + /* store the floating-point arguments in an extra array */ +#define __AV_FARG_NUM 8 + double* faptr; + double fargs[__AV_FARG_NUM]; +#endif +#if defined(__powerpc__) || defined(__powerpc64__) +#if defined(__powerpc_sysv4__) +#define __AV_IARG_NUM 8 + /* store the integer arguments in an extra array */ + unsigned int ianum; + __avrword iargs[__AV_IARG_NUM]; +#define __AV_FARG_NUM 8 +#else +#define __AV_FARG_NUM 13 +#endif + /* store the floating-point arguments in an extra array */ + double* faptr; + double fargs[__AV_FARG_NUM]; +#endif +#if defined(__x86_64_ms__) + /* store the floating-point arguments in an extra array */ + int anum; /* redundant: (LIST).aptr = &(LIST).args[(LIST).anum] */ +#define __AV_FARG_NUM 4 + unsigned int farg_mask; /* bitmask of those entries in fargs[] which have a float value */ + unsigned int darg_mask; /* bitmask of those entries in dargs[] which have a double value */ + float fargs[__AV_FARG_NUM]; + double dargs[__AV_FARG_NUM]; +#endif +#if (defined(__s390__) && !defined(__s390x__)) +#define __AV_IARG_NUM 5 + /* store the integer arguments in an extra array */ + unsigned int ianum; + __avrword iargs[__AV_IARG_NUM]; + /* store the floating-point arguments in an extra array */ +#define __AV_FARG_NUM 2 + unsigned int fanum; /* number of fargs[] words that are occupied so far */ + unsigned int farg_mask; /* bitmask of those entries in fargs[] which have a float value */ + unsigned int darg_mask; /* bitmask of those entries in dargs[] which have a double value */ + float fargs[__AV_FARG_NUM]; + double dargs[__AV_FARG_NUM]; +#endif +#if defined(__s390x__) +#define __AV_IARG_NUM 5 + /* store the integer arguments in an extra array */ + unsigned int ianum; + __avrword iargs[__AV_IARG_NUM]; +#define __AV_FARG_NUM 4 + /* store the floating-point arguments in an extra array */ + unsigned int fanum; /* number of fargs[] words that are occupied so far */ + unsigned int farg_mask; /* bitmask of those entries in fargs[] which have a float value */ + unsigned int darg_mask; /* bitmask of those entries in dargs[] which have a double value */ + float fargs[__AV_FARG_NUM]; + double dargs[__AV_FARG_NUM]; +#endif +#if defined(__riscv32__) || defined(__riscv64__) +#define __AV_FARG_NUM 8 + /* store the floating-point arguments in an extra array */ + unsigned int fanum; /* number of fargs[] words that are occupied so far */ + unsigned int farg_mask; /* bitmask of those entries in fargs[] which have a float value */ + unsigned int darg_mask; /* bitmask of those entries in dargs[] which have a double value */ + float fargs[__AV_FARG_NUM]; + double dargs[__AV_FARG_NUM]; +#endif +} __av_alist; diff --git a/avcall/avcall-alpha-linux.s b/avcall/avcall-alpha-linux.s new file mode 100644 index 0000000..52bb981 --- /dev/null +++ b/avcall/avcall-alpha-linux.s @@ -0,0 +1,185 @@ + .set noreorder + .set volatile + .set noat + .set nomacro + .text + .align 2 + .align 4 + .globl avcall_call + .ent avcall_call +avcall_call: + .frame $15,32,$26,0 + .mask 0x4008200,-32 + ldah $29,0($27) !gpdisp!1 + lda $29,0($29) !gpdisp!1 +$avcall_call..ng: + lda $30,-32($30) + ldq $1,40($16) + ldq $3,48($16) + stq $9,8($30) + mov $16,$9 + stq $15,16($30) + mov $30,$15 + subq $1,$3,$1 + stq $26,0($30) + .prologue 1 + srl $1,3,$1 + lda $30,-2064($30) + addl $31,$1,$7 + cmple $7,6,$2 + bne $2,$L2 + mov $30,$5 + lda $6,6($31) + lda $4,48($3) + .align 4 +$L4: + lda $6,1($6) + ldq $1,0($4) + cmpeq $7,$6,$2 + lda $4,8($4) + stq $1,0($5) + lda $5,8($5) + beq $2,$L4 +$L2: + .set macro + ldq $16,0($3) + ldt $f16,0($3) + .set nomacro + lda $1,8($3) + .set macro + ldq $17,0($1) + ldt $f17,0($1) + .set nomacro + lda $2,16($3) + .set macro + ldq $18,0($2) + ldt $f18,0($2) + .set nomacro + lda $1,24($3) + .set macro + ldq $19,0($1) + ldt $f19,0($1) + .set nomacro + lda $2,32($3) + .set macro + ldq $20,0($2) + ldt $f20,0($2) + .set nomacro + lda $3,40($3) + .set macro + ldq $21,0($3) + ldt $f21,0($3) + .set nomacro + ldq $27,8($9) + jsr $26,($27),0 + ldah $29,0($26) !gpdisp!2 + lda $29,0($29) !gpdisp!2 + mov $1,$4 + ldl $1,24($9) + zapnot $1,15,$3 + cmpeq $3,1,$2 + bne $2,$L5 + cmpeq $3,2,$1 + bne $1,$L50 + cmpeq $3,3,$1 + bne $1,$L50 + cmpeq $3,4,$1 + bne $1,$L50 + cmpeq $3,5,$1 + bne $1,$L52 + cmpeq $3,6,$1 + bne $1,$L52 + cmpeq $3,7,$1 + bne $1,$L53 + cmpeq $3,8,$1 + bne $1,$L53 + cmpeq $3,9,$1 + bne $1,$L54 + cmpeq $3,10,$1 + bne $1,$L54 + cmpeq $3,11,$1 + bne $1,$L54 + cmpeq $3,12,$1 + bne $1,$L54 + cmpeq $3,13,$1 + bne $1,$L56 + cmpeq $3,14,$1 + bne $1,$L57 + cmpeq $3,15,$1 + bne $1,$L54 + cmpeq $3,16,$1 + beq $1,$L5 + .align 3 #realign + lda $1,512($31) + ldl $2,0($9) + and $1,$2,$1 + beq $1,$L5 + ldq $2,32($9) + cmpeq $2,1,$1 + bne $1,$L50 + cmpeq $2,2,$1 + bne $1,$L52 + cmpeq $2,4,$1 + bne $1,$L53 + cmpeq $2,8,$1 + bne $1,$L54 + cmpeq $2,16,$1 + beq $1,$L5 + ldq $1,16($9) + stq $4,8($1) + cpys $f31,$f31,$f31 + stq $0,0($1) + br $31,$L5 + .align 4 +$L50: + ldq $1,16($9) + bis $31,$31,$31 + insbl $0,$1,$3 + ldq_u $2,0($1) + mskbl $2,$1,$2 + bis $3,$2,$3 + stq_u $3,0($1) +$L5: + mov $15,$30 + mov $31,$0 + ldq $26,0($30) + ldq $9,8($30) + ldq $15,16($30) + lda $30,32($30) + ret $31,($26),1 +$L52: + mov $15,$30 + ldq $1,16($9) + inswl $0,$1,$3 + ldq_u $2,0($1) + mov $31,$0 + mskwl $2,$1,$2 + bis $3,$2,$3 + stq_u $3,0($1) + ldq $26,0($30) + ldq $9,8($30) + ldq $15,16($30) + lda $30,32($30) + ret $31,($26),1 +$L54: + ldq $1,16($9) + stq $0,0($1) + br $31,$L5 +$L53: + ldq $1,16($9) + bis $31,$31,$31 + stl $0,0($1) + br $31,$L5 +$L56: + cvtts $f0,$f0 + ldq $1,16($9) + sts $f0,0($1) + br $31,$L5 +$L57: + ldq $1,16($9) + bis $31,$31,$31 + stt $f0,0($1) + br $31,$L5 + .end avcall_call + .ident "GCC: (GNU) 4.0.2" + .section .note.GNU-stack,"",@progbits diff --git a/avcall/avcall-alpha-macro.S b/avcall/avcall-alpha-macro.S new file mode 100644 index 0000000..2cb3ea6 --- /dev/null +++ b/avcall/avcall-alpha-macro.S @@ -0,0 +1,186 @@ + .set noreorder + .set volatile + .set noat + .set nomacro + .text + .align 2 + .align 4 + .globl avcall_call + .ent avcall_call +avcall_call: + .frame $15,32,$26,0 + .mask 0x4008200,-32 + ldah $29,0($27) !gpdisp!1 + lda $29,0($29) !gpdisp!1 +$avcall_call..ng: + lda $30,-32($30) + ldq $1,40($16) + ldq $3,48($16) + stq $9,8($30) + mov $16,$9 + stq $15,16($30) + mov $30,$15 + subq $1,$3,$1 + stq $26,0($30) + .prologue 1 + srl $1,3,$1 + lda $30,-2064($30) + addl $31,$1,$7 + cmple $7,6,$2 + bne $2,$L2 + mov $30,$5 + lda $6,6($31) + lda $4,48($3) + .align 4 +$L4: + lda $6,1($6) + ldq $1,0($4) + cmpeq $7,$6,$2 + lda $4,8($4) + stq $1,0($5) + lda $5,8($5) + beq $2,$L4 +$L2: + .set macro + ldq $16,0($3) + ldt $f16,0($3) + .set nomacro + lda $1,8($3) + .set macro + ldq $17,0($1) + ldt $f17,0($1) + .set nomacro + lda $2,16($3) + .set macro + ldq $18,0($2) + ldt $f18,0($2) + .set nomacro + lda $1,24($3) + .set macro + ldq $19,0($1) + ldt $f19,0($1) + .set nomacro + lda $2,32($3) + .set macro + ldq $20,0($2) + ldt $f20,0($2) + .set nomacro + lda $3,40($3) + .set macro + ldq $21,0($3) + ldt $f21,0($3) + .set nomacro + ldq $27,8($9) + jsr $26,($27),0 + ldah $29,0($26) !gpdisp!2 + lda $29,0($29) !gpdisp!2 + mov $1,$4 + ldl $1,24($9) + zapnot $1,15,$3 + cmpeq $3,1,$2 + bne $2,$L5 + cmpeq $3,2,$1 + bne $1,$L50 + cmpeq $3,3,$1 + bne $1,$L50 + cmpeq $3,4,$1 + bne $1,$L50 + cmpeq $3,5,$1 + bne $1,$L52 + cmpeq $3,6,$1 + bne $1,$L52 + cmpeq $3,7,$1 + bne $1,$L53 + cmpeq $3,8,$1 + bne $1,$L53 + cmpeq $3,9,$1 + bne $1,$L54 + cmpeq $3,10,$1 + bne $1,$L54 + cmpeq $3,11,$1 + bne $1,$L54 + cmpeq $3,12,$1 + bne $1,$L54 + cmpeq $3,13,$1 + bne $1,$L56 + cmpeq $3,14,$1 + bne $1,$L57 + cmpeq $3,15,$1 + bne $1,$L54 + cmpeq $3,16,$1 + beq $1,$L5 + .align 3 #realign + lda $1,512($31) + ldl $2,0($9) + and $1,$2,$1 + beq $1,$L5 + ldq $2,32($9) + cmpeq $2,1,$1 + bne $1,$L50 + cmpeq $2,2,$1 + bne $1,$L52 + cmpeq $2,4,$1 + bne $1,$L53 + cmpeq $2,8,$1 + bne $1,$L54 + cmpeq $2,16,$1 + beq $1,$L5 + ldq $1,16($9) + stq $4,8($1) + cpys $f31,$f31,$f31 + stq $0,0($1) + br $31,$L5 + .align 4 +$L50: + ldq $1,16($9) + bis $31,$31,$31 + insbl $0,$1,$3 + ldq_u $2,0($1) + mskbl $2,$1,$2 + bis $3,$2,$3 + stq_u $3,0($1) +$L5: + mov $15,$30 + mov $31,$0 + ldq $26,0($30) + ldq $9,8($30) + ldq $15,16($30) + lda $30,32($30) + ret $31,($26),1 +$L52: + mov $15,$30 + ldq $1,16($9) + inswl $0,$1,$3 + ldq_u $2,0($1) + mov $31,$0 + mskwl $2,$1,$2 + bis $3,$2,$3 + stq_u $3,0($1) + ldq $26,0($30) + ldq $9,8($30) + ldq $15,16($30) + lda $30,32($30) + ret $31,($26),1 +$L54: + ldq $1,16($9) + stq $0,0($1) + br $31,$L5 +$L53: + ldq $1,16($9) + bis $31,$31,$31 + stl $0,0($1) + br $31,$L5 +$L56: + cvtts $f0,$f0 + ldq $1,16($9) + sts $f0,0($1) + br $31,$L5 +$L57: + ldq $1,16($9) + bis $31,$31,$31 + stt $f0,0($1) + br $31,$L5 + .end avcall_call +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-alpha.c b/avcall/avcall-alpha.c new file mode 100644 index 0000000..b7abcb2 --- /dev/null +++ b/avcall/avcall-alpha.c @@ -0,0 +1,165 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for a DEC Alpha with gcc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + Alpha Argument Passing Conventions + + The first 6 arguments are passed in registers $16-$21 for integers, + in registers $f16-$f21 for floats. From then on, everything is passed + on the stack. + + Everything on the stack is word-aligned. + + Integers and pointers are returned in $0, floats and doubles in $f0. + To return a structure, the called function copies the value to space + pointed to by its first argument, and all other arguments are shifted + down by one. + + Compile this routine with gcc for the __asm__ extensions and with + optimisation on (-O or -O2 or -g -O) so that argframe is set to the + correct offset. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("$30"); /* C names for registers */ + register long arg1 __asm__("$16"); + register long arg2 __asm__("$17"); + register long arg3 __asm__("$18"); + register long arg4 __asm__("$19"); + register long arg5 __asm__("$20"); + register long arg6 __asm__("$21"); + register double fret __asm__("$f0"); + register double farg1 __asm__("$f16"); + register double farg2 __asm__("$f17"); + register double farg3 __asm__("$f18"); + register double farg4 __asm__("$f19"); + register double farg5 __asm__("$f20"); + register double farg6 __asm__("$f21"); +/*register __avrword iret __asm__("$0"); */ + register __avrword iret2 __asm__("$1"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = ((unsigned long) l->aptr - (unsigned long) l->args) / sizeof (__avword); + __avrword i, i2; + + for (i = 6; i < arglen; i++) /* push excess function args */ + argframe[i-6] = l->args[i]; + + /* call function with 1st 6 args */ + /* we pass the args both in the integer registers and the floating point + registers, so we don't have to store the argument types. */ + __asm__ __volatile__ ("ldq $16,%0" : : "m" (l->args[0])); /* arg1 = l->args[0]; */ + __asm__ __volatile__ ("ldt $f16,%0" : : "m" (l->args[0])); /* farg1 = *(double*) &l->args[0]; */ + __asm__ __volatile__ ("ldq $17,%0" : : "m" (l->args[1])); /* arg2 = l->args[1]; */ + __asm__ __volatile__ ("ldt $f17,%0" : : "m" (l->args[1])); /* farg2 = *(double*) &l->args[1]; */ + __asm__ __volatile__ ("ldq $18,%0" : : "m" (l->args[2])); /* arg3 = l->args[2]; */ + __asm__ __volatile__ ("ldt $f18,%0" : : "m" (l->args[2])); /* farg3 = *(double*) &l->args[2]; */ + __asm__ __volatile__ ("ldq $19,%0" : : "m" (l->args[3])); /* arg4 = l->args[3]; */ + __asm__ __volatile__ ("ldt $f19,%0" : : "m" (l->args[3])); /* farg4 = *(double*) &l->args[3]; */ + __asm__ __volatile__ ("ldq $20,%0" : : "m" (l->args[4])); /* arg5 = l->args[4]; */ + __asm__ __volatile__ ("ldt $f20,%0" : : "m" (l->args[4])); /* farg5 = *(double*) &l->args[4]; */ + __asm__ __volatile__ ("ldq $21,%0" : : "m" (l->args[5])); /* arg6 = l->args[5]; */ + __asm__ __volatile__ ("ldt $f21,%0" : : "m" (l->args[5])); /* farg6 = *(double*) &l->args[5]; */ + i = (*l->func)(); + i2 = iret2; + /* this is apparently not needed, but better safe than sorry... */ + __asm__ __volatile__ ("" : : : + /* clobber */ "$16", "$17", "$18", "$19", "$20", "$21", + "$f16","$f17","$f18","$f19","$f20","$f21"); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, i); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, i); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, i); + } else + if (l->rtype == __AVshort) { + RETURN(short, i); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, i); + } else + if (l->rtype == __AVint) { + RETURN(int, i); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, i); + } else + if (l->rtype == __AVlong) { + RETURN(long, i); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, i); + } else + if (l->rtype == __AVlonglong) { + RETURN(long long, i); + } else + if (l->rtype == __AVulonglong) { + RETURN(unsigned long long, i); + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, fret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, i); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + if (l->rsize == sizeof(char)) { + RETURN(char, i); + } else + if (l->rsize == sizeof(short)) { + RETURN(short, i); + } else + if (l->rsize == sizeof(int)) { + RETURN(int, i); + } else + if (l->rsize == sizeof(long)) { + RETURN(long, i); + } else + if (l->rsize == 2*sizeof(__avrword)) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = i2; + } + } + } + return 0; +} diff --git a/avcall/avcall-arm-macro.S b/avcall/avcall-arm-macro.S new file mode 100644 index 0000000..2278dc5 --- /dev/null +++ b/avcall/avcall-arm-macro.S @@ -0,0 +1,110 @@ +#include "asm-arm.h" + .text + .align 2 + .global C(avcall_call) + DECLARE_FUNCTION(avcall_call) +FUNBEGIN(avcall_call) + // args = 0, pretend = 0, frame = 1024 + // frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {r4, r5, fp, ip, lr, pc} + sub fp, ip, $4 + sub sp, sp, $1024 + add r2, r0, $20 + ldmia r2, {r2, r3} + sub r3, r2, r3 + mov ip, $4 + mov r1, r3, asr $2 + cmp ip, r1 + mov r5, r0 + bic sp, sp, $7 + ldr r4, [r0, $24] + bge L(45) + add r2, sp, $16 +L(6): + ldr r3, [r4, ip, asl $2] + add ip, ip, $1 + cmp ip, r1 + str r3, [r2, $-16] + add r2, r2, $4 + blt L(6) +L(45): + ldmia r4, {r0, r1, r2, r3} // phole ldm + mov lr, pc + ldr pc, [r5, $4] + ldr r2, [r5, $12] + cmp r2, $1 + mov ip, r0 + beq L(8) + cmp r2, $2 + beq L(48) + cmp r2, $3 + beq L(48) + cmp r2, $4 + beq L(48) + cmp r2, $5 + beq L(47) + cmp r2, $6 + beq L(47) + cmp r2, $7 + beq L(54) + cmp r2, $8 + beq L(54) + cmp r2, $9 + beq L(54) + cmp r2, $10 + beq L(54) + sub r3, r2, $11 + cmp r3, $1 + bls L(53) + cmp r2, $13 + ldreq r3, [r5, $8] + streq r0, [r3, $0] // float + beq L(8) + cmp r2, $14 + ldreq r3, [r5, $8] + stmeqia r3, {r0-r1} // double + beq L(8) + cmp r2, $15 + beq L(54) + cmp r2, $16 + beq L(55) +L(8): + mov r0, $0 + ldmea fp, {r4, r5, fp, sp, pc} +L(55): + ldr r3, [r5, $0] + tst r3, $512 + beq L(8) + ldr r3, [r5, $16] + cmp r3, $1 + beq L(48) + cmp r3, $2 + beq L(47) + cmp r3, $4 + bhi L(41) +L(54): + ldr r3, [r5, $8] +L(46): + str ip, [r3, $0] + b L(8) +L(41): + cmp r3, $8 + bne L(8) +L(53): + ldr r3, [r5, $8] + str r1, [r3, $4] + b L(46) +L(47): + ldr r3, [r5, $8] + strh ip, [r3, $0] // movhi + b L(8) +L(48): + ldr r3, [r5, $8] + strb ip, [r3, $0] + b L(8) +L(fe1): + FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/avcall/avcall-arm.c b/avcall/avcall-arm.c new file mode 100644 index 0000000..7574e7b --- /dev/null +++ b/avcall/avcall-arm.c @@ -0,0 +1,145 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for an Acorn Risc Maschine with gcc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + ARM Argument Passing Conventions: + + All arguments, except the first 4 words which are passed in the registers + r0, r1, r2, r3, are passed on the stack with word alignment. Doubles take + two words. + In ABIs where 'double' and 'long long' have alignment 4, they are passed + entirely in registers or entirely on the stack (i.e. not the first half + in r3 and the second half on the stack). + In ABIs where 'double' and 'long long' have alignment 8, they are passed + with 2-word alignment in this word sequence (e.g. a 'double' after an + 'int' in r0 gets passed in (r2,r3), not in (r1,r2)). This implies that + they are passed entirely in registers or entirely on the stack. + Structure args are passed as true structures embedded in the argument stack. + A structure arg may be allocated partially in registers (r0,...,r3) and + partially on the stack, if no previous args already consume stack space. + To return a structure, the called function copies the return value to the + address supplied in register r0. + + Compile this routine with gcc -O (or -O2 or -g -O) to get the right + register variables, or use the assembler version. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +int +avcall_call(av_alist* list) +{ + register unsigned long sp __asm__("r13"); /* C names for registers */ +/*register __avrword iret __asm__("r0"); */ + register __avrword iret2 __asm__("r1"); + register float fret __asm__("r0"); /* r0 */ + register double dret __asm__("r0"); /* r0,r1 */ + + __av_alist* l = &AV_LIST_INNER(list); + + __avword space[__AV_ALIST_WORDS]; /* space for callee's stack frame */ + + /* Enforce 8-bytes-alignment of the stack pointer. + We need to do it this way because the old GCC that we use to compile + this file does not support the option '-mabi=aapcs'. */ + sp &= -8; + + __avword* argframe = (__avword*) sp; /* stack offset for argument list */ + int arglen = l->aptr - l->args; + __avrword i; + + for (i = 4; i < arglen; i++) /* push function args onto stack */ + argframe[i-4] = l->args[i]; + + /* call function, pass 4 args in registers */ + i = (*l->func)(l->args[0], l->args[1], l->args[2], l->args[3]); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, i); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, i); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, i); + } else + if (l->rtype == __AVshort) { + RETURN(short, i); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, i); + } else + if (l->rtype == __AVint) { + RETURN(int, i); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, i); + } else + if (l->rtype == __AVlong) { + RETURN(long, i); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, i); + } else + if (l->rtype == __AVlonglong || l->rtype == __AVulonglong) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = iret2; + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, i); + } else + if (l->rtype == __AVstruct) { + /* PCS for ARM (http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042b/IHI0042B_aapcs.pdf): + page 19: "A Composite Type not larger than 4 bytes is returned in r0." + sizeof({char a[3];}) = 3, so we have to use <= sizeof below */ + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + if (l->rsize == sizeof(char)) { /* can't occur */ + RETURN(char, i); + } else + if (l->rsize == sizeof(short)) { /* can't occur */ + RETURN(short, i); + } else + if (l->rsize <= sizeof(int)) { + RETURN(int, i); + } else + if (l->rsize == 2*sizeof(__avrword)) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = iret2; + } + } + } + return 0; +} diff --git a/avcall/avcall-arm64-macos-macro.S b/avcall/avcall-arm64-macos-macro.S new file mode 100644 index 0000000..24b0f60 --- /dev/null +++ b/avcall/avcall-arm64-macos-macro.S @@ -0,0 +1,328 @@ +#include "asm-arm64.h" + .cpu generic+fp+simd + .text + .align 2 + .p2align 3,,7 + .global C(avcall_call) + DECLARE_FUNCTION(avcall_call) +FUNBEGIN(avcall_call) + stp x29, x30, [sp, -48]! + add x29, sp, 0 + ldp x11, x12, [x0, 40] + stp x19, x20, [sp, 16] + sub x11, x11, x12 + ldr w15, [x0, 64] + asr x10, x11, 2 + ldr w14, [x0, 136] + cmp w10, wzr + mov x19, x0 + str d8, [sp, 32] + sub sp, sp, $1040 + ble L(6) + mov x13, sp + mov x9, 0 + mov w11, w10 + .p2align 2 +L(86): + ldr w10, [x12, x9, lsl 2] + str w10, [x13, x9, lsl 2] + add x9, x9, 1 + cmp w11, w9 + bgt L(86) +L(6): + cbz w15, L(7) + cmp w15, 1 + ldr x0, [x19, 72] + bls L(7) + cmp w15, 2 + ldr x1, [x19, 80] + beq L(7) + cmp w15, 3 + ldr x2, [x19, 88] + beq L(7) + cmp w15, 4 + ldr x3, [x19, 96] + beq L(7) + cmp w15, 5 + ldr x4, [x19, 104] + beq L(7) + cmp w15, 6 + ldr x5, [x19, 112] + beq L(7) + cmp w15, 7 + ldr x6, [x19, 120] + beq L(7) + ldr x7, [x19, 128] + .p2align 2 +L(7): + cbz w14, L(9) + ldr w9, [x19, 144] + tbz x9, 0, L(10) + ldr d0, [x19, 184] +L(11): + cmp w14, 1 + bls L(9) + tbnz x9, 1, L(119) + ldr w10, [x19, 140] + tbz x10, 1, L(14) + ldr s1, [x19, 152] +L(14): + cmp w14, 2 + beq L(9) + tbz x9, 2, L(15) + ldr d2, [x19, 200] +L(16): + cmp w14, 3 + beq L(9) + tbnz x9, 3, L(120) + ldr w10, [x19, 140] + tbz x10, 3, L(18) + ldr s3, [x19, 160] +L(18): + cmp w14, 4 + beq L(9) + tbz x9, 4, L(19) + ldr d4, [x19, 216] +L(20): + cmp w14, 5 + beq L(9) + tbz x9, 5, L(21) + ldr d5, [x19, 224] +L(22): + cmp w14, 6 + beq L(9) + tbz x9, 6, L(23) + ldr d6, [x19, 232] +L(24): + cmp w14, 7 + beq L(9) + tbz x9, 7, L(25) + ldr d7, [x19, 240] + .p2align 2 +L(9): + ldr w9, [x19, 24] + cmp w9, 13 + beq L(121) + cmp w9, 14 + beq L(122) + ldr x9, [x19, 8] + blr x9 + mov x16, x0 + ldr w9, [x19, 24] + cmp w9, 1 + beq L(27) + cmp w9, 2 + beq L(113) + cmp w9, 3 + beq L(113) + cmp w9, 4 + beq L(113) + cmp w9, 5 + beq L(114) + cmp w9, 6 + beq L(114) + cmp w9, 7 + beq L(115) + cmp w9, 8 + beq L(115) + and w12, w9, -3 + cmp w12, 9 + beq L(117) + sub w12, w9, $10 + tst w12, -3 + beq L(117) + cmp w9, 15 + beq L(117) + cmp w9, 16 + bne L(27) + ldr w9, [x19] + tbz x9, 9, L(27) + ldr x12, [x19, 32] + sub x9, x12, $1 + cmp x9, 15 + bhi L(27) + ldr x13, [x19, 16] + cmp x12, 8 + and x9, x13, 7 + and x13, x13, -8 + add x12, x12, x9 + bhi L(39) + cmp x12, 8 + lsl w11, w12, 3 + bhi L(40) + lsl w9, w9, 3 + mov x12, 2 + mov x14, 1 + sub w11, w11, $1 + lsl x14, x14, x9 + lsl x11, x12, x11 + lsl x9, x0, x9 + sub x10, x11, x14 + ldr d17, [x13] + fmov d16, x10 + fmov d8, x9 + bif v8.8b, v17.8b, v16.8b + str d8, [x13] +L(27): + add sp, x29, 0 + ldr d8, [sp, 32] + mov w0, 0 + ldp x19, x20, [sp, 16] + ldp x29, x30, [sp], 48 + ret + .p2align 3 +L(10): + ldr w10, [x19, 140] + tbz x10, 0, L(11) + ldr s0, [x19, 148] + b L(11) + .p2align 3 +L(113): + ldr x9, [x19, 16] + mov w0, 0 + strb w16, [x9] + ldr d8, [x29, 32] + add sp, x29, 0 + ldp x19, x20, [sp, 16] + ldp x29, x30, [sp], 48 + ret + .p2align 3 +L(119): + ldr d1, [x19, 192] + b L(14) + .p2align 3 +L(114): + ldr x9, [x19, 16] + mov w0, 0 + strh w16, [x9] + ldr d8, [x29, 32] + add sp, x29, 0 + ldp x19, x20, [sp, 16] + ldp x29, x30, [sp], 48 + ret +L(117): + ldr x9, [x19, 16] + str x16, [x9] + b L(27) + .p2align 3 +L(122): + ldp x9, x20, [x19, 8] + blr x9 + str d0, [x20] + mov w0, 0 + ldr d8, [x29, 32] + add sp, x29, 0 + ldp x19, x20, [sp, 16] + ldp x29, x30, [sp], 48 + ret +L(121): + ldp x9, x20, [x19, 8] + blr x9 + str s0, [x20] + b L(27) +L(15): + ldr w10, [x19, 140] + tbz x10, 2, L(16) + ldr s2, [x19, 156] + b L(16) +L(115): + ldr x9, [x19, 16] + str w16, [x9] + b L(27) +L(120): + ldr d3, [x19, 208] + b L(18) +L(19): + ldr w10, [x19, 140] + tbz x10, 4, L(20) + ldr s4, [x19, 164] + b L(20) +L(21): + ldr w10, [x19, 140] + tbz x10, 5, L(22) + ldr s5, [x19, 168] + b L(22) +L(23): + ldr w10, [x19, 140] + tbz x10, 6, L(24) + ldr s6, [x19, 172] + b L(24) +L(25): + ldr w9, [x19, 140] + tbz x9, 7, L(9) + ldr s7, [x19, 176] + b L(9) +L(39): + lsl w14, w9, 3 + cmp x12, 16 + movi d16, -1 + lsl x15, x0, x14 + dup v8.8b, w14 + fmov d17, x15 + ushl d16, d16, d8 + ldr d8, [x13] + bsl v16.8b, v17.8b, v8.8b + str d16, [x13] + bls L(123) + lsl w12, w12, 3 + mov x15, 2 + neg w9, w9, lsl 3 + sub w12, w12, $129 + add w9, w9, 64 + lsl x12, x15, x12 + asr x11, x1, x9 + asr x10, x0, x9 + sub x9, x12, $1 + ldr d17, [x13, 16] + fmov d16, x11 + lsl x14, x1, x14 + fmov d8, x9 + orr x10, x10, x14 + bif v16.8b, v17.8b, v8.8b + fmov x11, d16 + stp x10, x11, [x13, 8] + b L(27) +L(40): + lsl w14, w9, 3 + neg w9, w9, lsl 3 + movi d16, -1 + add w10, w9, 64 + dup v8.8b, w14 + lsl x9, x0, x14 + ldp d17, d18, [x13] + mov x12, 2 + sub w11, w11, $65 + lsl x11, x12, x11 + ushl d16, d16, d8 + fmov d8, x9 + asr x9, x0, x10 + sub x10, x11, $1 + bsl v16.8b, v8.8b, v17.8b + fmov d8, x10 + fmov d17, x9 + str d16, [x13] + bif v17.8b, v18.8b, v8.8b + str d17, [x13, 8] + b L(27) +L(123): + neg w9, w9, lsl 2 + lsl w12, w12, 3 + add w9, w9, 32 + mov x15, 2 + sub w12, w12, $65 + lsl x11, x1, x14 + lsl x12, x15, x12 + asr x14, x0, x9 + asr x10, x14, x9 + sub x9, x12, $1 + ldr d17, [x13, 8] + fmov d8, x9 + orr x9, x10, x11 + fmov d16, x9 + bif v16.8b, v17.8b, v8.8b + str d16, [x13, 8] + b L(27) + FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/avcall/avcall-arm64-macro.S b/avcall/avcall-arm64-macro.S new file mode 100644 index 0000000..b96d0fe --- /dev/null +++ b/avcall/avcall-arm64-macro.S @@ -0,0 +1,328 @@ +#include "asm-arm64.h" + .cpu generic+fp+simd + .text + .align 2 + .p2align 3,,7 + .global C(avcall_call) + DECLARE_FUNCTION(avcall_call) +FUNBEGIN(avcall_call) + stp x29, x30, [sp, -48]! + add x29, sp, 0 + ldp x11, x12, [x0, 40] + stp x19, x20, [sp, 16] + sub x11, x11, x12 + ldr w15, [x0, 64] + asr x10, x11, 3 + ldr w14, [x0, 136] + cmp w10, wzr + mov x19, x0 + str d8, [sp, 32] + sub sp, sp, $2064 + ble L(6) + mov x13, sp + mov x9, 0 + mov w11, w10 + .p2align 2 +L(86): + ldr x10, [x12, x9, lsl 3] + str x10, [x13, x9, lsl 3] + add x9, x9, 1 + cmp w11, w9 + bgt L(86) +L(6): + cbz w15, L(7) + cmp w15, 1 + ldr x0, [x19, 72] + bls L(7) + cmp w15, 2 + ldr x1, [x19, 80] + beq L(7) + cmp w15, 3 + ldr x2, [x19, 88] + beq L(7) + cmp w15, 4 + ldr x3, [x19, 96] + beq L(7) + cmp w15, 5 + ldr x4, [x19, 104] + beq L(7) + cmp w15, 6 + ldr x5, [x19, 112] + beq L(7) + cmp w15, 7 + ldr x6, [x19, 120] + beq L(7) + ldr x7, [x19, 128] + .p2align 2 +L(7): + cbz w14, L(9) + ldr w9, [x19, 144] + tbz x9, 0, L(10) + ldr d0, [x19, 184] +L(11): + cmp w14, 1 + bls L(9) + tbnz x9, 1, L(119) + ldr w10, [x19, 140] + tbz x10, 1, L(14) + ldr s1, [x19, 152] +L(14): + cmp w14, 2 + beq L(9) + tbz x9, 2, L(15) + ldr d2, [x19, 200] +L(16): + cmp w14, 3 + beq L(9) + tbnz x9, 3, L(120) + ldr w10, [x19, 140] + tbz x10, 3, L(18) + ldr s3, [x19, 160] +L(18): + cmp w14, 4 + beq L(9) + tbz x9, 4, L(19) + ldr d4, [x19, 216] +L(20): + cmp w14, 5 + beq L(9) + tbz x9, 5, L(21) + ldr d5, [x19, 224] +L(22): + cmp w14, 6 + beq L(9) + tbz x9, 6, L(23) + ldr d6, [x19, 232] +L(24): + cmp w14, 7 + beq L(9) + tbz x9, 7, L(25) + ldr d7, [x19, 240] + .p2align 2 +L(9): + ldr w9, [x19, 24] + cmp w9, 13 + beq L(121) + cmp w9, 14 + beq L(122) + ldr x9, [x19, 8] + blr x9 + mov x16, x0 + ldr w9, [x19, 24] + cmp w9, 1 + beq L(27) + cmp w9, 2 + beq L(113) + cmp w9, 3 + beq L(113) + cmp w9, 4 + beq L(113) + cmp w9, 5 + beq L(114) + cmp w9, 6 + beq L(114) + cmp w9, 7 + beq L(115) + cmp w9, 8 + beq L(115) + and w12, w9, -3 + cmp w12, 9 + beq L(117) + sub w12, w9, $10 + tst w12, -3 + beq L(117) + cmp w9, 15 + beq L(117) + cmp w9, 16 + bne L(27) + ldr w9, [x19] + tbz x9, 9, L(27) + ldr x12, [x19, 32] + sub x9, x12, $1 + cmp x9, 15 + bhi L(27) + ldr x13, [x19, 16] + cmp x12, 8 + and x9, x13, 7 + and x13, x13, -8 + add x12, x12, x9 + bhi L(39) + cmp x12, 8 + lsl w11, w12, 3 + bhi L(40) + lsl w9, w9, 3 + mov x12, 2 + mov x14, 1 + sub w11, w11, $1 + lsl x14, x14, x9 + lsl x11, x12, x11 + lsl x9, x0, x9 + sub x10, x11, x14 + ldr d17, [x13] + fmov d16, x10 + fmov d8, x9 + bif v8.8b, v17.8b, v16.8b + str d8, [x13] +L(27): + add sp, x29, 0 + ldr d8, [sp, 32] + mov w0, 0 + ldp x19, x20, [sp, 16] + ldp x29, x30, [sp], 48 + ret + .p2align 3 +L(10): + ldr w10, [x19, 140] + tbz x10, 0, L(11) + ldr s0, [x19, 148] + b L(11) + .p2align 3 +L(113): + ldr x9, [x19, 16] + mov w0, 0 + strb w16, [x9] + ldr d8, [x29, 32] + add sp, x29, 0 + ldp x19, x20, [sp, 16] + ldp x29, x30, [sp], 48 + ret + .p2align 3 +L(119): + ldr d1, [x19, 192] + b L(14) + .p2align 3 +L(114): + ldr x9, [x19, 16] + mov w0, 0 + strh w16, [x9] + ldr d8, [x29, 32] + add sp, x29, 0 + ldp x19, x20, [sp, 16] + ldp x29, x30, [sp], 48 + ret +L(117): + ldr x9, [x19, 16] + str x16, [x9] + b L(27) + .p2align 3 +L(122): + ldp x9, x20, [x19, 8] + blr x9 + str d0, [x20] + mov w0, 0 + ldr d8, [x29, 32] + add sp, x29, 0 + ldp x19, x20, [sp, 16] + ldp x29, x30, [sp], 48 + ret +L(121): + ldp x9, x20, [x19, 8] + blr x9 + str s0, [x20] + b L(27) +L(15): + ldr w10, [x19, 140] + tbz x10, 2, L(16) + ldr s2, [x19, 156] + b L(16) +L(115): + ldr x9, [x19, 16] + str w16, [x9] + b L(27) +L(120): + ldr d3, [x19, 208] + b L(18) +L(19): + ldr w10, [x19, 140] + tbz x10, 4, L(20) + ldr s4, [x19, 164] + b L(20) +L(21): + ldr w10, [x19, 140] + tbz x10, 5, L(22) + ldr s5, [x19, 168] + b L(22) +L(23): + ldr w10, [x19, 140] + tbz x10, 6, L(24) + ldr s6, [x19, 172] + b L(24) +L(25): + ldr w9, [x19, 140] + tbz x9, 7, L(9) + ldr s7, [x19, 176] + b L(9) +L(39): + lsl w14, w9, 3 + cmp x12, 16 + movi d16, -1 + lsl x15, x0, x14 + dup v8.8b, w14 + fmov d17, x15 + ushl d16, d16, d8 + ldr d8, [x13] + bsl v16.8b, v17.8b, v8.8b + str d16, [x13] + bls L(123) + lsl w12, w12, 3 + mov x15, 2 + neg w9, w9, lsl 3 + sub w12, w12, $129 + add w9, w9, 64 + lsl x12, x15, x12 + asr x11, x1, x9 + asr x10, x0, x9 + sub x9, x12, $1 + ldr d17, [x13, 16] + fmov d16, x11 + lsl x14, x1, x14 + fmov d8, x9 + orr x10, x10, x14 + bif v16.8b, v17.8b, v8.8b + fmov x11, d16 + stp x10, x11, [x13, 8] + b L(27) +L(40): + lsl w14, w9, 3 + neg w9, w9, lsl 3 + movi d16, -1 + add w10, w9, 64 + dup v8.8b, w14 + lsl x9, x0, x14 + ldp d17, d18, [x13] + mov x12, 2 + sub w11, w11, $65 + lsl x11, x12, x11 + ushl d16, d16, d8 + fmov d8, x9 + asr x9, x0, x10 + sub x10, x11, $1 + bsl v16.8b, v8.8b, v17.8b + fmov d8, x10 + fmov d17, x9 + str d16, [x13] + bif v17.8b, v18.8b, v8.8b + str d17, [x13, 8] + b L(27) +L(123): + neg w9, w9, lsl 2 + lsl w12, w12, 3 + add w9, w9, 32 + mov x15, 2 + sub w12, w12, $65 + lsl x11, x1, x14 + lsl x12, x15, x12 + asr x14, x0, x9 + asr x10, x14, x9 + sub x9, x12, $1 + ldr d17, [x13, 8] + fmov d8, x9 + orr x9, x10, x11 + fmov d16, x9 + bif v16.8b, v17.8b, v8.8b + str d16, [x13, 8] + b L(27) + FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/avcall/avcall-arm64.c b/avcall/avcall-arm64.c new file mode 100644 index 0000000..e6b409d --- /dev/null +++ b/avcall/avcall-arm64.c @@ -0,0 +1,360 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O -fno-omit-frame-pointer !!! + + Foreign function interface for a Linux arm64 (a.k.a. aarch64) with gcc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + ARM64 Argument Passing Conventions are documented in + http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf. + + Up to 8 words are passed in integer registers (x0, ..., x7). + Up to 8 float/double arguments are passed in floating point / SIMD + registers (v0/q0/d0/s0, ..., v7/q7/d7/s7). + Arguments passed on the stack have 8-bytes alignment (but on macOS only + 4-bytes alignment). + Structure args larger than 16 bytes are passed as pointers to caller-made + local copies. (§ 5.4.2 rule B.3) + Structure args <= 16 bytes are passed as up to two words in registers + (§ 5.4.2 rule C.10) or otherwise on the stack (§ 5.4.2 rule C.13). + + Integers are returned in x0, x1. + Float/double values are returned in d0/s0, d1/s1. + Structures <= 16 bytes are returned in registers. To return a structure + larger than 16 bytes, the called function copies the value to space + pointed to by x8. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +register __avword* sret __asm__("x8"); /* structure return pointer */ + +register __avrword iarg1 __asm__("x0"); +register __avrword iarg2 __asm__("x1"); +register __avrword iarg3 __asm__("x2"); +register __avrword iarg4 __asm__("x3"); +register __avrword iarg5 __asm__("x4"); +register __avrword iarg6 __asm__("x5"); +register __avrword iarg7 __asm__("x6"); +register __avrword iarg8 __asm__("x7"); + +register float farg1 __asm__("s0"); +register float farg2 __asm__("s1"); +register float farg3 __asm__("s2"); +register float farg4 __asm__("s3"); +register float farg5 __asm__("s4"); +register float farg6 __asm__("s5"); +register float farg7 __asm__("s6"); +register float farg8 __asm__("s7"); + +register double darg1 __asm__("d0"); +register double darg2 __asm__("d1"); +register double darg3 __asm__("d2"); +register double darg4 __asm__("d3"); +register double darg5 __asm__("d4"); +register double darg6 __asm__("d5"); +register double darg7 __asm__("d6"); +register double darg8 __asm__("d7"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("sp"); /* C names for registers */ + register __avrword iretreg __asm__("x0"); + register __avrword iret2reg __asm__("x1"); + register double dret __asm__("d0"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + unsigned int ianum = l->ianum; + unsigned int fanum = l->fanum; + __avrword iret, iret2; + + { + int i; + for (i = 0; i < arglen; i++) /* push function args onto stack */ + argframe[i] = l->args[i]; + } + + /* Put up to 8 integer args into registers. */ + if (ianum >= 1) { + iarg1 = l->iargs[0]; + if (ianum >= 2) { + iarg2 = l->iargs[1]; + if (ianum >= 3) { + iarg3 = l->iargs[2]; + if (ianum >= 4) { + iarg4 = l->iargs[3]; + if (ianum >= 5) { + iarg5 = l->iargs[4]; + if (ianum >= 6) { + iarg6 = l->iargs[5]; + if (ianum >= 7) { + iarg7 = l->iargs[6]; + if (ianum >= 8) { + iarg8 = l->iargs[7]; + } + } + } + } + } + } + } + } + + /* Put upto 8 floating-point args into registers. */ + if (fanum >= 1) { + if (l->darg_mask & (1 << 0)) darg1 = l->dargs[0]; + else if (l->farg_mask & (1 << 0)) farg1 = l->fargs[0]; + if (fanum >= 2) { + if (l->darg_mask & (1 << 1)) darg2 = l->dargs[1]; + else if (l->farg_mask & (1 << 1)) farg2 = l->fargs[1]; + if (fanum >= 3) { + if (l->darg_mask & (1 << 2)) darg3 = l->dargs[2]; + else if (l->farg_mask & (1 << 2)) farg3 = l->fargs[2]; + if (fanum >= 4) { + if (l->darg_mask & (1 << 3)) darg4 = l->dargs[3]; + else if (l->farg_mask & (1 << 3)) farg4 = l->fargs[3]; + if (fanum >= 5) { + if (l->darg_mask & (1 << 4)) darg5 = l->dargs[4]; + else if (l->farg_mask & (1 << 4)) farg5 = l->fargs[4]; + if (fanum >= 6) { + if (l->darg_mask & (1 << 5)) darg6 = l->dargs[5]; + else if (l->farg_mask & (1 << 5)) farg6 = l->fargs[5]; + if (fanum >= 7) { + if (l->darg_mask & (1 << 6)) darg7 = l->dargs[6]; + else if (l->farg_mask & (1 << 6)) farg7 = l->fargs[6]; + if (fanum >= 8) { + if (l->darg_mask & (1 << 7)) darg8 = l->dargs[7]; + else if (l->farg_mask & (1 << 7)) farg8 = l->fargs[7]; + } + } + } + } + } + } + } + } + + /* Call function. */ + if (l->rtype == __AVfloat) { + *(float*)l->raddr = (*(float(*)())l->func)(); + } else + if (l->rtype == __AVdouble) { + *(double*)l->raddr = (*(double(*)())l->func)(); + } else { + iret = (*l->func)(); + iret2 = iret2reg; + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong || l->rtype == __AVlonglong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong || l->rtype == __AVulonglong) { + RETURN(unsigned long, iret); + } else + /* see above + if (l->rtype == __AVfloat) { + } else + if (l->rtype == __AVdouble) { + } else + */ + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + /* Return structs of size <= 16 in registers. */ + if (l->rsize > 0 && l->rsize <= 16) { + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize == 1) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + } else + if (l->rsize == 2) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + } else + if (l->rsize == 3) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + } else + if (l->rsize == 4) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + } else + if (l->rsize == 5) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + } else + if (l->rsize == 6) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + } else + if (l->rsize == 7) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + } else + if (l->rsize >= 8 && l->rsize <= 16) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[7] = (unsigned char)(iret>>56); + if (l->rsize == 8) { + } else + if (l->rsize == 9) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + } else + if (l->rsize == 10) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + } else + if (l->rsize == 11) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + } else + if (l->rsize == 12) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + } else + if (l->rsize == 13) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + } else + if (l->rsize == 14) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + } else + if (l->rsize == 15) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + } else + if (l->rsize == 16) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+7] = (unsigned char)(iret2>>56); + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 2*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__avrword) */ + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (end_offset*8-1)) - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret >> (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[1] ^= (wordaddr[1] ^ ((iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = ((__avrword)2 << (end_offset*8-2*sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*8-start_offset*8)) | (iret2 << (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 >> (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } + #endif + } + } + } + } + return 0; +} diff --git a/avcall/avcall-armhf-macro.S b/avcall/avcall-armhf-macro.S new file mode 100644 index 0000000..26cd1a7 --- /dev/null +++ b/avcall/avcall-armhf-macro.S @@ -0,0 +1,323 @@ +#include "asm-arm.h" + .arch armv6 + .eabi_attribute 28, 1 + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 1 + .eabi_attribute 30, 2 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .text + .align 2 + .global C(avcall_call) + .syntax unified + .arm + .fpu vfpv3-d16 + .type avcall_call, %function +FUNBEGIN(avcall_call) + // args = 0, pretend = 0, frame = 0 + // frame_needed = 1, uses_anonymous_args = 0 + push {r4, r5, fp, lr} + mov r4, r0 + ldr r0, [r0, $20] + ldr ip, [r4, $24] + sub r3, sp, $1024 + add fp, sp, $12 + sub sp, r3, $8 + sub r3, r0, ip + cmp r3, $19 + movgt r2, sp + subgt r2, r2, $4 + addgt r3, ip, $16 + ble L(6) +L(5): + ldr r1, [r3], $4 + cmp r0, r3 + str r1, [r2, $4]! + bne L(5) +L(6): + ldr r3, [r4, $48] + tst r3, $1 + beq L(4) +// 87 "avcall-armhf.c" 1 + vldr.32 s0,[r4, $56] +// 0 "" 2 + .arm + .syntax unified +L(4): + tst r3, $2 + beq L(7) +// 89 "avcall-armhf.c" 1 + vldr.32 s1,[r4, $60] +// 0 "" 2 + .arm + .syntax unified +L(7): + tst r3, $4 + beq L(8) +// 91 "avcall-armhf.c" 1 + vldr.32 s2,[r4, $64] +// 0 "" 2 + .arm + .syntax unified +L(8): + tst r3, $8 + beq L(9) +// 93 "avcall-armhf.c" 1 + vldr.32 s3,[r4, $68] +// 0 "" 2 + .arm + .syntax unified +L(9): + tst r3, $16 + beq L(10) +// 95 "avcall-armhf.c" 1 + vldr.32 s4,[r4, $72] +// 0 "" 2 + .arm + .syntax unified +L(10): + tst r3, $32 + beq L(11) +// 97 "avcall-armhf.c" 1 + vldr.32 s5,[r4, $76] +// 0 "" 2 + .arm + .syntax unified +L(11): + tst r3, $64 + beq L(12) +// 99 "avcall-armhf.c" 1 + vldr.32 s6,[r4, $80] +// 0 "" 2 + .arm + .syntax unified +L(12): + tst r3, $128 + beq L(13) +// 101 "avcall-armhf.c" 1 + vldr.32 s7,[r4, $84] +// 0 "" 2 + .arm + .syntax unified +L(13): + tst r3, $256 + beq L(14) +// 103 "avcall-armhf.c" 1 + vldr.32 s8,[r4, $88] +// 0 "" 2 + .arm + .syntax unified +L(14): + tst r3, $512 + beq L(15) +// 105 "avcall-armhf.c" 1 + vldr.32 s9,[r4, $92] +// 0 "" 2 + .arm + .syntax unified +L(15): + tst r3, $1024 + beq L(16) +// 107 "avcall-armhf.c" 1 + vldr.32 s10,[r4, $96] +// 0 "" 2 + .arm + .syntax unified +L(16): + tst r3, $2048 + beq L(17) +// 109 "avcall-armhf.c" 1 + vldr.32 s11,[r4, $100] +// 0 "" 2 + .arm + .syntax unified +L(17): + tst r3, $4096 + beq L(18) +// 111 "avcall-armhf.c" 1 + vldr.32 s12,[r4, $104] +// 0 "" 2 + .arm + .syntax unified +L(18): + tst r3, $8192 + beq L(19) +// 113 "avcall-armhf.c" 1 + vldr.32 s13,[r4, $108] +// 0 "" 2 + .arm + .syntax unified +L(19): + tst r3, $16384 + beq L(20) +// 115 "avcall-armhf.c" 1 + vldr.32 s14,[r4, $112] +// 0 "" 2 + .arm + .syntax unified +L(20): + tst r3, $32768 + beq L(21) +// 117 "avcall-armhf.c" 1 + vldr.32 s15,[r4, $116] +// 0 "" 2 + .arm + .syntax unified +L(21): + ldr r3, [r4, $52] + tst r3, $1 + beq L(22) +// 121 "avcall-armhf.c" 1 + vldr.64 d0,[r4, $120] +// 0 "" 2 + .arm + .syntax unified +L(22): + tst r3, $2 + beq L(23) +// 123 "avcall-armhf.c" 1 + vldr.64 d1,[r4, $128] +// 0 "" 2 + .arm + .syntax unified +L(23): + tst r3, $4 + beq L(24) +// 125 "avcall-armhf.c" 1 + vldr.64 d2,[r4, $136] +// 0 "" 2 + .arm + .syntax unified +L(24): + tst r3, $8 + beq L(25) +// 127 "avcall-armhf.c" 1 + vldr.64 d3,[r4, $144] +// 0 "" 2 + .arm + .syntax unified +L(25): + tst r3, $16 + beq L(26) +// 129 "avcall-armhf.c" 1 + vldr.64 d4,[r4, $152] +// 0 "" 2 + .arm + .syntax unified +L(26): + tst r3, $32 + beq L(27) +// 131 "avcall-armhf.c" 1 + vldr.64 d5,[r4, $160] +// 0 "" 2 + .arm + .syntax unified +L(27): + tst r3, $64 + beq L(28) +// 133 "avcall-armhf.c" 1 + vldr.64 d6,[r4, $168] +// 0 "" 2 + .arm + .syntax unified +L(28): + tst r3, $128 + beq L(29) +// 135 "avcall-armhf.c" 1 + vldr.64 d7,[r4, $176] +// 0 "" 2 + .arm + .syntax unified +L(29): + ldm ip, {r0, r1, r2, r3} + ldr r5, [r4, $4] + blx r5 + ldrb r3, [r4, $12] // zero_extendqisi2 + cmp r3, $1 + beq L(30) + cmp r3, $2 + beq L(126) + cmp r3, $3 + beq L(126) + cmp r3, $4 + beq L(126) + cmp r3, $5 + beq L(128) + cmp r3, $6 + beq L(128) + cmp r3, $7 + beq L(129) + cmp r3, $8 + beq L(129) + cmp r3, $9 + beq L(129) + cmp r3, $10 + beq L(129) + sub r2, r3, $11 + cmp r2, $1 + bls L(130) + cmp r3, $13 + beq L(132) + cmp r3, $14 + beq L(133) + cmp r3, $15 + beq L(129) + cmp r3, $16 + bne L(30) + ldr r3, [r4] + tst r3, $512 + beq L(30) + ldr r3, [r4, $16] + cmp r3, $1 + beq L(126) + cmp r3, $2 + beq L(128) + cmp r3, $4 + bls L(129) + cmp r3, $8 + bne L(30) +L(130): + ldr r3, [r4, $8] + stm r3, {r0, r1} +L(30): + mov r0, $0 + sub sp, fp, $12 + // sp needed + pop {r4, r5, fp, pc} +L(126): + ldr r3, [r4, $8] + strb r0, [r3] + mov r0, $0 + sub sp, fp, $12 + // sp needed + pop {r4, r5, fp, pc} +L(129): + ldr r3, [r4, $8] + str r0, [r3] + mov r0, $0 + sub sp, fp, $12 + // sp needed + pop {r4, r5, fp, pc} +L(128): + ldr r3, [r4, $8] + strh r0, [r3] // movhi + mov r0, $0 + sub sp, fp, $12 + // sp needed + pop {r4, r5, fp, pc} +L(132): + ldr r3, [r4, $8] + vstr.32 s0, [r3] + b L(30) +L(133): + ldr r3, [r4, $8] + vstr.64 d0, [r3] + b L(30) + FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/avcall/avcall-armhf.c b/avcall/avcall-armhf.c new file mode 100644 index 0000000..abf6937 --- /dev/null +++ b/avcall/avcall-armhf.c @@ -0,0 +1,206 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for an ARM with -mfloat-abi=hard with gcc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + ARM Argument Passing Conventions: + + All arguments, except the first 4 words which are passed in the registers + r0, r1, r2, r3, are passed on the stack with word alignment. Doubles take + two words. + In ABIs where 'double' and 'long long' have alignment 4, they are passed + entirely in registers or entirely on the stack (i.e. not the first half + in r3 and the second half on the stack). + In ABIs where 'double' and 'long long' have alignment 8, they are passed + with 2-word alignment in this word sequence (e.g. a 'double' after an + 'int' in r0 gets passed in (r2,r3), not in (r1,r2)). This implies that + they are passed entirely in registers or entirely on the stack. + Structure args are passed as true structures embedded in the argument stack. + A structure arg may be allocated partially in registers (r0,...,r3) and + partially on the stack, if no previous args already consume stack space. + To return a structure, the called function copies the return value to the + address supplied in register r0. + + In hard-float configurations (armhf): Up to 16 floats get passed in the + single-float registers s0, s1, ..., s15. A float gets returned in s0. + Up to 8 doubles gets passed in the double-float registers d0, ..., d7 + (= {s0,s1}, {s2,s3}, ..., {s14,s15}). A double gets returned in d0. + + The 4 integer args registers and the 16 float args slots are allocated + independently: 1) After more than 16 float args, integer args can still + be allocated in registers. 2) After more than 4 integer args, float args + can still be allocated in registers. + + Compile this routine with gcc -O (or -O2 or -g -O) to get the right + register variables, or use the assembler version. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +int +avcall_call(av_alist* list) +{ + register unsigned long sp __asm__("r13"); /* C names for registers */ +/*register __avrword iret __asm__("r0"); */ + register __avrword iret2 __asm__("r1"); + register float fret __asm__("s0"); + register double dret __asm__("d0"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + + /* Enforce 8-bytes-alignment of the stack pointer. + We need to do it this way because the old GCC that we use to compile + this file does not support the option '-mabi=aapcs'. */ + sp &= -8; + + int arglen = l->aptr - l->args; + __avrword i; + + for (i = 4; i < arglen; i++) /* push function args onto stack */ + argframe[i-4] = l->args[i]; + + /* load float values into floating-point registers */ + if ((l->farg_mask >> 0) & 1) + __asm__ __volatile__ ("vldr.32 s0,%0" : : "m" (l->fargs[0])); + if ((l->farg_mask >> 1) & 1) + __asm__ __volatile__ ("vldr.32 s1,%0" : : "m" (l->fargs[1])); + if ((l->farg_mask >> 2) & 1) + __asm__ __volatile__ ("vldr.32 s2,%0" : : "m" (l->fargs[2])); + if ((l->farg_mask >> 3) & 1) + __asm__ __volatile__ ("vldr.32 s3,%0" : : "m" (l->fargs[3])); + if ((l->farg_mask >> 4) & 1) + __asm__ __volatile__ ("vldr.32 s4,%0" : : "m" (l->fargs[4])); + if ((l->farg_mask >> 5) & 1) + __asm__ __volatile__ ("vldr.32 s5,%0" : : "m" (l->fargs[5])); + if ((l->farg_mask >> 6) & 1) + __asm__ __volatile__ ("vldr.32 s6,%0" : : "m" (l->fargs[6])); + if ((l->farg_mask >> 7) & 1) + __asm__ __volatile__ ("vldr.32 s7,%0" : : "m" (l->fargs[7])); + if ((l->farg_mask >> 8) & 1) + __asm__ __volatile__ ("vldr.32 s8,%0" : : "m" (l->fargs[8])); + if ((l->farg_mask >> 9) & 1) + __asm__ __volatile__ ("vldr.32 s9,%0" : : "m" (l->fargs[9])); + if ((l->farg_mask >> 10) & 1) + __asm__ __volatile__ ("vldr.32 s10,%0" : : "m" (l->fargs[10])); + if ((l->farg_mask >> 11) & 1) + __asm__ __volatile__ ("vldr.32 s11,%0" : : "m" (l->fargs[11])); + if ((l->farg_mask >> 12) & 1) + __asm__ __volatile__ ("vldr.32 s12,%0" : : "m" (l->fargs[12])); + if ((l->farg_mask >> 13) & 1) + __asm__ __volatile__ ("vldr.32 s13,%0" : : "m" (l->fargs[13])); + if ((l->farg_mask >> 14) & 1) + __asm__ __volatile__ ("vldr.32 s14,%0" : : "m" (l->fargs[14])); + if ((l->farg_mask >> 15) & 1) + __asm__ __volatile__ ("vldr.32 s15,%0" : : "m" (l->fargs[15])); + + /* load double values into floating-point registers */ + if ((l->darg_mask >> 0) & 1) + __asm__ __volatile__ ("vldr.64 d0,%0" : : "m" (l->dargs[0])); + if ((l->darg_mask >> 1) & 1) + __asm__ __volatile__ ("vldr.64 d1,%0" : : "m" (l->dargs[1])); + if ((l->darg_mask >> 2) & 1) + __asm__ __volatile__ ("vldr.64 d2,%0" : : "m" (l->dargs[2])); + if ((l->darg_mask >> 3) & 1) + __asm__ __volatile__ ("vldr.64 d3,%0" : : "m" (l->dargs[3])); + if ((l->darg_mask >> 4) & 1) + __asm__ __volatile__ ("vldr.64 d4,%0" : : "m" (l->dargs[4])); + if ((l->darg_mask >> 5) & 1) + __asm__ __volatile__ ("vldr.64 d5,%0" : : "m" (l->dargs[5])); + if ((l->darg_mask >> 6) & 1) + __asm__ __volatile__ ("vldr.64 d6,%0" : : "m" (l->dargs[6])); + if ((l->darg_mask >> 7) & 1) + __asm__ __volatile__ ("vldr.64 d7,%0" : : "m" (l->dargs[7])); + + /* call function, pass 4 integer args in registers */ + i = (*l->func)(l->args[0], l->args[1], l->args[2], l->args[3]); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, i); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, i); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, i); + } else + if (l->rtype == __AVshort) { + RETURN(short, i); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, i); + } else + if (l->rtype == __AVint) { + RETURN(int, i); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, i); + } else + if (l->rtype == __AVlong) { + RETURN(long, i); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, i); + } else + if (l->rtype == __AVlonglong || l->rtype == __AVulonglong) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = iret2; + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, i); + } else + if (l->rtype == __AVstruct) { + /* PCS for ARM (http://infocenter.arm.com/help/topic/com.arm.doc.ihi0042b/IHI0042B_aapcs.pdf): + page 19: "A Composite Type not larger than 4 bytes is returned in r0." + sizeof({char a[3];}) = 3, so we have to use <= sizeof below */ + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + if (l->rsize == sizeof(char)) { /* can't occur */ + RETURN(char, i); + } else + if (l->rsize == sizeof(short)) { /* can't occur */ + RETURN(short, i); + } else + if (l->rsize <= sizeof(int)) { + RETURN(int, i); + } else + if (l->rsize == 2*sizeof(__avrword)) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = iret2; + } + } + } + return 0; +} diff --git a/avcall/avcall-compat.c b/avcall/avcall-compat.c new file mode 100644 index 0000000..a1bdf92 --- /dev/null +++ b/avcall/avcall-compat.c @@ -0,0 +1,24 @@ +/* + * Copyright 2017 Bruno Haible + * + * 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, see . + */ + +#include "config.h" + +#include + +/* A dummy symbol, so that GNU clisp's autoconfiguration recognizes this + library. */ +void __builtin_avcall (void) { abort(); } diff --git a/avcall/avcall-hppa-linux.s b/avcall/avcall-hppa-linux.s new file mode 100644 index 0000000..d51ff8c --- /dev/null +++ b/avcall/avcall-hppa-linux.s @@ -0,0 +1,257 @@ + .LEVEL 1.1 + .text + .align 4 +.globl avcall_call + .type avcall_call,@function +avcall_call: + .PROC + .CALLINFO FRAME=128,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=5 + .ENTRY + copy %r3,%r1 + stw %r2,-20(%r30) + copy %r30,%r3 + stwm %r1,128(%r30) + stw %r5,8(%r3) + ldo -48(%r30),%r24 + ldo 15(%r24),%r21 + copy %r19,%r5 + stw %r4,12(%r3) + copy %r21,%r24 + depi 0,31,4,%r24 + copy %r26,%r4 + stw %r19,-32(%r30) + ldo 1104(%r24),%r24 + ldw 28(%r26),%r22 + ldw 20(%r26),%r20 + sub %r22,%r20,%r20 + extrs %r20,29,30,%r25 + sub %r0,%r25,%r23 + comib,<= -4,%r23,.L57 + ldo 1088(%r30),%r30 + copy %r22,%r29 +.L6: + zdep %r23,29,30,%r20 + ldo 1(%r23),%r23 + addl %r20,%r29,%r22 + addl %r20,%r24,%r20 + ldw 0(%r22),%r21 + comib,> -4,%r23,.L6 + stw %r21,0(%r20) +.L56: + ldw 12(%r4),%r21 + ldi 16,%r20 + comb,=,n %r20,%r21,.L62 +.L7: + comib,>=,n 0,%r25,.L8 + ldw 48(%r4),%r21 + extrs,>= %r21,31,1,%r0 + fldws -4(%r29),%fr4L +.L9: + comib,>=,n 1,%r25,.L8 + extrs,>= %r21,30,1,%r0 + fldws -8(%r29),%fr5L +.L11: + ldw 52(%r4),%r22 + ldi 2,%r20 + and %r22,%r20,%r20 + comiclr,= 0,%r20,%r0 + fldds -8(%r29),%fr5 +.L12: + comib,>=,n 2,%r25,.L8 + extrs,>= %r21,29,1,%r0 + fldws -12(%r29),%fr6L +.L14: + comib,>=,n 3,%r25,.L8 + extrs,>= %r21,28,1,%r0 + fldws -16(%r29),%fr7L +.L16: + ldi 8,%r20 + and %r22,%r20,%r20 + comiclr,= 0,%r20,%r0 + fldds -16(%r29),%fr7 +.L8: + ldw -16(%r29),%r23 + ldw -4(%r29),%r26 + ldw -8(%r29),%r25 + ldw -12(%r29),%r24 + ldw 4(%r4),%r22 + .CALL ARGW0=GR + bl $$dyncall,%r31 + copy %r31,%r2 + ldw 12(%r4),%r21 + copy %r5,%r19 + comib,= 1,%r21,.L19 + copy %r28,%r2 + comib,=,n 2,%r21,.L60 + comib,=,n 3,%r21,.L60 + comib,=,n 4,%r21,.L60 + comib,=,n 5,%r21,.L59 + comib,=,n 6,%r21,.L59 + comib,=,n 7,%r21,.L61 + comib,=,n 8,%r21,.L61 + comib,=,n 9,%r21,.L61 + comib,=,n 10,%r21,.L61 + ldo -11(%r21),%r20 + comib,<<,n 1,%r20,.L38 + ldw 8(%r4),%r20 + stw %r29,4(%r20) +.L58: + stw %r2,0(%r20) +.L19: + ldw -20(%r3),%r2 +.L65: + ldi 0,%r28 + ldw 8(%r3),%r5 + ldw 12(%r3),%r4 + ldo 64(%r3),%r30 + bv %r0(%r2) + ldwm -64(%r30),%r3 +.L38: + comib,=,n 13,%r21,.L63 + comib,=,n 14,%r21,.L64 + comib,=,n 15,%r21,.L61 + ldi 16,%r20 + comb,<>,n %r20,%r21,.L65 + ldw -20(%r3),%r2 + ldw 0(%r4),%r20 + bb,>=,n %r20,30,.L65 + ldw -20(%r3),%r2 + ldw 16(%r4),%r22 + ldo -1(%r22),%r20 + comib,<<,n 7,%r20,.L65 + ldw -20(%r3),%r2 + ldw 8(%r4),%r20 + extru %r20,31,2,%r26 + copy %r20,%r4 + depi 0,31,2,%r4 + comib,<< 4,%r22,.L49 + addl %r26,%r22,%r21 + comib,<< 4,%r21,.L50 + zdep %r21,28,29,%r20 + ldo -1(%r20),%r25 + zdep %r26,28,29,%r21 + mtsar %r25 + ldw 0(%r4),%r23 + zvdep %r28,32,%r20 + mtsar %r21 + zvdepi 2,32,%r21 + xor %r23,%r20,%r20 + mtsar %r25 + zvdepi 1,32,%r22 + sub %r21,%r22,%r21 + and %r20,%r21,%r20 + xor %r23,%r20,%r23 + b .L19 + stw %r23,0(%r4) +.L50: + subi 63,%r20,%r31 + zdep %r26,28,29,%r26 + ldo -33(%r20),%r20 + ldw 0(%r4),%r25 + mtsar %r20 + ldw 4(%r4),%r24 + zvdep %r28,32,%r23 + mtsar %r26 + zvdepi 2,32,%r22 + xor %r24,%r23,%r23 + mtsar %r31 + ldo -1(%r22),%r22 + vextrs %r28,32,%r21 + mtsar %r20 + zvdepi 1,32,%r20 + xor %r25,%r21,%r21 + sub %r0,%r20,%r20 + and %r21,%r22,%r21 + and %r23,%r20,%r23 + xor %r25,%r21,%r25 + xor %r24,%r23,%r24 + stw %r25,0(%r4) + b .L19 + stw %r24,4(%r4) +.L49: + zdep %r26,28,29,%r26 + mtsar %r26 + zvdepi 2,32,%r20 + comib,<< 8,%r21,.L53 + ldo -1(%r20),%r25 + zdep %r21,29,30,%r20 + subi 47,%r20,%r24 + zdep %r21,28,29,%r21 + mtsar %r24 + ldo -33(%r21),%r26 + vextrs %r29,32,%r22 + vextrs %r22,32,%r22 + mtsar %r26 + ldw 0(%r4),%r24 + ldw 4(%r4),%r23 + zvdep %r28,32,%r20 + or %r20,%r22,%r20 + zvdep %r29,32,%r29 + zvdepi 1,32,%r21 + xor %r24,%r20,%r20 + xor %r23,%r29,%r29 + sub %r0,%r21,%r21 + and %r20,%r25,%r20 + and %r29,%r21,%r29 + xor %r24,%r20,%r24 + xor %r23,%r29,%r23 + stw %r24,0(%r4) + b .L19 + stw %r23,4(%r4) +.L53: + zdep %r21,28,29,%r20 + ldo -65(%r20),%r31 + subi 95,%r20,%r26 + ldw 8(%r4),%r23 + mtsar %r31 + ldw 0(%r4),%r24 + zvdep %r29,32,%r22 + zvdepi 1,32,%r21 + xor %r23,%r22,%r22 + mtsar %r26 + sub %r0,%r21,%r21 + vextrs %r28,32,%r20 + and %r22,%r21,%r22 + mtsar %r31 + xor %r24,%r20,%r20 + zvdep %r28,32,%r21 + and %r20,%r25,%r20 + mtsar %r26 + xor %r24,%r20,%r24 + vextrs %r29,32,%r29 + xor %r23,%r22,%r23 + or %r21,%r29,%r21 + stw %r23,8(%r4) + stw %r24,0(%r4) + b .L19 + stw %r21,4(%r4) +.L61: + b .L58 + ldw 8(%r4),%r20 +.L64: + ldw 8(%r4),%r20 + b .L19 + fstds %fr4,0(%r20) +.L63: + ldw 8(%r4),%r20 + b .L19 + fstws %fr4L,0(%r20) +.L59: + ldw 8(%r4),%r20 + b .L19 + sth %r2,0(%r20) +.L60: + ldw 8(%r4),%r20 + b .L19 + stb %r2,0(%r20) +.L62: + b .L7 + ldw 8(%r4),%r28 +.L57: + b .L56 + ldw 28(%r26),%r29 + .EXIT + .PROCEND +.Lfe1: + .size avcall_call,.Lfe1-avcall_call + .ident "GCC: (GNU) 3.1" diff --git a/avcall/avcall-hppa-macro.S b/avcall/avcall-hppa-macro.S new file mode 100644 index 0000000..d5f01ed --- /dev/null +++ b/avcall/avcall-hppa-macro.S @@ -0,0 +1,262 @@ +#include "asm-hppa.h" + .LEVEL 1.1 + IMPORT_MILLICODE($$dyncall) + TEXT1() + TEXT2() + .align 4 +GLOBL(avcall_call) + DECLARE_FUNCTION(avcall_call) +DEF(avcall_call) + .PROC + .CALLINFO FRAME=128,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=5 + .ENTRY + copy %r3,%r1 + stw %r2,-20(%r30) + copy %r30,%r3 + stwm %r1,128(%r30) + stw %r5,8(%r3) + ldo -48(%r30),%r24 + ldo 15(%r24),%r21 + copy %r19,%r5 + stw %r4,12(%r3) + copy %r21,%r24 + depi 0,31,4,%r24 + copy %r26,%r4 + stw %r19,-32(%r30) + ldo 1104(%r24),%r24 + ldw 28(%r26),%r22 + ldw 20(%r26),%r20 + sub %r22,%r20,%r20 + extrs %r20,29,30,%r25 + sub %r0,%r25,%r23 + comib,<= -4,%r23,L(57) + ldo 1088(%r30),%r30 + copy %r22,%r29 +DEF(L(6)) + zdep %r23,29,30,%r20 + ldo 1(%r23),%r23 + addl %r20,%r29,%r22 + addl %r20,%r24,%r20 + ldw 0(%r22),%r21 + comib,> -4,%r23,L(6) + stw %r21,0(%r20) +DEF(L(56)) + ldw 12(%r4),%r21 + ldi 16,%r20 + comb,=,n %r20,%r21,L(62) +DEF(L(7)) + comib,>=,n 0,%r25,L(8) + ldw 48(%r4),%r21 + extrs,>= %r21,31,1,%r0 + fldws -4(%r29),%fr4L +DEF(L(9)) + comib,>=,n 1,%r25,L(8) + extrs,>= %r21,30,1,%r0 + fldws -8(%r29),%fr5L +DEF(L(11)) + ldw 52(%r4),%r22 + ldi 2,%r20 + and %r22,%r20,%r20 + comiclr,= 0,%r20,%r0 + fldds -8(%r29),%fr5 +DEF(L(12)) + comib,>=,n 2,%r25,L(8) + extrs,>= %r21,29,1,%r0 + fldws -12(%r29),%fr6L +DEF(L(14)) + comib,>=,n 3,%r25,L(8) + extrs,>= %r21,28,1,%r0 + fldws -16(%r29),%fr7L +DEF(L(16)) + ldi 8,%r20 + and %r22,%r20,%r20 + comiclr,= 0,%r20,%r0 + fldds -16(%r29),%fr7 +DEF(L(8)) + ldw -16(%r29),%r23 + ldw -4(%r29),%r26 + ldw -8(%r29),%r25 + ldw -12(%r29),%r24 + ldw 4(%r4),%r22 + .CALL ARGW0=GR + bl $$dyncall,%r31 + copy %r31,%r2 + ldw 12(%r4),%r21 + copy %r5,%r19 + comib,= 1,%r21,L(19) + copy %r28,%r2 + comib,=,n 2,%r21,L(60) + comib,=,n 3,%r21,L(60) + comib,=,n 4,%r21,L(60) + comib,=,n 5,%r21,L(59) + comib,=,n 6,%r21,L(59) + comib,=,n 7,%r21,L(61) + comib,=,n 8,%r21,L(61) + comib,=,n 9,%r21,L(61) + comib,=,n 10,%r21,L(61) + ldo -11(%r21),%r20 + comib,<<,n 1,%r20,L(38) + ldw 8(%r4),%r20 + stw %r29,4(%r20) +DEF(L(58)) + stw %r2,0(%r20) +DEF(L(19)) + ldw -20(%r3),%r2 +DEF(L(65)) + ldi 0,%r28 + ldw 8(%r3),%r5 + ldw 12(%r3),%r4 + ldo 64(%r3),%r30 + bv %r0(%r2) + ldwm -64(%r30),%r3 +DEF(L(38)) + comib,=,n 13,%r21,L(63) + comib,=,n 14,%r21,L(64) + comib,=,n 15,%r21,L(61) + ldi 16,%r20 + comb,<>,n %r20,%r21,L(65) + ldw -20(%r3),%r2 + ldw 0(%r4),%r20 + bb,>=,n %r20,30,L(65) + ldw -20(%r3),%r2 + ldw 16(%r4),%r22 + ldo -1(%r22),%r20 + comib,<<,n 7,%r20,L(65) + ldw -20(%r3),%r2 + ldw 8(%r4),%r20 + extru %r20,31,2,%r26 + copy %r20,%r4 + depi 0,31,2,%r4 + comib,<< 4,%r22,L(49) + addl %r26,%r22,%r21 + comib,<< 4,%r21,L(50) + zdep %r21,28,29,%r20 + ldo -1(%r20),%r25 + zdep %r26,28,29,%r21 + mtsar %r25 + ldw 0(%r4),%r23 + zvdep %r28,32,%r20 + mtsar %r21 + zvdepi 2,32,%r21 + xor %r23,%r20,%r20 + mtsar %r25 + zvdepi 1,32,%r22 + sub %r21,%r22,%r21 + and %r20,%r21,%r20 + xor %r23,%r20,%r23 + b L(19) + stw %r23,0(%r4) +DEF(L(50)) + subi 63,%r20,%r31 + zdep %r26,28,29,%r26 + ldo -33(%r20),%r20 + ldw 0(%r4),%r25 + mtsar %r20 + ldw 4(%r4),%r24 + zvdep %r28,32,%r23 + mtsar %r26 + zvdepi 2,32,%r22 + xor %r24,%r23,%r23 + mtsar %r31 + ldo -1(%r22),%r22 + vextrs %r28,32,%r21 + mtsar %r20 + zvdepi 1,32,%r20 + xor %r25,%r21,%r21 + sub %r0,%r20,%r20 + and %r21,%r22,%r21 + and %r23,%r20,%r23 + xor %r25,%r21,%r25 + xor %r24,%r23,%r24 + stw %r25,0(%r4) + b L(19) + stw %r24,4(%r4) +DEF(L(49)) + zdep %r26,28,29,%r26 + mtsar %r26 + zvdepi 2,32,%r20 + comib,<< 8,%r21,L(53) + ldo -1(%r20),%r25 + zdep %r21,29,30,%r20 + subi 47,%r20,%r24 + zdep %r21,28,29,%r21 + mtsar %r24 + ldo -33(%r21),%r26 + vextrs %r29,32,%r22 + vextrs %r22,32,%r22 + mtsar %r26 + ldw 0(%r4),%r24 + ldw 4(%r4),%r23 + zvdep %r28,32,%r20 + or %r20,%r22,%r20 + zvdep %r29,32,%r29 + zvdepi 1,32,%r21 + xor %r24,%r20,%r20 + xor %r23,%r29,%r29 + sub %r0,%r21,%r21 + and %r20,%r25,%r20 + and %r29,%r21,%r29 + xor %r24,%r20,%r24 + xor %r23,%r29,%r23 + stw %r24,0(%r4) + b L(19) + stw %r23,4(%r4) +DEF(L(53)) + zdep %r21,28,29,%r20 + ldo -65(%r20),%r31 + subi 95,%r20,%r26 + ldw 8(%r4),%r23 + mtsar %r31 + ldw 0(%r4),%r24 + zvdep %r29,32,%r22 + zvdepi 1,32,%r21 + xor %r23,%r22,%r22 + mtsar %r26 + sub %r0,%r21,%r21 + vextrs %r28,32,%r20 + and %r22,%r21,%r22 + mtsar %r31 + xor %r24,%r20,%r20 + zvdep %r28,32,%r21 + and %r20,%r25,%r20 + mtsar %r26 + xor %r24,%r20,%r24 + vextrs %r29,32,%r29 + xor %r23,%r22,%r23 + or %r21,%r29,%r21 + stw %r23,8(%r4) + stw %r24,0(%r4) + b L(19) + stw %r21,4(%r4) +DEF(L(61)) + b L(58) + ldw 8(%r4),%r20 +DEF(L(64)) + ldw 8(%r4),%r20 + b L(19) + fstds %fr4,0(%r20) +DEF(L(63)) + ldw 8(%r4),%r20 + b L(19) + fstws %fr4L,0(%r20) +DEF(L(59)) + ldw 8(%r4),%r20 + b L(19) + sth %r2,0(%r20) +DEF(L(60)) + ldw 8(%r4),%r20 + b L(19) + stb %r2,0(%r20) +DEF(L(62)) + b L(7) + ldw 8(%r4),%r28 +DEF(L(57)) + b L(56) + ldw 28(%r26),%r29 + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-hppa.c b/avcall/avcall-hppa.c new file mode 100644 index 0000000..b1c0ae6 --- /dev/null +++ b/avcall/avcall-hppa.c @@ -0,0 +1,270 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for a HP Precision Architecture 1.0 with gcc + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + HPPA Argument Passing Conventions: + + All arguments, except the first 4 words, are passed on the stack + - growing down! - with word alignment. Doubles take two words and force + double alignment. Small structures args are passed as true structures + embedded in the argument stack. They force double alignment and - if they + don't fit entirely in the 4 register words - are passed in memory. + The first 2 words are passed like this: + %r26 = first integer arg, %r25 = second integer arg, or + %r26 = high word of double arg, %r25 = low word of double arg. + Similarly for the next 2 words, passed in %r24 and %r23. + Note that other calling conventions would be in effect if we would call + an explicitly named function! + + Structures larger than 8 bytes are passed as a pointer. In GCC >= 8 + it's a caller-made copy; with GCC < 8 and with HP cc it's the callee's + responsibility to make a copy of the structure, so that side effects + made by the callee are not visible to the caller. + + To return a structure of more than 8 bytes, the called function copies + the return value to the address supplied in register "%r28". Smaller + structures are returned in the registers %r28 (first 4 bytes) and %r29 + (next 4 bytes, if present). + + It is forbidden to modify the stack pointer. + + Compile this routine with gcc -O2 -fomit-frame-pointer to get the right + register variables. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +/* This declaration tells gcc not to modify %r28. */ +register __avword* sret __asm__("%r28"); /* structure return pointer */ + +register float farg1 __asm__("%fr4"); /* fr4L */ +register float farg2 __asm__("%fr5"); /* fr5L */ +register float farg3 __asm__("%fr6"); /* fr6L */ +register float farg4 __asm__("%fr7"); /* fr7L */ +register double darg1 __asm__("%fr5"); +register double darg2 __asm__("%fr7"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("%r30"); /* C names for registers */ + register float fret __asm__("%fr4"); + register double dret __asm__("%fr4"); +/*register __avrword iret1 __asm__("%r28"); */ + register __avrword iret2 __asm__("%r29"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + argframe += __AV_ALIST_WORDS + 20; + int arglen = l->args_end - l->aptr; + __avrword iret; + + { + int i; + for (i = -arglen; i < -4; i++) /* push function args onto stack */ + argframe[i] = l->args_end[i]; + } + + if (l->rtype == __AVstruct) /* push struct return address */ + sret = l->raddr; + + /* The floats and doubles among the first 4 argument words are passed + * - in both general registers and floating-point registers when the + * function call is a variadic one, which means: + * - for HP cc: the call is done through a function pointer or + * directly to a function declared with a varargs prototype, + * - for GCC: the function's type is a varargs function. + * - in floating-point registers otherwise. + * To cover both cases, put these floating-point values into the general + * registers and the floating-point registers always. + */ + if (arglen >= 1) { + if (l->farg_mask & (1 << 0)) + /*__asm__ __volatile__ ("fldw %0,%%fr4R" : : "m" (*(float*)&l->args_end[-1]));*/ farg1 = *((float*)&l->args_end[-1]); + if (arglen >= 2) { + if (l->farg_mask & (1 << 1)) + /* __asm__ __volatile__ ("fldw %0,%%fr5R" : : "m" (*(float*)&l->args_end[-2])); */ farg2 = *((float*)&l->args_end[-2]); + if (l->darg_mask & (1 << 1)) + darg1 = *((double*)&l->args_end[-2]); + if (arglen >= 3) { + if (l->farg_mask & (1 << 2)) + /* __asm__ __volatile__ ("fldw %0,%%fr6R" : : "m" (*(float*)&l->args_end[-3])); */ farg3 = *((float*)&l->args_end[-3]); + if (arglen >= 4) { + if (l->farg_mask & (1 << 3)) + /* __asm__ __volatile__ ("fldw %0,%%fr7R" : : "m" (*(float*)&l->args_end[-4])); */ farg4 = *((float*)&l->args_end[-4]); + if (l->darg_mask & (1 << 3)) + darg2 = *((double*)&l->args_end[-4]); + } + } + } + } + /* call function, pass first 4 arg words in general registers */ + iret = (*l->func)(l->args_end[-1], l->args_end[-2], + l->args_end[-3], l->args_end[-4]); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, iret); + } else + if (l->rtype == __AVlonglong || l->rtype == __AVulonglong) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = iret; + ((__avrword*)raddr)[1] = iret2; + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_SMALL_STRUCT_RETURN) { + /* cc, c89 and gcc >= 2.7 return structs of size <= 8 in registers. */ + if (l->rsize > 0 && l->rsize <= 8) { + /* This is really weird code, unlike all other big-endian platforms. */ + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize == 1) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + } else + if (l->rsize == 2) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[1] = (unsigned char)(iret); + } else + if (l->rsize == 3) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret); + } else + if (l->rsize == 4) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[3] = (unsigned char)(iret); + } else + if (l->rsize == 5) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[4] = (unsigned char)(iret2); + } else + if (l->rsize == 6) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[1] = (unsigned char)(iret); + ((unsigned char *)raddr)[2] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[3] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[4] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[5] = (unsigned char)(iret2); + } else + if (l->rsize == 7) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret); + ((unsigned char *)raddr)[3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[5] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[6] = (unsigned char)(iret2); + } else + if (l->rsize == 8) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[3] = (unsigned char)(iret); + ((unsigned char *)raddr)[4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[6] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[7] = (unsigned char)(iret2); + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 2*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__avrword) */ + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - ((__avrword)1 << (sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (sizeof(__avrword)*8-end_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + __avrword mask1 = - ((__avrword)1 << (2*sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (end_offset*8-sizeof(__avrword)*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret << (2*sizeof(__avrword)*8-end_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = - ((__avrword)1 << (2*sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ ((iret << (2*sizeof(__avrword)*8-end_offset*8)) | (iret2 >> (end_offset*4-sizeof(__avrword)*4) >> (end_offset*4-sizeof(__avrword)*4)))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret2 << (2*sizeof(__avrword)*8-end_offset*8))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = - ((__avrword)1 << (3*sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (end_offset*8-2*sizeof(__avrword)*8))) & mask0; + wordaddr[1] = (iret << (3*sizeof(__avrword)*8-end_offset*8)) | (iret2 >> (end_offset*8-2*sizeof(__avrword)*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 << (3*sizeof(__avrword)*8-end_offset*8))) & mask2; + } + } + #endif + } + } + } + return 0; +} diff --git a/avcall/avcall-hppa64-linux.s b/avcall/avcall-hppa64-linux.s new file mode 100644 index 0000000..1053247 --- /dev/null +++ b/avcall/avcall-hppa64-linux.s @@ -0,0 +1,531 @@ + .LEVEL 2.0w + .text + .align 8 +.globl avcall_call + .type avcall_call,@function +avcall_call: + .PROC + .CALLINFO FRAME=256,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=9 + .ENTRY + copy %r3,%r1 + std %r2,-16(%r30) + copy %r30,%r3 + std,ma %r1,256(%r30) + ldi 8,%r31 + std %r9,16(%r3) + copy %r27,%r9 + std %r8,24(%r3) + copy %r26,%r8 + std %r7,32(%r3) + ldo -80(%r30),%r7 + std %r6,40(%r3) + std %r5,48(%r3) + std %r4,56(%r3) + ldd 40(%r26),%r29 + ldd 48(%r26),%r5 + sub %r29,%r5,%r29 + extrd,s %r29,29+32-1,32,%r6 + cmpb,<= %r6,%r31,.L113 + ldo 2112(%r30),%r30 +.L6: + depd,z %r31,60,61,%r29 + ldo 1(%r31),%r31 + add,l %r29,%r5,%r2 + extrd,s %r31,63,32,%r31 + ldd 0(%r2),%r4 + add,l %r29,%r7,%r29 + cmpb,> %r6,%r31,.L6 + std %r4,0(%r29) +.L113: + ldw 24(%r8),%r31 + ldi 16,%r29 + cmpb,= %r29,%r31,.L118 + copy %r31,%r4 +.L7: + cmpib,>=,n 0,%r6,.L8 + ldw 68(%r8),%r2 + extrw,u %r2,31,1,%r29 + cmpib,=,n 0,%r29,.L9 + fldd 0(%r5),%fr4 +.L10: + cmpib,>=,n 1,%r6,.L8 + ldi 2,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,.L14 + fldd 8(%r5),%fr5 +.L15: + cmpib,>=,n 2,%r6,.L8 + ldi 4,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,.L19 + fldd 16(%r5),%fr6 +.L20: + cmpib,>=,n 3,%r6,.L8 + ldi 8,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,.L24 + fldd 24(%r5),%fr7 +.L25: + cmpib,>=,n 4,%r6,.L8 + ldi 16,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,.L29 + fldd 32(%r5),%fr8 +.L30: + cmpib,>=,n 5,%r6,.L8 + ldi 32,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,.L34 + fldd 40(%r5),%fr9 +.L35: + cmpib,>=,n 6,%r6,.L8 + ldi 64,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,.L39 + fldd 48(%r5),%fr10 +.L40: + cmpib,>=,n 7,%r6,.L8 + ldi 128,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,.L44 + fldd 56(%r5),%fr11 +.L45: + cmpiclr,>= 8,%r6,%r0 + ldo 64(%r7),%r1 +.L8: + cmpib,=,n 13,%r4,.L119 + cmpib,=,n 14,%r4,.L120 +#APP + copy %r1,%r29 +#NO_APP + ldd 8(%r8),%r31 + ldo -16(%r30),%r29 + ldd 16(%r31),%r2 + ldd 24(%r31),%r27 + bve,l (%r2),%r2 + nop + ldw 24(%r8),%r2 + copy %r9,%r27 + cmpib,= 1,%r2,.L50 + copy %r28,%r1 + cmpib,=,n 2,%r2,.L117 + cmpib,=,n 3,%r2,.L117 + cmpib,=,n 4,%r2,.L117 + cmpib,=,n 5,%r2,.L116 + cmpib,=,n 6,%r2,.L116 + cmpib,=,n 7,%r2,.L115 + cmpib,=,n 8,%r2,.L115 + cmpib,=,n 9,%r2,.L114 + cmpib,=,n 11,%r2,.L114 + cmpib,=,n 10,%r2,.L114 + cmpib,=,n 12,%r2,.L114 + cmpib,= 15,%r2,.L114 + ldi 16,%r31 + cmpb,=,n %r31,%r2,.L121 +.L50: + ldd -16(%r3),%r2 +.L136: + ldi 0,%r28 + ldd 16(%r3),%r9 + ldd 24(%r3),%r8 + ldd 32(%r3),%r7 + ldd 40(%r3),%r6 + ldd 48(%r3),%r5 + ldd 56(%r3),%r4 + ldo 64(%r3),%r30 + bve (%r2) + ldd,mb -64(%r30),%r3 +.L121: + ldw 0(%r8),%r31 + extrd,u %r31,54+1-1,1,%r31 + cmpib,= 0,%r31,.L136 + ldd -16(%r3),%r2 + ldd 32(%r8),%r2 + ldo -1(%r2),%r31 + cmpib,*<<,n 15,%r31,.L136 + ldd -16(%r3),%r2 + cmpib,*=,n 1,%r2,.L122 + cmpib,*=,n 2,%r2,.L123 + cmpib,*= 3,%r2,.L124 + extrd,s %r28,23,24,%r4 + cmpib,*= 4,%r2,.L125 + extrd,s %r28,31,32,%r5 + cmpib,*=,n 5,%r2,.L126 + cmpib,*=,n 6,%r2,.L127 + cmpib,*= 7,%r2,.L128 + ldo -8(%r2),%r31 + cmpib,*<< 8,%r31,.L50 + extrd,s %r28,7,8,%r31 + ldd 16(%r8),%r2 + stb %r31,0(%r2) + extrd,s %r28,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r28,23,24,%r2 + stb %r4,1(%r31) + extrd,s %r28,31,32,%r5 + ldd 16(%r8),%r31 + extrd,s %r28,39,40,%r4 + stb %r2,2(%r31) + extrd,s %r28,47,48,%r6 + ldd 16(%r8),%r2 + extrd,s %r28,55,56,%r7 + stb %r5,3(%r2) + ldd 16(%r8),%r31 + stb %r4,4(%r31) + ldd 16(%r8),%r2 + stb %r6,5(%r2) + ldd 16(%r8),%r31 + stb %r7,6(%r31) + ldd 16(%r8),%r2 + stb %r28,7(%r2) + ldd 32(%r8),%r2 + cmpib,*=,n 8,%r2,.L136 + ldd -16(%r3),%r2 + cmpib,*=,n 9,%r2,.L129 + cmpib,*=,n 10,%r2,.L130 + cmpib,*=,n 11,%r2,.L131 + cmpib,*=,n 12,%r2,.L132 + cmpib,*= 13,%r2,.L133 + extrd,s %r29,7,8,%r31 + cmpib,*=,n 14,%r2,.L134 + cmpib,*= 15,%r2,.L135 + ldi 16,%r31 + cmpb,*<> %r31,%r2,.L136 + ldd -16(%r3),%r2 + ldd 16(%r8),%r2 + extrd,s %r29,7,8,%r31 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r29,23,24,%r2 + stb %r4,9(%r31) + extrd,s %r29,31,32,%r5 + ldd 16(%r8),%r31 + extrd,s %r29,39,40,%r4 + stb %r2,10(%r31) + extrd,s %r29,47,48,%r6 + ldd 16(%r8),%r2 + extrd,s %r29,55,56,%r7 + stb %r5,11(%r2) + ldd 16(%r8),%r31 + stb %r4,12(%r31) + ldd 16(%r8),%r2 + stb %r6,13(%r2) + ldd 16(%r8),%r31 + stb %r7,14(%r31) + ldd 16(%r8),%r2 + b .L50 + stb %r29,15(%r2) +.L135: + ldd 16(%r8),%r2 + extrd,s %r29,7,8,%r31 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r29,23,24,%r2 + stb %r4,9(%r31) + extrd,s %r29,31,32,%r5 + ldd 16(%r8),%r31 + extrd,s %r29,39,40,%r4 + stb %r2,10(%r31) + extrd,s %r29,47,48,%r6 + ldd 16(%r8),%r2 + extrd,s %r29,55,56,%r29 + stb %r5,11(%r2) + ldd 16(%r8),%r31 + stb %r4,12(%r31) + ldd 16(%r8),%r2 + stb %r6,13(%r2) + ldd 16(%r8),%r31 + b .L50 + stb %r29,14(%r31) +.L134: + ldd 16(%r8),%r2 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r29,23,24,%r2 + stb %r4,9(%r31) + extrd,s %r29,31,32,%r5 + ldd 16(%r8),%r31 + extrd,s %r29,39,40,%r4 + stb %r2,10(%r31) + extrd,s %r29,47,48,%r29 + ldd 16(%r8),%r31 + stb %r5,11(%r31) + ldd 16(%r8),%r2 + stb %r4,12(%r2) + ldd 16(%r8),%r31 + b .L50 + stb %r29,13(%r31) +.L133: + ldd 16(%r8),%r2 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r29,23,24,%r5 + stb %r4,9(%r31) + extrd,s %r29,31,32,%r6 + ldd 16(%r8),%r2 + extrd,s %r29,39,40,%r29 + stb %r5,10(%r2) + ldd 16(%r8),%r31 + stb %r6,11(%r31) + ldd 16(%r8),%r2 + b .L50 + stb %r29,12(%r2) +.L132: + ldd 16(%r8),%r2 + extrd,s %r29,7,8,%r31 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r29,23,24,%r5 + stb %r4,9(%r31) + extrd,s %r29,31,32,%r29 + ldd 16(%r8),%r31 + stb %r5,10(%r31) + ldd 16(%r8),%r2 + b .L50 + stb %r29,11(%r2) +.L131: + ldd 16(%r8),%r2 + extrd,s %r29,7,8,%r31 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r2 + extrd,s %r29,23,24,%r29 + stb %r4,9(%r2) + ldd 16(%r8),%r31 + b .L50 + stb %r29,10(%r31) +.L130: + ldd 16(%r8),%r2 + extrd,s %r29,7,8,%r31 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r29 + ldd 16(%r8),%r31 + b .L50 + stb %r29,9(%r31) +.L129: + ldd 16(%r8),%r31 + extrd,s %r29,7,8,%r29 + b .L50 + stb %r29,8(%r31) +.L128: + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r29 + extrd,s %r28,23,24,%r31 + stb %r2,1(%r29) + extrd,s %r28,31,32,%r4 + ldd 16(%r8),%r29 + extrd,s %r28,39,40,%r2 + stb %r31,2(%r29) + extrd,s %r28,47,48,%r5 + ldd 16(%r8),%r31 + extrd,s %r28,55,56,%r6 + stb %r4,3(%r31) + ldd 16(%r8),%r29 + stb %r2,4(%r29) + ldd 16(%r8),%r31 + stb %r5,5(%r31) + ldd 16(%r8),%r29 + b .L50 + stb %r6,6(%r29) +.L127: + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r29 + extrd,s %r28,23,24,%r31 + stb %r2,1(%r29) + extrd,s %r28,31,32,%r4 + ldd 16(%r8),%r29 + extrd,s %r28,39,40,%r2 + stb %r31,2(%r29) + extrd,s %r28,47,48,%r5 + ldd 16(%r8),%r29 + stb %r4,3(%r29) + ldd 16(%r8),%r31 + stb %r2,4(%r31) + ldd 16(%r8),%r29 + b .L50 + stb %r5,5(%r29) +.L126: + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r29 + stb %r2,1(%r29) + ldd 16(%r8),%r31 + extrd,s %r28,39,40,%r2 + stb %r4,2(%r31) + ldd 16(%r8),%r29 + stb %r5,3(%r29) + ldd 16(%r8),%r31 + b .L50 + stb %r2,4(%r31) +.L125: + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r29 + stb %r2,1(%r29) + ldd 16(%r8),%r29 + stb %r4,2(%r29) + ldd 16(%r8),%r31 + b .L50 + stb %r5,3(%r31) +.L124: + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r31 + stb %r2,1(%r31) + ldd 16(%r8),%r29 + b .L50 + stb %r4,2(%r29) +.L123: + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r29 + b .L50 + stb %r2,1(%r29) +.L122: + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + b .L50 + stb %r29,0(%r31) +.L114: + ldd 16(%r8),%r29 + b .L50 + std %r1,0(%r29) +.L115: + ldd 16(%r8),%r29 + b .L50 + stw %r1,0(%r29) +.L116: + ldd 16(%r8),%r29 + b .L50 + sth %r1,0(%r29) +.L117: + ldd 16(%r8),%r29 + b .L50 + stb %r1,0(%r29) +.L120: +#APP + copy %r1,%r29 +#NO_APP + ldd 8(%r8),%r31 + ldo -16(%r30),%r29 + ldd 16(%r31),%r2 + ldd 24(%r31),%r27 + bve,l (%r2),%r2 + nop + ldd 16(%r8),%r29 + copy %r9,%r27 + b .L50 + fstd %fr4,0(%r29) +.L119: +#APP + copy %r1,%r29 +#NO_APP + ldd 8(%r8),%r31 + ldo -16(%r30),%r29 + ldd 16(%r31),%r2 + ldd 24(%r31),%r27 + bve,l (%r2),%r2 + nop + ldd 16(%r8),%r29 + copy %r9,%r27 + b .L50 + fstw %fr4R,0(%r29) +.L44: + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,.L45 + ldd 56(%r5),%r19 +#APP + fldw 60(%r5),%fr11R +#NO_APP + b,n .L45 +.L39: + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,.L40 + ldd 48(%r5),%r20 +#APP + fldw 52(%r5),%fr10R +#NO_APP + b,n .L40 +.L34: + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,.L35 + ldd 40(%r5),%r21 +#APP + fldw 44(%r5),%fr9R +#NO_APP + b,n .L35 +.L29: + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,.L30 + ldd 32(%r5),%r22 +#APP + fldw 36(%r5),%fr8R +#NO_APP + b,n .L30 +.L24: + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,.L25 + ldd 24(%r5),%r23 +#APP + fldw 28(%r5),%fr7R +#NO_APP + b,n .L25 +.L19: + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,.L20 + ldd 16(%r5),%r24 +#APP + fldw 20(%r5),%fr6R +#NO_APP + b,n .L20 +.L14: + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,.L15 + ldd 8(%r5),%r25 +#APP + fldw 12(%r5),%fr5R +#NO_APP + b,n .L15 +.L9: + ldw 64(%r8),%r29 + extrw,u %r29,31,1,%r29 + cmpib,=,n 0,%r29,.L10 + ldd 0(%r5),%r26 +#APP + fldw 4(%r5),%fr4R +#NO_APP + b,n .L10 +.L118: + b .L7 + ldd 16(%r8),%r28 + .EXIT + .PROCEND +.Lfe1: + .size avcall_call,.Lfe1-avcall_call + .ident "GCC: (GNU) 3.1" diff --git a/avcall/avcall-hppa64-macro.S b/avcall/avcall-hppa64-macro.S new file mode 100644 index 0000000..c6dd66d --- /dev/null +++ b/avcall/avcall-hppa64-macro.S @@ -0,0 +1,510 @@ +#include "asm-hppa64.h" + .LEVEL 2.0w + TEXT1() + TEXT2() + .align 8 +GLOBL(avcall_call) + DECLARE_FUNCTION(avcall_call) +DEF(avcall_call) + .PROC + .CALLINFO FRAME=256,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=9 + .ENTRY + copy %r3,%r1 + std %r2,-16(%r30) + copy %r30,%r3 + std,ma %r1,256(%r30) + ldi 8,%r31 + std %r9,16(%r3) + copy %r27,%r9 + std %r8,24(%r3) + copy %r26,%r8 + std %r7,32(%r3) + ldo -80(%r30),%r7 + std %r6,40(%r3) + std %r5,48(%r3) + std %r4,56(%r3) + ldd 40(%r26),%r29 + ldd 48(%r26),%r5 + sub %r29,%r5,%r29 + extrd,s %r29,29+32-1,32,%r6 + cmpb,<= %r6,%r31,L(113) + ldo 2112(%r30),%r30 +DEF(L(6)) + depd,z %r31,60,61,%r29 + ldo 1(%r31),%r31 + add,l %r29,%r5,%r2 + extrd,s %r31,63,32,%r31 + ldd 0(%r2),%r4 + add,l %r29,%r7,%r29 + cmpb,> %r6,%r31,L(6) + std %r4,0(%r29) +DEF(L(113)) + ldw 24(%r8),%r31 + ldi 16,%r29 + cmpb,= %r29,%r31,L(118) + copy %r31,%r4 +DEF(L(7)) + cmpib,>=,n 0,%r6,L(8) + ldw 68(%r8),%r2 + extrw,u %r2,31,1,%r29 + cmpib,=,n 0,%r29,L(9) + fldd 0(%r5),%fr4 +DEF(L(10)) + cmpib,>=,n 1,%r6,L(8) + ldi 2,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,L(14) + fldd 8(%r5),%fr5 +DEF(L(15)) + cmpib,>=,n 2,%r6,L(8) + ldi 4,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,L(19) + fldd 16(%r5),%fr6 +DEF(L(20)) + cmpib,>=,n 3,%r6,L(8) + ldi 8,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,L(24) + fldd 24(%r5),%fr7 +DEF(L(25)) + cmpib,>=,n 4,%r6,L(8) + ldi 16,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,L(29) + fldd 32(%r5),%fr8 +DEF(L(30)) + cmpib,>=,n 5,%r6,L(8) + ldi 32,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,L(34) + fldd 40(%r5),%fr9 +DEF(L(35)) + cmpib,>=,n 6,%r6,L(8) + ldi 64,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,L(39) + fldd 48(%r5),%fr10 +DEF(L(40)) + cmpib,>=,n 7,%r6,L(8) + ldi 128,%r31 + and %r2,%r31,%r29 + cmpib,=,n 0,%r29,L(44) + fldd 56(%r5),%fr11 +DEF(L(45)) + cmpiclr,>= 8,%r6,%r0 + ldo 64(%r7),%r1 +DEF(L(8)) + cmpib,=,n 13,%r4,L(119) + cmpib,=,n 14,%r4,L(120) + copy %r1,%r29 + ldd 8(%r8),%r31 + ldd 16(%r31),%r2 + ldd 24(%r31),%r27 + bve,l (%r2),%r2 + nop + ldw 24(%r8),%r2 + copy %r9,%r27 + cmpib,= 1,%r2,L(50) + copy %r28,%r1 + cmpib,=,n 2,%r2,L(117) + cmpib,=,n 3,%r2,L(117) + cmpib,=,n 4,%r2,L(117) + cmpib,=,n 5,%r2,L(116) + cmpib,=,n 6,%r2,L(116) + cmpib,=,n 7,%r2,L(115) + cmpib,=,n 8,%r2,L(115) + cmpib,=,n 9,%r2,L(114) + cmpib,=,n 11,%r2,L(114) + cmpib,=,n 10,%r2,L(114) + cmpib,=,n 12,%r2,L(114) + cmpib,= 15,%r2,L(114) + ldi 16,%r31 + cmpb,=,n %r31,%r2,L(121) +DEF(L(50)) + ldd -16(%r3),%r2 +DEF(L(136)) + ldi 0,%r28 + ldd 16(%r3),%r9 + ldd 24(%r3),%r8 + ldd 32(%r3),%r7 + ldd 40(%r3),%r6 + ldd 48(%r3),%r5 + ldd 56(%r3),%r4 + ldo 64(%r3),%r30 + bve (%r2) + ldd,mb -64(%r30),%r3 +DEF(L(121)) + ldw 0(%r8),%r31 + extrd,u %r31,54+1-1,1,%r31 + cmpib,= 0,%r31,L(136) + ldd -16(%r3),%r2 + ldd 32(%r8),%r2 + ldo -1(%r2),%r31 + cmpib,*<<,n 15,%r31,L(136) + ldd -16(%r3),%r2 + cmpib,*=,n 1,%r2,L(122) + cmpib,*=,n 2,%r2,L(123) + cmpib,*= 3,%r2,L(124) + extrd,s %r28,23,24,%r4 + cmpib,*= 4,%r2,L(125) + extrd,s %r28,31,32,%r5 + cmpib,*=,n 5,%r2,L(126) + cmpib,*=,n 6,%r2,L(127) + cmpib,*= 7,%r2,L(128) + ldo -8(%r2),%r31 + cmpib,*<< 8,%r31,L(50) + extrd,s %r28,7,8,%r31 + ldd 16(%r8),%r2 + stb %r31,0(%r2) + extrd,s %r28,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r28,23,24,%r2 + stb %r4,1(%r31) + extrd,s %r28,31,32,%r5 + ldd 16(%r8),%r31 + extrd,s %r28,39,40,%r4 + stb %r2,2(%r31) + extrd,s %r28,47,48,%r6 + ldd 16(%r8),%r2 + extrd,s %r28,55,56,%r7 + stb %r5,3(%r2) + ldd 16(%r8),%r31 + stb %r4,4(%r31) + ldd 16(%r8),%r2 + stb %r6,5(%r2) + ldd 16(%r8),%r31 + stb %r7,6(%r31) + ldd 16(%r8),%r2 + stb %r28,7(%r2) + ldd 32(%r8),%r2 + cmpib,*=,n 8,%r2,L(136) + ldd -16(%r3),%r2 + cmpib,*=,n 9,%r2,L(129) + cmpib,*=,n 10,%r2,L(130) + cmpib,*=,n 11,%r2,L(131) + cmpib,*=,n 12,%r2,L(132) + cmpib,*= 13,%r2,L(133) + extrd,s %r29,7,8,%r31 + cmpib,*=,n 14,%r2,L(134) + cmpib,*= 15,%r2,L(135) + ldi 16,%r31 + cmpb,*<> %r31,%r2,L(136) + ldd -16(%r3),%r2 + ldd 16(%r8),%r2 + extrd,s %r29,7,8,%r31 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r29,23,24,%r2 + stb %r4,9(%r31) + extrd,s %r29,31,32,%r5 + ldd 16(%r8),%r31 + extrd,s %r29,39,40,%r4 + stb %r2,10(%r31) + extrd,s %r29,47,48,%r6 + ldd 16(%r8),%r2 + extrd,s %r29,55,56,%r7 + stb %r5,11(%r2) + ldd 16(%r8),%r31 + stb %r4,12(%r31) + ldd 16(%r8),%r2 + stb %r6,13(%r2) + ldd 16(%r8),%r31 + stb %r7,14(%r31) + ldd 16(%r8),%r2 + b L(50) + stb %r29,15(%r2) +DEF(L(135)) + ldd 16(%r8),%r2 + extrd,s %r29,7,8,%r31 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r29,23,24,%r2 + stb %r4,9(%r31) + extrd,s %r29,31,32,%r5 + ldd 16(%r8),%r31 + extrd,s %r29,39,40,%r4 + stb %r2,10(%r31) + extrd,s %r29,47,48,%r6 + ldd 16(%r8),%r2 + extrd,s %r29,55,56,%r29 + stb %r5,11(%r2) + ldd 16(%r8),%r31 + stb %r4,12(%r31) + ldd 16(%r8),%r2 + stb %r6,13(%r2) + ldd 16(%r8),%r31 + b L(50) + stb %r29,14(%r31) +DEF(L(134)) + ldd 16(%r8),%r2 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r29,23,24,%r2 + stb %r4,9(%r31) + extrd,s %r29,31,32,%r5 + ldd 16(%r8),%r31 + extrd,s %r29,39,40,%r4 + stb %r2,10(%r31) + extrd,s %r29,47,48,%r29 + ldd 16(%r8),%r31 + stb %r5,11(%r31) + ldd 16(%r8),%r2 + stb %r4,12(%r2) + ldd 16(%r8),%r31 + b L(50) + stb %r29,13(%r31) +DEF(L(133)) + ldd 16(%r8),%r2 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r29,23,24,%r5 + stb %r4,9(%r31) + extrd,s %r29,31,32,%r6 + ldd 16(%r8),%r2 + extrd,s %r29,39,40,%r29 + stb %r5,10(%r2) + ldd 16(%r8),%r31 + stb %r6,11(%r31) + ldd 16(%r8),%r2 + b L(50) + stb %r29,12(%r2) +DEF(L(132)) + ldd 16(%r8),%r2 + extrd,s %r29,7,8,%r31 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r31 + extrd,s %r29,23,24,%r5 + stb %r4,9(%r31) + extrd,s %r29,31,32,%r29 + ldd 16(%r8),%r31 + stb %r5,10(%r31) + ldd 16(%r8),%r2 + b L(50) + stb %r29,11(%r2) +DEF(L(131)) + ldd 16(%r8),%r2 + extrd,s %r29,7,8,%r31 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r4 + ldd 16(%r8),%r2 + extrd,s %r29,23,24,%r29 + stb %r4,9(%r2) + ldd 16(%r8),%r31 + b L(50) + stb %r29,10(%r31) +DEF(L(130)) + ldd 16(%r8),%r2 + extrd,s %r29,7,8,%r31 + stb %r31,8(%r2) + extrd,s %r29,15,16,%r29 + ldd 16(%r8),%r31 + b L(50) + stb %r29,9(%r31) +DEF(L(129)) + ldd 16(%r8),%r31 + extrd,s %r29,7,8,%r29 + b L(50) + stb %r29,8(%r31) +DEF(L(128)) + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r29 + extrd,s %r28,23,24,%r31 + stb %r2,1(%r29) + extrd,s %r28,31,32,%r4 + ldd 16(%r8),%r29 + extrd,s %r28,39,40,%r2 + stb %r31,2(%r29) + extrd,s %r28,47,48,%r5 + ldd 16(%r8),%r31 + extrd,s %r28,55,56,%r6 + stb %r4,3(%r31) + ldd 16(%r8),%r29 + stb %r2,4(%r29) + ldd 16(%r8),%r31 + stb %r5,5(%r31) + ldd 16(%r8),%r29 + b L(50) + stb %r6,6(%r29) +DEF(L(127)) + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r29 + extrd,s %r28,23,24,%r31 + stb %r2,1(%r29) + extrd,s %r28,31,32,%r4 + ldd 16(%r8),%r29 + extrd,s %r28,39,40,%r2 + stb %r31,2(%r29) + extrd,s %r28,47,48,%r5 + ldd 16(%r8),%r29 + stb %r4,3(%r29) + ldd 16(%r8),%r31 + stb %r2,4(%r31) + ldd 16(%r8),%r29 + b L(50) + stb %r5,5(%r29) +DEF(L(126)) + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r29 + stb %r2,1(%r29) + ldd 16(%r8),%r31 + extrd,s %r28,39,40,%r2 + stb %r4,2(%r31) + ldd 16(%r8),%r29 + stb %r5,3(%r29) + ldd 16(%r8),%r31 + b L(50) + stb %r2,4(%r31) +DEF(L(125)) + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r29 + stb %r2,1(%r29) + ldd 16(%r8),%r29 + stb %r4,2(%r29) + ldd 16(%r8),%r31 + b L(50) + stb %r5,3(%r31) +DEF(L(124)) + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r31 + stb %r2,1(%r31) + ldd 16(%r8),%r29 + b L(50) + stb %r4,2(%r29) +DEF(L(123)) + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + stb %r29,0(%r31) + extrd,s %r28,15,16,%r2 + ldd 16(%r8),%r29 + b L(50) + stb %r2,1(%r29) +DEF(L(122)) + ldd 16(%r8),%r31 + extrd,s %r28,7,8,%r29 + b L(50) + stb %r29,0(%r31) +DEF(L(114)) + ldd 16(%r8),%r29 + b L(50) + std %r1,0(%r29) +DEF(L(115)) + ldd 16(%r8),%r29 + b L(50) + stw %r1,0(%r29) +DEF(L(116)) + ldd 16(%r8),%r29 + b L(50) + sth %r1,0(%r29) +DEF(L(117)) + ldd 16(%r8),%r29 + b L(50) + stb %r1,0(%r29) +DEF(L(120)) + copy %r1,%r29 + ldd 8(%r8),%r31 + ldd 16(%r31),%r2 + ldd 24(%r31),%r27 + bve,l (%r2),%r2 + nop + ldd 16(%r8),%r29 + copy %r9,%r27 + b L(50) + fstd %fr4,0(%r29) +DEF(L(119)) + copy %r1,%r29 + ldd 8(%r8),%r31 + ldd 16(%r31),%r2 + ldd 24(%r31),%r27 + bve,l (%r2),%r2 + nop + ldd 16(%r8),%r29 + copy %r9,%r27 + b L(50) + fstw %fr4R,0(%r29) +DEF(L(44)) + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,L(45) + ldd 56(%r5),%r19 + fldw 60(%r5),%fr11R + b,n L(45) +DEF(L(39)) + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,L(40) + ldd 48(%r5),%r20 + fldw 52(%r5),%fr10R + b,n L(40) +DEF(L(34)) + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,L(35) + ldd 40(%r5),%r21 + fldw 44(%r5),%fr9R + b,n L(35) +DEF(L(29)) + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,L(30) + ldd 32(%r5),%r22 + fldw 36(%r5),%fr8R + b,n L(30) +DEF(L(24)) + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,L(25) + ldd 24(%r5),%r23 + fldw 28(%r5),%fr7R + b,n L(25) +DEF(L(19)) + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,L(20) + ldd 16(%r5),%r24 + fldw 20(%r5),%fr6R + b,n L(20) +DEF(L(14)) + ldw 64(%r8),%r29 + and %r29,%r31,%r29 + cmpib,=,n 0,%r29,L(15) + ldd 8(%r5),%r25 + fldw 12(%r5),%fr5R + b,n L(15) +DEF(L(9)) + ldw 64(%r8),%r29 + extrw,u %r29,31,1,%r29 + cmpib,=,n 0,%r29,L(10) + ldd 0(%r5),%r26 + fldw 4(%r5),%fr4R + b,n L(10) +DEF(L(118)) + b L(7) + ldd 16(%r8),%r28 + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-hppa64.c b/avcall/avcall-hppa64.c new file mode 100644 index 0000000..26ca851 --- /dev/null +++ b/avcall/avcall-hppa64.c @@ -0,0 +1,399 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for a HP-PA 2.0w in 64-bit mode with cc + (NB: gcc-7.1.0/gcc/config/pa/pa64-regs.h is quite incorrect. Ignore it.) + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + hppa64 Argument Passing Conventions: + + Up to 8 words are passed in registers: + integer/pointer float double + 1. %r26 %fr4R %fr4 + 2. %r25 %fr5R %fr5 + 3. %r24 %fr6R %fr6 + 4. %r23 %fr7R %fr7 + 5. %r22 %fr8R %fr8 + 6. %r21 %fr9R %fr9 + 7. %r20 %fr10R %fr10 + 8. %r19 %fr11R %fr11 + The remaining arguments are passed on the stack - growing up, unlike + in 32-bit mode! -, and %r29 is the base address of this stack area. + Room is preallocated for 8 words, i.e. from address %r29-64 to %r29-1. + Among these stack arguments: + - integer/pointer occupies 1 word (right-adjusted, since big-endian), + - float occupies 1 word and is stored in the upper 4 bytes of the word, + - double occupies 1 word. + + Structs of any size are passed in the argument sequence, e.g. in integer + registers (first byte being at bits 63..56). Note that a {long,long} + struct has 2*(8 bytes) alignment. + + The return value is returned in register %r28. + Float return values are also returned in %fr4R. + Double return values are also returned in %fr4. + (How silly! Who designed this ABI?!) + + To return a structure of more than 16 bytes, the called function copies + the return value to the address supplied in register %r28. The function + also returns the pointer. + Smaller structures are returned in the registers %r28 (first 8 bytes) + and %r29 (next 8 bytes, if present). + + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +/* This declaration tells gcc not to modify %r28. */ +register __avword* sret __asm__("%r28"); /* structure return pointer */ + +register __avrword arg1 __asm__("r26"); +register __avrword arg2 __asm__("r25"); +register __avrword arg3 __asm__("r24"); +register __avrword arg4 __asm__("r23"); +register __avrword arg5 __asm__("r22"); +register __avrword arg6 __asm__("r21"); +register __avrword arg7 __asm__("r20"); +register __avrword arg8 __asm__("r19"); + +/*register float farg1 __asm__("fr4R");*/ +/*register float farg2 __asm__("fr5R");*/ +/*register float farg3 __asm__("fr6R");*/ +/*register float farg4 __asm__("fr7R");*/ +/*register float farg5 __asm__("fr8R");*/ +/*register float farg6 __asm__("fr9R");*/ +/*register float farg7 __asm__("fr10R");*/ +/*register float farg8 __asm__("fr11R");*/ + +register double darg1 __asm__("fr4"); +register double darg2 __asm__("fr5"); +register double darg3 __asm__("fr6"); +register double darg4 __asm__("fr7"); +register double darg5 __asm__("fr8"); +register double darg6 __asm__("fr9"); +register double darg7 __asm__("fr10"); +register double darg8 __asm__("fr11"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("%r30"); /* C names for registers */ +/*register __avrword iret1 __asm__("%r28"); */ + register __avrword iret2 __asm__("%r29"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + __avword* memargptr; + int arglen = l->aptr - l->args; + __avrword iret; + + { + int i; + for (i = 8; i < arglen; i++) /* push function args onto stack */ + argframe[i] = l->args[i]; + } + + if (l->rtype == __AVstruct) /* push struct return address */ + sret = l->raddr; + + /* Put args in registers */ + if (arglen >= 1) { + if (l->darg_mask & (1 << 0)) + darg1 = ((double*)&l->args[1])[-1]; + else if (l->farg_mask & (1 << 0)) + __asm__ __volatile__ ("fldw %0,%%fr4R" : : "m" (((float*)&l->args[1])[-1])); /* farg1 = ((float*)&l->args[1])[-1]; */ + else + arg1 = l->args[0]; + if (arglen >= 2) { + if (l->darg_mask & (1 << 1)) + darg2 = ((double*)&l->args[2])[-1]; + else if (l->farg_mask & (1 << 1)) + __asm__ __volatile__ ("fldw %0,%%fr5R" : : "m" (((float*)&l->args[2])[-1])); /* farg2 = ((float*)&l->args[2])[-1]; */ + else + arg2 = l->args[1]; + if (arglen >= 3) { + if (l->darg_mask & (1 << 2)) + darg3 = ((double*)&l->args[3])[-1]; + else if (l->farg_mask & (1 << 2)) + __asm__ __volatile__ ("fldw %0,%%fr6R" : : "m" (((float*)&l->args[3])[-1])); /* farg3 = ((float*)&l->args[3])[-1]; */ + else + arg3 = l->args[2]; + if (arglen >= 4) { + if (l->darg_mask & (1 << 3)) + darg4 = ((double*)&l->args[4])[-1]; + else if (l->farg_mask & (1 << 3)) + __asm__ __volatile__ ("fldw %0,%%fr7R" : : "m" (((float*)&l->args[4])[-1])); /* farg4 = ((float*)&l->args[4])[-1]; */ + else + arg4 = l->args[3]; + if (arglen >= 5) { + if (l->darg_mask & (1 << 4)) + darg5 = ((double*)&l->args[5])[-1]; + else if (l->farg_mask & (1 << 4)) + __asm__ __volatile__ ("fldw %0,%%fr8R" : : "m" (((float*)&l->args[5])[-1])); /* farg5 = ((float*)&l->args[5])[-1]; */ + else + arg5 = l->args[4]; + if (arglen >= 6) { + if (l->darg_mask & (1 << 5)) + darg6 = ((double*)&l->args[6])[-1]; + else if (l->farg_mask & (1 << 5)) + __asm__ __volatile__ ("fldw %0,%%fr9R" : : "m" (((float*)&l->args[6])[-1])); /* farg6 = ((float*)&l->args[6])[-1]; */ + else + arg6 = l->args[5]; + if (arglen >= 7) { + if (l->darg_mask & (1 << 6)) + darg7 = ((double*)&l->args[7])[-1]; + else if (l->farg_mask & (1 << 6)) + __asm__ __volatile__ ("fldw %0,%%fr10R" : : "m" (((float*)&l->args[7])[-1])); /* farg7 = ((float*)&l->args[7])[-1]; */ + else + arg7 = l->args[6]; + if (arglen >= 8) { + if (l->darg_mask & (1 << 7)) + darg8 = ((double*)&l->args[8])[-1]; + else if (l->farg_mask & (1 << 7)) + __asm__ __volatile__ ("fldw %0,%%fr11R" : : "m" (((float*)&l->args[8])[-1])); /* farg8 = ((float*)&l->args[8])[-1]; */ + else + arg8 = l->args[7]; + if (arglen > 8) { + memargptr = &argframe[8]; + } + } + } + } + } + } + } + } + } + if (l->rtype == __AVfloat) { + __asm__ __volatile__ ("copy %0,%%r29" : : "r" (memargptr)); + /* GCC generates an 'ldo -16(%r30),%r29' instruction as part of this + function call. We eliminate it through post-processing. */ + *(float*)l->raddr = (*(float(*)())l->func)(); + } else + if (l->rtype == __AVdouble) { + __asm__ __volatile__ ("copy %0,%%r29" : : "r" (memargptr)); + /* GCC generates an 'ldo -16(%r30),%r29' instruction as part of this + function call. We eliminate it through post-processing. */ + *(double*)l->raddr = (*(double(*)())l->func)(); + } else { + __asm__ __volatile__ ("copy %0,%%r29" : : "r" (memargptr)); + /* GCC generates an 'ldo -16(%r30),%r29' instruction as part of this + function call. We eliminate it through post-processing. */ + iret = (*l->func)(); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong || l->rtype == __AVlonglong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong || l->rtype == __AVulonglong) { + RETURN(unsigned long, iret); + } else + /* see above + if (l->rtype == __AVfloat) { + } else + if (l->rtype == __AVdouble) { + } else + */ + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + /* cc returns structs of size <= 16 in registers. */ + if (l->rsize > 0 && l->rsize <= 16) { + #if 0 + void* raddr = l->raddr; + #else + #define raddr l->raddr + #endif + #if 1 /* Unoptimized */ + if (l->rsize == 1) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + } else + if (l->rsize == 2) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + } else + if (l->rsize == 3) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + } else + if (l->rsize == 4) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + } else + if (l->rsize == 5) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + } else + if (l->rsize == 6) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + } else + if (l->rsize == 7) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>8); + } else + if (l->rsize >= 8 && l->rsize <= 16) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[7] = (unsigned char)(iret); + if (l->rsize == 8) { + } else + if (l->rsize == 9) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + } else + if (l->rsize == 10) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + } else + if (l->rsize == 11) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + } else + if (l->rsize == 12) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + } else + if (l->rsize == 13) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + } else + if (l->rsize == 14) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + } else + if (l->rsize == 15) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>8); + } else + if (l->rsize == 16) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+7] = (unsigned char)(iret2); + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 2*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__avrword) */ + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - ((__avrword)1 << (sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + __avrword mask1 = - ((__avrword)1 << (2*sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret << (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = - ((__avrword)1 << (2*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] ^= (wordaddr[1] ^ ((iret << (sizeof(__avrword)*4-start_offset*4) << (sizeof(__avrword)*4-start_offset*4)) | (iret2 >> (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = - ((__avrword)1 << (3*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] = (iret << (sizeof(__avrword)*8-start_offset*8)) | (iret2 >> (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 << (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } + #endif + } + } + } + } + return 0; +} diff --git a/avcall/avcall-i386-linux.s b/avcall/avcall-i386-linux.s new file mode 100644 index 0000000..2a226d9 --- /dev/null +++ b/avcall/avcall-i386-linux.s @@ -0,0 +1,143 @@ + .file "avcall-i386.c" + .text + .align 2 + .p2align 2,,3 +.globl avcall_call + .type avcall_call,@function +avcall_call: + pushl %ebp + movl %esp, %ebp + pushl %edi + pushl %esi + movl 8(%ebp), %eax + movl 20(%eax), %edx + movl 24(%eax), %eax + subl %eax, %edx + sarl $2, %edx + xorl %esi, %esi + subl $1024, %esp + cmpl %edx, %esi + movl %esp, %edi + jge .L45 + movl %eax, %ecx + .p2align 2,,3 +.L6: + movl (%ecx,%esi,4), %eax + movl %eax, (%edi,%esi,4) + incl %esi + cmpl %edx, %esi + jl .L6 +.L45: + movl 8(%ebp), %edx + movl 12(%edx), %eax + cmpl $13, %eax + je .L55 + cmpl $14, %eax + je .L56 + movl 8(%ebp), %ecx + call *4(%ecx) + movl %eax, %esi + movl 8(%ebp), %eax + movl 12(%eax), %ecx + cmpl $1, %ecx + je .L8 + cmpl $2, %ecx + je .L57 + cmpl $3, %ecx + je .L53 + cmpl $4, %ecx + je .L53 + cmpl $5, %ecx + je .L54 + cmpl $6, %ecx + je .L58 + cmpl $7, %ecx + je .L52 + cmpl $8, %ecx + je .L46 + cmpl $9, %ecx + je .L52 + cmpl $10, %ecx + je .L46 + leal -11(%ecx), %eax + cmpl $1, %eax + jbe .L47 + cmpl $15, %ecx + je .L46 + cmpl $16, %ecx + je .L59 + .p2align 2,,3 +.L8: + leal -8(%ebp), %esp + popl %esi + xorl %eax, %eax + popl %edi + leave + ret +.L59: + movl 8(%ebp), %ecx + testb $2, 1(%ecx) + je .L8 + movl 16(%ecx), %eax + cmpl $1, %eax + je .L50 + cmpl $2, %eax + je .L54 + cmpl $4, %eax + je .L46 + cmpl $8, %eax + jne .L8 +.L47: + movl 8(%ebp), %ecx + movl 8(%ecx), %eax + movl %esi, (%eax) + movl %edx, 4(%eax) + jmp .L8 +.L46: + movl 8(%ebp), %edx + movl 8(%edx), %eax +.L48: + movl %esi, (%eax) + jmp .L8 +.L54: + movl 8(%ebp), %ecx + movl 8(%ecx), %eax +.L49: + movw %si, (%eax) + jmp .L8 +.L50: + movl 8(%ecx), %eax +.L51: + movl %esi, %edx + movb %dl, (%eax) + jmp .L8 +.L52: + movl 8(%ebp), %ecx + movl 8(%ecx), %eax + jmp .L48 +.L58: + movl 8(%ebp), %edx + movl 8(%edx), %eax + jmp .L49 +.L53: + movl 8(%ebp), %ecx + jmp .L50 +.L57: + movl 8(%eax), %eax + jmp .L51 +.L56: + movl 8(%ebp), %eax + call *4(%eax) + movl 8(%ebp), %edx + movl 8(%edx), %eax + fstpl (%eax) + jmp .L8 +.L55: + call *4(%edx) + movl 8(%ebp), %ecx + movl 8(%ecx), %eax + fstps (%eax) + jmp .L8 +.Lfe1: + .size avcall_call,.Lfe1-avcall_call + .ident "GCC: (GNU) 3.1" diff --git a/avcall/avcall-i386-macro.S b/avcall/avcall-i386-macro.S new file mode 100644 index 0000000..2f00035 --- /dev/null +++ b/avcall/avcall-i386-macro.S @@ -0,0 +1,146 @@ +#include "asm-i386.h" + TEXT() + ALIGN(2) + P2ALIGN(2,3) +GLOBL(C(avcall_call)) + DECLARE_FUNCTION(avcall_call) +FUNBEGIN(avcall_call) + INSN1(push,l ,R(ebp)) + INSN2(mov,l ,R(esp), R(ebp)) + INSN1(push,l ,R(edi)) + INSN1(push,l ,R(esi)) + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(eax,20), R(edx)) + INSN2(mov,l ,X4 MEM_DISP(eax,24), R(eax)) + INSN2(sub,l ,R(eax), R(edx)) + INSN2(sar,l ,NUM(2), R(edx)) + INSN2(xor,l ,R(esi), R(esi)) + INSN2(sub,l ,NUM(1024), R(esp)) + INSN2(cmp,l ,R(edx), R(esi)) + INSN2(mov,l ,R(esp), R(edi)) + INSN1(jge,_ ,L(45)) + INSN2(mov,l ,R(eax), R(ecx)) + P2ALIGN(2,3) +L(6): + INSN2(mov,l ,X4 MEM_SHINDEX(ecx,esi,4), R(eax)) + INSN2(mov,l ,R(eax),X4 MEM_SHINDEX(edi,esi,4)) + INSN1(inc,l ,R(esi)) + INSN2(cmp,l ,R(edx), R(esi)) + INSN1(jl,_ ,L(6)) +L(45): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(mov,l ,X4 MEM_DISP(edx,12), R(eax)) + INSN2(cmp,l ,NUM(13), R(eax)) + INSN1(je,_ ,L(55)) + INSN2(cmp,l ,NUM(14), R(eax)) + INSN1(je,_ ,L(56)) + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN1(call,_ ,INDIR(X4 MEM_DISP(ecx,4))) + INSN2(mov,l ,R(eax), R(esi)) + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(eax,12), R(ecx)) + INSN2(cmp,l ,NUM(1), R(ecx)) + INSN1(je,_ ,L(8)) + INSN2(cmp,l ,NUM(2), R(ecx)) + INSN1(je,_ ,L(57)) + INSN2(cmp,l ,NUM(3), R(ecx)) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(4), R(ecx)) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(5), R(ecx)) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(6), R(ecx)) + INSN1(je,_ ,L(58)) + INSN2(cmp,l ,NUM(7), R(ecx)) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(8), R(ecx)) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(9), R(ecx)) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(10), R(ecx)) + INSN1(je,_ ,L(46)) + INSN2(lea,l ,X4 MEM_DISP(ecx,-11), R(eax)) + INSN2(cmp,l ,NUM(1), R(eax)) + INSN1(jbe,_ ,L(47)) + INSN2(cmp,l ,NUM(15), R(ecx)) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(16), R(ecx)) + INSN1(je,_ ,L(59)) + P2ALIGN(2,3) +L(8): + INSN2(lea,l ,X4 MEM_DISP(ebp,-8), R(esp)) + INSN1(pop,l ,R(esi)) + INSN2(xor,l ,R(eax), R(eax)) + INSN1(pop,l ,R(edi)) + leave + ret +L(59): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN2(test,b ,NUM(2),X1 MEM_DISP(ecx,1)) + INSN1(je,_ ,L(8)) + INSN2(mov,l ,X4 MEM_DISP(ecx,16), R(eax)) + INSN2(cmp,l ,NUM(1), R(eax)) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(2), R(eax)) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(4), R(eax)) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(8), R(eax)) + INSN1(jne,_ ,L(8)) +L(47): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ecx,8), R(eax)) + INSN2(mov,l ,R(esi),X4 MEM(eax)) + INSN2(mov,l ,R(edx),X4 MEM_DISP(eax,4)) + INSN1(jmp,_ ,L(8)) +L(46): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(mov,l ,X4 MEM_DISP(edx,8), R(eax)) +L(48): + INSN2(mov,l ,R(esi),X4 MEM(eax)) + INSN1(jmp,_ ,L(8)) +L(54): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ecx,8), R(eax)) +L(49): + INSN2(mov,w ,R(si),X2 MEM(eax)) + INSN1(jmp,_ ,L(8)) +L(50): + INSN2(mov,l ,X4 MEM_DISP(ecx,8), R(eax)) +L(51): + INSN2(mov,l ,R(esi), R(edx)) + INSN2(mov,b ,R(dl),X1 MEM(eax)) + INSN1(jmp,_ ,L(8)) +L(52): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ecx,8), R(eax)) + INSN1(jmp,_ ,L(48)) +L(58): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(mov,l ,X4 MEM_DISP(edx,8), R(eax)) + INSN1(jmp,_ ,L(49)) +L(53): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN1(jmp,_ ,L(50)) +L(57): + INSN2(mov,l ,X4 MEM_DISP(eax,8), R(eax)) + INSN1(jmp,_ ,L(51)) +L(56): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(eax)) + INSN1(call,_ ,INDIR(X4 MEM_DISP(eax,4))) + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(mov,l ,X4 MEM_DISP(edx,8), R(eax)) + INSN1(fstp,l ,X8 MEM(eax)) + INSN1(jmp,_ ,L(8)) +L(55): + INSN1(call,_ ,INDIR(X4 MEM_DISP(edx,4))) + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ecx,8), R(eax)) + INSN1(fstp,s ,X4 MEM(eax)) + INSN1(jmp,_ ,L(8)) +L(fe1): + FUNEND(avcall_call,L(fe1)-avcall_call) + +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-i386-msvc.c b/avcall/avcall-i386-msvc.c new file mode 100644 index 0000000..2f00035 --- /dev/null +++ b/avcall/avcall-i386-msvc.c @@ -0,0 +1,146 @@ +#include "asm-i386.h" + TEXT() + ALIGN(2) + P2ALIGN(2,3) +GLOBL(C(avcall_call)) + DECLARE_FUNCTION(avcall_call) +FUNBEGIN(avcall_call) + INSN1(push,l ,R(ebp)) + INSN2(mov,l ,R(esp), R(ebp)) + INSN1(push,l ,R(edi)) + INSN1(push,l ,R(esi)) + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(eax,20), R(edx)) + INSN2(mov,l ,X4 MEM_DISP(eax,24), R(eax)) + INSN2(sub,l ,R(eax), R(edx)) + INSN2(sar,l ,NUM(2), R(edx)) + INSN2(xor,l ,R(esi), R(esi)) + INSN2(sub,l ,NUM(1024), R(esp)) + INSN2(cmp,l ,R(edx), R(esi)) + INSN2(mov,l ,R(esp), R(edi)) + INSN1(jge,_ ,L(45)) + INSN2(mov,l ,R(eax), R(ecx)) + P2ALIGN(2,3) +L(6): + INSN2(mov,l ,X4 MEM_SHINDEX(ecx,esi,4), R(eax)) + INSN2(mov,l ,R(eax),X4 MEM_SHINDEX(edi,esi,4)) + INSN1(inc,l ,R(esi)) + INSN2(cmp,l ,R(edx), R(esi)) + INSN1(jl,_ ,L(6)) +L(45): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(mov,l ,X4 MEM_DISP(edx,12), R(eax)) + INSN2(cmp,l ,NUM(13), R(eax)) + INSN1(je,_ ,L(55)) + INSN2(cmp,l ,NUM(14), R(eax)) + INSN1(je,_ ,L(56)) + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN1(call,_ ,INDIR(X4 MEM_DISP(ecx,4))) + INSN2(mov,l ,R(eax), R(esi)) + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(eax,12), R(ecx)) + INSN2(cmp,l ,NUM(1), R(ecx)) + INSN1(je,_ ,L(8)) + INSN2(cmp,l ,NUM(2), R(ecx)) + INSN1(je,_ ,L(57)) + INSN2(cmp,l ,NUM(3), R(ecx)) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(4), R(ecx)) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(5), R(ecx)) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(6), R(ecx)) + INSN1(je,_ ,L(58)) + INSN2(cmp,l ,NUM(7), R(ecx)) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(8), R(ecx)) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(9), R(ecx)) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(10), R(ecx)) + INSN1(je,_ ,L(46)) + INSN2(lea,l ,X4 MEM_DISP(ecx,-11), R(eax)) + INSN2(cmp,l ,NUM(1), R(eax)) + INSN1(jbe,_ ,L(47)) + INSN2(cmp,l ,NUM(15), R(ecx)) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(16), R(ecx)) + INSN1(je,_ ,L(59)) + P2ALIGN(2,3) +L(8): + INSN2(lea,l ,X4 MEM_DISP(ebp,-8), R(esp)) + INSN1(pop,l ,R(esi)) + INSN2(xor,l ,R(eax), R(eax)) + INSN1(pop,l ,R(edi)) + leave + ret +L(59): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN2(test,b ,NUM(2),X1 MEM_DISP(ecx,1)) + INSN1(je,_ ,L(8)) + INSN2(mov,l ,X4 MEM_DISP(ecx,16), R(eax)) + INSN2(cmp,l ,NUM(1), R(eax)) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(2), R(eax)) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(4), R(eax)) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(8), R(eax)) + INSN1(jne,_ ,L(8)) +L(47): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ecx,8), R(eax)) + INSN2(mov,l ,R(esi),X4 MEM(eax)) + INSN2(mov,l ,R(edx),X4 MEM_DISP(eax,4)) + INSN1(jmp,_ ,L(8)) +L(46): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(mov,l ,X4 MEM_DISP(edx,8), R(eax)) +L(48): + INSN2(mov,l ,R(esi),X4 MEM(eax)) + INSN1(jmp,_ ,L(8)) +L(54): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ecx,8), R(eax)) +L(49): + INSN2(mov,w ,R(si),X2 MEM(eax)) + INSN1(jmp,_ ,L(8)) +L(50): + INSN2(mov,l ,X4 MEM_DISP(ecx,8), R(eax)) +L(51): + INSN2(mov,l ,R(esi), R(edx)) + INSN2(mov,b ,R(dl),X1 MEM(eax)) + INSN1(jmp,_ ,L(8)) +L(52): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ecx,8), R(eax)) + INSN1(jmp,_ ,L(48)) +L(58): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(mov,l ,X4 MEM_DISP(edx,8), R(eax)) + INSN1(jmp,_ ,L(49)) +L(53): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN1(jmp,_ ,L(50)) +L(57): + INSN2(mov,l ,X4 MEM_DISP(eax,8), R(eax)) + INSN1(jmp,_ ,L(51)) +L(56): + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(eax)) + INSN1(call,_ ,INDIR(X4 MEM_DISP(eax,4))) + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(mov,l ,X4 MEM_DISP(edx,8), R(eax)) + INSN1(fstp,l ,X8 MEM(eax)) + INSN1(jmp,_ ,L(8)) +L(55): + INSN1(call,_ ,INDIR(X4 MEM_DISP(edx,4))) + INSN2(mov,l ,X4 MEM_DISP(ebp,8), R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ecx,8), R(eax)) + INSN1(fstp,s ,X4 MEM(eax)) + INSN1(jmp,_ ,L(8)) +L(fe1): + FUNEND(avcall_call,L(fe1)-avcall_call) + +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-i386.c b/avcall/avcall-i386.c new file mode 100644 index 0000000..63c2462 --- /dev/null +++ b/avcall/avcall-i386.c @@ -0,0 +1,144 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O -fno-omit-frame-pointer !!! + + Foreign function interface for a Linux i386/486 with gcc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + i386 Argument Passing Conventions: + + All arguments are passed on the stack with word alignment. Doubles take + two words. Structure args are passed as true structures embedded in the + argument stack. Float and double returns often come from FPU registers. + + To return a structure, the called function copies the value to space + pointed to by its first argument, and all other arguments are shifted + down by one. At least on FreeBSD, the function also returns the pointer. + GCC returns structures of size 1, 2, 4, 8 like integers. + + Compile this routine with gcc -O (or -O2 -fno-omit-frame-pointer or -g -O) + to get the right register variables. For other compilers use the + pre-compiled assembler version. + + -fomit-frame-pointer is forbidden because when calling structure returning + functions (the "i = (*l->func)();" line below) the called functions pops + the return value container pointer from the stack: "ret $4" instead of + "ret". (See gcc-2.6.3 macro RETURN_POPS_ARGS.) From our point of view, %esp + gets magically incremented. A workaround would be to push the return value + container pointer using an __asm__("pushl %0" : : : ...) instruction. + Similarly, when calling functions with ‘stdcall’ linkage, %esp also gets + incremented: all arguments (including the return value container pointer) + are popped from the stack. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("sp"); /* C names for registers */ +/*register __avrword iret __asm__("eax"); */ + register __avrword iret2 __asm__("edx"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + __avrword i; + + for (i = 0; i < arglen; i++) /* push function args onto stack */ + argframe[i] = l->args[i]; + + /* call function */ + if (l->rtype == __AVfloat) { + *(float*)l->raddr = (*(float(*)())l->func)(); + } else + if (l->rtype == __AVdouble) { + *(double*)l->raddr = (*(double(*)())l->func)(); + } else { + i = (*l->func)(); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, i); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, i); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, i); + } else + if (l->rtype == __AVshort) { + RETURN(short, i); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, i); + } else + if (l->rtype == __AVint) { + RETURN(int, i); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, i); + } else + if (l->rtype == __AVlong) { + RETURN(long, i); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, i); + } else + if (l->rtype == __AVlonglong || l->rtype == __AVulonglong) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = iret2; + } else + /* see above + if (l->rtype == __AVfloat) { + } else + if (l->rtype == __AVdouble) { + } else + */ + if (l->rtype == __AVvoidp) { + RETURN(void*, i); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + if (l->rsize == sizeof(char)) { + RETURN(char, i); + } else + if (l->rsize == sizeof(short)) { + RETURN(short, i); + } else + if (l->rsize == sizeof(int)) { + RETURN(int, i); + } else + if (l->rsize == 2*sizeof(__avrword)) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = iret2; + } + } + } + } + return 0; +} diff --git a/avcall/avcall-ia64-linux.s b/avcall/avcall-ia64-linux.s new file mode 100644 index 0000000..69cd59f --- /dev/null +++ b/avcall/avcall-ia64-linux.s @@ -0,0 +1,1169 @@ + .file "avcall-ia64.c" + .pred.safe_across_calls p1-p5,p16-p63 + .text + .align 16 + .global avcall_call# + .proc avcall_call# +avcall_call: + .prologue 14, 34 + .mmi + .save ar.pfs, r35 + alloc r35 = ar.pfs, 1, 6, 8, 0 + adds r14 = 40, r32 + adds r20 = 48, r32 + .mmi + adds r16 = 64, r32 + adds r21 = 72, r32 + adds r19 = -2032, r12 + ;; + .mmb + ld8 r15 = [r14] + ld8 r17 = [r20] + nop 0 + .mii + .vframe r36 + mov r36 = r12 + .save ar.lc, r38 + mov r38 = ar.lc + mov r37 = r1 + ;; + .mmi + sub r15 = r15, r17 + ld8 r14 = [r16] + .save rp, r34 + mov r34 = b0 + .body + .mmi + nop 0 + ;; + nop 0 + shr.u r15 = r15, 3 + .mmi + sub r14 = r14, r21 + ;; + nop 0 + shr.u r18 = r14, 3 + .mmb + nop 0 + cmp4.ge p6, p7 = 8, r15 + (p6) br.cond.dptk .L2 + .mii + sub r14 = 8, r15 + addl r16 = 8, r0 + ;; + andcm r14 = -1, r14 + ;; + .mii + nop 0 + addp4 r14 = r14, r0 + ;; + mov ar.lc = r14 +.L4: + .mii + nop 0 + sxt4 r14 = r16 + adds r16 = 1, r16 + ;; + .mmi + shladd r14 = r14, 3, r0 + ;; + add r15 = r17, r14 + add r14 = r19, r14 + ;; + .mmb + adds r14 = -64, r14 + ld8 r15 = [r15] + nop 0 + ;; + .mfb + st8 [r14] = r15 + nop 0 + br.cloop.sptk.few .L4 +.L2: + .mmi + adds r33 = 24, r32 + ;; + ld4 r15 = [r33] + nop 0 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 16, r15 + ;; + (p7) adds r14 = 16, r32 + ;; + .mfi + (p7) ld8 r8 = [r14] + nop 0 + cmp4.ge p6, p7 = 0, r18 + .mfb + adds r14 = 80, r32 + nop 0 + (p6) br.cond.dpnt .L7 + ;; + .mmb + nop 0 + cmp4.ge p6, p7 = 1, r18 + nop 0 + .mfb + ldfd f8 = [r21] + nop 0 + (p6) br.cond.dpnt .L7 + ;; + .mmb + nop 0 + cmp4.ge p6, p7 = 2, r18 + nop 0 + .mfb + ldfd f9 = [r14] + nop 0 + (p7) br.cond.dptk .L68 + ;; +.L7: + .mib + nop 0 + cmp4.ne p6, p7 = 13, r15 + (p7) br.cond.dpnt .L69 + ;; +.L16: + .mib + cmp4.ne p6, p7 = 14, r15 + adds r15 = 8, r32 + (p7) br.cond.dpnt .L70 + .mmb + nop 0 + ld8 r14 = [r20] + nop 0 + ;; + .mmi + ld8 r15 = [r15] + adds r16 = 8, r14 + adds r17 = 16, r14 + .mmi + adds r18 = 24, r14 + adds r19 = 32, r14 + adds r20 = 40, r14 + .mmi + nop 0 + adds r21 = 48, r14 + adds r22 = 56, r14 + .mmi + ld8 r39 = [r14] + ;; + ld8 r14 = [r15], 8 + nop 0 + .mii + ld8 r40 = [r16] + nop 0 + ;; + mov b6 = r14 + .mmb + ld8 r1 = [r15] + ld8 r41 = [r17] + nop 0 + .mmb + ld8 r42 = [r18] + ld8 r43 = [r19] + nop 0 + .mmb + ld8 r44 = [r20] + ld8 r45 = [r21] + nop 0 + .mbb + ld8 r46 = [r22] + nop 0 + br.call.sptk.many b0 = b6 + ;; + .mmi + mov r1 = r37 + ld4 r14 = [r33] + mov r28 = r8 + ;; + .mfb + cmp4.eq p6, p7 = 1, r14 + nop 0 + (p6) br.cond.dpnt .L18 + ;; + .mfb + cmp4.ne p6, p7 = 2, r14 + nop 0 + (p7) br.cond.dpnt .L62 + ;; + .mfb + cmp4.ne p6, p7 = 3, r14 + nop 0 + (p7) br.cond.dpnt .L62 + ;; + .mfb + cmp4.ne p6, p7 = 4, r14 + nop 0 + (p7) br.cond.dpnt .L62 + ;; + .mfb + cmp4.ne p6, p7 = 5, r14 + nop 0 + (p7) br.cond.dpnt .L63 + ;; + .mfb + cmp4.ne p6, p7 = 6, r14 + nop 0 + (p7) br.cond.dpnt .L63 + ;; + .mfb + cmp4.ne p6, p7 = 7, r14 + nop 0 + (p7) br.cond.dpnt .L64 + ;; + .mfb + cmp4.ne p6, p7 = 8, r14 + nop 0 + (p7) br.cond.dpnt .L64 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 9, r14 + ;; + nop 0 + .mfb + cmp4.ne.and.orcm p6, p7 = 11, r14 + nop 0 + (p7) br.cond.dptk .L66 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 10, r14 + ;; + nop 0 + .mfb + cmp4.ne.and.orcm p6, p7 = 12, r14 + nop 0 + (p7) br.cond.dptk .L66 + ;; + .mfb + cmp4.ne p6, p7 = 15, r14 + nop 0 + (p7) br.cond.dpnt .L66 + ;; + .mib + nop 0 + cmp4.ne p6, p7 = 16, r14 + (p6) br.cond.dptk .L18 + .mmi + ld4 r14 = [r32] + ;; + nop 0 + tbit.z p6, p7 = r14, 9 + .mfb + adds r14 = 32, r32 + nop 0 + (p6) br.cond.dpnt .L18 + ;; + .mmi + ld8 r19 = [r14] + ;; + adds r14 = -1, r19 + nop 0 + ;; + .mib + cmp.ltu p6, p7 = 31, r14 + adds r14 = 16, r32 + (p6) br.cond.dpnt .L18 + ;; + .mii + ld8 r14 = [r14] + cmp.ltu p6, p7 = 8, r19 + ;; + and r17 = 7, r14 + .mii + nop 0 + and r27 = -8, r14 + ;; + nop 0 + .mfb + add r23 = r19, r17 + nop 0 + (p6) br.cond.dptk .L45 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 8, r23 + (p6) br.cond.dptk .L47 + .mmi + shladd r15 = r23, 3, r0 + addl r14 = 2, r0 + shladd r18 = r17, 3, r0 + .mmi + ld8 r17 = [r27] + ;; + adds r15 = -1, r15 + nop 0 + ;; + .mii + nop 0 + sxt4 r15 = r15 + ;; + shl r14 = r14, r15 + .mii + addl r15 = 1, r0 + shl r16 = r8, r18 + ;; + shl r15 = r15, r18 + .mii + nop 0 + xor r16 = r16, r17 + ;; + sub r14 = r14, r15 + ;; + .mmi + and r14 = r16, r14 + ;; + xor r17 = r14, r17 + nop 0 + ;; + .mfb + st8 [r27] = r17 + nop 0 + nop 0 +.L18: + .mfi + mov r8 = r0 + nop 0 + mov b0 = r34 + .mmi + nop 0 + .label_state 1 + .restore sp + mov r12 = r36 + mov ar.pfs = r35 + .mib + nop 0 + mov ar.lc = r38 + br.ret.sptk.many b0 +.L68: + .body + .copy_state 1 + .mfi + adds r14 = 88, r32 + nop 0 + cmp4.ge p6, p7 = 3, r18 + ;; + .mfb + ldfd f10 = [r14] + nop 0 + (p6) br.cond.dptk .L7 + .mfi + adds r14 = 96, r32 + nop 0 + cmp4.ge p6, p7 = 4, r18 + ;; + .mfb + ldfd f11 = [r14] + nop 0 + (p6) br.cond.dptk .L7 + .mfi + adds r14 = 104, r32 + nop 0 + cmp4.ge p6, p7 = 5, r18 + ;; + .mfb + ldfd f12 = [r14] + nop 0 + (p6) br.cond.dptk .L7 + .mfi + adds r14 = 112, r32 + nop 0 + cmp4.ge p6, p7 = 6, r18 + ;; + .mfb + ldfd f13 = [r14] + nop 0 + (p6) br.cond.dptk .L7 + .mii + adds r14 = 120, r32 + cmp4.ge p6, p7 = 7, r18 + ;; + nop 0 + .mii + ldfd f14 = [r14] + (p7) adds r14 = 128, r32 + ;; + nop 0 + .mmb + (p7) ldfd f15 = [r14] + cmp4.ne p6, p7 = 13, r15 + (p6) br.cond.dptk .L16 +.L69: + .mmb + adds r16 = 8, r32 + adds r15 = 16, r32 + nop 0 + .mfi + ld8 r14 = [r20] + nop 0 + mov ar.lc = r38 + ;; + .mmi + ld8 r33 = [r15] + ld8 r15 = [r16] + adds r17 = 8, r14 + .mmi + adds r18 = 16, r14 + adds r19 = 24, r14 + adds r20 = 32, r14 + .mmi + adds r21 = 40, r14 + adds r22 = 48, r14 + adds r23 = 56, r14 + .mii + ld8 r39 = [r14] + nop 0 + ;; + nop 0 + .mmb + ld8 r14 = [r15], 8 + ld8 r40 = [r17] + nop 0 + ;; + .mmi + ld8 r1 = [r15] + ld8 r41 = [r18] + mov b6 = r14 + .mmb + ld8 r42 = [r19] + ld8 r43 = [r20] + nop 0 + .mmb + ld8 r44 = [r21] + ld8 r45 = [r22] + nop 0 + .mbb + ld8 r46 = [r23] + nop 0 + br.call.sptk.many b0 = b6 + ;; + .mmb + .label_state 2 + .restore sp + mov r12 = r36 + mov r8 = r0 + nop 0 + .mmi + mov r1 = r37 + stfs [r33] = f8 + mov b0 = r34 + .mib + nop 0 + mov ar.pfs = r35 + br.ret.sptk.many b0 + ;; +.L62: + .body + .copy_state 2 + .mmi + adds r14 = 16, r32 + mov r8 = r0 + mov b0 = r34 + .mmi + .label_state 3 + .restore sp + mov r12 = r36 + ;; + ld8 r14 = [r14] + mov ar.pfs = r35 + .mii + nop 0 + mov ar.lc = r38 + ;; + nop 0 + .mfb + st1 [r14] = r28 + nop 0 + br.ret.sptk.many b0 +.L70: + .body + .copy_state 3 + .mmb + adds r16 = 8, r32 + adds r15 = 16, r32 + nop 0 + .mfi + ld8 r14 = [r20] + nop 0 + mov ar.lc = r38 + ;; + .mmi + ld8 r33 = [r15] + ld8 r15 = [r16] + adds r17 = 8, r14 + .mmi + adds r18 = 16, r14 + adds r19 = 24, r14 + adds r20 = 32, r14 + .mmi + adds r21 = 40, r14 + adds r22 = 48, r14 + adds r23 = 56, r14 + .mii + ld8 r39 = [r14] + nop 0 + ;; + nop 0 + .mmb + ld8 r14 = [r15], 8 + ld8 r40 = [r17] + nop 0 + ;; + .mmi + ld8 r1 = [r15] + ld8 r41 = [r18] + mov b6 = r14 + .mmb + ld8 r42 = [r19] + ld8 r43 = [r20] + nop 0 + .mmb + ld8 r44 = [r21] + ld8 r45 = [r22] + nop 0 + .mbb + ld8 r46 = [r23] + nop 0 + br.call.sptk.many b0 = b6 + ;; + .mmb + .label_state 4 + .restore sp + mov r12 = r36 + mov r8 = r0 + nop 0 + .mmi + mov r1 = r37 + stfd [r33] = f8 + mov b0 = r34 + .mib + nop 0 + mov ar.pfs = r35 + br.ret.sptk.many b0 + ;; +.L63: + .body + .copy_state 4 + .mmi + adds r14 = 16, r32 + mov r8 = r0 + mov b0 = r34 + .mmi + .label_state 5 + .restore sp + mov r12 = r36 + ;; + ld8 r14 = [r14] + mov ar.pfs = r35 + .mii + nop 0 + mov ar.lc = r38 + ;; + nop 0 + .mfb + st2 [r14] = r28 + nop 0 + br.ret.sptk.many b0 +.L64: + .body + .copy_state 5 + .mmi + adds r14 = 16, r32 + mov r8 = r0 + mov b0 = r34 + .mmi + .label_state 6 + .restore sp + mov r12 = r36 + ;; + ld8 r14 = [r14] + mov ar.pfs = r35 + .mii + nop 0 + mov ar.lc = r38 + ;; + nop 0 + .mfb + st4 [r14] = r28 + nop 0 + br.ret.sptk.many b0 +.L66: + .body + .copy_state 6 + .mmi + adds r14 = 16, r32 + mov r8 = r0 + mov b0 = r34 + .mmi + .label_state 7 + .restore sp + mov r12 = r36 + ;; + ld8 r14 = [r14] + mov ar.pfs = r35 + .mii + nop 0 + mov ar.lc = r38 + ;; + nop 0 + .mfb + st8 [r14] = r28 + nop 0 + br.ret.sptk.many b0 +.L45: + .body + .copy_state 7 + .mib + nop 0 + cmp.ltu p6, p7 = 16, r19 + (p6) br.cond.dptk .L49 + ;; + .mfi + shladd r20 = r17, 3, r0 + nop 0 + addl r14 = -1, r0 + .mii + ld8 r16 = [r27] + cmp.ltu p6, p7 = 16, r23 + ;; + nop 0 + .mii + mov r19 = r20 + shl r15 = r8, r20 + shl r14 = r14, r20 + ;; + .mmi + xor r15 = r15, r16 + ;; + and r14 = r15, r14 + nop 0 + ;; + .mii + nop 0 + xor r16 = r14, r16 + ;; + nop 0 + .mfb + st8 [r27] = r16 + nop 0 + (p6) br.cond.dptk .L51 + .mmi + shladd r17 = r17, 2, r0 + shladd r16 = r23, 3, r0 + addl r15 = 2, r0 + .mmi + adds r19 = 8, r27 + .label_state 8 + .restore sp + mov r12 = r36 + shl r20 = r9, r20 + ;; + .mmb + sub r17 = 32, r17 + adds r16 = -65, r16 + nop 0 + .mii + ld8 r18 = [r19] + mov b0 = r34 + mov ar.pfs = r35 + ;; + .mii + nop 0 + sxt4 r16 = r16 + sxt4 r17 = r17 + .mib + nop 0 + mov ar.lc = r38 + nop 0 + ;; + .mii + nop 0 + shr r14 = r8, r17 + shl r15 = r15, r16 + .mmi + mov r8 = r0 + ;; + nop 0 + shr r14 = r14, r17 + .mii + nop 0 + adds r15 = -1, r15 + ;; + or r14 = r20, r14 + ;; + .mii + nop 0 + xor r14 = r14, r18 + ;; + and r15 = r14, r15 + ;; + .mii + nop 0 + xor r18 = r15, r18 + ;; + nop 0 + .mfb + st8 [r19] = r18 + nop 0 + br.ret.sptk.many b0 +.L47: + .body + .copy_state 8 + .mmi + shladd r14 = r23, 3, r0 + addl r15 = 2, r0 + mov b0 = r34 + .mmi + shladd r18 = r17, 3, r0 + ld8 r19 = [r27] + .label_state 9 + .restore sp + mov r12 = r36 + ;; + .mmi + adds r14 = -65, r14 + sub r16 = 64, r18 + mov ar.pfs = r35 + .mii + nop 0 + mov ar.lc = r38 + ;; + sxt4 r14 = r14 + .mii + nop 0 + shl r17 = r8, r18 + ;; + shl r15 = r15, r14 + .mii + addl r14 = -1, r0 + sxt4 r16 = r16 + ;; + shr r16 = r8, r16 + .mii + mov r8 = r0 + xor r17 = r17, r19 + shl r14 = r14, r18 + .mii + nop 0 + adds r15 = -1, r15 + ;; + and r14 = r17, r14 + ;; + .mmi + xor r19 = r14, r19 + ;; + st8 [r27] = r19, 8 + nop 0 + ;; + .mmi + ld8 r14 = [r27] + ;; + xor r16 = r16, r14 + nop 0 + ;; + .mmi + and r15 = r16, r15 + ;; + xor r14 = r15, r14 + nop 0 + ;; + .mfb + st8 [r27] = r14 + nop 0 + br.ret.sptk.many b0 +.L49: + .body + .copy_state 9 + .mib + nop 0 + cmp.ltu p6, p7 = 24, r19 + (p6) br.cond.dptk .L53 + ;; + .mfi + shladd r19 = r17, 3, r0 + nop 0 + addl r14 = -1, r0 + .mii + ld8 r16 = [r27] + cmp.ltu p6, p7 = 24, r23 + ;; + nop 0 + .mii + mov r29 = r19 + shl r15 = r8, r19 + shl r14 = r14, r19 + ;; + .mmi + xor r15 = r15, r16 + ;; + and r14 = r15, r14 + nop 0 + ;; + .mii + nop 0 + xor r16 = r14, r16 + ;; + nop 0 + .mfb + st8 [r27] = r16 + nop 0 + (p6) br.cond.dptk .L55 + .mmi + shladd r14 = r17, 2, r0 + shladd r18 = r23, 3, r0 + addl r16 = 2, r0 + .mmi + adds r22 = 16, r27 + adds r20 = 8, r27 + shl r21 = r10, r29 + ;; + .mmi + sub r14 = 32, r14 + adds r18 = -65, r18 + mov b0 = r34 + .mii + .label_state 10 + .restore sp + mov r12 = r36 + shl r19 = r9, r29 + mov ar.pfs = r35 + ;; + .mii + nop 0 + sxt4 r18 = r18 + sxt4 r14 = r14 + .mib + nop 0 + mov ar.lc = r38 + nop 0 + ;; + .mii + nop 0 + shr r15 = r9, r14 + shr r17 = r8, r14 + .mii + mov r8 = r0 + nop 0 + shl r16 = r16, r18 + ;; + .mii + nop 0 + shr r15 = r15, r14 + shr r17 = r17, r14 + .mii + ld8 r14 = [r22] + nop 0 + adds r16 = -1, r16 + ;; + .mii + or r15 = r21, r15 + or r17 = r19, r17 + ;; + xor r15 = r15, r14 + .mmi + st8 [r20] = r17 + ;; + and r16 = r15, r16 + nop 0 + ;; + .mii + nop 0 + xor r14 = r16, r14 + ;; + nop 0 + .mfb + st8 [r22] = r14 + nop 0 + br.ret.sptk.many b0 +.L51: + .body + .copy_state 10 + .mmi + shladd r15 = r23, 3, r0 + addl r14 = 2, r0 + sub r17 = 64, r20 + .mmi + adds r21 = 16, r27 + adds r20 = 8, r27 + shl r19 = r9, r19 + ;; + .mii + adds r15 = -129, r15 + mov b0 = r34 + sxt4 r17 = r17 + .mmi + .label_state 11 + .restore sp + mov r12 = r36 + nop 0 + mov ar.pfs = r35 + ;; + .mii + nop 0 + shr r18 = r9, r17 + sxt4 r15 = r15 + ;; + .mii + nop 0 + shl r14 = r14, r15 + shr r16 = r8, r17 + .mmi + ld8 r15 = [r21] + mov r8 = r0 + mov ar.lc = r38 + ;; + .mii + xor r18 = r18, r15 + adds r14 = -1, r14 + or r16 = r19, r16 + ;; + .mmb + and r14 = r18, r14 + st8 [r20] = r16 + nop 0 + ;; + .mii + nop 0 + xor r15 = r14, r15 + ;; + nop 0 + .mfb + st8 [r21] = r15 + nop 0 + br.ret.sptk.many b0 +.L55: + .body + .copy_state 11 + .mmi + shladd r14 = r23, 3, r0 + addl r15 = 2, r0 + sub r16 = 64, r19 + .mmi + adds r24 = 24, r27 + adds r22 = 8, r27 + shl r21 = r10, r29 + ;; + .mii + adds r14 = -129, r14 + sxt4 r16 = r16 + shl r20 = r9, r29 + .mmi + adds r23 = 16, r27 + .label_state 12 + .restore sp + mov r12 = r36 + mov b0 = r34 + ;; + .mii + nop 0 + shr r18 = r10, r16 + sxt4 r14 = r14 + ;; + .mii + nop 0 + shl r15 = r15, r14 + shr r19 = r8, r16 + .mmi + ld8 r14 = [r24] + mov r8 = r0 + mov ar.pfs = r35 + .mib + nop 0 + shr r17 = r9, r16 + nop 0 + ;; + .mii + xor r18 = r18, r14 + mov ar.lc = r38 + adds r15 = -1, r15 + .mmi + or r19 = r20, r19 + ;; + and r15 = r18, r15 + or r17 = r21, r17 + .mii + st8 [r22] = r19 + nop 0 + ;; + xor r14 = r15, r14 + .mmb + nop 0 + st8 [r23] = r17 + nop 0 + ;; + .mfb + st8 [r24] = r14 + nop 0 + br.ret.sptk.many b0 +.L53: + .body + .copy_state 12 + .mfi + shladd r18 = r17, 3, r0 + nop 0 + addl r14 = -1, r0 + .mii + ld8 r16 = [r27] + cmp.ltu p6, p7 = 32, r23 + ;; + nop 0 + .mii + mov r29 = r18 + shl r15 = r8, r18 + shl r14 = r14, r18 + ;; + .mmi + xor r15 = r15, r16 + ;; + and r14 = r15, r14 + nop 0 + ;; + .mii + nop 0 + xor r16 = r14, r16 + ;; + nop 0 + .mfb + st8 [r27] = r16 + nop 0 + (p6) br.cond.dptk .L57 + .mmi + shladd r14 = r17, 2, r0 + addl r15 = 2, r0 + shl r20 = r10, r18 + .mmi + shladd r18 = r23, 3, r0 + adds r23 = 24, r27 + shl r19 = r9, r29 + ;; + .mmi + sub r14 = 32, r14 + adds r18 = -65, r18 + mov b0 = r34 + .mmi + adds r21 = 8, r27 + adds r22 = 16, r27 + .label_state 13 + .restore sp + mov r12 = r36 + .mii + nop 0 + mov ar.pfs = r35 + ;; + sxt4 r18 = r18 + .mii + nop 0 + sxt4 r14 = r14 + mov ar.lc = r38 + ;; + .mii + nop 0 + shr r16 = r8, r14 + shr r17 = r9, r14 + .mii + mov r8 = r0 + nop 0 + shl r15 = r15, r18 + ;; + .mii + nop 0 + shr r16 = r16, r14 + shr r17 = r17, r14 + .mii + ld8 r14 = [r23] + adds r15 = -1, r15 + ;; + or r16 = r19, r16 + .mmi + or r17 = r20, r17 + ;; + st8 [r21] = r16 + xor r16 = r14, r16 + .mmi + st8 [r22] = r17 + ;; + and r15 = r16, r15 + nop 0 + ;; + .mii + nop 0 + xor r14 = r15, r14 + ;; + nop 0 + .mfb + st8 [r23] = r14 + nop 0 + br.ret.sptk.many b0 +.L57: + .body + .copy_state 13 + .mmi + shladd r16 = r23, 3, r0 + addl r15 = 2, r0 + sub r14 = 64, r18 + .mmi + adds r24 = 8, r27 + adds r25 = 16, r27 + adds r26 = 24, r27 + ;; + .mmi + nop 0 + adds r16 = -129, r16 + sxt4 r14 = r14 + .mmi + adds r27 = 32, r27 + .restore sp + mov r12 = r36 + shl r23 = r11, r29 + ;; + .mii + nop 0 + sxt4 r16 = r16 + shr r22 = r11, r14 + ;; + .mii + nop 0 + shl r15 = r15, r16 + shr r17 = r8, r14 + .mii + mov r8 = r0 + shr r18 = r9, r14 + shr r19 = r10, r14 + .mii + ld8 r14 = [r27] + shl r20 = r9, r29 + shl r21 = r10, r29 + ;; + .mmi + xor r22 = r22, r14 + adds r15 = -1, r15 + mov b0 = r34 + ;; + .mmi + and r15 = r22, r15 + or r19 = r23, r19 + mov ar.pfs = r35 + .mmi + or r17 = r20, r17 + or r18 = r21, r18 + mov ar.lc = r38 + ;; + .mmb + xor r14 = r15, r14 + st8 [r24] = r17 + nop 0 + .mmb + st8 [r25] = r18 + st8 [r26] = r19 + nop 0 + ;; + .mfb + st8 [r27] = r14 + nop 0 + br.ret.sptk.many b0 + .endp avcall_call# + .ident "GCC: (GNU) 4.0.1" diff --git a/avcall/avcall-ia64-macro.S b/avcall/avcall-ia64-macro.S new file mode 100644 index 0000000..fb9a8a5 --- /dev/null +++ b/avcall/avcall-ia64-macro.S @@ -0,0 +1,1172 @@ + .file "avcall-ia64.c" + .pred.safe_across_calls p1-p5,p16-p63 + .text + .align 16 + .global avcall_call# + .proc avcall_call# +avcall_call: + .prologue 14, 34 + .mmi + .save ar.pfs, r35 + alloc r35 = ar.pfs, 1, 6, 8, 0 + adds r14 = 40, r32 + adds r20 = 48, r32 + .mmi + adds r16 = 64, r32 + adds r21 = 72, r32 + adds r19 = -2032, r12 + ;; + .mmb + ld8 r15 = [r14] + ld8 r17 = [r20] + nop 0 + .mii + .vframe r36 + mov r36 = r12 + .save ar.lc, r38 + mov r38 = ar.lc + mov r37 = r1 + ;; + .mmi + sub r15 = r15, r17 + ld8 r14 = [r16] + .save rp, r34 + mov r34 = b0 + .body + .mmi + nop 0 + ;; + nop 0 + shr.u r15 = r15, 3 + .mmi + sub r14 = r14, r21 + ;; + nop 0 + shr.u r18 = r14, 3 + .mmb + nop 0 + cmp4.ge p6, p7 = 8, r15 + (p6) br.cond.dptk .L2 + .mii + sub r14 = 8, r15 + addl r16 = 8, r0 + ;; + andcm r14 = -1, r14 + ;; + .mii + nop 0 + addp4 r14 = r14, r0 + ;; + mov ar.lc = r14 +.L4: + .mii + nop 0 + sxt4 r14 = r16 + adds r16 = 1, r16 + ;; + .mmi + shladd r14 = r14, 3, r0 + ;; + add r15 = r17, r14 + add r14 = r19, r14 + ;; + .mmb + adds r14 = -64, r14 + ld8 r15 = [r15] + nop 0 + ;; + .mfb + st8 [r14] = r15 + nop 0 + br.cloop.sptk.few .L4 +.L2: + .mmi + adds r33 = 24, r32 + ;; + ld4 r15 = [r33] + nop 0 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 16, r15 + ;; + (p7) adds r14 = 16, r32 + ;; + .mfi + (p7) ld8 r8 = [r14] + nop 0 + cmp4.ge p6, p7 = 0, r18 + .mfb + adds r14 = 80, r32 + nop 0 + (p6) br.cond.dpnt .L7 + ;; + .mmb + nop 0 + cmp4.ge p6, p7 = 1, r18 + nop 0 + .mfb + ldfd f8 = [r21] + nop 0 + (p6) br.cond.dpnt .L7 + ;; + .mmb + nop 0 + cmp4.ge p6, p7 = 2, r18 + nop 0 + .mfb + ldfd f9 = [r14] + nop 0 + (p7) br.cond.dptk .L68 + ;; +.L7: + .mib + nop 0 + cmp4.ne p6, p7 = 13, r15 + (p7) br.cond.dpnt .L69 + ;; +.L16: + .mib + cmp4.ne p6, p7 = 14, r15 + adds r15 = 8, r32 + (p7) br.cond.dpnt .L70 + .mmb + nop 0 + ld8 r14 = [r20] + nop 0 + ;; + .mmi + ld8 r15 = [r15] + adds r16 = 8, r14 + adds r17 = 16, r14 + .mmi + adds r18 = 24, r14 + adds r19 = 32, r14 + adds r20 = 40, r14 + .mmi + nop 0 + adds r21 = 48, r14 + adds r22 = 56, r14 + .mmi + ld8 r39 = [r14] + ;; + ld8 r14 = [r15], 8 + nop 0 + .mii + ld8 r40 = [r16] + nop 0 + ;; + mov b6 = r14 + .mmb + ld8 r1 = [r15] + ld8 r41 = [r17] + nop 0 + .mmb + ld8 r42 = [r18] + ld8 r43 = [r19] + nop 0 + .mmb + ld8 r44 = [r20] + ld8 r45 = [r21] + nop 0 + .mbb + ld8 r46 = [r22] + nop 0 + br.call.sptk.many b0 = b6 + ;; + .mmi + mov r1 = r37 + ld4 r14 = [r33] + mov r28 = r8 + ;; + .mfb + cmp4.eq p6, p7 = 1, r14 + nop 0 + (p6) br.cond.dpnt .L18 + ;; + .mfb + cmp4.ne p6, p7 = 2, r14 + nop 0 + (p7) br.cond.dpnt .L62 + ;; + .mfb + cmp4.ne p6, p7 = 3, r14 + nop 0 + (p7) br.cond.dpnt .L62 + ;; + .mfb + cmp4.ne p6, p7 = 4, r14 + nop 0 + (p7) br.cond.dpnt .L62 + ;; + .mfb + cmp4.ne p6, p7 = 5, r14 + nop 0 + (p7) br.cond.dpnt .L63 + ;; + .mfb + cmp4.ne p6, p7 = 6, r14 + nop 0 + (p7) br.cond.dpnt .L63 + ;; + .mfb + cmp4.ne p6, p7 = 7, r14 + nop 0 + (p7) br.cond.dpnt .L64 + ;; + .mfb + cmp4.ne p6, p7 = 8, r14 + nop 0 + (p7) br.cond.dpnt .L64 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 9, r14 + ;; + nop 0 + .mfb + cmp4.ne.and.orcm p6, p7 = 11, r14 + nop 0 + (p7) br.cond.dptk .L66 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 10, r14 + ;; + nop 0 + .mfb + cmp4.ne.and.orcm p6, p7 = 12, r14 + nop 0 + (p7) br.cond.dptk .L66 + ;; + .mfb + cmp4.ne p6, p7 = 15, r14 + nop 0 + (p7) br.cond.dpnt .L66 + ;; + .mib + nop 0 + cmp4.ne p6, p7 = 16, r14 + (p6) br.cond.dptk .L18 + .mmi + ld4 r14 = [r32] + ;; + nop 0 + tbit.z p6, p7 = r14, 9 + .mfb + adds r14 = 32, r32 + nop 0 + (p6) br.cond.dpnt .L18 + ;; + .mmi + ld8 r19 = [r14] + ;; + adds r14 = -1, r19 + nop 0 + ;; + .mib + cmp.ltu p6, p7 = 31, r14 + adds r14 = 16, r32 + (p6) br.cond.dpnt .L18 + ;; + .mii + ld8 r14 = [r14] + cmp.ltu p6, p7 = 8, r19 + ;; + and r17 = 7, r14 + .mii + nop 0 + and r27 = -8, r14 + ;; + nop 0 + .mfb + add r23 = r19, r17 + nop 0 + (p6) br.cond.dptk .L45 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 8, r23 + (p6) br.cond.dptk .L47 + .mmi + shladd r15 = r23, 3, r0 + addl r14 = 2, r0 + shladd r18 = r17, 3, r0 + .mmi + ld8 r17 = [r27] + ;; + adds r15 = -1, r15 + nop 0 + ;; + .mii + nop 0 + sxt4 r15 = r15 + ;; + shl r14 = r14, r15 + .mii + addl r15 = 1, r0 + shl r16 = r8, r18 + ;; + shl r15 = r15, r18 + .mii + nop 0 + xor r16 = r16, r17 + ;; + sub r14 = r14, r15 + ;; + .mmi + and r14 = r16, r14 + ;; + xor r17 = r14, r17 + nop 0 + ;; + .mfb + st8 [r27] = r17 + nop 0 + nop 0 +.L18: + .mfi + mov r8 = r0 + nop 0 + mov b0 = r34 + .mmi + nop 0 + .label_state 1 + .restore sp + mov r12 = r36 + mov ar.pfs = r35 + .mib + nop 0 + mov ar.lc = r38 + br.ret.sptk.many b0 +.L68: + .body + .copy_state 1 + .mfi + adds r14 = 88, r32 + nop 0 + cmp4.ge p6, p7 = 3, r18 + ;; + .mfb + ldfd f10 = [r14] + nop 0 + (p6) br.cond.dptk .L7 + .mfi + adds r14 = 96, r32 + nop 0 + cmp4.ge p6, p7 = 4, r18 + ;; + .mfb + ldfd f11 = [r14] + nop 0 + (p6) br.cond.dptk .L7 + .mfi + adds r14 = 104, r32 + nop 0 + cmp4.ge p6, p7 = 5, r18 + ;; + .mfb + ldfd f12 = [r14] + nop 0 + (p6) br.cond.dptk .L7 + .mfi + adds r14 = 112, r32 + nop 0 + cmp4.ge p6, p7 = 6, r18 + ;; + .mfb + ldfd f13 = [r14] + nop 0 + (p6) br.cond.dptk .L7 + .mii + adds r14 = 120, r32 + cmp4.ge p6, p7 = 7, r18 + ;; + nop 0 + .mii + ldfd f14 = [r14] + (p7) adds r14 = 128, r32 + ;; + nop 0 + .mmb + (p7) ldfd f15 = [r14] + cmp4.ne p6, p7 = 13, r15 + (p6) br.cond.dptk .L16 +.L69: + .mmb + adds r16 = 8, r32 + adds r15 = 16, r32 + nop 0 + .mfi + ld8 r14 = [r20] + nop 0 + mov ar.lc = r38 + ;; + .mmi + ld8 r33 = [r15] + ld8 r15 = [r16] + adds r17 = 8, r14 + .mmi + adds r18 = 16, r14 + adds r19 = 24, r14 + adds r20 = 32, r14 + .mmi + adds r21 = 40, r14 + adds r22 = 48, r14 + adds r23 = 56, r14 + .mii + ld8 r39 = [r14] + nop 0 + ;; + nop 0 + .mmb + ld8 r14 = [r15], 8 + ld8 r40 = [r17] + nop 0 + ;; + .mmi + ld8 r1 = [r15] + ld8 r41 = [r18] + mov b6 = r14 + .mmb + ld8 r42 = [r19] + ld8 r43 = [r20] + nop 0 + .mmb + ld8 r44 = [r21] + ld8 r45 = [r22] + nop 0 + .mbb + ld8 r46 = [r23] + nop 0 + br.call.sptk.many b0 = b6 + ;; + .mmb + .label_state 2 + .restore sp + mov r12 = r36 + mov r8 = r0 + nop 0 + .mmi + mov r1 = r37 + stfs [r33] = f8 + mov b0 = r34 + .mib + nop 0 + mov ar.pfs = r35 + br.ret.sptk.many b0 + ;; +.L62: + .body + .copy_state 2 + .mmi + adds r14 = 16, r32 + mov r8 = r0 + mov b0 = r34 + .mmi + .label_state 3 + .restore sp + mov r12 = r36 + ;; + ld8 r14 = [r14] + mov ar.pfs = r35 + .mii + nop 0 + mov ar.lc = r38 + ;; + nop 0 + .mfb + st1 [r14] = r28 + nop 0 + br.ret.sptk.many b0 +.L70: + .body + .copy_state 3 + .mmb + adds r16 = 8, r32 + adds r15 = 16, r32 + nop 0 + .mfi + ld8 r14 = [r20] + nop 0 + mov ar.lc = r38 + ;; + .mmi + ld8 r33 = [r15] + ld8 r15 = [r16] + adds r17 = 8, r14 + .mmi + adds r18 = 16, r14 + adds r19 = 24, r14 + adds r20 = 32, r14 + .mmi + adds r21 = 40, r14 + adds r22 = 48, r14 + adds r23 = 56, r14 + .mii + ld8 r39 = [r14] + nop 0 + ;; + nop 0 + .mmb + ld8 r14 = [r15], 8 + ld8 r40 = [r17] + nop 0 + ;; + .mmi + ld8 r1 = [r15] + ld8 r41 = [r18] + mov b6 = r14 + .mmb + ld8 r42 = [r19] + ld8 r43 = [r20] + nop 0 + .mmb + ld8 r44 = [r21] + ld8 r45 = [r22] + nop 0 + .mbb + ld8 r46 = [r23] + nop 0 + br.call.sptk.many b0 = b6 + ;; + .mmb + .label_state 4 + .restore sp + mov r12 = r36 + mov r8 = r0 + nop 0 + .mmi + mov r1 = r37 + stfd [r33] = f8 + mov b0 = r34 + .mib + nop 0 + mov ar.pfs = r35 + br.ret.sptk.many b0 + ;; +.L63: + .body + .copy_state 4 + .mmi + adds r14 = 16, r32 + mov r8 = r0 + mov b0 = r34 + .mmi + .label_state 5 + .restore sp + mov r12 = r36 + ;; + ld8 r14 = [r14] + mov ar.pfs = r35 + .mii + nop 0 + mov ar.lc = r38 + ;; + nop 0 + .mfb + st2 [r14] = r28 + nop 0 + br.ret.sptk.many b0 +.L64: + .body + .copy_state 5 + .mmi + adds r14 = 16, r32 + mov r8 = r0 + mov b0 = r34 + .mmi + .label_state 6 + .restore sp + mov r12 = r36 + ;; + ld8 r14 = [r14] + mov ar.pfs = r35 + .mii + nop 0 + mov ar.lc = r38 + ;; + nop 0 + .mfb + st4 [r14] = r28 + nop 0 + br.ret.sptk.many b0 +.L66: + .body + .copy_state 6 + .mmi + adds r14 = 16, r32 + mov r8 = r0 + mov b0 = r34 + .mmi + .label_state 7 + .restore sp + mov r12 = r36 + ;; + ld8 r14 = [r14] + mov ar.pfs = r35 + .mii + nop 0 + mov ar.lc = r38 + ;; + nop 0 + .mfb + st8 [r14] = r28 + nop 0 + br.ret.sptk.many b0 +.L45: + .body + .copy_state 7 + .mib + nop 0 + cmp.ltu p6, p7 = 16, r19 + (p6) br.cond.dptk .L49 + ;; + .mfi + shladd r20 = r17, 3, r0 + nop 0 + addl r14 = -1, r0 + .mii + ld8 r16 = [r27] + cmp.ltu p6, p7 = 16, r23 + ;; + nop 0 + .mii + mov r19 = r20 + shl r15 = r8, r20 + shl r14 = r14, r20 + ;; + .mmi + xor r15 = r15, r16 + ;; + and r14 = r15, r14 + nop 0 + ;; + .mii + nop 0 + xor r16 = r14, r16 + ;; + nop 0 + .mfb + st8 [r27] = r16 + nop 0 + (p6) br.cond.dptk .L51 + .mmi + shladd r17 = r17, 2, r0 + shladd r16 = r23, 3, r0 + addl r15 = 2, r0 + .mmi + adds r19 = 8, r27 + .label_state 8 + .restore sp + mov r12 = r36 + shl r20 = r9, r20 + ;; + .mmb + sub r17 = 32, r17 + adds r16 = -65, r16 + nop 0 + .mii + ld8 r18 = [r19] + mov b0 = r34 + mov ar.pfs = r35 + ;; + .mii + nop 0 + sxt4 r16 = r16 + sxt4 r17 = r17 + .mib + nop 0 + mov ar.lc = r38 + nop 0 + ;; + .mii + nop 0 + shr r14 = r8, r17 + shl r15 = r15, r16 + .mmi + mov r8 = r0 + ;; + nop 0 + shr r14 = r14, r17 + .mii + nop 0 + adds r15 = -1, r15 + ;; + or r14 = r20, r14 + ;; + .mii + nop 0 + xor r14 = r14, r18 + ;; + and r15 = r14, r15 + ;; + .mii + nop 0 + xor r18 = r15, r18 + ;; + nop 0 + .mfb + st8 [r19] = r18 + nop 0 + br.ret.sptk.many b0 +.L47: + .body + .copy_state 8 + .mmi + shladd r14 = r23, 3, r0 + addl r15 = 2, r0 + mov b0 = r34 + .mmi + shladd r18 = r17, 3, r0 + ld8 r19 = [r27] + .label_state 9 + .restore sp + mov r12 = r36 + ;; + .mmi + adds r14 = -65, r14 + sub r16 = 64, r18 + mov ar.pfs = r35 + .mii + nop 0 + mov ar.lc = r38 + ;; + sxt4 r14 = r14 + .mii + nop 0 + shl r17 = r8, r18 + ;; + shl r15 = r15, r14 + .mii + addl r14 = -1, r0 + sxt4 r16 = r16 + ;; + shr r16 = r8, r16 + .mii + mov r8 = r0 + xor r17 = r17, r19 + shl r14 = r14, r18 + .mii + nop 0 + adds r15 = -1, r15 + ;; + and r14 = r17, r14 + ;; + .mmi + xor r19 = r14, r19 + ;; + st8 [r27] = r19, 8 + nop 0 + ;; + .mmi + ld8 r14 = [r27] + ;; + xor r16 = r16, r14 + nop 0 + ;; + .mmi + and r15 = r16, r15 + ;; + xor r14 = r15, r14 + nop 0 + ;; + .mfb + st8 [r27] = r14 + nop 0 + br.ret.sptk.many b0 +.L49: + .body + .copy_state 9 + .mib + nop 0 + cmp.ltu p6, p7 = 24, r19 + (p6) br.cond.dptk .L53 + ;; + .mfi + shladd r19 = r17, 3, r0 + nop 0 + addl r14 = -1, r0 + .mii + ld8 r16 = [r27] + cmp.ltu p6, p7 = 24, r23 + ;; + nop 0 + .mii + mov r29 = r19 + shl r15 = r8, r19 + shl r14 = r14, r19 + ;; + .mmi + xor r15 = r15, r16 + ;; + and r14 = r15, r14 + nop 0 + ;; + .mii + nop 0 + xor r16 = r14, r16 + ;; + nop 0 + .mfb + st8 [r27] = r16 + nop 0 + (p6) br.cond.dptk .L55 + .mmi + shladd r14 = r17, 2, r0 + shladd r18 = r23, 3, r0 + addl r16 = 2, r0 + .mmi + adds r22 = 16, r27 + adds r20 = 8, r27 + shl r21 = r10, r29 + ;; + .mmi + sub r14 = 32, r14 + adds r18 = -65, r18 + mov b0 = r34 + .mii + .label_state 10 + .restore sp + mov r12 = r36 + shl r19 = r9, r29 + mov ar.pfs = r35 + ;; + .mii + nop 0 + sxt4 r18 = r18 + sxt4 r14 = r14 + .mib + nop 0 + mov ar.lc = r38 + nop 0 + ;; + .mii + nop 0 + shr r15 = r9, r14 + shr r17 = r8, r14 + .mii + mov r8 = r0 + nop 0 + shl r16 = r16, r18 + ;; + .mii + nop 0 + shr r15 = r15, r14 + shr r17 = r17, r14 + .mii + ld8 r14 = [r22] + nop 0 + adds r16 = -1, r16 + ;; + .mii + or r15 = r21, r15 + or r17 = r19, r17 + ;; + xor r15 = r15, r14 + .mmi + st8 [r20] = r17 + ;; + and r16 = r15, r16 + nop 0 + ;; + .mii + nop 0 + xor r14 = r16, r14 + ;; + nop 0 + .mfb + st8 [r22] = r14 + nop 0 + br.ret.sptk.many b0 +.L51: + .body + .copy_state 10 + .mmi + shladd r15 = r23, 3, r0 + addl r14 = 2, r0 + sub r17 = 64, r20 + .mmi + adds r21 = 16, r27 + adds r20 = 8, r27 + shl r19 = r9, r19 + ;; + .mii + adds r15 = -129, r15 + mov b0 = r34 + sxt4 r17 = r17 + .mmi + .label_state 11 + .restore sp + mov r12 = r36 + nop 0 + mov ar.pfs = r35 + ;; + .mii + nop 0 + shr r18 = r9, r17 + sxt4 r15 = r15 + ;; + .mii + nop 0 + shl r14 = r14, r15 + shr r16 = r8, r17 + .mmi + ld8 r15 = [r21] + mov r8 = r0 + mov ar.lc = r38 + ;; + .mii + xor r18 = r18, r15 + adds r14 = -1, r14 + or r16 = r19, r16 + ;; + .mmb + and r14 = r18, r14 + st8 [r20] = r16 + nop 0 + ;; + .mii + nop 0 + xor r15 = r14, r15 + ;; + nop 0 + .mfb + st8 [r21] = r15 + nop 0 + br.ret.sptk.many b0 +.L55: + .body + .copy_state 11 + .mmi + shladd r14 = r23, 3, r0 + addl r15 = 2, r0 + sub r16 = 64, r19 + .mmi + adds r24 = 24, r27 + adds r22 = 8, r27 + shl r21 = r10, r29 + ;; + .mii + adds r14 = -129, r14 + sxt4 r16 = r16 + shl r20 = r9, r29 + .mmi + adds r23 = 16, r27 + .label_state 12 + .restore sp + mov r12 = r36 + mov b0 = r34 + ;; + .mii + nop 0 + shr r18 = r10, r16 + sxt4 r14 = r14 + ;; + .mii + nop 0 + shl r15 = r15, r14 + shr r19 = r8, r16 + .mmi + ld8 r14 = [r24] + mov r8 = r0 + mov ar.pfs = r35 + .mib + nop 0 + shr r17 = r9, r16 + nop 0 + ;; + .mii + xor r18 = r18, r14 + mov ar.lc = r38 + adds r15 = -1, r15 + .mmi + or r19 = r20, r19 + ;; + and r15 = r18, r15 + or r17 = r21, r17 + .mii + st8 [r22] = r19 + nop 0 + ;; + xor r14 = r15, r14 + .mmb + nop 0 + st8 [r23] = r17 + nop 0 + ;; + .mfb + st8 [r24] = r14 + nop 0 + br.ret.sptk.many b0 +.L53: + .body + .copy_state 12 + .mfi + shladd r18 = r17, 3, r0 + nop 0 + addl r14 = -1, r0 + .mii + ld8 r16 = [r27] + cmp.ltu p6, p7 = 32, r23 + ;; + nop 0 + .mii + mov r29 = r18 + shl r15 = r8, r18 + shl r14 = r14, r18 + ;; + .mmi + xor r15 = r15, r16 + ;; + and r14 = r15, r14 + nop 0 + ;; + .mii + nop 0 + xor r16 = r14, r16 + ;; + nop 0 + .mfb + st8 [r27] = r16 + nop 0 + (p6) br.cond.dptk .L57 + .mmi + shladd r14 = r17, 2, r0 + addl r15 = 2, r0 + shl r20 = r10, r18 + .mmi + shladd r18 = r23, 3, r0 + adds r23 = 24, r27 + shl r19 = r9, r29 + ;; + .mmi + sub r14 = 32, r14 + adds r18 = -65, r18 + mov b0 = r34 + .mmi + adds r21 = 8, r27 + adds r22 = 16, r27 + .label_state 13 + .restore sp + mov r12 = r36 + .mii + nop 0 + mov ar.pfs = r35 + ;; + sxt4 r18 = r18 + .mii + nop 0 + sxt4 r14 = r14 + mov ar.lc = r38 + ;; + .mii + nop 0 + shr r16 = r8, r14 + shr r17 = r9, r14 + .mii + mov r8 = r0 + nop 0 + shl r15 = r15, r18 + ;; + .mii + nop 0 + shr r16 = r16, r14 + shr r17 = r17, r14 + .mii + ld8 r14 = [r23] + adds r15 = -1, r15 + ;; + or r16 = r19, r16 + .mmi + or r17 = r20, r17 + ;; + st8 [r21] = r16 + xor r16 = r14, r16 + .mmi + st8 [r22] = r17 + ;; + and r15 = r16, r15 + nop 0 + ;; + .mii + nop 0 + xor r14 = r15, r14 + ;; + nop 0 + .mfb + st8 [r23] = r14 + nop 0 + br.ret.sptk.many b0 +.L57: + .body + .copy_state 13 + .mmi + shladd r16 = r23, 3, r0 + addl r15 = 2, r0 + sub r14 = 64, r18 + .mmi + adds r24 = 8, r27 + adds r25 = 16, r27 + adds r26 = 24, r27 + ;; + .mmi + nop 0 + adds r16 = -129, r16 + sxt4 r14 = r14 + .mmi + adds r27 = 32, r27 + .restore sp + mov r12 = r36 + shl r23 = r11, r29 + ;; + .mii + nop 0 + sxt4 r16 = r16 + shr r22 = r11, r14 + ;; + .mii + nop 0 + shl r15 = r15, r16 + shr r17 = r8, r14 + .mii + mov r8 = r0 + shr r18 = r9, r14 + shr r19 = r10, r14 + .mii + ld8 r14 = [r27] + shl r20 = r9, r29 + shl r21 = r10, r29 + ;; + .mmi + xor r22 = r22, r14 + adds r15 = -1, r15 + mov b0 = r34 + ;; + .mmi + and r15 = r22, r15 + or r19 = r23, r19 + mov ar.pfs = r35 + .mmi + or r17 = r20, r17 + or r18 = r21, r18 + mov ar.lc = r38 + ;; + .mmb + xor r14 = r15, r14 + st8 [r24] = r17 + nop 0 + .mmb + st8 [r25] = r18 + st8 [r26] = r19 + nop 0 + ;; + .mfb + st8 [r27] = r14 + nop 0 + br.ret.sptk.many b0 + .endp avcall_call# + .ident "GCC: (GNU) 4.0.1" +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-ia64.c b/avcall/avcall-ia64.c new file mode 100644 index 0000000..7d67723 --- /dev/null +++ b/avcall/avcall-ia64.c @@ -0,0 +1,314 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for a Intel IA-64 in little-endian mode with gcc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + IA-64 64-bit Argument Passing Conventions: + + The argument sequence is mapped linearly on the registers r32,...,r39, + and continued on the stack, in [r12+16], [r12+24], ... + Items in this sequence are word-aligned. In gcc < 3.0, structures larger + than a single word are even two-word-aligned. + Integer/pointer arguments are passed in the allocated slots (registers + or stack slots). The first 8 float/double arguments are passed in + registers f8,...,f15 instead, but their slots are kept allocated. + Structure args are passed like multiple integer arguments; except that + structures consisting only of floats or only of doubles are passed like + multiple float arguments or multiple double arguments, respectively. + + Integers and pointers are returned in r8, floats and doubles in f8. + Structures consisting only of at most 8 floats or only of at most 8 doubles + are returned in f8,...,f15. Other than that, structures of size <= 32 bytes + are returned in r8,...,r11, as if these were 4 contiguous words in memory. + Larger structures are returned in memory; the caller passes the address + of the target memory area in r8, and it is returned unmodified in r8. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +register __avword* sret __asm__("r8"); /* structure return pointer */ +/*register __avrword iret __asm__("r8");*/ +register __avrword iret2 __asm__("r9"); +register __avrword iret3 __asm__("r10"); +register __avrword iret4 __asm__("r11"); +/*register float fret __asm__("f8");*/ +/*register double dret __asm__("f8");*/ +register double farg1 __asm__("f8"); +register double farg2 __asm__("f9"); +register double farg3 __asm__("f10"); +register double farg4 __asm__("f11"); +register double farg5 __asm__("f12"); +register double farg6 __asm__("f13"); +register double farg7 __asm__("f14"); +register double farg8 __asm__("f15"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("r12"); /* C names for registers */ + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = (sp -= __AV_ALIST_WORDS) + 2; /* make room for argument list */ + int arglen = l->aptr - l->args; + int farglen = l->faptr - l->fargs; + __avrword iret; + + { + int i; + for (i = 8; i < arglen; i++) /* push function args onto stack */ + argframe[i-8] = l->args[i]; + } + + /* struct return address */ + if (l->rtype == __AVstruct) + sret = l->raddr; + + /* put max. 8 double args in registers */ + if (farglen > 0) { + farg1 = l->fargs[0]; + if (farglen > 1) { + farg2 = l->fargs[1]; + if (farglen > 2) { + farg3 = l->fargs[2]; + if (farglen > 3) { + farg4 = l->fargs[3]; + if (farglen > 4) { + farg5 = l->fargs[4]; + if (farglen > 5) { + farg6 = l->fargs[5]; + if (farglen > 6) { + farg7 = l->fargs[6]; + if (farglen > 7) + farg8 = l->fargs[7]; + } + } + } + } + } + } + } + + /* call function, pass 8 integer and 8 double args in registers */ + if (l->rtype == __AVfloat) { + *(float*)l->raddr = (*(float(*)())l->func)(l->args[0], l->args[1], + l->args[2], l->args[3], + l->args[4], l->args[5], + l->args[6], l->args[7]); + } else + if (l->rtype == __AVdouble) { + *(double*)l->raddr = (*(double(*)())l->func)(l->args[0], l->args[1], + l->args[2], l->args[3], + l->args[4], l->args[5], + l->args[6], l->args[7]); + } else { + iret = (*l->func)(l->args[0], l->args[1], l->args[2], l->args[3], + l->args[4], l->args[5], l->args[6], l->args[7]); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong || l->rtype == __AVlonglong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong || l->rtype == __AVulonglong) { + RETURN(unsigned long, iret); + } else + /* see above + if (l->rtype == __AVfloat) { + } else + if (l->rtype == __AVdouble) { + } else + */ + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + /* Return structs of size <= 32 in registers. */ + if (l->rsize > 0 && l->rsize <= 32) { + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize >= 1) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + if (l->rsize >= 2) + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + if (l->rsize >= 3) + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + if (l->rsize >= 4) + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + if (l->rsize >= 5) + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + if (l->rsize >= 6) + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + if (l->rsize >= 7) + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + if (l->rsize >= 8) + ((unsigned char *)raddr)[7] = (unsigned char)(iret>>56); + if (l->rsize >= 9) { + ((unsigned char *)raddr)[8] = (unsigned char)(iret2); + if (l->rsize >= 10) + ((unsigned char *)raddr)[9] = (unsigned char)(iret2>>8); + if (l->rsize >= 11) + ((unsigned char *)raddr)[10] = (unsigned char)(iret2>>16); + if (l->rsize >= 12) + ((unsigned char *)raddr)[11] = (unsigned char)(iret2>>24); + if (l->rsize >= 13) + ((unsigned char *)raddr)[12] = (unsigned char)(iret2>>32); + if (l->rsize >= 14) + ((unsigned char *)raddr)[13] = (unsigned char)(iret2>>40); + if (l->rsize >= 15) + ((unsigned char *)raddr)[14] = (unsigned char)(iret2>>48); + if (l->rsize >= 16) + ((unsigned char *)raddr)[15] = (unsigned char)(iret2>>56); + if (l->rsize >= 17) { + ((unsigned char *)raddr)[16] = (unsigned char)(iret3); + if (l->rsize >= 18) + ((unsigned char *)raddr)[17] = (unsigned char)(iret3>>8); + if (l->rsize >= 19) + ((unsigned char *)raddr)[18] = (unsigned char)(iret3>>16); + if (l->rsize >= 20) + ((unsigned char *)raddr)[19] = (unsigned char)(iret3>>24); + if (l->rsize >= 21) + ((unsigned char *)raddr)[20] = (unsigned char)(iret3>>32); + if (l->rsize >= 22) + ((unsigned char *)raddr)[21] = (unsigned char)(iret3>>40); + if (l->rsize >= 23) + ((unsigned char *)raddr)[22] = (unsigned char)(iret3>>48); + if (l->rsize >= 24) + ((unsigned char *)raddr)[23] = (unsigned char)(iret3>>56); + if (l->rsize >= 25) { + ((unsigned char *)raddr)[24] = (unsigned char)(iret4); + if (l->rsize >= 26) + ((unsigned char *)raddr)[25] = (unsigned char)(iret4>>8); + if (l->rsize >= 27) + ((unsigned char *)raddr)[26] = (unsigned char)(iret4>>16); + if (l->rsize >= 28) + ((unsigned char *)raddr)[27] = (unsigned char)(iret4>>24); + if (l->rsize >= 29) + ((unsigned char *)raddr)[28] = (unsigned char)(iret4>>32); + if (l->rsize >= 30) + ((unsigned char *)raddr)[29] = (unsigned char)(iret4>>40); + if (l->rsize >= 31) + ((unsigned char *)raddr)[30] = (unsigned char)(iret4>>48); + if (l->rsize >= 32) + ((unsigned char *)raddr)[31] = (unsigned char)(iret4>>56); + } + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 4*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 5*sizeof(__avrword) */ + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (end_offset*8-1)) - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret >> (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else if (count <= 2*sizeof(__avrword)) { + /* Use iret, iret2. */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[1] ^= (wordaddr[1] ^ ((iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = ((__avrword)2 << (end_offset*8-2*sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*8-start_offset*8)) | (iret2 << (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 >> (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } else if (count <= 3*sizeof(__avrword)) { + /* Use iret, iret2, iret3. */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + if (end_offset <= 3*sizeof(__avrword)) { + /* 2*sizeof(__avrword) < end_offset ≤ 3*sizeof(__avrword) */ + __avrword mask2 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ ((iret2 >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret3 << (start_offset*8)))) & mask2; + } else { + /* 3*sizeof(__avrword) < end_offset < 4*sizeof(__avrword), start_offset > 0 */ + __avrword mask3 = ((__avrword)2 << (end_offset*8-2*sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*8-start_offset*8)) | (iret2 << (start_offset*8)); + wordaddr[2] = (iret2 >> (sizeof(__avrword)*8-start_offset*8)) | (iret3 << (start_offset*8)); + wordaddr[3] ^= (wordaddr[3] ^ (iret3 >> (sizeof(__avrword)*8-start_offset*8))) & mask3; + } + } else { + /* Use iret, iret2, iret3, iret4. */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + if (end_offset <= 4*sizeof(__avrword)) { + /* 3*sizeof(__avrword) < end_offset ≤ 4*sizeof(__avrword) */ + __avrword mask3 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)); + wordaddr[2] = (iret2 >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret3 << (start_offset*8)); + wordaddr[3] ^= (wordaddr[3] ^ ((iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)))) & mask3; + } else { + /* 4*sizeof(__avrword) < end_offset < 5*sizeof(__avrword), start_offset > 0 */ + __avrword mask4 = ((__avrword)2 << (end_offset*8-2*sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*8-start_offset*8)) | (iret2 << (start_offset*8)); + wordaddr[2] = (iret2 >> (sizeof(__avrword)*8-start_offset*8)) | (iret3 << (start_offset*8)); + wordaddr[3] = (iret3 >> (sizeof(__avrword)*8-start_offset*8)) | (iret4 << (start_offset*8)); + wordaddr[4] ^= (wordaddr[4] ^ (iret4 >> (sizeof(__avrword)*8-start_offset*8))) & mask4; + } + } + #endif + } + } + } + } + return 0; +} diff --git a/avcall/avcall-internal.h b/avcall/avcall-internal.h new file mode 100644 index 0000000..c878134 --- /dev/null +++ b/avcall/avcall-internal.h @@ -0,0 +1,1558 @@ +/* + * Copyright 1993-1995 Bill Triggs + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#ifndef _AVCALL_INTERNAL_H +#define _AVCALL_INTERNAL_H + +/* Get intptr_t, uintptr_t. */ +#include "ffcall-stdint.h" + +/* Include the public definitions and "avcall-alist.h", */ +#include "avcall.h" + + +/* Verify at compile time that sizeof(__av_alist) <= __AV_ALIST_SIZE_BOUND. */ +typedef int __av_alist_verify[2*(__AV_ALIST_SIZE_BOUND - (int)sizeof(__av_alist))+1]; + +/* Conversion from the public, mostly opaque, 'av_alist*' to '__av_alist*'. */ +#define AV_LIST_INNER(list) ((list)->_av_alist_head._av_m_alist) + + +/* Delayed overflow detection */ +#if defined(__hppa__) && !defined(__hppa64__) +#define _av_overflown(LIST) ((LIST).aptr < (LIST).eptr) +#else +#define _av_overflown(LIST) ((LIST).aptr > (LIST).eptr) +#endif + + +/* + * Initialization of an __av_alist + */ + +#define __av_start(LIST,LIST_ARGS,LIST_ARGS_END,FUNC,RADDR,RETTYPE,FLAGS) \ + ((LIST).func = (FUNC), \ + (LIST).raddr = (RADDR), \ + (LIST).rtype = (RETTYPE), \ + (LIST).args = (LIST_ARGS), \ + __av_start1(LIST,LIST_ARGS_END) \ + __av_start_init_eptr(LIST,LIST_ARGS_END) \ + (LIST).flags = (FLAGS)) + +#if defined(__i386__) || defined(__m68k__) || defined(__alpha__) || (defined(__arm__) && !defined(__armhf__)) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).aptr = &(LIST).args[0], +#endif +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).anum = 0, \ + (LIST).fanum = 0, \ + (LIST).farg_mask = 0, \ + (LIST).darg_mask = 0, \ + (LIST).aptr = &(LIST).args[0], +#endif +#if defined(__mipsn32__) || defined(__mips64__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).anum = 0, \ + (LIST).farg_mask = 0, \ + (LIST).darg_mask = 0, \ + (LIST).aptr = &(LIST).args[0], +#endif +#if defined(__sparc__) && !defined(__sparc64__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).aptr = &(LIST).args[0], +#endif +#if defined(__sparc64__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).anum = 0, \ + (LIST).darg_mask = 0, \ + (LIST).aptr = &(LIST).args[0], +#endif +#if defined(__hppa__) && !defined(__hppa64__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).farg_mask = 0, \ + (LIST).darg_mask = 0, \ + (LIST).aptr = (LIST).args_end = (LIST_ARGS_END), +#endif +#if defined(__hppa64__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).farg_mask = 0, \ + (LIST).darg_mask = 0, \ + (LIST).aptr = &(LIST).args[0], +#endif +#if defined(__armhf__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).aptr = &(LIST).args[__AV_IARG_NUM], \ + (LIST).ianum = 0, \ + (LIST).fanum = 0, \ + (LIST).farg_mask = 0, \ + (LIST).darg_mask = 0, +#endif +#if defined(__arm64__) || defined(__s390__) || defined(__s390x__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).aptr = &(LIST).args[0], \ + (LIST).ianum = 0, \ + (LIST).fanum = 0, \ + (LIST).farg_mask = 0, \ + (LIST).darg_mask = 0, +#endif +#if defined(__riscv32__) || defined(__riscv64__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).aptr = &(LIST).args[0], \ + (LIST).fanum = 0, \ + (LIST).farg_mask = 0, \ + (LIST).darg_mask = 0, +#endif +#if defined(__powerpc_aix__) || defined(__powerpc64__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).aptr = &(LIST).args[0], \ + (LIST).faptr = &(LIST).fargs[0], +#endif +#if defined(__powerpc_sysv4__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).aptr = &(LIST).args[0], \ + (LIST).ianum = 0, \ + (LIST).faptr = &(LIST).fargs[0], +#endif +#if defined(__ia64__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).aptr = &(LIST).args[0], \ + (LIST).faptr = &(LIST).fargs[0], +#endif +#if defined(__x86_64_sysv__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).aptr = &(LIST).args[0], \ + (LIST).ianum = 0, \ + (LIST).faptr = &(LIST).fargs[0], +#endif +#if defined(__x86_64_ms__) +#define __av_start1(LIST,LIST_ARGS_END) \ + (LIST).aptr = &(LIST).args[0], \ + (LIST).anum = 0, \ + (LIST).farg_mask = 0, \ + (LIST).darg_mask = 0, +#endif + +#if defined(__hppa__) && !defined(__hppa64__) +#define __av_start_init_eptr(LIST,LIST_ARGS_END) \ + (LIST).eptr = &(LIST).args[0], +#else +#define __av_start_init_eptr(LIST,LIST_ARGS_END) \ + (LIST).eptr = (LIST_ARGS_END), +#endif + +#define __av_start_struct(LIST,LIST_ARGS,LIST_ARGS_END,FUNC,TYPE_SIZE,TYPE_SPLITTABLE,RADDR,FLAGS) \ + (__av_start(LIST,LIST_ARGS,LIST_ARGS_END,FUNC,RADDR,__AVstruct,FLAGS), \ + (LIST).rsize = (TYPE_SIZE), \ + __av_start_struct2(LIST,TYPE_SIZE,TYPE_SPLITTABLE), \ + 0) + +#if (defined(__sparc__) && !defined(__sparc64__)) +/* Return structure pointer is passed in a special register. + */ +#define __av_start_struct2(LIST,TYPE_SIZE,TYPE_SPLITTABLE) 0 +#else +#define __av_start_struct2(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + (((LIST).flags & __AV_SMALL_STRUCT_RETURN) \ + && __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ? /* <= Word-sized structures are returned in a register. */ \ + __av_start_struct3(LIST) \ + : __av_start_struct4(LIST,TYPE_SIZE) \ + ) +/* Determines whether a structure is returned in registers, + * depending on its size and its word-splittable flag. + */ +#if (defined(__i386__) && defined(_WIN32)) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 \ + || ((TYPE_SIZE) == 8 \ + && (((LIST).flags & __AV_MSVC_STRUCT_RETURN) \ + || ((TYPE_SPLITTABLE) \ + && ((LIST).flags & __AV_GCC_STRUCT_RETURN) \ + ) ) ) ) +/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __av_start_struct3(LIST) \ + ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0) +#endif +#if (defined(__i386__) && !defined(_WIN32)) || defined(__m68k__) || (defined(__powerpc__) && !defined(__powerpc64__)) || (defined(__s390__) && !defined(__s390x__)) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 \ + || ((TYPE_SIZE) == 8 && (TYPE_SPLITTABLE) \ + && ((LIST).flags & __AV_GCC_STRUCT_RETURN) \ + ) ) +/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __av_start_struct3(LIST) \ + ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0) +#endif +#if defined(__arm__) || defined(__armhf__) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) <= 4) +#define __av_start_struct3(LIST) \ + ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0) +#endif +#if defined(__alpha__) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8 \ + || ((TYPE_SIZE) == 16 && (TYPE_SPLITTABLE) \ + && ((LIST).flags & __AV_GCC_STRUCT_RETURN) \ + ) ) +/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __av_start_struct3(LIST) \ + ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0) +#endif +#if (defined(__hppa__) && !defined(__hppa64__)) || defined(__riscv32__) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) <= 8) +/* Test __AV_SMALL_STRUCT_RETURN at run time. */ +#define __av_start_struct3(LIST) \ + 0 +#endif +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4) +/* Test __AV_SMALL_STRUCT_RETURN instead of __AV_REGISTER_STRUCT_RETURN. */ +#define __av_start_struct3(LIST) \ + 0 +#endif +#if defined(__mipsn32__) || defined(__mips64__) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((LIST).flags & __AV_GCC_STRUCT_RETURN \ + ? ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8) \ + : ((TYPE_SIZE) <= 16) \ + ) +/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __av_start_struct3(LIST) \ + ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0) +#endif +#if (defined(__powerpc64__) && !defined(__powerpc64_elfv2__)) || defined(__s390x__) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + 0 +#define __av_start_struct3(LIST) \ + 0 +#endif +#if defined(__sparc64__) || defined(__ia64__) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) <= 32) +/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __av_start_struct3(LIST) \ + ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0) +#endif +#if defined(__hppa64__) || defined(__arm64__) || (defined(__powerpc64__) && defined(__powerpc64_elfv2__)) || defined(__x86_64_sysv__) || defined(__riscv64__) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) <= 16) +/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __av_start_struct3(LIST) \ + ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0) +#endif +#if defined(__x86_64_ms__) +#define __av_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8) +/* Turn on __AV_REGISTER_STRUCT_RETURN if __AV_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __av_start_struct3(LIST) \ + ((LIST).flags |= __AV_REGISTER_STRUCT_RETURN, 0) +#endif +#if defined(__m68k__) || defined(__hppa__) || defined(__hppa64__) || defined(__arm64__) || defined(__ia64__) +/* Return structure pointer is passed in a special register. + */ +#define __av_start_struct4(LIST,TYPE_SIZE) 0 +#endif +/* Return structure pointer is passed as first arg. + */ +#if defined(__i386__) || defined(__alpha__) || (defined(__arm__) && !defined(__armhf__)) || defined(__powerpc_aix__) || defined(__powerpc64__) || defined(__riscv32__) || defined(__riscv64__) +#define __av_start_struct4(LIST,TYPE_SIZE) \ + (*(LIST).aptr++ = (__avword)((LIST).raddr), 0) +#endif +#if defined(__armhf__) +#define __av_start_struct4(LIST,TYPE_SIZE) \ + ((LIST).args[(LIST).ianum++] = (__avword)((LIST).raddr), 0) +#endif +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__x86_64_ms__) +#define __av_start_struct4(LIST,TYPE_SIZE) \ + (*(LIST).aptr++ = (__avword)((LIST).raddr), \ + (LIST).anum++, \ + 0 \ + ) +#endif +#if defined(__powerpc_sysv4__) || defined(__x86_64_sysv__) || defined(__s390__) || defined(__s390x__) +#if defined(__x86_64_x32__) +/* The x86_64 ABI, section 10.1, specifies that pointers are zero-extended + from 32 bits to 64 bits. */ +#define __av_start_struct4(LIST,TYPE_SIZE) \ + ((LIST).iargs[(LIST).ianum++] = (unsigned long long)(unsigned long)((LIST).raddr), 0) +#else +#define __av_start_struct4(LIST,TYPE_SIZE) \ + ((LIST).iargs[(LIST).ianum++] = (__avrword)((LIST).raddr), 0) +#endif +#endif +#endif + + +/* + * av_ macros which specify the argument and its type + * In these macro definitions, + * 1. check the new value of (LIST).aptr against (LIST).eptr, then + * 2. modify (LIST).aptr (considering the alignment needed for the argument + * type), then store the argument. On little-endian machines and when + * there are no alignment considerations, it's also OK to store the + * argument and then modify (LIST).aptr. + */ + +/* + * scalar argument types + */ + +#if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__alpha__) || defined(__hppa64__) || (defined(__arm__) && !defined(__armhf__)) || defined(__arm64__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || defined(__x86_64_sysv__) || defined(__s390__) || defined(__s390x__) || defined(__riscv32__) || defined(__riscv64__) +/* Floats and all integer types are passed as words, + * doubles as two words (on 32-bit platforms) or one word (on 64-bit platforms). + */ +#define __av_word(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((LIST).aptr)[-1] = (__avword)(VAL), \ + 0)) +#endif +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__x86_64_ms__) +/* Most things are passed as integers: + */ +#define __av_word(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((LIST).aptr)[-1] = (__avword)(VAL), \ + (LIST).anum++, \ + 0)) +#endif +#if defined(__hppa__) && !defined(__hppa64__) +/* Floats and all integer types are passed as words, + * doubles as two words. + */ +#define __av_word(LIST,VAL) \ + ((LIST).aptr <= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr--, \ + *(LIST).aptr = (__avword)(VAL), \ + 0)) +#endif +#if defined(__armhf__) +#define __av_word(LIST,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).args[(LIST).ianum++] = (__avword)(VAL), 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((LIST).aptr)[-1] = (__avword)(VAL), \ + 0))) +#endif + +/* integer argument types */ + +#if defined(__arm64__) || defined(__powerpc_sysv4__) || defined(__x86_64_sysv__) || defined(__s390__) || defined(__s390x__) +/* The first __AV_IARG_NUM integer arguments are passed in registers. */ +#define __av_int(LIST,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).iargs[(LIST).ianum++] = (int)(VAL), 0) \ + : __av_word(LIST,(int)(VAL))) +#else +#define __av_int(LIST,VAL) __av_word(LIST,(int)(VAL)) +#endif + +#if defined(__arm64__) || defined(__powerpc_sysv4__) || defined(__x86_64_sysv__) || defined(__s390__) || defined(__s390x__) +/* The first __AV_IARG_NUM integer arguments are passed in registers. */ +#define __av_uint(LIST,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).iargs[(LIST).ianum++] = (unsigned int)(VAL), 0) \ + : __av_word(LIST,(unsigned int)(VAL))) +#else +#define __av_uint(LIST,VAL) __av_word(LIST,(unsigned int)(VAL)) +#endif + +#if (defined(__arm64__) && !(defined(__APPLE__) && defined(__MACH__))) || defined(__powerpc_sysv4__) || defined(__x86_64_sysv__) || defined(__s390__) || defined(__s390x__) +/* The first __AV_IARG_NUM integer arguments are passed in registers. */ +#define __av_long(LIST,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).iargs[(LIST).ianum++] = (long)(VAL), 0) \ + : __av_word(LIST,(long)(VAL))) +#elif defined(__arm64__) && defined(__APPLE__) && defined(__MACH__) +#define __av_long(LIST,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).iargs[(LIST).ianum++] = (long)(VAL), 0) \ + : ((LIST).aptr + 2 > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr += 2, \ + ((LIST).aptr)[-2] = (unsigned int)(unsigned long)(long)(VAL), \ + ((LIST).aptr)[-1] = (unsigned int)((unsigned long)(long)(VAL) >> 32), \ + 0))) +#else +#define __av_long(LIST,VAL) __av_word(LIST,(long)(VAL)) +#endif + +#if (defined(__arm64__) && !(defined(__APPLE__) && defined(__MACH__))) || defined(__powerpc_sysv4__) || defined(__x86_64_sysv__) || defined(__s390__) || defined(__s390x__) +/* The first __AV_IARG_NUM integer arguments are passed in registers. */ +#define __av_ulong(LIST,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).iargs[(LIST).ianum++] = (unsigned long)(VAL), 0) \ + : __av_word(LIST,(unsigned long)(VAL))) +#elif defined(__arm64__) && defined(__APPLE__) && defined(__MACH__) +#define __av_ulong(LIST,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).iargs[(LIST).ianum++] = (unsigned long)(VAL), 0) \ + : ((LIST).aptr + 2 > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr += 2, \ + ((LIST).aptr)[-2] = (unsigned int)(unsigned long)(VAL), \ + ((LIST).aptr)[-1] = (unsigned int)((unsigned long)(VAL) >> 32), \ + 0))) +#else +#define __av_ulong(LIST,VAL) __av_word(LIST,(unsigned long)(VAL)) +#endif + +#if (defined(__arm64__) && !(defined(__APPLE__) && defined(__MACH__))) || defined(__powerpc_sysv4__) || defined(__x86_64_sysv__) || defined(__s390__) || defined(__s390x__) +/* The first __AV_IARG_NUM integer arguments are passed in registers. */ +#if defined(__x86_64_x32__) +/* The x86_64 ABI, section 10.1, specifies that pointers are zero-extended + from 32 bits to 64 bits. */ +#define __av_ptr(LIST,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).iargs[(LIST).ianum++] = (unsigned long long)(unsigned long)(VAL), 0) \ + : __av_word(LIST,(unsigned long long)(unsigned long)(VAL))) +#else +#define __av_ptr(LIST,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).iargs[(LIST).ianum++] = (__avrword)(VAL), 0) \ + : __av_word(LIST,VAL)) +#endif +#elif defined(__arm64__) && defined(__APPLE__) && defined(__MACH__) +#define __av_ptr(LIST,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).iargs[(LIST).ianum++] = (unsigned long)(VAL), 0) \ + : ((LIST).aptr + 2 > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr += 2, \ + ((LIST).aptr)[-2] = (unsigned int)(unsigned long)(VAL), \ + ((LIST).aptr)[-1] = (unsigned int)((unsigned long)(VAL) >> 32), \ + 0))) +#else +#define __av_ptr(LIST,VAL) __av_word(LIST,VAL) +#endif + +#if defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppa64__) || defined(__arm64__) || defined(__powerpc64__) || defined(__ia64__) || (defined(__x86_64__) && !defined(__x86_64_x32__) && !defined(__AV_LLP64)) || defined(__s390x__) || defined(__riscv64__) +/* ‘long long’ and ‘long’ are identical. */ +#define __av_longlong __av_long +#define __av_ulonglong __av_ulong +#elif defined(__mipsn32__) || (defined(__x86_64__) && defined(__AV_LLP64)) +/* ‘long long’ fits in __avword. */ +#define __av_longlong __av_word +#define __av_ulonglong(LIST,VAL) __av_word(LIST,(unsigned long long)(VAL)) +#elif defined(__i386__) || defined(__m68k__) || (defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)) || (defined(__sparc__) && !defined(__sparc64__)) || (defined(__hppa__) && !defined(__hppa64__)) || defined(__arm__) || defined(__armhf__) || defined(__powerpc__) || defined(__x86_64_x32__) || (defined(__s390__) && !defined(__s390x__)) || defined(__riscv32__) +/* ‘long long’s are passed embedded on the arg stack. */ +#define __av_longlong(LIST,VAL) __av_arg_longlong(LIST,long long,VAL) +#define __av_ulonglong(LIST,VAL) __av_arg_longlong(LIST,unsigned long long,VAL) +#if defined(__i386__) || defined(__m68k__) || defined(__powerpc_aix__) +/* ‘long long’s are (at most) word-aligned. */ +#define __av_arg_longlong(LIST,TYPE,VAL) \ + ((LIST).aptr + sizeof(TYPE)/sizeof(__avword) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr += sizeof(TYPE)/sizeof(__avword), \ + ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), \ + 0)) +#endif +#if defined(__mips__) || (defined(__sparc__) && !defined(__sparc64__)) || (defined(__hppa__) && !defined(__hppa64__)) || defined(__arm__) || defined(__armhf__) || defined(__powerpc_sysv4__) || defined(__x86_64_x32__) || (defined(__s390__) && !defined(__s390x__)) || defined(__riscv32__) +/* ‘long long’s have alignment 4 or 8. */ +#if defined(__mips__) +#define __av_arg_longlong(LIST,TYPE,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(intptr_t)__AV_alignof(TYPE)) > (LIST).eptr \ + ? -1 : \ + (((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(intptr_t)__AV_alignof(TYPE))), \ + ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), \ + (LIST).anum++, \ + 0)) +#endif +#if defined(__sparc__) && !defined(__sparc64__) +/* Within the arg stack, the alignment is only 4, not 8. */ +/* This assumes sizeof(long long) == 2*sizeof(__avword). */ +#define __av_arg_longlong(LIST,TYPE,VAL) \ + ((LIST).aptr + sizeof(TYPE)/sizeof(__avword) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr += sizeof(TYPE)/sizeof(__avword), \ + (LIST).tmp._longlong = (TYPE)(VAL), \ + (LIST).aptr[-2] = (LIST).tmp.words[0], \ + (LIST).aptr[-1] = (LIST).tmp.words[1], \ + 0)) +#endif +#if (defined(__hppa__) && !defined(__hppa64__)) +#define __av_arg_longlong(LIST,TYPE,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr & -(intptr_t)__AV_alignof(TYPE)) - sizeof(TYPE)) < (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr & -(intptr_t)__AV_alignof(TYPE)) - sizeof(TYPE)), \ + *(TYPE*)(LIST).aptr = (TYPE)(VAL), \ + 0)) +#endif +#if defined(__arm__) && !defined(__armhf__) +#define __av_arg_longlong(LIST,TYPE,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(intptr_t)__AV_alignof(TYPE)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(intptr_t)__AV_alignof(TYPE)), \ + ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), \ + 0)) +#endif +#if defined(__armhf__) +#define __av_arg_longlong(LIST,TYPE,VAL) \ + ((((LIST).ianum + sizeof(TYPE)/sizeof(__avword)+__AV_alignof(TYPE)/sizeof(__avword)-1) & -(intptr_t)(__AV_alignof(TYPE)/sizeof(__avword))) <= __AV_IARG_NUM \ + ? ((LIST).ianum = (((LIST).ianum + sizeof(TYPE)/sizeof(__avword)+__AV_alignof(TYPE)/sizeof(__avword)-1) & -(intptr_t)(__AV_alignof(TYPE)/sizeof(__avword))), \ + ((TYPE*)&(LIST).args[(LIST).ianum])[-1] = (TYPE)(VAL), \ + 0) \ + : ((LIST).aptr == &(LIST).args[__AV_IARG_NUM] \ + ? /* split case */ \ + ((__avword*)(((uintptr_t)&(LIST).args[(LIST).ianum]+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(intptr_t)__AV_alignof(TYPE)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)&(LIST).args[(LIST).ianum]+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(intptr_t)__AV_alignof(TYPE)), \ + ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), \ + (LIST).ianum = __AV_IARG_NUM, \ + 0)) \ + : ((__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(intptr_t)__AV_alignof(TYPE)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(intptr_t)__AV_alignof(TYPE)), \ + ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), \ + (LIST).ianum = __AV_IARG_NUM, \ + 0)))) +#endif +#if defined(__powerpc_sysv4__) +#define __av_arg_longlong(LIST,TYPE,VAL) \ + ((((LIST).ianum + sizeof(TYPE)/sizeof(__avrword)+__AV_alignof(TYPE)/sizeof(__avrword)-1) & -(intptr_t)(__AV_alignof(TYPE)/sizeof(__avrword))) <= __AV_IARG_NUM \ + ? ((LIST).ianum = (((LIST).ianum + sizeof(TYPE)/sizeof(__avrword)+__AV_alignof(TYPE)/sizeof(__avrword)-1) & -(intptr_t)(__AV_alignof(TYPE)/sizeof(__avrword))), \ + ((TYPE*)&(LIST).iargs[(LIST).ianum])[-1] = (TYPE)(VAL), \ + 0) \ + : ((LIST).ianum = __AV_IARG_NUM, \ + ((__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(intptr_t)__AV_alignof(TYPE)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+__AV_alignof(TYPE)-1) & -(intptr_t)__AV_alignof(TYPE)), \ + ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), \ + 0)))) +#endif +#if defined(__x86_64_x32__) +#define __av_arg_longlong(LIST,TYPE,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).iargs[(LIST).ianum++] = (__avrword)(TYPE)(VAL), 0) \ + : __av_word(LIST,(TYPE)(VAL))) +#endif +#if (defined(__s390__) && !defined(__s390x__)) +/* Within the arg stack, the alignment is only 4, not 8. */ +#define __av_arg_longlong(LIST,TYPE,VAL) \ + ((LIST).ianum + (sizeof(TYPE)+sizeof(__avrword)-1)/sizeof(__avrword) <= __AV_IARG_NUM \ + ? ((LIST).ianum += (sizeof(TYPE)+sizeof(__avrword)-1)/sizeof(__avrword), \ + ((TYPE*)&(LIST).iargs[(LIST).ianum])[-1] = (TYPE)(VAL), \ + 0) \ + : ((LIST).ianum = __AV_IARG_NUM, \ + ((__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), \ + 0)))) +#endif +#if defined(__riscv32__) +/* Within the arg stack, the alignment is only 4, not 8. Also, the argument + may be put into one word in registers and one word on the stack. */ +#define __av_arg_longlong(LIST,TYPE,VAL) \ + (((__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr+sizeof(TYPE)+sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + ((TYPE*)(LIST).aptr)[-1] = (TYPE)(VAL), \ + 0))) +#endif +#endif +#endif + +/* floating-point argument types */ + +#if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) + +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((float*)(LIST).aptr)[-1] = (float)(VAL), \ + 0)) + +/* This assumes sizeof(double) == 2*sizeof(__avword). */ +#define _av_double(LIST,VAL) \ + ((LIST).aptr + 2 > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr += 2, \ + (LIST).tmp._double = (double)(VAL), \ + (LIST).aptr[-2] = (LIST).tmp.words[0], \ + (LIST).aptr[-1] = (LIST).tmp.words[1], \ + 0)) + +#endif + +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) + +/* Up to 2 leading float or double non-varargs args can be passed in + * float registers, but we also push them into the corresponding int + * registers in case of varargs. For doubles we need to align the aptr + * to an even boundary. + */ +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((LIST).anum == (LIST).fanum && (LIST).fanum < __AV_FARG_NUM \ + ? /* only floating-point arguments so far */ \ + ((LIST).farg_mask |= (unsigned int) 1 << (LIST).fanum, \ + (LIST).fargs[(LIST).fanum] = ((float*)(LIST).aptr)[-1] = (float)(VAL), \ + (LIST).fanum++, \ + 0) \ + : (((float*)(LIST).aptr)[-1] = (float)(VAL), \ + 0)), \ + (LIST).anum++, \ + 0)) + +#define _av_double(LIST,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr+15)&-8) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr+15)&-8), \ + ((LIST).anum == (LIST).fanum && (LIST).fanum < __AV_FARG_NUM \ + ? /* only floating-point arguments so far */ \ + ((LIST).darg_mask |= (unsigned int) 1 << (LIST).fanum, \ + (LIST).dargs[(LIST).fanum] = ((double*)(LIST).aptr)[-1] = (double)(VAL), \ + (LIST).fanum++, \ + 0) \ + : (((double*)(LIST).aptr)[-1] = (double)(VAL), \ + 0)), \ + (LIST).anum++, \ + 0)) + +#endif + +#if defined(__mipsn32__) || defined(__mips64__) + +/* Up to 8 leading float or double non-varargs args can be passed in + * float registers, but we also push them into the corresponding int + * registers in case of varargs. + */ +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + (((LIST).anum < 8 \ + ? ((LIST).farg_mask |= (1 << (LIST).anum), \ + (LIST).fargs[(LIST).anum] = *(float*)(LIST).aptr = (float)(VAL)) \ + : (*(float*)(LIST).aptr = (float)(VAL))), \ + (LIST).anum++, \ + (LIST).aptr++, \ + 0)) + +#define _av_double(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + (((LIST).anum < 8 && ((LIST).darg_mask |= (1 << (LIST).anum))), \ + *(double*)(LIST).aptr = (double)(VAL), \ + (LIST).anum++, \ + (LIST).aptr++, \ + 0)) + +#endif + +#if defined(__sparc64__) + +/* Up to 16 leading float or double non-varargs args can be passed in + * float registers, but we also push them into the corresponding int + * registers in case of varargs. + */ +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((LIST).anum < 16 && ((LIST).darg_mask |= (1 << (LIST).anum))), \ + (((float*)(LIST).aptr)[-1] = (float)(VAL)), \ + (LIST).anum++, \ + 0)) + +#define _av_double(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((LIST).anum < 16 && ((LIST).darg_mask |= (1 << (LIST).anum))), \ + ((double*)(LIST).aptr)[-1] = (double)(VAL), \ + (LIST).anum++, \ + 0)) + +#endif + +#if defined(__alpha__) + +#define _av_double(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((double*)(LIST).aptr)[-1] = (double)(VAL), \ + 0)) + +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 \ + : ((LIST).aptr++, \ + ((LIST).aptr > &(LIST).args[6] \ + ? /* These args will be fetched from memory using "lds" instructions */ \ + /* therefore store them as floats */ \ + (*(float*)((LIST).aptr-1) = (float)(VAL)) \ + : /* The first 6 args will be put into registers by "ldt" instructions */ \ + /* (see avcall-alpha.c!). Therefore store them as doubles. */ \ + /* When viewed as floats, the value will be the correct one. */\ + (*(double*)((LIST).aptr-1) = (double)(float)(VAL))), \ + 0)) + +#endif + +#if defined(__hppa__) && !defined(__hppa64__) + +#define _av_float(LIST,VAL) \ + ((LIST).aptr <= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr--, \ + ((LIST).aptr >= &(LIST).args_end[-4] \ + ? ((LIST).farg_mask |= (unsigned int)1 << ((LIST).args_end - (LIST).aptr - 1), 0) \ + : 0), \ + *(float*)(LIST).aptr = (float)(VAL), \ + 0)) + +#define _av_double(LIST,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr-sizeof(double)) & -(intptr_t)sizeof(double)) < (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr-sizeof(double)) & -(intptr_t)sizeof(double)), \ + ((LIST).aptr >= &(LIST).args_end[-4] \ + ? ((LIST).darg_mask |= (unsigned int)1 << ((LIST).args_end - (LIST).aptr - 1), 0) \ + : 0), \ + *(double*)(LIST).aptr = (double)(VAL), \ + 0)) + +#endif + +#if defined(__hppa64__) + +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + (((LIST).aptr < &(LIST).args[8] \ + ? ((LIST).farg_mask |= (unsigned int)1 << ((LIST).aptr - (LIST).args), 0) \ + : 0), \ + (LIST).aptr++, \ + ((float*)(LIST).aptr)[-1] = (float)(VAL), \ + 0)) + +#define _av_double(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + (((LIST).aptr < &(LIST).args[8] \ + ? ((LIST).darg_mask |= (unsigned int)1 << ((LIST).aptr - (LIST).args), 0) \ + : 0), \ + (LIST).aptr++, \ + ((double*)(LIST).aptr)[-1] = (double)(VAL), \ + 0)) + +#endif + +#if defined(__arm__) && !defined(__armhf__) + +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((float*)(LIST).aptr)[-1] = (float)(VAL), \ + 0)) + +#define _av_double(LIST,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr + 15) & -8) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr + 15) & -8), \ + (LIST).tmp._double = (double)(VAL), \ + (LIST).aptr[-2] = (LIST).tmp.words[0], \ + (LIST).aptr[-1] = (LIST).tmp.words[1], \ + 0)) + +#endif + +#if defined(__armhf__) + +/* Up to 16 float or up to 8 double args can be passed in float registers. + * But they overlap: {s0,s1} = d0, {s2,s3} = d1, and so on. + */ +#define _av_float(LIST,VAL) \ + ((LIST).fanum <= 15 \ + ? ((LIST).fargs[(LIST).fanum] = (float)(VAL), \ + (LIST).farg_mask |= ((unsigned int) 1) << (LIST).fanum, \ + (LIST).fanum++, \ + 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((*(float*)(LIST).aptr = (float)(VAL)), \ + (LIST).aptr++, \ + 0))) + +#define _av_double(LIST,VAL) \ + (((LIST).fanum % 2 ? ((LIST).fanum++, 0) : 0), \ + ((LIST).fanum <= 14 \ + ? ((LIST).dargs[(LIST).fanum / 2] = (double)(VAL), \ + (LIST).darg_mask |= ((unsigned int) 1) << ((LIST).fanum / 2), \ + (LIST).fanum += 2, \ + 0) \ + : ((LIST).aptr + 2 > (LIST).eptr \ + ? -1 : \ + ((*(double*)(LIST).aptr = (double)(VAL)), \ + (LIST).aptr += 2, \ + 0)))) + +#endif + +#if defined(__arm64__) || defined(__riscv64__) + +/* Up to __AV_FARG_NUM float or double args can be passed in float registers. + The remaining float or double args are passed in the general-purpose + argument sequence (first the integer registers, then the stack.) */ +#define _av_float(LIST,VAL) \ + ((LIST).fanum < __AV_FARG_NUM \ + ? ((LIST).fargs[(LIST).fanum] = (float)(VAL), \ + (LIST).farg_mask |= ((unsigned int) 1) << (LIST).fanum, \ + (LIST).fanum++, \ + 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((*(float*)(LIST).aptr = (float)(VAL)), \ + (LIST).aptr++, \ + 0))) + +#define _av_double(LIST,VAL) \ + ((LIST).fanum < __AV_FARG_NUM \ + ? ((LIST).dargs[(LIST).fanum] = (double)(VAL), \ + (LIST).darg_mask |= ((unsigned int) 1) << (LIST).fanum, \ + (LIST).fanum++, \ + 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((*(double*)(LIST).aptr = (double)(VAL)), \ + (LIST).aptr += sizeof(double)/sizeof(__avword), \ + 0))) + +#endif + +#if defined(__powerpc_aix__) + +/* Up to __AV_FARG_NUM float or double non-varargs args can be passed in + * float registers, but we also push them into the corresponding int + * registers in case of varargs. + */ + +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((float*)(LIST).aptr)[-1] = (float)(VAL), \ + (LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] && (*(LIST).faptr++ = (double)(float)(VAL)), \ + 0)) + +#define _av_double(LIST,VAL) \ + ((LIST).aptr + 2 > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr += 2, \ + (LIST).tmp._double = (double)(VAL), \ + (LIST).aptr[-2] = (LIST).tmp.words[0], \ + (LIST).aptr[-1] = (LIST).tmp.words[1], \ + (LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] && (*(LIST).faptr++ = (LIST).tmp._double), \ + 0)) + +#endif + +#if defined(__powerpc_sysv4__) + +/* Up to __AV_FARG_NUM float or double non-varargs args can be passed in + * float registers, without occupying space in the general registers. + */ + +#define _av_float(LIST,VAL) \ + ((LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] \ + ? ((*(LIST).faptr++ = (double)(float)(VAL)), 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((float*)(LIST).aptr)[-1] = (float)(VAL), \ + 0))) + +#define _av_double(LIST,VAL) \ + ((LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] \ + ? ((*(LIST).faptr++ = (double)(VAL)), 0) \ + : ((LIST).aptr + 2 > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr += 2, \ + (LIST).tmp._double = (double)(VAL), \ + (LIST).aptr[-2] = (LIST).tmp.words[0], \ + (LIST).aptr[-1] = (LIST).tmp.words[1], \ + 0))) + +#endif + +#if defined(__powerpc64__) + +/* Up to __AV_FARG_NUM float or double non-varargs args can be passed in + * float registers, but we also push them into the corresponding int + * registers in case of varargs. + */ + +#if defined(_AIX) +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((float*)(LIST).aptr)[(LIST).flags & __AV_AIXCC_FLOAT_ARGS ? -2 : -1] = (float)(VAL), \ + (LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] && (*(LIST).faptr++ = (double)(float)(VAL)), \ + 0)) +#elif defined(_LITTLE_ENDIAN) +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((float*)(LIST).aptr)[-2] = (float)(VAL), \ + (LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] && (*(LIST).faptr++ = (double)(float)(VAL)), \ + 0)) +#else /* _BIG_ENDIAN */ +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((float*)(LIST).aptr)[-1] = (float)(VAL), \ + (LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] && (*(LIST).faptr++ = (double)(float)(VAL)), \ + 0)) +#endif + +#define _av_double(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((double*)(LIST).aptr)[-1] = (double)(VAL), \ + (LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] && (*(LIST).faptr++ = (double)(VAL)), \ + 0)) + +#endif + +#if defined(__ia64__) + +/* Up to 8 leading float or double non-varargs args can be passed in + * float registers, but we also push them into the corresponding int + * registers in case of varargs. + */ +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((*(float*)(LIST).aptr = (float)(VAL)), \ + ((LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] && (*(LIST).faptr = *(float*)(LIST).aptr, (LIST).faptr++)), \ + (LIST).aptr++, \ + 0)) + +#define _av_double(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + (*(double*)(LIST).aptr = (double)(VAL), \ + ((LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] && (*(LIST).faptr = *(double*)(LIST).aptr, (LIST).faptr++)), \ + (LIST).aptr++, \ + 0)) + +#endif + +#if defined(__x86_64_sysv__) + +/* Up to 8 leading float or double args can be passed in float registers. + */ +#define _av_float(LIST,VAL) \ + ((LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] \ + ? (*(LIST).faptr = 0.0, *(float*)(LIST).faptr = (float)(VAL), \ + (LIST).faptr++, \ + 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((*(float*)(LIST).aptr = (float)(VAL)), \ + (LIST).aptr++, \ + 0))) + +#define _av_double(LIST,VAL) \ + ((LIST).faptr < &(LIST).fargs[__AV_FARG_NUM] \ + ? (*(LIST).faptr = (double)(VAL), \ + (LIST).faptr++, \ + 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((*(double*)(LIST).aptr = (double)(VAL)), \ + (LIST).aptr++, \ + 0))) + +#endif + +#if defined(__x86_64_ms__) + +/* The float or double args among the first 4 argument words are passed + * in floating-point registers, but we also push them into the + * corresponding integer registers in case of varargs. + */ +#define _av_float(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + (((LIST).anum < 4 \ + ? ((LIST).farg_mask |= (1 << (LIST).anum), \ + (LIST).fargs[(LIST).anum] = *(float*)(LIST).aptr = (float)(VAL)) \ + : (*(float*)(LIST).aptr = (float)(VAL))), \ + (LIST).anum++, \ + (LIST).aptr++, \ + 0)) + +#define _av_double(LIST,VAL) \ + ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + (((LIST).anum < 4 \ + ? ((LIST).darg_mask |= (1 << (LIST).anum), \ + (LIST).dargs[(LIST).anum] = *(double*)(LIST).aptr = (double)(VAL)) \ + : (*(double*)(LIST).aptr = (double)(VAL))), \ + (LIST).anum++, \ + (LIST).aptr++, \ + 0)) + +#endif + +#if defined(__s390__) && !defined(__s390x__) + +/* Up to 2 float or double non-varargs args can be passed in + * float registers, without occupying space in the general registers. + */ + +#define _av_float(LIST,VAL) \ + ((LIST).fanum < __AV_FARG_NUM \ + ? ((LIST).fargs[(LIST).fanum] = (float)(VAL), \ + (LIST).farg_mask |= ((unsigned int) 1) << (LIST).fanum, \ + (LIST).fanum++, \ + 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((float*)(LIST).aptr)[-1] = (float)(VAL), \ + 0))) + +#define _av_double(LIST,VAL) \ + ((LIST).fanum < __AV_FARG_NUM \ + ? ((LIST).dargs[(LIST).fanum] = (double)(VAL), \ + (LIST).darg_mask |= ((unsigned int) 1) << (LIST).fanum, \ + (LIST).fanum++, \ + 0) \ + : ((LIST).aptr + 2 > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr += 2, \ + (LIST).tmp._double = (double)(VAL), \ + (LIST).aptr[-2] = (LIST).tmp.words[0], \ + (LIST).aptr[-1] = (LIST).tmp.words[1], \ + 0))) + +#endif + +#if defined(__s390x__) + +/* Up to __AV_FARG_NUM float or double args can be passed in float registers. */ +#define _av_float(LIST,VAL) \ + ((LIST).fanum < __AV_FARG_NUM \ + ? ((LIST).fargs[(LIST).fanum] = (float)(VAL), \ + (LIST).farg_mask |= ((unsigned int) 1) << (LIST).fanum, \ + (LIST).fanum++, \ + 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((LIST).aptr++, \ + ((float*)(LIST).aptr)[-1] = (float)(VAL), \ + 0))) + +#define _av_double(LIST,VAL) \ + ((LIST).fanum < __AV_FARG_NUM \ + ? ((LIST).dargs[(LIST).fanum] = (double)(VAL), \ + (LIST).darg_mask |= ((unsigned int) 1) << (LIST).fanum, \ + (LIST).fanum++, \ + 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((*(double*)(LIST).aptr = (double)(VAL)), \ + (LIST).aptr++, \ + 0))) + +#endif + +#if defined(__riscv32__) + +/* Up to __AV_FARG_NUM float or double args can be passed in float registers. + The remaining float or double args are passed in the general-purpose + argument sequence (first the integer registers, then the stack.) */ +#define _av_float(LIST,VAL) \ + ((LIST).fanum < __AV_FARG_NUM \ + ? ((LIST).fargs[(LIST).fanum] = (float)(VAL), \ + (LIST).farg_mask |= ((unsigned int) 1) << (LIST).fanum, \ + (LIST).fanum++, \ + 0) \ + : ((LIST).aptr >= (LIST).eptr \ + ? -1 : \ + ((*(float*)(LIST).aptr) = (float)(VAL), \ + (LIST).aptr++, \ + 0))) + +#define _av_double(LIST,VAL) \ + ((LIST).fanum < __AV_FARG_NUM \ + ? ((LIST).dargs[(LIST).fanum] = (double)(VAL), \ + (LIST).darg_mask |= ((unsigned int) 1) << (LIST).fanum, \ + (LIST).fanum++, \ + 0) \ + : ((LIST).aptr + 2 > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr += 2, \ + (LIST).tmp._double = (double)(VAL), \ + (LIST).aptr[-2] = (LIST).tmp.words[0], \ + (LIST).aptr[-1] = (LIST).tmp.words[1], \ + 0))) + +#endif + +/* + * structure argument types + */ + +extern void avcall_structcpy (void* dest, const void* src, unsigned long size, unsigned long alignment); + +#define __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,PLACE,VAL_ADDR) \ + avcall_structcpy(PLACE,VAL_ADDR,TYPE_SIZE,TYPE_ALIGN) + +/* Structure argument alignment. */ +#if defined(__i386__) && defined(_MSC_VER) +/* In MSVC, doubles inside structures have alignment 8, i.e. + * __AV_alignof(double) = 8, but doubles (and also structures containing + * doubles) are passed on the stack with alignment 4. Looks really weird. + */ +#define __av_struct_alignment(TYPE_ALIGN) \ + ((TYPE_ALIGN) <= 4 ? (TYPE_ALIGN) : 4) +#else +#define __av_struct_alignment(TYPE_ALIGN) \ + (TYPE_ALIGN) +#endif +#if defined(__i386__) || defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__alpha__) || defined(__hppa64__) || defined(__arm__) || defined(__armhf__) || defined(__powerpc_aix__) || defined(__powerpc64__) || defined(__ia64__) +/* Structures are passed as fully aligned structures on the arg stack. + * We align the aptr, store the structure, then fill to word alignment. + * Single-small-integer structures are NOT promoted to integers and have + * different alignment. + */ +/* little endian -> small structures < 1 word are adjusted to the left (i.e. occupy the low bits of the word) */ +#if defined(__i386__) || defined(__alpha__) || (defined(__arm__) && !defined(__armhf__) && defined(__ARMEL__)) +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__av_struct_alignment(TYPE_ALIGN)) > (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__av_struct_alignment(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__av_struct_alignment(TYPE_ALIGN)) +sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + 0)) +#endif +#if defined(__ia64__) +/* With GCC < 3, types larger than a word have 2-word alignment. */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + (((LIST).flags & __AV_OLDGCC_STRUCT_ARGS) \ + ? ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__av_struct_alignment(TYPE_ALIGN)), \ + ((TYPE_SIZE) > sizeof(__avword) && (((LIST).aptr - &(LIST).args[0]) & 1) ? ++(LIST).aptr : 0), \ + ((LIST).aptr > (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).aptr-(TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr+sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + 0))) \ + : ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__av_struct_alignment(TYPE_ALIGN)) > (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__av_struct_alignment(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__av_struct_alignment(TYPE_ALIGN)) +sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + 0))) +#endif +/* small structures < 1 word are adjusted depending on compiler */ +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) +#define __av_struct_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) > (LIST).eptr \ + ? -1 : \ + (++(LIST).anum, \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) +sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + 0)) +#define __av_struct_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + ++(LIST).anum, \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).aptr-(TYPE_SIZE)),VAL),\ + 0)) +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((LIST).flags & __AV_SGICC_STRUCT_ARGS \ + ? /* SGI MIPS cc passes small structures left-adjusted, although big-endian! */\ + __av_struct_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + : /* SGI MIPS gcc passes small structures within the first four words left- \ + * adjusted, for compatibility with cc. But structures in memory are passed \ + * right-adjusted!! See gcc-2.6.3/config/mips/mips.c:function_arg(). \ + */ \ + ((LIST).aptr < &(LIST).args[4] \ + ? __av_struct_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + : __av_struct_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL))) +#endif +#if defined(__mipsn32__) || defined(__mips64__) +/* When a structure is passed (partially) in registers, it is passed in the + * integer registers, except that doubles within the structure are passed in + * the floating point registers. Instead of distinguishing these cases, we + * always pass the structure in both the integer and the floating point + * registers. + */ +#define __av_struct_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) > (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) +sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + ((LIST).anum < 8 && ((LIST).darg_mask |= (-1 << (LIST).anum))), \ + (LIST).anum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword))/sizeof(__avword), \ + (LIST).darg_mask &= (1 << ((LIST).anum < 8 ? (LIST).anum : 8)) - 1, \ + 0)) +#define __av_struct_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).aptr-(TYPE_SIZE)),VAL), \ + ((LIST).anum < 8 && ((LIST).darg_mask |= (-1 << (LIST).anum))), \ + (LIST).anum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword))/sizeof(__avword), \ + (LIST).darg_mask &= (1 << ((LIST).anum < 8 ? (LIST).anum : 8)) - 1, \ + 0)) +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((LIST).flags & __AV_SGICC_STRUCT_ARGS \ + ? /* SGI MIPS cc and gcc >= 3.4 passes small structures left-adjusted, although big-endian! */\ + __av_struct_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + : /* SGI MIPS gcc < 3.4 passes small structures right-adjusted. */ \ + __av_struct_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL)) +#endif +#if (defined(__armhf__) && defined(__ARMEL__)) +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((((LIST).ianum*sizeof(__avword)+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) <= __AV_IARG_NUM*sizeof(__avword) \ + ? ((LIST).ianum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword))/sizeof(__avword), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)&(LIST).args[(LIST).ianum]-(TYPE_SIZE)),VAL), \ + 0) \ + : ((LIST).aptr == &(LIST).args[__AV_IARG_NUM] \ + ? /* split case */ \ + ((__avword*)(((((uintptr_t)&(LIST).args[(LIST).ianum]+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)&(LIST).args[(LIST).ianum]+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)&(LIST).args[(LIST).ianum]+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + (LIST).ianum = __AV_IARG_NUM, \ + 0)) \ + : ((__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + (LIST).ianum = __AV_IARG_NUM, \ + 0)))) +#endif +#if defined(__powerpc__) || defined(__powerpc64__) +#define __av_struct_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) > (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) +sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + 0)) +#define __av_struct_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).aptr-(TYPE_SIZE)),VAL), \ + 0)) +#if (defined(__powerpc__) && !defined(__powerpc64__)) || (defined(__powerpc64__) && defined(_BIG_ENDIAN)) +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((LIST).flags & __AV_AIXCC_STRUCT_ARGS \ + ? /* AIX cc and xlc pass small structures left-adjusted, although big-endian! */\ + __av_struct_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + : /* gcc passes small structures right-adjusted. */ \ + __av_struct_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL)) +#endif +#if (defined(__powerpc64__) && defined(_LITTLE_ENDIAN)) +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + __av_struct_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) +#endif +#endif +/* big endian -> small structures < 1 word are adjusted to the right (i.e. occupy the high bits of the word) */ +#if (defined(__arm__) && !defined(__armhf__) && !defined(__ARMEL__)) +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).aptr-(TYPE_SIZE)),VAL), \ + 0)) +#endif +#if (defined(__armhf__) && !defined(__ARMEL__)) +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((((LIST).ianum*sizeof(__avword)+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) <= __AV_IARG_NUM*sizeof(__avword) \ + ? ((LIST).ianum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword))/sizeof(__avword), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)&(LIST).args[(LIST).ianum]-(TYPE_SIZE)),VAL), \ + 0) \ + : ((LIST).aptr == &(LIST).args[__AV_IARG_NUM] \ + ? /* split case */ \ + ((__avword*)(((((uintptr_t)&(LIST).args[(LIST).ianum]+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((((uintptr_t)&(LIST).args[(LIST).ianum]+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).aptr-(TYPE_SIZE)),VAL), \ + (LIST).ianum = __AV_IARG_NUM, \ + 0)) \ + : ((__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).aptr-(TYPE_SIZE)),VAL), \ + (LIST).ianum = __AV_IARG_NUM, \ + 0)))) +#endif +#if defined(__hppa64__) +/* Structures are passed left-adjusted (although big-endian!). */ +#define __av_struct_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) > (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) +sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + 0)) +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + __av_struct_leftadjusted(LIST,TYPE_SIZE,(TYPE_SIZE)>sizeof(__avword)?2*sizeof(__avword):(TYPE_ALIGN),VAL) +#endif +#endif +#if defined(__m68k__) +/* Structures are passed as embedded copies on the arg stack. + */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).aptr-(TYPE_SIZE)),VAL),\ + 0)) +#endif +#if (defined(__sparc__) && !defined(__sparc64__)) +/* Structures are passed as pointers to caller-made local copies. We + * grab space for the copies from the end of the argument list space + * and always use maximal (double) alignment. + */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + (++(LIST).aptr \ + > ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL), \ + (LIST).aptr[-1] = (__avword)(LIST).eptr, \ + 0)) +#endif +#if defined(__sparc64__) +/* Structures <= 16 bytes are passed as embedded copies on the arg stack, + * left-adjusted (although big-endian!). + * When a structure is passed (partially) in registers, it is passed in the + * integer registers, except that floats and doubles within the structure + * are passed in the floating point registers. Instead of distinguishing + * these cases, we always pass the structure in both the integer and the + * floating point registers. + * Big structures are passed as pointers to caller-made local copies. + * FIXME: Shouldn't (LIST).anum be incremented in sync with (LIST).aptr ? + */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((TYPE_SIZE) > 16 \ + ? (++(LIST).aptr \ + > ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL), \ + (LIST).aptr[-1] = (__avword)(LIST).eptr, \ + 0)) \ + : ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) > (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) +sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + ((LIST).anum < 16 && ((LIST).darg_mask |= (-1 << (LIST).anum))), \ + (LIST).anum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avword)-1) & -(intptr_t)sizeof(__avword))/sizeof(__avword), \ + (LIST).darg_mask &= (1 << ((LIST).anum < 16 ? (LIST).anum : 16)) - 1, \ + 0))) +#endif +#if defined(__hppa__) && !defined(__hppa64__) +/* Structures <= 8 bytes are passed as embedded copies on the arg stack. + * Big structures are passed as pointers (to caller-made local copies + * with GCC >= 8, without copy otherwise). + */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((TYPE_SIZE) > 8 \ + ? (--(LIST).aptr \ + < ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr + (((TYPE_SIZE) + 7) & -8))) \ + ? -1 \ + : (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE) + 7) & -8)), VAL), \ + *(LIST).aptr = (__avword)((uintptr_t)(LIST).eptr - (((TYPE_SIZE) + 7) & -8)), \ + 0)) \ + : ((TYPE_SIZE) > 4 \ + ? ((__avword*)((((uintptr_t)(LIST).aptr & -8) - (intptr_t)(TYPE_SIZE)) & -8) < (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)((((uintptr_t)(LIST).aptr & -8) - (intptr_t)(TYPE_SIZE)) & -8), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).aptr,VAL), \ + 0)) \ + : /* FIXME: gcc-2.6.3 passes structures <= 4 bytes in memory left-adjusted! ?? */\ + ((__avword*)(((uintptr_t)(LIST).aptr & -4) - (intptr_t)(TYPE_SIZE)) < (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(((uintptr_t)(LIST).aptr & -4) - (intptr_t)(TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)((((uintptr_t)(LIST).aptr & -4) - (intptr_t)(TYPE_SIZE)) & -4), \ + 0)))) +#endif +#if defined(__arm64__) +/* Structures <= 16 bytes are passed as embedded copies on the arg stack. + * Big structures are passed as pointers to caller-made local copies. + */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((TYPE_SIZE) <= 16 \ + ? ((((LIST).ianum*sizeof(__avrword)+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) <= __AV_IARG_NUM*sizeof(__avrword) \ + ? (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)&(LIST).iargs[(LIST).ianum],VAL), \ + (LIST).ianum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avrword)-1) & -(intptr_t)sizeof(__avrword))/sizeof(__avrword), \ + 0) \ + : ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) > (LIST).eptr \ + ? -1 : \ + ((LIST).ianum = __AV_IARG_NUM, \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) +sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + 0))) \ + : ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).aptr \ + > ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL), \ + (LIST).iargs[(LIST).ianum++] = (__avrword)(LIST).eptr, \ + 0)) \ + : (((LIST).aptr += sizeof(void*)/sizeof(__avword)) \ + > ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL), \ + ((void**)(LIST).aptr)[-1] = (LIST).eptr, \ + 0)))) +#endif +#if defined(__powerpc_sysv4__) +/* Structures are passed as pointers to caller-made local copies. We + * grab space for the copies from the end of the argument list space + * and always use maximal (double) alignment. + */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).aptr \ + > ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL), \ + (LIST).iargs[(LIST).ianum++] = (__avrword)(LIST).eptr, \ + 0)) \ + : (++(LIST).aptr \ + > ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL), \ + (LIST).aptr[-1] = (__avword)(LIST).eptr, \ + 0))) +#endif +#if defined(__x86_64_sysv__) +/* Structures <= 16 bytes can be passed in integer or floating-point registers + if there is enough room for the whole number of words needed by the structure + in the corresponding iargs/fargs block. We can't distinguish the two cases + and support only passing in integer registers. Other structures are passed + on the arg stack. */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + (((TYPE_SIZE) <= 2*sizeof(__avword) \ + && (LIST).ianum + ((TYPE_SIZE) + sizeof(__avrword)-1) / sizeof(__avrword) <= __AV_IARG_NUM) \ + ? (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)&(LIST).iargs[(LIST).ianum],VAL), \ + (LIST).ianum += ((TYPE_SIZE) + sizeof(__avrword)-1) / sizeof(__avrword), \ + 0) \ + : ((__avword*)((uintptr_t)(LIST).aptr + (((TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__av_struct_alignment(TYPE_ALIGN))) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)((uintptr_t)(LIST).aptr + (((TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__av_struct_alignment(TYPE_ALIGN))), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).aptr - (((TYPE_SIZE)+__av_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__av_struct_alignment(TYPE_ALIGN))),VAL), \ + 0))) +#endif +#if defined(__x86_64_ms__) +/* Structures of 1, 2, 4, 8 bytes are passed as embedded copies on the arg stack. + * Big structures are passed as pointers to caller-made local copies. + */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8 \ + ? ((__avword*)((uintptr_t)(LIST).aptr + (((TYPE_SIZE)+sizeof(__avword)-1) & -(intptr_t)sizeof(__avword))) > (LIST).eptr \ + ? -1 : \ + ((LIST).aptr = (__avword*)((uintptr_t)(LIST).aptr + (((TYPE_SIZE)+sizeof(__avword)-1) & -(intptr_t)sizeof(__avword))), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)(LIST).aptr - (((TYPE_SIZE)+sizeof(__avword)-1) & -(intptr_t)sizeof(__avword))),VAL), \ + 0)) \ + : (++(LIST).aptr \ + > ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL), \ + (LIST).aptr[-1] = (__avword)(LIST).eptr, \ + 0))) +#endif +#if defined(__s390__) || defined(__s390x__) +/* Structures of 1, 2, 4, 8 bytes are passed as embedded copies on the arg stack. + * Big structures are passed as pointers to caller-made local copies. + */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8 \ + ? ((((LIST).ianum*sizeof(__avrword)+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) <= __AV_IARG_NUM*sizeof(__avrword) \ + ? ((LIST).ianum += (((((TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) + sizeof(__avrword)-1) & -(intptr_t)sizeof(__avrword))/sizeof(__avrword), \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((uintptr_t)&(LIST).iargs[(LIST).ianum]-(TYPE_SIZE)),VAL), \ + 0) \ + : ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) > (LIST).eptr \ + ? -1 : \ + ((LIST).ianum = __AV_IARG_NUM, \ + __av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) +sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + 0))) \ + : ((LIST).ianum < __AV_IARG_NUM \ + ? ((LIST).aptr \ + > ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL), \ + (LIST).iargs[(LIST).ianum++] = (__avrword)(LIST).eptr, \ + 0)) \ + : (++(LIST).aptr \ + > ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL), \ + (LIST).aptr[-1] = (__avword)(LIST).eptr, \ + 0)))) +#endif +#if defined(__riscv32__) || defined(__riscv64__) +/* Structures <= 16 bytes are passed as embedded copies on the arg stack. + * Big structures are passed as pointers to caller-made local copies. + */ +#define __av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL) \ + ((TYPE_SIZE) <= 2*sizeof(__avword) \ + ? ((__avword*)(((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) > (LIST).eptr \ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) - (TYPE_SIZE)),VAL), \ + (LIST).aptr = (__avword*)(((((uintptr_t)(LIST).aptr+(TYPE_SIZE)+(TYPE_ALIGN)-1) & -(intptr_t)(TYPE_ALIGN)) +sizeof(__avword)-1) & -(intptr_t)sizeof(__avword)), \ + 0)) \ + : (++(LIST).aptr \ + > ((LIST).eptr = (__avword*)((uintptr_t)(LIST).eptr - (((TYPE_SIZE)+7)&-8)))\ + ? -1 : \ + (__av_struct_copy(TYPE_SIZE,TYPE_ALIGN,(void*)(LIST).eptr,VAL), \ + (LIST).aptr[-1] = (__avword)(LIST).eptr, \ + 0))) +#endif + + +#endif /* _AVCALL_INTERNAL_H */ diff --git a/avcall/avcall-libapi.c b/avcall/avcall-libapi.c new file mode 100644 index 0000000..2de2080 --- /dev/null +++ b/avcall/avcall-libapi.c @@ -0,0 +1,89 @@ +/* + * Copyright 2017-2021 Bruno Haible + * + * 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, see . + */ + +#include "config.h" + +#include "avcall-internal.h" + +/* This is the implementation of the library API. + The symbols that the linker sees are all prefixed with 'avcall_', + to avoid potential collisions with other libraries. */ + +int avcall_overflown (av_alist* list) +{ + return _av_overflown(AV_LIST_INNER(list)); +} + +void avcall_start (av_alist* list, __avword* list_args, __avword* list_args_end, __avrword(*func)(), void* raddr, int rettype, int flags) +{ + __av_start(AV_LIST_INNER(list),list_args,list_args_end,func,raddr,rettype,flags); +} + +void avcall_start_struct (av_alist* list, __avword* list_args, __avword* list_args_end, __avrword(*func)(), size_t type_size, int type_splittable, void* raddr, int flags) +{ + __av_start_struct(AV_LIST_INNER(list),list_args,list_args_end,func,type_size,type_splittable,raddr,flags); +} + +int avcall_arg_int (av_alist* list, int val) +{ + return __av_int(AV_LIST_INNER(list),val); +} + +int avcall_arg_uint (av_alist* list, unsigned int val) +{ + return __av_uint(AV_LIST_INNER(list),val); +} + +int avcall_arg_long (av_alist* list, long val) +{ + return __av_long(AV_LIST_INNER(list),val); +} + +int avcall_arg_ulong (av_alist* list, unsigned long val) +{ + return __av_ulong(AV_LIST_INNER(list),val); +} + +int avcall_arg_ptr (av_alist* list, void* val) +{ + return __av_ptr(AV_LIST_INNER(list),val); +} + +int avcall_arg_longlong (av_alist* list, long long val) +{ + return __av_longlong(AV_LIST_INNER(list),val); +} + +int avcall_arg_ulonglong (av_alist* list, unsigned long long val) +{ + return __av_ulonglong(AV_LIST_INNER(list),val); +} + +int avcall_arg_float (av_alist* list, float val) +{ + return _av_float(AV_LIST_INNER(list),val); +} + +int avcall_arg_double (av_alist* list, double val) +{ + return _av_double(AV_LIST_INNER(list),val); +} + +int avcall_arg_struct (av_alist* list, size_t type_size, size_t type_align, const void* val_addr) +{ + return __av_struct(AV_LIST_INNER(list),type_size,type_align,val_addr); +} diff --git a/avcall/avcall-m68k-linux.s b/avcall/avcall-m68k-linux.s new file mode 100644 index 0000000..db2aa86 --- /dev/null +++ b/avcall/avcall-m68k-linux.s @@ -0,0 +1,165 @@ + .file "avcall-m68k.c" + .text + .align 2 + .globl avcall_call + .type avcall_call,@function +avcall_call: + link.w %a6,#0 + movm.l #0x3820,-(%sp) + move.l 8(%a6),%a2 + lea (-1024,%sp),%sp + move.l 24(%a2),%d1 + move.l 20(%a2),%d0 + sub.l %d1,%d0 + asr.l #2,%d0 + jble .L52 + move.l %sp,%a1 + move.l %d1,%a0 + move.l %d0,%d2 + .align 2 +.L6: + move.l (%a0)+,(%a1)+ + subq.l #1,%d2 + jbne .L6 +.L52: + moveq.l #16,%d0 + cmp.l 12(%a2),%d0 + jbeq .L57 +.L7: + move.l 4(%a2),%a0 + jsr (%a0) + move.l %d0,%d2 + move.l %d1,%d3 + move.l 12(%a2),%a1 + moveq.l #1,%d1 + cmp.l %a1,%d1 + jbeq .L9 + moveq.l #2,%d4 + cmp.l %a1,%d4 + jbeq .L56 + moveq.l #3,%d4 + cmp.l %a1,%d4 + jbeq .L56 + moveq.l #4,%d4 + cmp.l %a1,%d4 + jbeq .L56 + moveq.l #5,%d4 + cmp.l %a1,%d4 + jbeq .L55 + moveq.l #6,%d4 + cmp.l %a1,%d4 + jbeq .L55 + moveq.l #7,%d4 + cmp.l %a1,%d4 + jbeq .L53 + moveq.l #8,%d4 + cmp.l %a1,%d4 + jbeq .L53 + moveq.l #9,%d4 + cmp.l %a1,%d4 + jbeq .L53 + moveq.l #10,%d4 + cmp.l %a1,%d4 + jbeq .L53 + lea (-11,%a1),%a0 + moveq.l #1,%d4 + cmp.l %a0,%d4 + jbcc .L54 + moveq.l #13,%d4 + cmp.l %a1,%d4 + jbeq .L58 + moveq.l #14,%d4 + cmp.l %a1,%d4 + jbeq .L59 + moveq.l #15,%d0 + cmp.l %a1,%d0 + jbeq .L53 + moveq.l #16,%d1 + cmp.l %a1,%d1 + jbne .L9 + btst #1,2(%a2) + jbeq .L9 + move.l 16(%a2),%d0 + moveq.l #1,%d4 + cmp.l %d0,%d4 + jbeq .L56 + moveq.l #2,%d1 + cmp.l %d0,%d1 + jbeq .L55 + moveq.l #4,%d4 + cmp.l %d0,%d4 + jbeq .L53 + moveq.l #8,%d1 + cmp.l %d0,%d1 + jbne .L9 +.L54: + move.l 8(%a2),%a0 + move.l %d2,(%a0) + move.l %d3,4(%a0) + jbra .L9 + .align 2 +.L53: + move.l 8(%a2),%a0 + move.l %d2,(%a0) + jbra .L9 + .align 2 +.L55: + move.l 8(%a2),%a0 + move.w %d2,(%a0) + jbra .L9 + .align 2 +.L56: + move.l 8(%a2),%a0 + move.b %d2,(%a0) + jbra .L9 + .align 2 +.L59: + btst #6,3(%a2) + jbeq .L37 + move.l 8(%a2),%a0 + fmove.d %fp0,(%a0) + jbra .L9 + .align 2 +.L37: + move.l 8(%a2),%a0 + move.l %d0,(%a0) + move.l %d1,4(%a0) + jbra .L9 + .align 2 +.L58: + move.l (%a2),%d2 + btst #6,%d2 + jbeq .L31 + move.l 8(%a2),%a0 + fmove.s %fp0,(%a0) + jbra .L9 + .align 2 +.L31: + btst #5,%d2 + jbeq .L33 + move.l 8(%a2),%a0 + move.l %d1,-(%sp) + move.l %d0,-(%sp) + fmove.d (%sp)+,%fp0 + fmove.s %fp0,(%a0) + jbra .L9 + .align 2 +.L33: + move.l 8(%a2),%a0 + move.l %d0,(%a0) + jbra .L9 + .align 2 +.L57: +#APP + move.l 8(%a2),%a1 +#NO_APP + jbra .L7 + .align 2 +.L9: + clr.l %d0 + movm.l -16(%a6),#0x41c + unlk %a6 + rts +.Lfe1: + .size avcall_call,.Lfe1-avcall_call + .ident "GCC: (GNU) 3.1" diff --git a/avcall/avcall-m68k-sun.s b/avcall/avcall-m68k-sun.s new file mode 100644 index 0000000..41656cc --- /dev/null +++ b/avcall/avcall-m68k-sun.s @@ -0,0 +1,161 @@ +#NO_APP + .text + .even + .globl _avcall_call +_avcall_call: + link a6,#0 + moveml #0x3820,sp@- + movel a6@(8),a2 + lea sp@(-1024),sp + movel a2@(24),d1 + movel a2@(20),d0 + subl d1,d0 + asrl #2,d0 + jle L52 + movel sp,a1 + movel d1,a0 + movel d0,d2 + .even +L6: + movel a0@+,a1@+ + subql #1,d2 + jne L6 +L52: + moveq #16,d0 + cmpl a2@(12),d0 + jeq L57 +L7: + movel a2@(4),a0 + jsr a0@ + movel d0,d2 + movel d1,d3 + movel a2@(12),a1 + moveq #1,d1 + cmpl a1,d1 + jeq L9 + moveq #2,d4 + cmpl a1,d4 + jeq L56 + moveq #3,d4 + cmpl a1,d4 + jeq L56 + moveq #4,d4 + cmpl a1,d4 + jeq L56 + moveq #5,d4 + cmpl a1,d4 + jeq L55 + moveq #6,d4 + cmpl a1,d4 + jeq L55 + moveq #7,d4 + cmpl a1,d4 + jeq L53 + moveq #8,d4 + cmpl a1,d4 + jeq L53 + moveq #9,d4 + cmpl a1,d4 + jeq L53 + moveq #10,d4 + cmpl a1,d4 + jeq L53 + lea a1@(-11),a0 + moveq #1,d4 + cmpl a0,d4 + jcc L54 + moveq #13,d4 + cmpl a1,d4 + jeq L58 + moveq #14,d4 + cmpl a1,d4 + jeq L59 + moveq #15,d0 + cmpl a1,d0 + jeq L53 + moveq #16,d1 + cmpl a1,d1 + jne L9 + btst #1,a2@(2) + jeq L9 + movel a2@(16),d0 + moveq #1,d4 + cmpl d0,d4 + jeq L56 + moveq #2,d1 + cmpl d0,d1 + jeq L55 + moveq #4,d4 + cmpl d0,d4 + jeq L53 + moveq #8,d1 + cmpl d0,d1 + jne L9 +L54: + movel a2@(8),a0 + movel d2,a0@ + movel d3,a0@(4) + jra L9 + .even +L53: + movel a2@(8),a0 + movel d2,a0@ + jra L9 + .even +L55: + movel a2@(8),a0 + movew d2,a0@ + jra L9 + .even +L56: + movel a2@(8),a0 + moveb d2,a0@ + jra L9 + .even +L59: + btst #6,a2@(3) + jeq L37 + movel a2@(8),a0 + fmoved fp0,a0@ + jra L9 + .even +L37: + movel a2@(8),a0 + movel d0,a0@ + movel d1,a0@(4) + jra L9 + .even +L58: + movel a2@,d2 + btst #6,d2 + jeq L31 + movel a2@(8),a0 + fmoves fp0,a0@ + jra L9 + .even +L31: + btst #5,d2 + jeq L33 + movel a2@(8),a0 + movel d1,sp@- + movel d0,sp@- + fmoved sp@+,fp0 + fmoves fp0,a0@ + jra L9 + .even +L33: + movel a2@(8),a0 + movel d0,a0@ + jra L9 + .even +L57: +#APP + movel a2@(8),a1 +#NO_APP + jra L7 + .even +L9: + clrl d0 + moveml a6@(-16),#0x41c + unlk a6 + rts diff --git a/avcall/avcall-m68k.c b/avcall/avcall-m68k.c new file mode 100644 index 0000000..b45a2cc --- /dev/null +++ b/avcall/avcall-m68k.c @@ -0,0 +1,145 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for a m68k Sun3 with gcc/sun-cc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + M68k Argument Passing Conventions: + + All arguments are passed on the stack with word alignment. Doubles take + two words. Structure args are passed as true structures embedded in the + argument stack. To return a structure, the called function copies the + return value to the address supplied in register "a1". Gcc without + -fpcc-struct-return returns <= 4 byte structures as integers. + + Compile this routine with gcc -O (or -O2 or -g -O) to get the right + register variables, or use the assembler version. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("sp"); /* C names for registers */ + register __avword* sret __asm__("a1"); /* structure return pointer */ +/*register __avrword iret __asm__("d0"); */ + register __avrword iret2 __asm__("d1"); + register float fret __asm__("d0"); /* d0 */ + register double dret __asm__("d0"); /* d0,d1 */ + register float fp_fret __asm__("fp0"); + register double fp_dret __asm__("fp0"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + __avrword i; + __avrword i2; + + for (i = 0; i < arglen; i++) /* push function args onto stack */ + argframe[i] = l->args[i]; + + if (l->rtype == __AVstruct) /* push struct return address */ + __asm__("move%.l %0,%/a1" : : "g" (l->raddr)); + + i = (*l->func)(); /* call function */ + i2 = iret2; + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, i); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, i); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, i); + } else + if (l->rtype == __AVshort) { + RETURN(short, i); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, i); + } else + if (l->rtype == __AVint) { + RETURN(int, i); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, i); + } else + if (l->rtype == __AVlong) { + RETURN(long, i); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, i); + } else + if (l->rtype == __AVlonglong || l->rtype == __AVulonglong) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = i2; + } else + if (l->rtype == __AVfloat) { + if (l->flags & __AV_FREG_FLOAT_RETURN) { + RETURN(float, fp_fret); + } else { + if (l->flags & __AV_SUNCC_FLOAT_RETURN) { + RETURN(float, (float)dret); + } else { + RETURN(float, fret); + } + } + } else + if (l->rtype == __AVdouble) { + if (l->flags & __AV_FREG_FLOAT_RETURN) { + RETURN(double, fp_dret); + } else { + RETURN(double, dret); + } + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, i); + } else + if (l->rtype == __AVstruct) { + /* NB: On m68k, all structure sizes are divisible by 2. */ + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + if (l->rsize == sizeof(char)) { /* can't occur */ + RETURN(char, i); + } else + if (l->rsize == sizeof(short)) { + RETURN(short, i); + } else + if (l->rsize == sizeof(int)) { + RETURN(int, i); + } else + if (l->rsize == 2*sizeof(__avrword)) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = i2; + } + } + } + return 0; +} diff --git a/avcall/avcall-m68k.mit.S b/avcall/avcall-m68k.mit.S new file mode 100644 index 0000000..2c668a6 --- /dev/null +++ b/avcall/avcall-m68k.mit.S @@ -0,0 +1,164 @@ +#include "asm-m68k.h" + .text + .even + .globl C(avcall_call) + DECLARE_FUNCTION(avcall_call) +FUNBEGIN(avcall_call) + link $a6,#0 + moveml #0x3820,$sp@- + movel $a6@(8),$a2 + lea $sp@(-1024),$sp + movel $a2@(24),$d1 + movel $a2@(20),$d0 + subl $d1,$d0 + asrl #2,$d0 + jle L(52) + movel $sp,$a1 + movel $d1,$a0 + movel $d0,$d2 + .even +L(6): + movel $a0@+,$a1@+ + subql #1,$d2 + jne L(6) +L(52): + moveq #16,$d0 + cmpl $a2@(12),$d0 + jeq L(57) +L(7): + movel $a2@(4),$a0 + jsr $a0@ + movel $d0,$d2 + movel $d1,$d3 + movel $a2@(12),$a1 + moveq #1,$d1 + cmpl $a1,$d1 + jeq L(9) + moveq #2,$d4 + cmpl $a1,$d4 + jeq L(56) + moveq #3,$d4 + cmpl $a1,$d4 + jeq L(56) + moveq #4,$d4 + cmpl $a1,$d4 + jeq L(56) + moveq #5,$d4 + cmpl $a1,$d4 + jeq L(55) + moveq #6,$d4 + cmpl $a1,$d4 + jeq L(55) + moveq #7,$d4 + cmpl $a1,$d4 + jeq L(53) + moveq #8,$d4 + cmpl $a1,$d4 + jeq L(53) + moveq #9,$d4 + cmpl $a1,$d4 + jeq L(53) + moveq #10,$d4 + cmpl $a1,$d4 + jeq L(53) + lea $a1@(-11),$a0 + moveq #1,$d4 + cmpl $a0,$d4 + jcc L(54) + moveq #13,$d4 + cmpl $a1,$d4 + jeq L(58) + moveq #14,$d4 + cmpl $a1,$d4 + jeq L(59) + moveq #15,$d0 + cmpl $a1,$d0 + jeq L(53) + moveq #16,$d1 + cmpl $a1,$d1 + jne L(9) + btst #1,$a2@(2) + jeq L(9) + movel $a2@(16),$d0 + moveq #1,$d4 + cmpl $d0,$d4 + jeq L(56) + moveq #2,$d1 + cmpl $d0,$d1 + jeq L(55) + moveq #4,$d4 + cmpl $d0,$d4 + jeq L(53) + moveq #8,$d1 + cmpl $d0,$d1 + jne L(9) +L(54): + movel $a2@(8),$a0 + movel $d2,$a0@ + movel $d3,$a0@(4) + jra L(9) + .even +L(53): + movel $a2@(8),$a0 + movel $d2,$a0@ + jra L(9) + .even +L(55): + movel $a2@(8),$a0 + movew $d2,$a0@ + jra L(9) + .even +L(56): + movel $a2@(8),$a0 + moveb $d2,$a0@ + jra L(9) + .even +L(59): + btst #6,$a2@(3) + jeq L(37) + movel $a2@(8),$a0 + fmoved $fp0,$a0@ + jra L(9) + .even +L(37): + movel $a2@(8),$a0 + movel $d0,$a0@ + movel $d1,$a0@(4) + jra L(9) + .even +L(58): + movel $a2@,$d2 + btst #6,$d2 + jeq L(31) + movel $a2@(8),$a0 + fmoves $fp0,$a0@ + jra L(9) + .even +L(31): + btst #5,$d2 + jeq L(33) + movel $a2@(8),$a0 + movel $d1,$sp@- + movel $d0,$sp@- + fmoved $sp@+,$fp0 + fmoves $fp0,$a0@ + jra L(9) + .even +L(33): + movel $a2@(8),$a0 + movel $d0,$a0@ + jra L(9) + .even +L(57): + movel $a2@(8),$a1 + jra L(7) + .even +L(9): + clrl $d0 + moveml $a6@(-16),#0x41c + unlk $a6 + rts +FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-m68k.motorola.S b/avcall/avcall-m68k.motorola.S new file mode 100644 index 0000000..fd653fe --- /dev/null +++ b/avcall/avcall-m68k.motorola.S @@ -0,0 +1,165 @@ +#include "asm-m68k.h" + .text + .align 2 + .globl C(avcall_call) + DECLARE_FUNCTION(avcall_call) +FUNBEGIN(avcall_call) + link.w %a6,#0 + movm.l #0x3820,-(%sp) + move.l 8(%a6),%a2 + lea (-1024,%sp),%sp + move.l 24(%a2),%d1 + move.l 20(%a2),%d0 + sub.l %d1,%d0 + asr.l #2,%d0 + jble L(52) + move.l %sp,%a1 + move.l %d1,%a0 + move.l %d0,%d2 + .align 2 +L(6): + move.l (%a0)+,(%a1)+ + subq.l #1,%d2 + jbne L(6) +L(52): + moveq.l #16,%d0 + cmp.l 12(%a2),%d0 + jbeq L(57) +L(7): + move.l 4(%a2),%a0 + jsr (%a0) + move.l %d0,%d2 + move.l %d1,%d3 + move.l 12(%a2),%a1 + moveq.l #1,%d1 + cmp.l %a1,%d1 + jbeq L(9) + moveq.l #2,%d4 + cmp.l %a1,%d4 + jbeq L(56) + moveq.l #3,%d4 + cmp.l %a1,%d4 + jbeq L(56) + moveq.l #4,%d4 + cmp.l %a1,%d4 + jbeq L(56) + moveq.l #5,%d4 + cmp.l %a1,%d4 + jbeq L(55) + moveq.l #6,%d4 + cmp.l %a1,%d4 + jbeq L(55) + moveq.l #7,%d4 + cmp.l %a1,%d4 + jbeq L(53) + moveq.l #8,%d4 + cmp.l %a1,%d4 + jbeq L(53) + moveq.l #9,%d4 + cmp.l %a1,%d4 + jbeq L(53) + moveq.l #10,%d4 + cmp.l %a1,%d4 + jbeq L(53) + lea (-11,%a1),%a0 + moveq.l #1,%d4 + cmp.l %a0,%d4 + jbcc L(54) + moveq.l #13,%d4 + cmp.l %a1,%d4 + jbeq L(58) + moveq.l #14,%d4 + cmp.l %a1,%d4 + jbeq L(59) + moveq.l #15,%d0 + cmp.l %a1,%d0 + jbeq L(53) + moveq.l #16,%d1 + cmp.l %a1,%d1 + jbne L(9) + btst #1,2(%a2) + jbeq L(9) + move.l 16(%a2),%d0 + moveq.l #1,%d4 + cmp.l %d0,%d4 + jbeq L(56) + moveq.l #2,%d1 + cmp.l %d0,%d1 + jbeq L(55) + moveq.l #4,%d4 + cmp.l %d0,%d4 + jbeq L(53) + moveq.l #8,%d1 + cmp.l %d0,%d1 + jbne L(9) +L(54): + move.l 8(%a2),%a0 + move.l %d2,(%a0) + move.l %d3,4(%a0) + jbra L(9) + .align 2 +L(53): + move.l 8(%a2),%a0 + move.l %d2,(%a0) + jbra L(9) + .align 2 +L(55): + move.l 8(%a2),%a0 + move.w %d2,(%a0) + jbra L(9) + .align 2 +L(56): + move.l 8(%a2),%a0 + move.b %d2,(%a0) + jbra L(9) + .align 2 +L(59): + btst #6,3(%a2) + jbeq L(37) + move.l 8(%a2),%a0 + fmove.d %fp0,(%a0) + jbra L(9) + .align 2 +L(37): + move.l 8(%a2),%a0 + move.l %d0,(%a0) + move.l %d1,4(%a0) + jbra L(9) + .align 2 +L(58): + move.l (%a2),%d2 + btst #6,%d2 + jbeq L(31) + move.l 8(%a2),%a0 + fmove.s %fp0,(%a0) + jbra L(9) + .align 2 +L(31): + btst #5,%d2 + jbeq L(33) + move.l 8(%a2),%a0 + move.l %d1,-(%sp) + move.l %d0,-(%sp) + fmove.d (%sp)+,%fp0 + fmove.s %fp0,(%a0) + jbra L(9) + .align 2 +L(33): + move.l 8(%a2),%a0 + move.l %d0,(%a0) + jbra L(9) + .align 2 +L(57): + move.l 8(%a2),%a1 + jbra L(7) + .align 2 +L(9): + clr.l %d0 + movm.l -16(%a6),#0x41c + unlk %a6 + rts +L(fe1): + FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-mips.c b/avcall/avcall-mips.c new file mode 100644 index 0000000..503511b --- /dev/null +++ b/avcall/avcall-mips.c @@ -0,0 +1,152 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + Copyright 2005 Thiemo Seufer + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for an SGI MIPS with gcc/sgi-cc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + SGI MIPS Argument Passing Conventions + + - The entire argument list forms a structure with all the appropriate + holes & alignments, and space for this is allocated in the stack frame. + - Shorter integers are promoted to word length (sizeof(int)=sizeof(long)=4). + - Doubles are 2 words aligned on even boundaries. + - The first 4 words of the structure are passed in registers $4...$7, stack + space for these is always allocated. Remaining words are passed on the + stack. + - If the first two args are floats or doubles, they are also passed in $f12 + and $f14. But varargs functions will expect them in the integer registers + and we can't tell whether the function is varargs so we pass them both ways. + - GCC 3.3.x and 3.4.x pass the next args after two floats in $7 and on the + stack, instead of in $6, $7, and on the stack. This is a bug that is fixed + in GCC 4.0.4. We don't support these versions of GCC on mips with -mabi=32. + - Structure arguments are copies embedded in the arglist structure. + - Structure returns are pointers to caller-allocated space passed in as the + first argument of the list. The function also returns the pointer. + - Integer/pointer returns are in $2, float/double returns in $f0. + - Under IRIX 5, the called function expects to see its own address in $25. + + This file needs to be compiled with gcc for the asm extensions, but the + assembly version of it and the header file seem to work with SGI cc. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) +#define OFFSETOF(struct,member) ((int)&(((struct*)0)->member)) + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("$sp"); /* C names for registers */ + register __avrword iret2 __asm__("$3"); + register float fret_tmp __asm__("$f0"); + register double dret_tmp __asm__("$f0"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword *space = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* big space for child's stack frame */ + __avword *argframe = sp; /* stack offset for argument list is 0 */ + int arglen = l->aptr - l->args; + int i; + __avrword iret; + float fret; + double dret; + + /* load leading float args */ + if (l->farg_mask & (1 << 0)) + __asm__("l.s $f12,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[0])); + if (l->darg_mask & (1 << 0)) + __asm__("l.d $f12,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,dargs[0])); + if (l->farg_mask & (1 << 1)) + __asm__("l.s $f14,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[1])); + if (l->darg_mask & (1 << 1)) + __asm__("l.d $f14,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,dargs[1])); + + for (i = 4; i < arglen; i++) /* push excess function args */ + argframe[i] = l->args[i]; + + /* Note: The code of this call ought to put the address of the called function + in register $25 before the call. */ + iret = (*l->func)(l->args[0], l->args[1], /* call function with 1st 4 args */ + l->args[2], l->args[3]); + fret = fret_tmp; + dret = dret_tmp; + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, iret); + } else + if (l->rtype == __AVlonglong || l->rtype == __AVulonglong) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = iret; + ((__avrword*)raddr)[1] = iret2; + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_SMALL_STRUCT_RETURN) { + if (l->rsize == sizeof(char)) { + RETURN(char, iret); + } else + if (l->rsize == sizeof(short)) { + RETURN(short, iret); + } else + if (l->rsize == sizeof(int)) { + RETURN(int, iret); + } + } + } + return 0; +} diff --git a/avcall/avcall-mips64.c b/avcall/avcall-mips64.c new file mode 100644 index 0000000..22913cf --- /dev/null +++ b/avcall/avcall-mips64.c @@ -0,0 +1,492 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for an SGI 64-bit MIPS with sgi-cc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + SGI MIPS 64-bit Argument Passing Conventions + + - The entire argument list forms a structure with all the appropriate + holes & alignments, and space for this is allocated in the stack frame. + - Shorter integers are promoted to longword length (sizeof(long)=8). + - Doubles are 1 longword. + - Structure arguments are copies embedded in the arglist structure. + - The first 8 longwords of the structure are passed in registers $4...$11, + except that float arguments are passed in registers $f12...$f19, and + that double arguments and structure elements of type double are passed + in registers $f12...$f19. (But varargs functions may expect them in the + integer registers and we can't tell whether the function is varargs so + we pass them both ways.) + Remaining longwords are passed on the stack. No stack space is allocated + for the first 8 longwords of the structure. + - Structure returns of structures > 16 bytes: pointers to caller-allocated + space are passed in as the first argument of the list. + - Structure returns of structures <= 16 bytes: in the registers $2 (for the + first 8 bytes) and $3 (for the next 8 bytes). + A structure of 1 or 2 floats or doubles is returned in $f0 and $f2: + the first float or double in $f0, the second float or double in $f2. + - Integer/pointer returns are in $2, float/double returns in $f0. + - The called function expects to see its own address in $25. + + This file needs to be compiled with gcc for the asm extensions, but the + assembly version of it and the header file seem to work with SGI cc. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) +#define OFFSETOF(struct,member) ((int)&(((struct*)0)->member)) + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("$sp"); /* C names for registers */ + register float fret __asm__("$f0"); + register double dret __asm__("$f0"); +/*register __avrword iret1 __asm__("$2"); */ + register __avrword iret2 __asm__("$3"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + __avrword iret; + int i; + + if (l->farg_mask) + { /* push leading float args */ + if (l->farg_mask & (1<<0)) + __asm__("lwc1 $f12,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[0])); + if (l->farg_mask & (1<<1)) + __asm__("lwc1 $f13,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[1])); + if (l->farg_mask & (1<<2)) + __asm__("lwc1 $f14,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[2])); + if (l->farg_mask & (1<<3)) + __asm__("lwc1 $f15,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[3])); + if (l->farg_mask & (1<<4)) + __asm__("lwc1 $f16,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[4])); + if (l->farg_mask & (1<<5)) + __asm__("lwc1 $f17,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[5])); + if (l->farg_mask & (1<<6)) + __asm__("lwc1 $f18,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[6])); + if (l->farg_mask & (1<<7)) + __asm__("lwc1 $f19,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[7])); + } + if (l->darg_mask) + { /* push leading double args */ + __avword* a = l->args; + if (l->darg_mask & (1<<0)) + __asm__("ldc1 $f12,%1(%0)" : : "p" (a), "i" (0 * sizeof (__avword))); + if (l->darg_mask & (1<<1)) + __asm__("ldc1 $f13,%1(%0)" : : "p" (a), "i" (1 * sizeof (__avword))); + if (l->darg_mask & (1<<2)) + __asm__("ldc1 $f14,%1(%0)" : : "p" (a), "i" (2 * sizeof (__avword))); + if (l->darg_mask & (1<<3)) + __asm__("ldc1 $f15,%1(%0)" : : "p" (a), "i" (3 * sizeof (__avword))); + if (l->darg_mask & (1<<4)) + __asm__("ldc1 $f16,%1(%0)" : : "p" (a), "i" (4 * sizeof (__avword))); + if (l->darg_mask & (1<<5)) + __asm__("ldc1 $f17,%1(%0)" : : "p" (a), "i" (5 * sizeof (__avword))); + if (l->darg_mask & (1<<6)) + __asm__("ldc1 $f18,%1(%0)" : : "p" (a), "i" (6 * sizeof (__avword))); + if (l->darg_mask & (1<<7)) + __asm__("ldc1 $f19,%1(%0)" : : "p" (a), "i" (7 * sizeof (__avword))); + } + + for (i = 8; i < arglen; i++) /* push excess function args */ + argframe[i-8] = l->args[i]; + + /* call function with 1st 8 args */ + __asm__ __volatile__ ("ld $4,%0" : : "m" (l->args[0]) : "$4"); /* arg1 = l->args[0]; */ + __asm__ __volatile__ ("ld $5,%0" : : "m" (l->args[1]) : "$5"); /* arg1 = l->args[1]; */ + __asm__ __volatile__ ("ld $6,%0" : : "m" (l->args[2]) : "$6"); /* arg1 = l->args[2]; */ + __asm__ __volatile__ ("ld $7,%0" : : "m" (l->args[3]) : "$7"); /* arg1 = l->args[3]; */ + __asm__ __volatile__ ("ld $8,%0" : : "m" (l->args[4]) : "$8"); /* arg1 = l->args[4]; */ + __asm__ __volatile__ ("ld $9,%0" : : "m" (l->args[5]) : "$9"); /* arg1 = l->args[5]; */ + __asm__ __volatile__ ("ld $10,%0" : : "m" (l->args[6]) : "$10"); /* arg1 = l->args[6]; */ + __asm__ __volatile__ ("ld $11,%0" : : "m" (l->args[7]) : "$11"); /* arg1 = l->args[7]; */ + /* Note: The code of this call ought to put the address of the called function + in register $25 before the call. */ + iret = (*l->func)(); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, iret); + } else + if (l->rtype == __AVlonglong) { + RETURN(long long, iret); + } else + if (l->rtype == __AVulonglong) { + RETURN(unsigned long long, iret); + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + if (l->flags & __AV_GCC_STRUCT_RETURN) { + /* gcc returns structs of size 1,2,4,8 in registers. */ + if (l->rsize == sizeof(char)) { + RETURN(char, iret); + } else + if (l->rsize == sizeof(short)) { + RETURN(short, iret); + } else + if (l->rsize == sizeof(int)) { + RETURN(int, iret); + } else + if (l->rsize == sizeof(long)) { + RETURN(long, iret); + } + } else { + /* cc returns structs of size <= 16 in registers. */ + if (l->rsize > 0 && l->rsize <= 16) { + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize == 1) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + #endif + } else + if (l->rsize == 2) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + #endif + } else + if (l->rsize == 3) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + #endif + } else + if (l->rsize == 4) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + #endif + } else + if (l->rsize == 5) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + #endif + } else + if (l->rsize == 6) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + #endif + } else + if (l->rsize == 7) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>8); + #endif + } else + if (l->rsize >= 8 && l->rsize <= 16) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[7] = (unsigned char)(iret>>56); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[7] = (unsigned char)(iret); + #endif + if (l->rsize == 8) { + } else + if (l->rsize == 9) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + #endif + } else + if (l->rsize == 10) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + #endif + } else + if (l->rsize == 11) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + #endif + } else + if (l->rsize == 12) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + #endif + } else + if (l->rsize == 13) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + #endif + } else + if (l->rsize == 14) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + #endif + } else + if (l->rsize == 15) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>8); + #endif + } else + if (l->rsize == 16) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+7] = (unsigned char)(iret2>>56); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+7] = (unsigned char)(iret2); + #endif + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 2*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__avrword) */ + #if defined(_MIPSEL) + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (end_offset*8-1)) - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret >> (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[1] ^= (wordaddr[1] ^ ((iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = ((__avrword)2 << (end_offset*8-2*sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*8-start_offset*8)) | (iret2 << (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 >> (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } + #else + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - ((__avrword)1 << (sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + __avrword mask1 = - ((__avrword)1 << (2*sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret << (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = - ((__avrword)1 << (2*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] ^= (wordaddr[1] ^ ((iret << (sizeof(__avrword)*4-start_offset*4) << (sizeof(__avrword)*4-start_offset*4)) | (iret2 >> (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = - ((__avrword)1 << (3*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] = (iret << (sizeof(__avrword)*8-start_offset*8)) | (iret2 >> (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 << (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } + #endif + #endif + } + } + } + } + return 0; +} diff --git a/avcall/avcall-mips64eb-linux.s b/avcall/avcall-mips64eb-linux.s new file mode 100644 index 0000000..1d77c55 --- /dev/null +++ b/avcall/avcall-mips64eb-linux.s @@ -0,0 +1,733 @@ + .file 1 "avcall-mips64.c" + .section .mdebug.abi64 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + .type avcall_call, @function +avcall_call: + .frame $fp,32,$31 # vars= 0, regs= 4/0, args= 0, gp= 0 + .mask 0xd0010000,-8 + .fmask 0x00000000,0 + ld $2,40($4) + ld $12,48($4) + lw $3,68($4) + daddiu $sp,$sp,-32 + dsubu $6,$2,$12 + dsra $6,$6,3 + sd $fp,16($sp) + sd $16,0($sp) + sd $31,24($sp) + move $fp,$sp + daddiu $sp,$sp,-2064 + move $16,$4 + sll $6,$6,0 + .set noreorder + .set nomacro + beq $3,$0,.L2 + move $2,$sp + .set macro + .set reorder + + andi $4,$3,0x1 + .set noreorder + .set nomacro + beq $4,$0,.L123 + andi $4,$3,0x2 + .set macro + .set reorder + +#APP + # 77 "avcall-mips64.c" 1 + lwc1 $f12,76($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x2 +.L123: + .set noreorder + .set nomacro + beq $4,$0,.L124 + andi $4,$3,0x4 + .set macro + .set reorder + +#APP + # 79 "avcall-mips64.c" 1 + lwc1 $f13,80($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x4 +.L124: + .set noreorder + .set nomacro + beq $4,$0,.L125 + andi $4,$3,0x8 + .set macro + .set reorder + +#APP + # 81 "avcall-mips64.c" 1 + lwc1 $f14,84($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x8 +.L125: + .set noreorder + .set nomacro + beq $4,$0,.L126 + andi $4,$3,0x10 + .set macro + .set reorder + +#APP + # 83 "avcall-mips64.c" 1 + lwc1 $f15,88($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x10 +.L126: + .set noreorder + .set nomacro + beq $4,$0,.L127 + andi $4,$3,0x20 + .set macro + .set reorder + +#APP + # 85 "avcall-mips64.c" 1 + lwc1 $f16,92($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x20 +.L127: + .set noreorder + .set nomacro + beq $4,$0,.L128 + andi $4,$3,0x40 + .set macro + .set reorder + +#APP + # 87 "avcall-mips64.c" 1 + lwc1 $f17,96($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x40 +.L128: + .set noreorder + .set nomacro + beql $4,$0,.L129 + andi $3,$3,0x80 + .set macro + .set reorder + +#APP + # 89 "avcall-mips64.c" 1 + lwc1 $f18,100($16) + # 0 "" 2 +#NO_APP + andi $3,$3,0x80 +.L129: + bne $3,$0,.L116 +.L2: + lw $3,72($16) +.L122: + .set noreorder + .set nomacro + beql $3,$0,.L121 + slt $3,$6,9 + .set macro + .set reorder + + andi $4,$3,0x1 + .set noreorder + .set nomacro + beq $4,$0,.L130 + andi $4,$3,0x2 + .set macro + .set reorder + +#APP + # 97 "avcall-mips64.c" 1 + ldc1 $f12,0($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x2 +.L130: + .set noreorder + .set nomacro + beq $4,$0,.L131 + andi $4,$3,0x4 + .set macro + .set reorder + +#APP + # 99 "avcall-mips64.c" 1 + ldc1 $f13,8($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x4 +.L131: + .set noreorder + .set nomacro + beq $4,$0,.L132 + andi $4,$3,0x8 + .set macro + .set reorder + +#APP + # 101 "avcall-mips64.c" 1 + ldc1 $f14,16($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x8 +.L132: + .set noreorder + .set nomacro + beq $4,$0,.L133 + andi $4,$3,0x10 + .set macro + .set reorder + +#APP + # 103 "avcall-mips64.c" 1 + ldc1 $f15,24($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x10 +.L133: + .set noreorder + .set nomacro + beq $4,$0,.L134 + andi $4,$3,0x20 + .set macro + .set reorder + +#APP + # 105 "avcall-mips64.c" 1 + ldc1 $f16,32($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x20 +.L134: + .set noreorder + .set nomacro + beq $4,$0,.L135 + andi $4,$3,0x40 + .set macro + .set reorder + +#APP + # 107 "avcall-mips64.c" 1 + ldc1 $f17,40($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x40 +.L135: + .set noreorder + .set nomacro + beql $4,$0,.L136 + andi $3,$3,0x80 + .set macro + .set reorder + +#APP + # 109 "avcall-mips64.c" 1 + ldc1 $f18,48($12) + # 0 "" 2 +#NO_APP + andi $3,$3,0x80 +.L136: + bne $3,$0,.L117 + slt $3,$6,9 +.L121: + .set noreorder + .set nomacro + bne $3,$0,.L22 + daddiu $4,$12,64 + .set macro + .set reorder + + li $3,8 # 0x8 + .align 3 +.L21: + ld $5,0($4) + addiu $3,$3,1 + daddiu $4,$4,8 + sd $5,0($2) + .set noreorder + .set nomacro + bne $6,$3,.L21 + daddiu $2,$2,8 + .set macro + .set reorder + +.L22: +#APP + # 118 "avcall-mips64.c" 1 + ld $4,0($12) + # 0 "" 2 + # 119 "avcall-mips64.c" 1 + ld $5,8($12) + # 0 "" 2 + # 120 "avcall-mips64.c" 1 + ld $6,16($12) + # 0 "" 2 + # 121 "avcall-mips64.c" 1 + ld $7,24($12) + # 0 "" 2 + # 122 "avcall-mips64.c" 1 + ld $8,32($12) + # 0 "" 2 + # 123 "avcall-mips64.c" 1 + ld $9,40($12) + # 0 "" 2 + # 124 "avcall-mips64.c" 1 + ld $10,48($12) + # 0 "" 2 + # 125 "avcall-mips64.c" 1 + ld $11,56($12) + # 0 "" 2 +#NO_APP + ld $25,8($16) + jalr $25 + lw $4,24($16) + li $5,1 # 0x1 + .set noreorder + .set nomacro + beq $4,$5,.L19 + li $5,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,3 # 0x3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,5 # 0x5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L108 + li $5,6 # 0x6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L108 + li $5,7 # 0x7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L111 + li $5,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L111 + li $5,9 # 0x9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,10 # 0xa + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,11 # 0xb + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,12 # 0xc + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,13 # 0xd + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L118 + li $5,14 # 0xe + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L119 + li $5,15 # 0xf + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,16 # 0x10 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,.L137 + move $sp,$fp + .set macro + .set reorder + + lw $4,0($16) + andi $5,$4,0x200 + .set noreorder + .set nomacro + beq $5,$0,.L19 + andi $4,$4,0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $4,$0,.L37 + ld $4,32($16) + .set macro + .set reorder + + ld $3,32($16) + li $4,1 # 0x1 + .set noreorder + .set nomacro + beq $3,$4,.L106 + li $4,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L108 + li $4,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L111 + li $4,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,.L138 + ld $3,16($16) + .set macro + .set reorder + +.L19: + move $sp,$fp +.L137: + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L117: +#APP + # 111 "avcall-mips64.c" 1 + ldc1 $f19,56($12) + # 0 "" 2 +#NO_APP + .set noreorder + .set nomacro + b .L121 + slt $3,$6,9 + .set macro + .set reorder + + .align 3 +.L116: +#APP + # 91 "avcall-mips64.c" 1 + lwc1 $f19,104($16) + # 0 "" 2 +#NO_APP + .set noreorder + .set nomacro + b .L122 + lw $3,72($16) + .set macro + .set reorder + + .align 3 +.L106: + ld $3,16($16) + sb $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + +.L111: + ld $3,16($16) + .set noreorder + .set nomacro + b .L19 + sw $2,0($3) + .set macro + .set reorder + + .align 3 +.L108: + ld $3,16($16) + sh $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L109: + ld $3,16($16) + .align 3 +.L138: + sd $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + +.L119: + ld $2,16($16) + .set noreorder + .set nomacro + b .L19 + sdc1 $f0,0($2) + .set macro + .set reorder + +.L118: + ld $2,16($16) + .set noreorder + .set nomacro + b .L19 + swc1 $f0,0($2) + .set macro + .set reorder + +.L37: + daddiu $5,$4,-1 + sltu $5,$5,16 + .set noreorder + .set nomacro + beq $5,$0,.L19 + sltu $7,$4,9 + .set macro + .set reorder + + ld $6,16($16) + li $8,-8 # 0xfffffffffffffff8 + andi $5,$6,0x7 + daddu $4,$4,$5 + .set noreorder + .set nomacro + beq $7,$0,.L41 + and $6,$6,$8 + .set macro + .set reorder + + sltu $3,$4,9 + .set noreorder + .set nomacro + beq $3,$0,.L42 + subu $8,$0,$5 + .set macro + .set reorder + + subu $3,$0,$5 + sll $7,$4,0 + sll $3,$3,3 + ld $8,0($6) + addiu $3,$3,63 + subu $7,$0,$7 + li $4,2 # 0x2 + dsll $4,$4,$3 + sll $7,$7,3 + sll $5,$5,3 + li $3,1 # 0x1 + dsll $3,$3,$7 + dsra $2,$2,$5 + dsubu $3,$4,$3 + xor $2,$2,$8 + and $2,$3,$2 + xor $2,$2,$8 + .set noreorder + .set nomacro + b .L19 + sd $2,0($6) + .set macro + .set reorder + +.L41: + subu $9,$0,$5 + ld $11,0($6) + sll $10,$9,3 + addiu $7,$10,63 + sll $5,$5,3 + li $8,2 # 0x2 + dsll $8,$8,$7 + dsra $7,$2,$5 + daddiu $8,$8,-1 + xor $7,$7,$11 + and $7,$8,$7 + xor $7,$7,$11 + sltu $8,$4,17 + .set noreorder + .set nomacro + bne $8,$0,.L120 + sd $7,0($6) + .set macro + .set reorder + + ld $9,16($6) + sll $4,$4,0 + addiu $10,$10,64 + subu $4,$0,$4 + move $8,$3 + sll $4,$4,3 + dsll $3,$3,$10 + li $7,-1 # 0xffffffffffffffff + dsll $4,$7,$4 + xor $3,$3,$9 + dsll $2,$2,$10 + dsra $5,$8,$5 + and $3,$4,$3 + or $2,$2,$5 + xor $3,$3,$9 + sd $2,8($6) + .set noreorder + .set nomacro + b .L19 + sd $3,16($6) + .set macro + .set reorder + +.L42: + ld $11,0($6) + ld $10,8($6) + sll $7,$4,0 + sll $8,$8,3 + sll $5,$5,3 + subu $9,$0,$7 + addiu $4,$8,63 + li $7,2 # 0x2 + dsra $3,$2,$5 + dsll $4,$7,$4 + dsll $2,$2,$8 + sll $7,$9,3 + li $5,-1 # 0xffffffffffffffff + daddiu $4,$4,-1 + xor $3,$3,$11 + dsll $5,$5,$7 + xor $2,$2,$10 + and $3,$4,$3 + and $2,$5,$2 + xor $3,$3,$11 + xor $2,$2,$10 + sd $3,0($6) + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + +.L120: + sll $7,$9,2 + addiu $7,$7,32 + ld $8,8($6) + dsll $2,$2,$7 + sll $4,$4,0 + dsll $7,$2,$7 + dsra $3,$3,$5 + subu $4,$0,$4 + or $3,$7,$3 + sll $4,$4,3 + li $2,-1 # 0xffffffffffffffff + xor $3,$3,$8 + dsll $2,$2,$4 + and $2,$3,$2 + xor $2,$2,$8 + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call + .ident "GCC: (GNU) 5.4.0" diff --git a/avcall/avcall-mips64eb-macro.S b/avcall/avcall-mips64eb-macro.S new file mode 100644 index 0000000..23b0348 --- /dev/null +++ b/avcall/avcall-mips64eb-macro.S @@ -0,0 +1,727 @@ +#include "asm-mips.h" + .file 1 "avcall-mips64.c" + .text + .align 2 + .align 3 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + DECLARE_FUNCTION(avcall_call) +avcall_call: + .frame $fp,32,$31 + .mask 0xd0010000,-8 + .fmask 0x00000000,0 + ld $2,40($4) + ld $12,48($4) + lw $3,68($4) + daddiu $sp,$sp,-32 + dsubu $6,$2,$12 + dsra $6,$6,3 + sd $fp,16($sp) + sd $16,0($sp) + sd $31,24($sp) + move $fp,$sp + daddiu $sp,$sp,-2064 + move $16,$4 + sll $6,$6,0 + .set noreorder + .set nomacro + beq $3,$0,.L2 + move $2,$sp + .set macro + .set reorder + + andi $4,$3,0x1 + .set noreorder + .set nomacro + beq $4,$0,.L123 + andi $4,$3,0x2 + .set macro + .set reorder + + + + lwc1 $f12,76($16) + + + andi $4,$3,0x2 +.L123: + .set noreorder + .set nomacro + beq $4,$0,.L124 + andi $4,$3,0x4 + .set macro + .set reorder + + + + lwc1 $f13,80($16) + + + andi $4,$3,0x4 +.L124: + .set noreorder + .set nomacro + beq $4,$0,.L125 + andi $4,$3,0x8 + .set macro + .set reorder + + + + lwc1 $f14,84($16) + + + andi $4,$3,0x8 +.L125: + .set noreorder + .set nomacro + beq $4,$0,.L126 + andi $4,$3,0x10 + .set macro + .set reorder + + + + lwc1 $f15,88($16) + + + andi $4,$3,0x10 +.L126: + .set noreorder + .set nomacro + beq $4,$0,.L127 + andi $4,$3,0x20 + .set macro + .set reorder + + + + lwc1 $f16,92($16) + + + andi $4,$3,0x20 +.L127: + .set noreorder + .set nomacro + beq $4,$0,.L128 + andi $4,$3,0x40 + .set macro + .set reorder + + + + lwc1 $f17,96($16) + + + andi $4,$3,0x40 +.L128: + .set noreorder + .set nomacro + beql $4,$0,.L129 + andi $3,$3,0x80 + .set macro + .set reorder + + + + lwc1 $f18,100($16) + + + andi $3,$3,0x80 +.L129: + bne $3,$0,.L116 +.L2: + lw $3,72($16) +.L122: + .set noreorder + .set nomacro + beql $3,$0,.L121 + slt $3,$6,9 + .set macro + .set reorder + + andi $4,$3,0x1 + .set noreorder + .set nomacro + beq $4,$0,.L130 + andi $4,$3,0x2 + .set macro + .set reorder + + + + ldc1 $f12,0($12) + + + andi $4,$3,0x2 +.L130: + .set noreorder + .set nomacro + beq $4,$0,.L131 + andi $4,$3,0x4 + .set macro + .set reorder + + + + ldc1 $f13,8($12) + + + andi $4,$3,0x4 +.L131: + .set noreorder + .set nomacro + beq $4,$0,.L132 + andi $4,$3,0x8 + .set macro + .set reorder + + + + ldc1 $f14,16($12) + + + andi $4,$3,0x8 +.L132: + .set noreorder + .set nomacro + beq $4,$0,.L133 + andi $4,$3,0x10 + .set macro + .set reorder + + + + ldc1 $f15,24($12) + + + andi $4,$3,0x10 +.L133: + .set noreorder + .set nomacro + beq $4,$0,.L134 + andi $4,$3,0x20 + .set macro + .set reorder + + + + ldc1 $f16,32($12) + + + andi $4,$3,0x20 +.L134: + .set noreorder + .set nomacro + beq $4,$0,.L135 + andi $4,$3,0x40 + .set macro + .set reorder + + + + ldc1 $f17,40($12) + + + andi $4,$3,0x40 +.L135: + .set noreorder + .set nomacro + beql $4,$0,.L136 + andi $3,$3,0x80 + .set macro + .set reorder + + + + ldc1 $f18,48($12) + + + andi $3,$3,0x80 +.L136: + bne $3,$0,.L117 + slt $3,$6,9 +.L121: + .set noreorder + .set nomacro + bne $3,$0,.L22 + daddiu $4,$12,64 + .set macro + .set reorder + + li $3,8 + .align 3 +.L21: + ld $5,0($4) + addiu $3,$3,1 + daddiu $4,$4,8 + sd $5,0($2) + .set noreorder + .set nomacro + bne $6,$3,.L21 + daddiu $2,$2,8 + .set macro + .set reorder + +.L22: + + + ld $4,0($12) + + + ld $5,8($12) + + + ld $6,16($12) + + + ld $7,24($12) + + + ld $8,32($12) + + + ld $9,40($12) + + + ld $10,48($12) + + + ld $11,56($12) + + + ld $25,8($16) + jalr $25 + lw $4,24($16) + li $5,1 + .set noreorder + .set nomacro + beq $4,$5,.L19 + li $5,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L108 + li $5,6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L108 + li $5,7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L111 + li $5,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L111 + li $5,9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,10 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,11 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,12 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,13 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L118 + li $5,14 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L119 + li $5,15 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,16 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,.L137 + move $sp,$fp + .set macro + .set reorder + + lw $4,0($16) + andi $5,$4,0x200 + .set noreorder + .set nomacro + beq $5,$0,.L19 + andi $4,$4,0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $4,$0,.L37 + ld $4,32($16) + .set macro + .set reorder + + ld $3,32($16) + li $4,1 + .set noreorder + .set nomacro + beq $3,$4,.L106 + li $4,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L108 + li $4,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L111 + li $4,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,.L138 + ld $3,16($16) + .set macro + .set reorder + +.L19: + move $sp,$fp +.L137: + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L117: + + + ldc1 $f19,56($12) + + + .set noreorder + .set nomacro + b .L121 + slt $3,$6,9 + .set macro + .set reorder + + .align 3 +.L116: + + + lwc1 $f19,104($16) + + + .set noreorder + .set nomacro + b .L122 + lw $3,72($16) + .set macro + .set reorder + + .align 3 +.L106: + ld $3,16($16) + sb $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + +.L111: + ld $3,16($16) + .set noreorder + .set nomacro + b .L19 + sw $2,0($3) + .set macro + .set reorder + + .align 3 +.L108: + ld $3,16($16) + sh $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L109: + ld $3,16($16) + .align 3 +.L138: + sd $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + +.L119: + ld $2,16($16) + .set noreorder + .set nomacro + b .L19 + sdc1 $f0,0($2) + .set macro + .set reorder + +.L118: + ld $2,16($16) + .set noreorder + .set nomacro + b .L19 + swc1 $f0,0($2) + .set macro + .set reorder + +.L37: + daddiu $5,$4,-1 + sltu $5,$5,16 + .set noreorder + .set nomacro + beq $5,$0,.L19 + sltu $7,$4,9 + .set macro + .set reorder + + ld $6,16($16) + li $8,-8 + andi $5,$6,0x7 + daddu $4,$4,$5 + .set noreorder + .set nomacro + beq $7,$0,.L41 + and $6,$6,$8 + .set macro + .set reorder + + sltu $3,$4,9 + .set noreorder + .set nomacro + beq $3,$0,.L42 + subu $8,$0,$5 + .set macro + .set reorder + + subu $3,$0,$5 + sll $7,$4,0 + sll $3,$3,3 + ld $8,0($6) + addiu $3,$3,63 + subu $7,$0,$7 + li $4,2 + dsll $4,$4,$3 + sll $7,$7,3 + sll $5,$5,3 + li $3,1 + dsll $3,$3,$7 + dsra $2,$2,$5 + dsubu $3,$4,$3 + xor $2,$2,$8 + and $2,$3,$2 + xor $2,$2,$8 + .set noreorder + .set nomacro + b .L19 + sd $2,0($6) + .set macro + .set reorder + +.L41: + subu $9,$0,$5 + ld $11,0($6) + sll $10,$9,3 + addiu $7,$10,63 + sll $5,$5,3 + li $8,2 + dsll $8,$8,$7 + dsra $7,$2,$5 + daddiu $8,$8,-1 + xor $7,$7,$11 + and $7,$8,$7 + xor $7,$7,$11 + sltu $8,$4,17 + .set noreorder + .set nomacro + bne $8,$0,.L120 + sd $7,0($6) + .set macro + .set reorder + + ld $9,16($6) + sll $4,$4,0 + addiu $10,$10,64 + subu $4,$0,$4 + move $8,$3 + sll $4,$4,3 + dsll $3,$3,$10 + li $7,-1 + dsll $4,$7,$4 + xor $3,$3,$9 + dsll $2,$2,$10 + dsra $5,$8,$5 + and $3,$4,$3 + or $2,$2,$5 + xor $3,$3,$9 + sd $2,8($6) + .set noreorder + .set nomacro + b .L19 + sd $3,16($6) + .set macro + .set reorder + +.L42: + ld $11,0($6) + ld $10,8($6) + sll $7,$4,0 + sll $8,$8,3 + sll $5,$5,3 + subu $9,$0,$7 + addiu $4,$8,63 + li $7,2 + dsra $3,$2,$5 + dsll $4,$7,$4 + dsll $2,$2,$8 + sll $7,$9,3 + li $5,-1 + daddiu $4,$4,-1 + xor $3,$3,$11 + dsll $5,$5,$7 + xor $2,$2,$10 + and $3,$4,$3 + and $2,$5,$2 + xor $3,$3,$11 + xor $2,$2,$10 + sd $3,0($6) + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + +.L120: + sll $7,$9,2 + addiu $7,$7,32 + ld $8,8($6) + dsll $2,$2,$7 + sll $4,$4,0 + dsll $7,$2,$7 + dsra $3,$3,$5 + subu $4,$0,$4 + or $3,$7,$3 + sll $4,$4,3 + li $2,-1 + xor $3,$3,$8 + dsll $2,$2,$4 + and $2,$3,$2 + xor $2,$2,$8 + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call diff --git a/avcall/avcall-mips64el-linux.s b/avcall/avcall-mips64el-linux.s new file mode 100644 index 0000000..d8809b4 --- /dev/null +++ b/avcall/avcall-mips64el-linux.s @@ -0,0 +1,728 @@ + .file 1 "avcall-mips64.c" + .section .mdebug.abi64 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + .type avcall_call, @function +avcall_call: + .frame $fp,32,$31 # vars= 0, regs= 4/0, args= 0, gp= 0 + .mask 0xd0010000,-8 + .fmask 0x00000000,0 + ld $2,40($4) + ld $12,48($4) + lw $3,68($4) + daddiu $sp,$sp,-32 + dsubu $6,$2,$12 + dsra $6,$6,3 + sd $fp,16($sp) + sd $16,0($sp) + sd $31,24($sp) + move $fp,$sp + daddiu $sp,$sp,-2064 + move $16,$4 + sll $6,$6,0 + .set noreorder + .set nomacro + beq $3,$0,.L2 + move $2,$sp + .set macro + .set reorder + + andi $4,$3,0x1 + .set noreorder + .set nomacro + beq $4,$0,.L123 + andi $4,$3,0x2 + .set macro + .set reorder + +#APP + # 77 "avcall-mips64.c" 1 + lwc1 $f12,76($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x2 +.L123: + .set noreorder + .set nomacro + beq $4,$0,.L124 + andi $4,$3,0x4 + .set macro + .set reorder + +#APP + # 79 "avcall-mips64.c" 1 + lwc1 $f13,80($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x4 +.L124: + .set noreorder + .set nomacro + beq $4,$0,.L125 + andi $4,$3,0x8 + .set macro + .set reorder + +#APP + # 81 "avcall-mips64.c" 1 + lwc1 $f14,84($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x8 +.L125: + .set noreorder + .set nomacro + beq $4,$0,.L126 + andi $4,$3,0x10 + .set macro + .set reorder + +#APP + # 83 "avcall-mips64.c" 1 + lwc1 $f15,88($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x10 +.L126: + .set noreorder + .set nomacro + beq $4,$0,.L127 + andi $4,$3,0x20 + .set macro + .set reorder + +#APP + # 85 "avcall-mips64.c" 1 + lwc1 $f16,92($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x20 +.L127: + .set noreorder + .set nomacro + beq $4,$0,.L128 + andi $4,$3,0x40 + .set macro + .set reorder + +#APP + # 87 "avcall-mips64.c" 1 + lwc1 $f17,96($16) + # 0 "" 2 +#NO_APP + andi $4,$3,0x40 +.L128: + .set noreorder + .set nomacro + beql $4,$0,.L129 + andi $3,$3,0x80 + .set macro + .set reorder + +#APP + # 89 "avcall-mips64.c" 1 + lwc1 $f18,100($16) + # 0 "" 2 +#NO_APP + andi $3,$3,0x80 +.L129: + bne $3,$0,.L116 +.L2: + lw $3,72($16) +.L122: + .set noreorder + .set nomacro + beql $3,$0,.L121 + slt $3,$6,9 + .set macro + .set reorder + + andi $4,$3,0x1 + .set noreorder + .set nomacro + beq $4,$0,.L130 + andi $4,$3,0x2 + .set macro + .set reorder + +#APP + # 97 "avcall-mips64.c" 1 + ldc1 $f12,0($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x2 +.L130: + .set noreorder + .set nomacro + beq $4,$0,.L131 + andi $4,$3,0x4 + .set macro + .set reorder + +#APP + # 99 "avcall-mips64.c" 1 + ldc1 $f13,8($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x4 +.L131: + .set noreorder + .set nomacro + beq $4,$0,.L132 + andi $4,$3,0x8 + .set macro + .set reorder + +#APP + # 101 "avcall-mips64.c" 1 + ldc1 $f14,16($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x8 +.L132: + .set noreorder + .set nomacro + beq $4,$0,.L133 + andi $4,$3,0x10 + .set macro + .set reorder + +#APP + # 103 "avcall-mips64.c" 1 + ldc1 $f15,24($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x10 +.L133: + .set noreorder + .set nomacro + beq $4,$0,.L134 + andi $4,$3,0x20 + .set macro + .set reorder + +#APP + # 105 "avcall-mips64.c" 1 + ldc1 $f16,32($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x20 +.L134: + .set noreorder + .set nomacro + beq $4,$0,.L135 + andi $4,$3,0x40 + .set macro + .set reorder + +#APP + # 107 "avcall-mips64.c" 1 + ldc1 $f17,40($12) + # 0 "" 2 +#NO_APP + andi $4,$3,0x40 +.L135: + .set noreorder + .set nomacro + beql $4,$0,.L136 + andi $3,$3,0x80 + .set macro + .set reorder + +#APP + # 109 "avcall-mips64.c" 1 + ldc1 $f18,48($12) + # 0 "" 2 +#NO_APP + andi $3,$3,0x80 +.L136: + bne $3,$0,.L117 + slt $3,$6,9 +.L121: + .set noreorder + .set nomacro + bne $3,$0,.L22 + daddiu $4,$12,64 + .set macro + .set reorder + + li $3,8 # 0x8 + .align 3 +.L21: + ld $5,0($4) + addiu $3,$3,1 + daddiu $4,$4,8 + sd $5,0($2) + .set noreorder + .set nomacro + bne $6,$3,.L21 + daddiu $2,$2,8 + .set macro + .set reorder + +.L22: +#APP + # 118 "avcall-mips64.c" 1 + ld $4,0($12) + # 0 "" 2 + # 119 "avcall-mips64.c" 1 + ld $5,8($12) + # 0 "" 2 + # 120 "avcall-mips64.c" 1 + ld $6,16($12) + # 0 "" 2 + # 121 "avcall-mips64.c" 1 + ld $7,24($12) + # 0 "" 2 + # 122 "avcall-mips64.c" 1 + ld $8,32($12) + # 0 "" 2 + # 123 "avcall-mips64.c" 1 + ld $9,40($12) + # 0 "" 2 + # 124 "avcall-mips64.c" 1 + ld $10,48($12) + # 0 "" 2 + # 125 "avcall-mips64.c" 1 + ld $11,56($12) + # 0 "" 2 +#NO_APP + ld $25,8($16) + jalr $25 + lw $4,24($16) + li $5,1 # 0x1 + .set noreorder + .set nomacro + beq $4,$5,.L19 + li $5,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,3 # 0x3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,5 # 0x5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L108 + li $5,6 # 0x6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L108 + li $5,7 # 0x7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L111 + li $5,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L111 + li $5,9 # 0x9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,10 # 0xa + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,11 # 0xb + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,12 # 0xc + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,13 # 0xd + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L118 + li $5,14 # 0xe + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L119 + li $5,15 # 0xf + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,16 # 0x10 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,.L137 + move $sp,$fp + .set macro + .set reorder + + lw $4,0($16) + andi $5,$4,0x200 + .set noreorder + .set nomacro + beq $5,$0,.L19 + andi $4,$4,0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $4,$0,.L37 + ld $5,32($16) + .set macro + .set reorder + + ld $3,32($16) + li $4,1 # 0x1 + .set noreorder + .set nomacro + beq $3,$4,.L106 + li $4,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L108 + li $4,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L111 + li $4,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,.L138 + ld $3,16($16) + .set macro + .set reorder + +.L19: + move $sp,$fp +.L137: + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L117: +#APP + # 111 "avcall-mips64.c" 1 + ldc1 $f19,56($12) + # 0 "" 2 +#NO_APP + .set noreorder + .set nomacro + b .L121 + slt $3,$6,9 + .set macro + .set reorder + + .align 3 +.L116: +#APP + # 91 "avcall-mips64.c" 1 + lwc1 $f19,104($16) + # 0 "" 2 +#NO_APP + .set noreorder + .set nomacro + b .L122 + lw $3,72($16) + .set macro + .set reorder + + .align 3 +.L106: + ld $3,16($16) + sb $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + +.L111: + ld $3,16($16) + .set noreorder + .set nomacro + b .L19 + sw $2,0($3) + .set macro + .set reorder + + .align 3 +.L108: + ld $3,16($16) + sh $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L109: + ld $3,16($16) + .align 3 +.L138: + sd $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + +.L119: + ld $2,16($16) + .set noreorder + .set nomacro + b .L19 + sdc1 $f0,0($2) + .set macro + .set reorder + +.L118: + ld $2,16($16) + .set noreorder + .set nomacro + b .L19 + swc1 $f0,0($2) + .set macro + .set reorder + +.L37: + daddiu $4,$5,-1 + sltu $4,$4,16 + .set noreorder + .set nomacro + beq $4,$0,.L19 + sltu $7,$5,9 + .set macro + .set reorder + + ld $6,16($16) + li $8,-8 # 0xfffffffffffffff8 + andi $4,$6,0x7 + daddu $5,$5,$4 + .set noreorder + .set nomacro + beq $7,$0,.L41 + and $6,$6,$8 + .set macro + .set reorder + + sltu $3,$5,9 + .set noreorder + .set nomacro + beq $3,$0,.L42 + dsll $3,$5,3 + .set macro + .set reorder + + daddiu $3,$3,-1 + ld $7,0($6) + li $5,2 # 0x2 + sll $3,$3,0 + sll $4,$4,3 + dsll $3,$5,$3 + li $5,1 # 0x1 + dsll $5,$5,$4 + dsll $4,$2,$4 + dsubu $3,$3,$5 + xor $4,$4,$7 + and $4,$3,$4 + xor $4,$4,$7 + .set noreorder + .set nomacro + b .L19 + sd $4,0($6) + .set macro + .set reorder + +.L41: + ld $10,0($6) + sll $8,$4,3 + dsll $7,$2,$8 + li $9,-1 # 0xffffffffffffffff + dsll $9,$9,$8 + xor $7,$7,$10 + and $7,$9,$7 + xor $7,$7,$10 + sltu $9,$5,17 + subu $4,$0,$4 + .set noreorder + .set nomacro + bne $9,$0,.L120 + sd $7,0($6) + .set macro + .set reorder + + dsll $5,$5,3 + ld $10,16($6) + sll $4,$4,3 + daddiu $5,$5,-129 + addiu $4,$4,64 + sll $5,$5,0 + li $7,2 # 0x2 + move $9,$3 + dsll $5,$7,$5 + dsra $3,$3,$4 + daddiu $5,$5,-1 + xor $3,$3,$10 + dsra $2,$2,$4 + dsll $8,$9,$8 + and $3,$5,$3 + or $2,$2,$8 + xor $3,$3,$10 + sd $2,8($6) + .set noreorder + .set nomacro + b .L19 + sd $3,16($6) + .set macro + .set reorder + +.L42: + ld $10,0($6) + ld $9,8($6) + subu $7,$0,$4 + daddiu $3,$3,-65 + sll $4,$4,3 + li $5,2 # 0x2 + sll $3,$3,0 + sll $7,$7,3 + dsll $8,$2,$4 + dsll $3,$5,$3 + dsra $2,$2,$7 + li $5,-1 # 0xffffffffffffffff + dsll $4,$5,$4 + daddiu $3,$3,-1 + xor $5,$8,$10 + xor $2,$2,$9 + and $2,$3,$2 + and $4,$4,$5 + xor $3,$4,$10 + xor $2,$2,$9 + sd $3,0($6) + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + +.L120: + sll $4,$4,2 + addiu $4,$4,32 + dsll $5,$5,3 + ld $7,8($6) + dsra $2,$2,$4 + daddiu $5,$5,-65 + dsra $4,$2,$4 + dsll $3,$3,$8 + sll $5,$5,0 + li $2,2 # 0x2 + or $3,$4,$3 + dsll $2,$2,$5 + xor $3,$3,$7 + daddiu $2,$2,-1 + and $2,$3,$2 + xor $2,$2,$7 + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call + .ident "GCC: (GNU) 5.4.0" diff --git a/avcall/avcall-mips64el-macro.S b/avcall/avcall-mips64el-macro.S new file mode 100644 index 0000000..c691c18 --- /dev/null +++ b/avcall/avcall-mips64el-macro.S @@ -0,0 +1,722 @@ +#include "asm-mips.h" + .file 1 "avcall-mips64.c" + .text + .align 2 + .align 3 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + DECLARE_FUNCTION(avcall_call) +avcall_call: + .frame $fp,32,$31 + .mask 0xd0010000,-8 + .fmask 0x00000000,0 + ld $2,40($4) + ld $12,48($4) + lw $3,68($4) + daddiu $sp,$sp,-32 + dsubu $6,$2,$12 + dsra $6,$6,3 + sd $fp,16($sp) + sd $16,0($sp) + sd $31,24($sp) + move $fp,$sp + daddiu $sp,$sp,-2064 + move $16,$4 + sll $6,$6,0 + .set noreorder + .set nomacro + beq $3,$0,.L2 + move $2,$sp + .set macro + .set reorder + + andi $4,$3,0x1 + .set noreorder + .set nomacro + beq $4,$0,.L123 + andi $4,$3,0x2 + .set macro + .set reorder + + + + lwc1 $f12,76($16) + + + andi $4,$3,0x2 +.L123: + .set noreorder + .set nomacro + beq $4,$0,.L124 + andi $4,$3,0x4 + .set macro + .set reorder + + + + lwc1 $f13,80($16) + + + andi $4,$3,0x4 +.L124: + .set noreorder + .set nomacro + beq $4,$0,.L125 + andi $4,$3,0x8 + .set macro + .set reorder + + + + lwc1 $f14,84($16) + + + andi $4,$3,0x8 +.L125: + .set noreorder + .set nomacro + beq $4,$0,.L126 + andi $4,$3,0x10 + .set macro + .set reorder + + + + lwc1 $f15,88($16) + + + andi $4,$3,0x10 +.L126: + .set noreorder + .set nomacro + beq $4,$0,.L127 + andi $4,$3,0x20 + .set macro + .set reorder + + + + lwc1 $f16,92($16) + + + andi $4,$3,0x20 +.L127: + .set noreorder + .set nomacro + beq $4,$0,.L128 + andi $4,$3,0x40 + .set macro + .set reorder + + + + lwc1 $f17,96($16) + + + andi $4,$3,0x40 +.L128: + .set noreorder + .set nomacro + beql $4,$0,.L129 + andi $3,$3,0x80 + .set macro + .set reorder + + + + lwc1 $f18,100($16) + + + andi $3,$3,0x80 +.L129: + bne $3,$0,.L116 +.L2: + lw $3,72($16) +.L122: + .set noreorder + .set nomacro + beql $3,$0,.L121 + slt $3,$6,9 + .set macro + .set reorder + + andi $4,$3,0x1 + .set noreorder + .set nomacro + beq $4,$0,.L130 + andi $4,$3,0x2 + .set macro + .set reorder + + + + ldc1 $f12,0($12) + + + andi $4,$3,0x2 +.L130: + .set noreorder + .set nomacro + beq $4,$0,.L131 + andi $4,$3,0x4 + .set macro + .set reorder + + + + ldc1 $f13,8($12) + + + andi $4,$3,0x4 +.L131: + .set noreorder + .set nomacro + beq $4,$0,.L132 + andi $4,$3,0x8 + .set macro + .set reorder + + + + ldc1 $f14,16($12) + + + andi $4,$3,0x8 +.L132: + .set noreorder + .set nomacro + beq $4,$0,.L133 + andi $4,$3,0x10 + .set macro + .set reorder + + + + ldc1 $f15,24($12) + + + andi $4,$3,0x10 +.L133: + .set noreorder + .set nomacro + beq $4,$0,.L134 + andi $4,$3,0x20 + .set macro + .set reorder + + + + ldc1 $f16,32($12) + + + andi $4,$3,0x20 +.L134: + .set noreorder + .set nomacro + beq $4,$0,.L135 + andi $4,$3,0x40 + .set macro + .set reorder + + + + ldc1 $f17,40($12) + + + andi $4,$3,0x40 +.L135: + .set noreorder + .set nomacro + beql $4,$0,.L136 + andi $3,$3,0x80 + .set macro + .set reorder + + + + ldc1 $f18,48($12) + + + andi $3,$3,0x80 +.L136: + bne $3,$0,.L117 + slt $3,$6,9 +.L121: + .set noreorder + .set nomacro + bne $3,$0,.L22 + daddiu $4,$12,64 + .set macro + .set reorder + + li $3,8 + .align 3 +.L21: + ld $5,0($4) + addiu $3,$3,1 + daddiu $4,$4,8 + sd $5,0($2) + .set noreorder + .set nomacro + bne $6,$3,.L21 + daddiu $2,$2,8 + .set macro + .set reorder + +.L22: + + + ld $4,0($12) + + + ld $5,8($12) + + + ld $6,16($12) + + + ld $7,24($12) + + + ld $8,32($12) + + + ld $9,40($12) + + + ld $10,48($12) + + + ld $11,56($12) + + + ld $25,8($16) + jalr $25 + lw $4,24($16) + li $5,1 + .set noreorder + .set nomacro + beq $4,$5,.L19 + li $5,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L106 + li $5,5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L108 + li $5,6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L108 + li $5,7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L111 + li $5,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L111 + li $5,9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,10 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,11 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,12 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,13 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L118 + li $5,14 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L119 + li $5,15 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,16 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,.L137 + move $sp,$fp + .set macro + .set reorder + + lw $4,0($16) + andi $5,$4,0x200 + .set noreorder + .set nomacro + beq $5,$0,.L19 + andi $4,$4,0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $4,$0,.L37 + ld $5,32($16) + .set macro + .set reorder + + ld $3,32($16) + li $4,1 + .set noreorder + .set nomacro + beq $3,$4,.L106 + li $4,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L108 + li $4,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L111 + li $4,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,.L138 + ld $3,16($16) + .set macro + .set reorder + +.L19: + move $sp,$fp +.L137: + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L117: + + + ldc1 $f19,56($12) + + + .set noreorder + .set nomacro + b .L121 + slt $3,$6,9 + .set macro + .set reorder + + .align 3 +.L116: + + + lwc1 $f19,104($16) + + + .set noreorder + .set nomacro + b .L122 + lw $3,72($16) + .set macro + .set reorder + + .align 3 +.L106: + ld $3,16($16) + sb $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + +.L111: + ld $3,16($16) + .set noreorder + .set nomacro + b .L19 + sw $2,0($3) + .set macro + .set reorder + + .align 3 +.L108: + ld $3,16($16) + sh $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L109: + ld $3,16($16) + .align 3 +.L138: + sd $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + daddiu $sp,$sp,32 + .set macro + .set reorder + +.L119: + ld $2,16($16) + .set noreorder + .set nomacro + b .L19 + sdc1 $f0,0($2) + .set macro + .set reorder + +.L118: + ld $2,16($16) + .set noreorder + .set nomacro + b .L19 + swc1 $f0,0($2) + .set macro + .set reorder + +.L37: + daddiu $4,$5,-1 + sltu $4,$4,16 + .set noreorder + .set nomacro + beq $4,$0,.L19 + sltu $7,$5,9 + .set macro + .set reorder + + ld $6,16($16) + li $8,-8 + andi $4,$6,0x7 + daddu $5,$5,$4 + .set noreorder + .set nomacro + beq $7,$0,.L41 + and $6,$6,$8 + .set macro + .set reorder + + sltu $3,$5,9 + .set noreorder + .set nomacro + beq $3,$0,.L42 + dsll $3,$5,3 + .set macro + .set reorder + + daddiu $3,$3,-1 + ld $7,0($6) + li $5,2 + sll $3,$3,0 + sll $4,$4,3 + dsll $3,$5,$3 + li $5,1 + dsll $5,$5,$4 + dsll $4,$2,$4 + dsubu $3,$3,$5 + xor $4,$4,$7 + and $4,$3,$4 + xor $4,$4,$7 + .set noreorder + .set nomacro + b .L19 + sd $4,0($6) + .set macro + .set reorder + +.L41: + ld $10,0($6) + sll $8,$4,3 + dsll $7,$2,$8 + li $9,-1 + dsll $9,$9,$8 + xor $7,$7,$10 + and $7,$9,$7 + xor $7,$7,$10 + sltu $9,$5,17 + subu $4,$0,$4 + .set noreorder + .set nomacro + bne $9,$0,.L120 + sd $7,0($6) + .set macro + .set reorder + + dsll $5,$5,3 + ld $10,16($6) + sll $4,$4,3 + daddiu $5,$5,-129 + addiu $4,$4,64 + sll $5,$5,0 + li $7,2 + move $9,$3 + dsll $5,$7,$5 + dsra $3,$3,$4 + daddiu $5,$5,-1 + xor $3,$3,$10 + dsra $2,$2,$4 + dsll $8,$9,$8 + and $3,$5,$3 + or $2,$2,$8 + xor $3,$3,$10 + sd $2,8($6) + .set noreorder + .set nomacro + b .L19 + sd $3,16($6) + .set macro + .set reorder + +.L42: + ld $10,0($6) + ld $9,8($6) + subu $7,$0,$4 + daddiu $3,$3,-65 + sll $4,$4,3 + li $5,2 + sll $3,$3,0 + sll $7,$7,3 + dsll $8,$2,$4 + dsll $3,$5,$3 + dsra $2,$2,$7 + li $5,-1 + dsll $4,$5,$4 + daddiu $3,$3,-1 + xor $5,$8,$10 + xor $2,$2,$9 + and $2,$3,$2 + and $4,$4,$5 + xor $3,$4,$10 + xor $2,$2,$9 + sd $3,0($6) + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + +.L120: + sll $4,$4,2 + addiu $4,$4,32 + dsll $5,$5,3 + ld $7,8($6) + dsra $2,$2,$4 + daddiu $5,$5,-65 + dsra $4,$2,$4 + dsll $3,$3,$8 + sll $5,$5,0 + li $2,2 + or $3,$4,$3 + dsll $2,$2,$5 + xor $3,$3,$7 + daddiu $2,$2,-1 + and $2,$3,$2 + xor $2,$2,$7 + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call diff --git a/avcall/avcall-mipseb-linux.s b/avcall/avcall-mipseb-linux.s new file mode 100644 index 0000000..fa6dbe3 --- /dev/null +++ b/avcall/avcall-mipseb-linux.s @@ -0,0 +1,349 @@ + .file 1 "avcall-mips.c" + .section .mdebug.abi32 + .previous + .nan legacy + .module fp=xx + .module nooddspreg + .abicalls + .text + .align 2 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + .type avcall_call, @function +avcall_call: + .frame $fp,40,$31 # vars= 0, regs= 3/0, args= 16, gp= 8 + .mask 0xc0010000,-4 + .fmask 0x00000000,0 + lw $6,40($4) + lw $5,20($4) + lw $8,24($4) + addiu $sp,$sp,-40 + andi $2,$6,0x1 + sw $fp,32($sp) + sw $16,28($sp) + move $fp,$sp + sw $31,36($sp) + move $16,$4 + addiu $sp,$sp,-1032 + subu $4,$5,$8 + move $3,$sp + .set noreorder + .set nomacro + beq $2,$0,$L2 + sra $4,$4,2 + .set macro + .set reorder + +#APP + # 76 "avcall-mips.c" 1 + l.s $f12,48($16) + # 0 "" 2 +#NO_APP +$L2: + lw $2,44($16) + andi $7,$2,0x1 + .set noreorder + .set nomacro + beql $7,$0,$L54 + andi $6,$6,0x2 + .set macro + .set reorder + +#APP + # 78 "avcall-mips.c" 1 + l.d $f12,56($16) + # 0 "" 2 +#NO_APP + andi $6,$6,0x2 +$L54: + .set noreorder + .set nomacro + beql $6,$0,$L55 + andi $2,$2,0x2 + .set macro + .set reorder + +#APP + # 80 "avcall-mips.c" 1 + l.s $f14,52($16) + # 0 "" 2 +#NO_APP + andi $2,$2,0x2 +$L55: + .set noreorder + .set nomacro + beql $2,$0,$L56 + slt $4,$4,5 + .set macro + .set reorder + +#APP + # 82 "avcall-mips.c" 1 + l.d $f14,64($16) + # 0 "" 2 +#NO_APP + slt $4,$4,5 +$L56: + addiu $2,$8,16 + .set noreorder + .set nomacro + bne $4,$0,$L10 + addiu $3,$3,16 + .set macro + .set reorder + +$L36: + lw $4,0($2) + addiu $3,$3,4 + addiu $2,$2,4 + .set noreorder + .set nomacro + bne $5,$2,$L36 + sw $4,-4($3) + .set macro + .set reorder + +$L10: + lw $5,4($8) + lw $4,0($8) + lw $25,4($16) + lw $7,12($8) + .set noreorder + .set nomacro + jalr $25 + lw $6,8($8) + .set macro + .set reorder + + lw $4,12($16) + li $5,1 # 0x1 + .set noreorder + .set nomacro + beq $4,$5,$L7 + li $5,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,3 # 0x3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,5 # 0x5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L48 + li $5,6 # 0x6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L48 + li $5,7 # 0x7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,9 # 0x9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,10 # 0xa + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + addiu $5,$4,-11 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bnel $5,$0,$L51 + lw $4,8($16) + .set macro + .set reorder + + li $3,13 # 0xd + .set noreorder + .set nomacro + beq $4,$3,$L52 + li $3,14 # 0xe + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$3,$L53 + li $3,15 # 0xf + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$3,$L49 + li $3,16 # 0x10 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$3,$L57 + move $sp,$fp + .set macro + .set reorder + + lw $3,0($16) + andi $3,$3,0x2 + .set noreorder + .set nomacro + beq $3,$0,$L7 + li $4,1 # 0x1 + .set macro + .set reorder + + lw $3,16($16) + .set noreorder + .set nomacro + beq $3,$4,$L47 + li $4,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,$L48 + li $4,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,$L58 + lw $3,8($16) + .set macro + .set reorder + +$L7: + move $sp,$fp +$L57: + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L47: + lw $3,8($16) + sb $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L49: + lw $3,8($16) +$L58: + sw $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L48: + lw $3,8($16) + sh $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L51: + sw $2,0($4) + .set noreorder + .set nomacro + b $L7 + sw $3,4($4) + .set macro + .set reorder + +$L52: + lw $2,8($16) + .set noreorder + .set nomacro + b $L7 + swc1 $f0,0($2) + .set macro + .set reorder + +$L53: + lw $2,8($16) + .set noreorder + .set nomacro + b $L7 + sdc1 $f0,0($2) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call + .ident "GCC: (GNU) 5.4.0" diff --git a/avcall/avcall-mipseb-macro.S b/avcall/avcall-mipseb-macro.S new file mode 100644 index 0000000..ee34b38 --- /dev/null +++ b/avcall/avcall-mipseb-macro.S @@ -0,0 +1,343 @@ +#include "asm-mips.h" + .file 1 "avcall-mips.c" + .text + .align 2 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + DECLARE_FUNCTION(avcall_call) +avcall_call: + .frame $fp,40,$31 + .mask 0xc0010000,-4 + .fmask 0x00000000,0 + lw $6,40($4) + lw $5,20($4) + lw $8,24($4) + addiu $sp,$sp,-40 + andi $2,$6,0x1 + sw $fp,32($sp) + sw $16,28($sp) + move $fp,$sp + sw $31,36($sp) + move $16,$4 + addiu $sp,$sp,-1032 + subu $4,$5,$8 + move $3,$sp + .set noreorder + .set nomacro + beq $2,$0,$L2 + sra $4,$4,2 + .set macro + .set reorder + + + + l.s $f12,48($16) + + +$L2: + lw $2,44($16) + andi $7,$2,0x1 + .set noreorder + .set nomacro + beql $7,$0,$L54 + andi $6,$6,0x2 + .set macro + .set reorder + + + + l.d $f12,56($16) + + + andi $6,$6,0x2 +$L54: + .set noreorder + .set nomacro + beql $6,$0,$L55 + andi $2,$2,0x2 + .set macro + .set reorder + + + + l.s $f14,52($16) + + + andi $2,$2,0x2 +$L55: + .set noreorder + .set nomacro + beql $2,$0,$L56 + slt $4,$4,5 + .set macro + .set reorder + + + + l.d $f14,64($16) + + + slt $4,$4,5 +$L56: + addiu $2,$8,16 + .set noreorder + .set nomacro + bne $4,$0,$L10 + addiu $3,$3,16 + .set macro + .set reorder + +$L36: + lw $4,0($2) + addiu $3,$3,4 + addiu $2,$2,4 + .set noreorder + .set nomacro + bne $5,$2,$L36 + sw $4,-4($3) + .set macro + .set reorder + +$L10: + lw $5,4($8) + lw $4,0($8) + lw $25,4($16) + lw $7,12($8) + .set noreorder + .set nomacro + jalr $25 + lw $6,8($8) + .set macro + .set reorder + + lw $4,12($16) + li $5,1 + .set noreorder + .set nomacro + beq $4,$5,$L7 + li $5,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L48 + li $5,6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L48 + li $5,7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,10 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + addiu $5,$4,-11 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bnel $5,$0,$L51 + lw $4,8($16) + .set macro + .set reorder + + li $3,13 + .set noreorder + .set nomacro + beq $4,$3,$L52 + li $3,14 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$3,$L53 + li $3,15 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$3,$L49 + li $3,16 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$3,$L57 + move $sp,$fp + .set macro + .set reorder + + lw $3,0($16) + andi $3,$3,0x2 + .set noreorder + .set nomacro + beq $3,$0,$L7 + li $4,1 + .set macro + .set reorder + + lw $3,16($16) + .set noreorder + .set nomacro + beq $3,$4,$L47 + li $4,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,$L48 + li $4,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,$L58 + lw $3,8($16) + .set macro + .set reorder + +$L7: + move $sp,$fp +$L57: + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L47: + lw $3,8($16) + sb $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L49: + lw $3,8($16) +$L58: + sw $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L48: + lw $3,8($16) + sh $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L51: + sw $2,0($4) + .set noreorder + .set nomacro + b $L7 + sw $3,4($4) + .set macro + .set reorder + +$L52: + lw $2,8($16) + .set noreorder + .set nomacro + b $L7 + swc1 $f0,0($2) + .set macro + .set reorder + +$L53: + lw $2,8($16) + .set noreorder + .set nomacro + b $L7 + sdc1 $f0,0($2) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call diff --git a/avcall/avcall-mipsel-linux.s b/avcall/avcall-mipsel-linux.s new file mode 100644 index 0000000..fa6dbe3 --- /dev/null +++ b/avcall/avcall-mipsel-linux.s @@ -0,0 +1,349 @@ + .file 1 "avcall-mips.c" + .section .mdebug.abi32 + .previous + .nan legacy + .module fp=xx + .module nooddspreg + .abicalls + .text + .align 2 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + .type avcall_call, @function +avcall_call: + .frame $fp,40,$31 # vars= 0, regs= 3/0, args= 16, gp= 8 + .mask 0xc0010000,-4 + .fmask 0x00000000,0 + lw $6,40($4) + lw $5,20($4) + lw $8,24($4) + addiu $sp,$sp,-40 + andi $2,$6,0x1 + sw $fp,32($sp) + sw $16,28($sp) + move $fp,$sp + sw $31,36($sp) + move $16,$4 + addiu $sp,$sp,-1032 + subu $4,$5,$8 + move $3,$sp + .set noreorder + .set nomacro + beq $2,$0,$L2 + sra $4,$4,2 + .set macro + .set reorder + +#APP + # 76 "avcall-mips.c" 1 + l.s $f12,48($16) + # 0 "" 2 +#NO_APP +$L2: + lw $2,44($16) + andi $7,$2,0x1 + .set noreorder + .set nomacro + beql $7,$0,$L54 + andi $6,$6,0x2 + .set macro + .set reorder + +#APP + # 78 "avcall-mips.c" 1 + l.d $f12,56($16) + # 0 "" 2 +#NO_APP + andi $6,$6,0x2 +$L54: + .set noreorder + .set nomacro + beql $6,$0,$L55 + andi $2,$2,0x2 + .set macro + .set reorder + +#APP + # 80 "avcall-mips.c" 1 + l.s $f14,52($16) + # 0 "" 2 +#NO_APP + andi $2,$2,0x2 +$L55: + .set noreorder + .set nomacro + beql $2,$0,$L56 + slt $4,$4,5 + .set macro + .set reorder + +#APP + # 82 "avcall-mips.c" 1 + l.d $f14,64($16) + # 0 "" 2 +#NO_APP + slt $4,$4,5 +$L56: + addiu $2,$8,16 + .set noreorder + .set nomacro + bne $4,$0,$L10 + addiu $3,$3,16 + .set macro + .set reorder + +$L36: + lw $4,0($2) + addiu $3,$3,4 + addiu $2,$2,4 + .set noreorder + .set nomacro + bne $5,$2,$L36 + sw $4,-4($3) + .set macro + .set reorder + +$L10: + lw $5,4($8) + lw $4,0($8) + lw $25,4($16) + lw $7,12($8) + .set noreorder + .set nomacro + jalr $25 + lw $6,8($8) + .set macro + .set reorder + + lw $4,12($16) + li $5,1 # 0x1 + .set noreorder + .set nomacro + beq $4,$5,$L7 + li $5,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,3 # 0x3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,5 # 0x5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L48 + li $5,6 # 0x6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L48 + li $5,7 # 0x7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,9 # 0x9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,10 # 0xa + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + addiu $5,$4,-11 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bnel $5,$0,$L51 + lw $4,8($16) + .set macro + .set reorder + + li $3,13 # 0xd + .set noreorder + .set nomacro + beq $4,$3,$L52 + li $3,14 # 0xe + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$3,$L53 + li $3,15 # 0xf + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$3,$L49 + li $3,16 # 0x10 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$3,$L57 + move $sp,$fp + .set macro + .set reorder + + lw $3,0($16) + andi $3,$3,0x2 + .set noreorder + .set nomacro + beq $3,$0,$L7 + li $4,1 # 0x1 + .set macro + .set reorder + + lw $3,16($16) + .set noreorder + .set nomacro + beq $3,$4,$L47 + li $4,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,$L48 + li $4,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,$L58 + lw $3,8($16) + .set macro + .set reorder + +$L7: + move $sp,$fp +$L57: + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L47: + lw $3,8($16) + sb $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L49: + lw $3,8($16) +$L58: + sw $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L48: + lw $3,8($16) + sh $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L51: + sw $2,0($4) + .set noreorder + .set nomacro + b $L7 + sw $3,4($4) + .set macro + .set reorder + +$L52: + lw $2,8($16) + .set noreorder + .set nomacro + b $L7 + swc1 $f0,0($2) + .set macro + .set reorder + +$L53: + lw $2,8($16) + .set noreorder + .set nomacro + b $L7 + sdc1 $f0,0($2) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call + .ident "GCC: (GNU) 5.4.0" diff --git a/avcall/avcall-mipsel-macro.S b/avcall/avcall-mipsel-macro.S new file mode 100644 index 0000000..ee34b38 --- /dev/null +++ b/avcall/avcall-mipsel-macro.S @@ -0,0 +1,343 @@ +#include "asm-mips.h" + .file 1 "avcall-mips.c" + .text + .align 2 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + DECLARE_FUNCTION(avcall_call) +avcall_call: + .frame $fp,40,$31 + .mask 0xc0010000,-4 + .fmask 0x00000000,0 + lw $6,40($4) + lw $5,20($4) + lw $8,24($4) + addiu $sp,$sp,-40 + andi $2,$6,0x1 + sw $fp,32($sp) + sw $16,28($sp) + move $fp,$sp + sw $31,36($sp) + move $16,$4 + addiu $sp,$sp,-1032 + subu $4,$5,$8 + move $3,$sp + .set noreorder + .set nomacro + beq $2,$0,$L2 + sra $4,$4,2 + .set macro + .set reorder + + + + l.s $f12,48($16) + + +$L2: + lw $2,44($16) + andi $7,$2,0x1 + .set noreorder + .set nomacro + beql $7,$0,$L54 + andi $6,$6,0x2 + .set macro + .set reorder + + + + l.d $f12,56($16) + + + andi $6,$6,0x2 +$L54: + .set noreorder + .set nomacro + beql $6,$0,$L55 + andi $2,$2,0x2 + .set macro + .set reorder + + + + l.s $f14,52($16) + + + andi $2,$2,0x2 +$L55: + .set noreorder + .set nomacro + beql $2,$0,$L56 + slt $4,$4,5 + .set macro + .set reorder + + + + l.d $f14,64($16) + + + slt $4,$4,5 +$L56: + addiu $2,$8,16 + .set noreorder + .set nomacro + bne $4,$0,$L10 + addiu $3,$3,16 + .set macro + .set reorder + +$L36: + lw $4,0($2) + addiu $3,$3,4 + addiu $2,$2,4 + .set noreorder + .set nomacro + bne $5,$2,$L36 + sw $4,-4($3) + .set macro + .set reorder + +$L10: + lw $5,4($8) + lw $4,0($8) + lw $25,4($16) + lw $7,12($8) + .set noreorder + .set nomacro + jalr $25 + lw $6,8($8) + .set macro + .set reorder + + lw $4,12($16) + li $5,1 + .set noreorder + .set nomacro + beq $4,$5,$L7 + li $5,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L47 + li $5,5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L48 + li $5,6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L48 + li $5,7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + li $5,10 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L49 + addiu $5,$4,-11 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bnel $5,$0,$L51 + lw $4,8($16) + .set macro + .set reorder + + li $3,13 + .set noreorder + .set nomacro + beq $4,$3,$L52 + li $3,14 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$3,$L53 + li $3,15 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$3,$L49 + li $3,16 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$3,$L57 + move $sp,$fp + .set macro + .set reorder + + lw $3,0($16) + andi $3,$3,0x2 + .set noreorder + .set nomacro + beq $3,$0,$L7 + li $4,1 + .set macro + .set reorder + + lw $3,16($16) + .set noreorder + .set nomacro + beq $3,$4,$L47 + li $4,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,$L48 + li $4,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,$L58 + lw $3,8($16) + .set macro + .set reorder + +$L7: + move $sp,$fp +$L57: + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L47: + lw $3,8($16) + sb $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L49: + lw $3,8($16) +$L58: + sw $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L48: + lw $3,8($16) + sh $2,0($3) + move $sp,$fp + lw $31,36($sp) + lw $fp,32($sp) + lw $16,28($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,40 + .set macro + .set reorder + +$L51: + sw $2,0($4) + .set noreorder + .set nomacro + b $L7 + sw $3,4($4) + .set macro + .set reorder + +$L52: + lw $2,8($16) + .set noreorder + .set nomacro + b $L7 + swc1 $f0,0($2) + .set macro + .set reorder + +$L53: + lw $2,8($16) + .set noreorder + .set nomacro + b $L7 + sdc1 $f0,0($2) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call diff --git a/avcall/avcall-mipsn32.c b/avcall/avcall-mipsn32.c new file mode 100644 index 0000000..95d3168 --- /dev/null +++ b/avcall/avcall-mipsn32.c @@ -0,0 +1,493 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for an SGI 32-bit MIPS III with "cc -n32", + or gcc configured as mips-sgi-irix6. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + SGI MIPS new 32-bit Argument Passing Conventions + + - The entire argument list forms a structure with all the appropriate + holes & alignments, and space for this is allocated in the stack frame. + - Shorter integers are promoted to long long length (sizeof(long long)=8). + - Doubles are 1 longword. + - Structure arguments are copies embedded in the arglist structure. + - The first 8 longwords of the structure are passed in registers $4...$11, + except that float arguments are passed in registers $f12...$f19, and + that double arguments and structure elements of type double are passed + in registers $f12...$f19. (But varargs functions may expect them in the + integer registers and we can't tell whether the function is varargs so + we pass them both ways.) + Remaining longwords are passed on the stack. No stack space is allocated + for the first 8 longwords of the structure. + - Structure returns of structures > 16 bytes: pointers to caller-allocated + space are passed in as the first argument of the list. + - Structure returns of structures <= 16 bytes: in the registers $2 (for the + first 8 bytes) and $3 (for the next 8 bytes). + A structure of 1 or 2 floats or doubles is returned in $f0 and $f2: + the first float or double in $f0, the second float or double in $f2. + - Integer/pointer returns are in $2, float/double returns in $f0. + - The called function expects to see its own address in $25. + + This file needs to be compiled with gcc for the asm extensions, but the + assembly version of it and the header file seem to work with SGI cc. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) +#define OFFSETOF(struct,member) ((int)&(((struct*)0)->member)) + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("$sp"); /* C names for registers */ + register float fret __asm__("$f0"); + register double dret __asm__("$f0"); +/*register __avrword iret1 __asm__("$2"); */ + register __avrword iret2 __asm__("$3"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword *argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* big space for child's stack frame */ + int arglen = l->aptr - l->args; + __avrword iret; + int i; + + if (l->farg_mask) + { /* push leading float args */ + if (l->farg_mask & (1<<0)) + __asm__("lwc1 $f12,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[0])); + if (l->farg_mask & (1<<1)) + __asm__("lwc1 $f13,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[1])); + if (l->farg_mask & (1<<2)) + __asm__("lwc1 $f14,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[2])); + if (l->farg_mask & (1<<3)) + __asm__("lwc1 $f15,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[3])); + if (l->farg_mask & (1<<4)) + __asm__("lwc1 $f16,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[4])); + if (l->farg_mask & (1<<5)) + __asm__("lwc1 $f17,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[5])); + if (l->farg_mask & (1<<6)) + __asm__("lwc1 $f18,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[6])); + if (l->farg_mask & (1<<7)) + __asm__("lwc1 $f19,%1(%0)" : : "p" (l), "i" OFFSETOF(__av_alist,fargs[7])); + } + if (l->darg_mask) + { /* push leading double args */ + __avword* a = l->args; + if (l->darg_mask & (1<<0)) + __asm__("ldc1 $f12,%1(%0)" : : "p" (a), "i" (0 * sizeof (__avword))); + if (l->darg_mask & (1<<1)) + __asm__("ldc1 $f13,%1(%0)" : : "p" (a), "i" (1 * sizeof (__avword))); + if (l->darg_mask & (1<<2)) + __asm__("ldc1 $f14,%1(%0)" : : "p" (a), "i" (2 * sizeof (__avword))); + if (l->darg_mask & (1<<3)) + __asm__("ldc1 $f15,%1(%0)" : : "p" (a), "i" (3 * sizeof (__avword))); + if (l->darg_mask & (1<<4)) + __asm__("ldc1 $f16,%1(%0)" : : "p" (a), "i" (4 * sizeof (__avword))); + if (l->darg_mask & (1<<5)) + __asm__("ldc1 $f17,%1(%0)" : : "p" (a), "i" (5 * sizeof (__avword))); + if (l->darg_mask & (1<<6)) + __asm__("ldc1 $f18,%1(%0)" : : "p" (a), "i" (6 * sizeof (__avword))); + if (l->darg_mask & (1<<7)) + __asm__("ldc1 $f19,%1(%0)" : : "p" (a), "i" (7 * sizeof (__avword))); + } + + for (i = 8; i < arglen; i++) /* push excess function args */ + argframe[i-8] = l->args[i]; + + /* call function with 1st 8 args */ + __asm__ __volatile__ ("ld $4,%0" : : "m" (l->args[0]) : "$4"); /* arg1 = l->args[0]; */ + __asm__ __volatile__ ("ld $5,%0" : : "m" (l->args[1]) : "$5"); /* arg1 = l->args[1]; */ + __asm__ __volatile__ ("ld $6,%0" : : "m" (l->args[2]) : "$6"); /* arg1 = l->args[2]; */ + __asm__ __volatile__ ("ld $7,%0" : : "m" (l->args[3]) : "$7"); /* arg1 = l->args[3]; */ + __asm__ __volatile__ ("ld $8,%0" : : "m" (l->args[4]) : "$8"); /* arg1 = l->args[4]; */ + __asm__ __volatile__ ("ld $9,%0" : : "m" (l->args[5]) : "$9"); /* arg1 = l->args[5]; */ + __asm__ __volatile__ ("ld $10,%0" : : "m" (l->args[6]) : "$10"); /* arg1 = l->args[6]; */ + __asm__ __volatile__ ("ld $11,%0" : : "m" (l->args[7]) : "$11"); /* arg1 = l->args[7]; */ + /* Note: The code of this call ought to put the address of the called function + in register $25 before the call. */ + iret = (*l->func)(); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, iret); + } else + if (l->rtype == __AVlonglong) { + RETURN(long long, iret); + } else + if (l->rtype == __AVulonglong) { + RETURN(unsigned long long, iret); + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + if (l->flags & __AV_GCC_STRUCT_RETURN) { + /* gcc returns structs of size 1,2,4,8 in registers. */ + if (l->rsize == sizeof(char)) { + RETURN(char, iret); + } else + if (l->rsize == sizeof(short)) { + RETURN(short, iret); + } else + if (l->rsize == sizeof(int)) { + RETURN(int, iret); + } else + if (l->rsize == sizeof(long long)) { + RETURN(long long, iret); + } + } else { + /* cc returns structs of size <= 16 in registers. */ + if (l->rsize > 0 && l->rsize <= 16) { + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize == 1) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + #endif + } else + if (l->rsize == 2) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + #endif + } else + if (l->rsize == 3) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + #endif + } else + if (l->rsize == 4) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + #endif + } else + if (l->rsize == 5) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + #endif + } else + if (l->rsize == 6) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + #endif + } else + if (l->rsize == 7) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>8); + #endif + } else + if (l->rsize >= 8 && l->rsize <= 16) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[7] = (unsigned char)(iret>>56); + #else + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[7] = (unsigned char)(iret); + #endif + if (l->rsize == 8) { + } else + if (l->rsize == 9) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + #endif + } else + if (l->rsize == 10) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + #endif + } else + if (l->rsize == 11) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + #endif + } else + if (l->rsize == 12) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + #endif + } else + if (l->rsize == 13) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + #endif + } else + if (l->rsize == 14) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + #endif + } else + if (l->rsize == 15) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>8); + #endif + } else + if (l->rsize == 16) { + #if defined(_MIPSEL) + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+7] = (unsigned char)(iret2>>56); + #else + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+7] = (unsigned char)(iret2); + #endif + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 2*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__avrword) */ + #if defined(_MIPSEL) + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (end_offset*8-1)) - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret >> (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[1] ^= (wordaddr[1] ^ ((iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = ((__avrword)2 << (end_offset*8-2*sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*8-start_offset*8)) | (iret2 << (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 >> (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } + #else + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - ((__avrword)1 << (sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + __avrword mask1 = - ((__avrword)1 << (2*sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret << (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = - ((__avrword)1 << (2*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] ^= (wordaddr[1] ^ ((iret << (sizeof(__avrword)*4-start_offset*4) << (sizeof(__avrword)*4-start_offset*4)) | (iret2 >> (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = - ((__avrword)1 << (3*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] = (iret << (sizeof(__avrword)*8-start_offset*8)) | (iret2 >> (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 << (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } + #endif + #endif + } + } + } + } + return 0; +} diff --git a/avcall/avcall-mipsn32eb-linux.s b/avcall/avcall-mipsn32eb-linux.s new file mode 100644 index 0000000..d2e348c --- /dev/null +++ b/avcall/avcall-mipsn32eb-linux.s @@ -0,0 +1,725 @@ + .file 1 "avcall-mipsn32.c" + .section .mdebug.abiN32 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + .type avcall_call, @function +avcall_call: + .frame $fp,32,$31 # vars= 0, regs= 4/0, args= 0, gp= 0 + .mask 0xd0010000,-8 + .fmask 0x00000000,0 + lw $5,20($4) + lw $12,24($4) + lw $2,36($4) + addiu $sp,$sp,-32 + sd $fp,16($sp) + sd $16,0($sp) + sd $31,24($sp) + move $fp,$sp + move $16,$4 + addiu $sp,$sp,-2064 + subu $4,$5,$12 + move $3,$sp + .set noreorder + .set nomacro + beq $2,$0,.L2 + sra $4,$4,3 + .set macro + .set reorder + + andi $6,$2,0x1 + .set noreorder + .set nomacro + beq $6,$0,.L124 + andi $6,$2,0x2 + .set macro + .set reorder + +#APP + # 78 "avcall-mipsn32.c" 1 + lwc1 $f12,44($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x2 +.L124: + .set noreorder + .set nomacro + beq $6,$0,.L125 + andi $6,$2,0x4 + .set macro + .set reorder + +#APP + # 80 "avcall-mipsn32.c" 1 + lwc1 $f13,48($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x4 +.L125: + .set noreorder + .set nomacro + beq $6,$0,.L126 + andi $6,$2,0x8 + .set macro + .set reorder + +#APP + # 82 "avcall-mipsn32.c" 1 + lwc1 $f14,52($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x8 +.L126: + .set noreorder + .set nomacro + beq $6,$0,.L127 + andi $6,$2,0x10 + .set macro + .set reorder + +#APP + # 84 "avcall-mipsn32.c" 1 + lwc1 $f15,56($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x10 +.L127: + .set noreorder + .set nomacro + beq $6,$0,.L128 + andi $6,$2,0x20 + .set macro + .set reorder + +#APP + # 86 "avcall-mipsn32.c" 1 + lwc1 $f16,60($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x20 +.L128: + .set noreorder + .set nomacro + beq $6,$0,.L129 + andi $6,$2,0x40 + .set macro + .set reorder + +#APP + # 88 "avcall-mipsn32.c" 1 + lwc1 $f17,64($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x40 +.L129: + .set noreorder + .set nomacro + beql $6,$0,.L130 + andi $2,$2,0x80 + .set macro + .set reorder + +#APP + # 90 "avcall-mipsn32.c" 1 + lwc1 $f18,68($16) + # 0 "" 2 +#NO_APP + andi $2,$2,0x80 +.L130: + bne $2,$0,.L117 +.L2: + lw $2,40($16) +.L123: + .set noreorder + .set nomacro + beql $2,$0,.L122 + slt $4,$4,9 + .set macro + .set reorder + + andi $6,$2,0x1 + .set noreorder + .set nomacro + beq $6,$0,.L131 + andi $6,$2,0x2 + .set macro + .set reorder + +#APP + # 98 "avcall-mipsn32.c" 1 + ldc1 $f12,0($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x2 +.L131: + .set noreorder + .set nomacro + beq $6,$0,.L132 + andi $6,$2,0x4 + .set macro + .set reorder + +#APP + # 100 "avcall-mipsn32.c" 1 + ldc1 $f13,8($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x4 +.L132: + .set noreorder + .set nomacro + beq $6,$0,.L133 + andi $6,$2,0x8 + .set macro + .set reorder + +#APP + # 102 "avcall-mipsn32.c" 1 + ldc1 $f14,16($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x8 +.L133: + .set noreorder + .set nomacro + beq $6,$0,.L134 + andi $6,$2,0x10 + .set macro + .set reorder + +#APP + # 104 "avcall-mipsn32.c" 1 + ldc1 $f15,24($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x10 +.L134: + .set noreorder + .set nomacro + beq $6,$0,.L135 + andi $6,$2,0x20 + .set macro + .set reorder + +#APP + # 106 "avcall-mipsn32.c" 1 + ldc1 $f16,32($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x20 +.L135: + .set noreorder + .set nomacro + beq $6,$0,.L136 + andi $6,$2,0x40 + .set macro + .set reorder + +#APP + # 108 "avcall-mipsn32.c" 1 + ldc1 $f17,40($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x40 +.L136: + .set noreorder + .set nomacro + beql $6,$0,.L137 + andi $2,$2,0x80 + .set macro + .set reorder + +#APP + # 110 "avcall-mipsn32.c" 1 + ldc1 $f18,48($12) + # 0 "" 2 +#NO_APP + andi $2,$2,0x80 +.L137: + bne $2,$0,.L118 + slt $4,$4,9 +.L122: + .set noreorder + .set nomacro + bne $4,$0,.L22 + addiu $2,$12,64 + .set macro + .set reorder + + .align 3 +.L82: + ld $4,0($2) + addiu $3,$3,8 + addiu $2,$2,8 + .set noreorder + .set nomacro + bne $5,$2,.L82 + sd $4,-8($3) + .set macro + .set reorder + +.L22: +#APP + # 119 "avcall-mipsn32.c" 1 + ld $4,0($12) + # 0 "" 2 + # 120 "avcall-mipsn32.c" 1 + ld $5,8($12) + # 0 "" 2 + # 121 "avcall-mipsn32.c" 1 + ld $6,16($12) + # 0 "" 2 + # 122 "avcall-mipsn32.c" 1 + ld $7,24($12) + # 0 "" 2 + # 123 "avcall-mipsn32.c" 1 + ld $8,32($12) + # 0 "" 2 + # 124 "avcall-mipsn32.c" 1 + ld $9,40($12) + # 0 "" 2 + # 125 "avcall-mipsn32.c" 1 + ld $10,48($12) + # 0 "" 2 + # 126 "avcall-mipsn32.c" 1 + ld $11,56($12) + # 0 "" 2 +#NO_APP + lw $25,4($16) + jalr $25 + lw $4,12($16) + li $5,1 # 0x1 + .set noreorder + .set nomacro + beq $4,$5,.L19 + li $5,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,3 # 0x3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,5 # 0x5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,6 # 0x6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,7 # 0x7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,9 # 0x9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,10 # 0xa + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,11 # 0xb + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L115 + li $5,12 # 0xc + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L115 + li $5,13 # 0xd + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L119 + li $5,14 # 0xe + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L120 + li $5,15 # 0xf + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,16 # 0x10 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,.L138 + move $sp,$fp + .set macro + .set reorder + + lw $4,0($16) + andi $5,$4,0x200 + .set noreorder + .set nomacro + beq $5,$0,.L19 + andi $4,$4,0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $4,$0,.L37 + lw $4,16($16) + .set macro + .set reorder + + lw $3,16($16) + li $4,1 # 0x1 + .set noreorder + .set nomacro + beq $3,$4,.L107 + li $4,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L109 + li $4,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L110 + li $4,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,.L139 + lw $3,8($16) + .set macro + .set reorder + +.L19: + move $sp,$fp +.L138: + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L118: +#APP + # 112 "avcall-mipsn32.c" 1 + ldc1 $f19,56($12) + # 0 "" 2 +#NO_APP + .set noreorder + .set nomacro + b .L122 + slt $4,$4,9 + .set macro + .set reorder + + .align 3 +.L117: +#APP + # 92 "avcall-mipsn32.c" 1 + lwc1 $f19,72($16) + # 0 "" 2 +#NO_APP + .set noreorder + .set nomacro + b .L123 + lw $2,40($16) + .set macro + .set reorder + + .align 3 +.L107: + lw $3,8($16) + sb $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L110: + lw $3,8($16) + sw $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L109: + lw $3,8($16) + sh $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + +.L120: + lw $2,8($16) + .set noreorder + .set nomacro + b .L19 + sdc1 $f0,0($2) + .set macro + .set reorder + +.L115: + lw $3,8($16) +.L139: + .set noreorder + .set nomacro + b .L19 + sd $2,0($3) + .set macro + .set reorder + +.L119: + lw $2,8($16) + .set noreorder + .set nomacro + b .L19 + swc1 $f0,0($2) + .set macro + .set reorder + +.L37: + addiu $5,$4,-1 + sltu $5,$5,16 + .set noreorder + .set nomacro + beq $5,$0,.L19 + sltu $8,$4,9 + .set macro + .set reorder + + lw $6,8($16) + li $7,-8 # 0xfffffffffffffff8 + andi $5,$6,0x7 + and $7,$6,$7 + .set noreorder + .set nomacro + beq $8,$0,.L41 + addu $4,$4,$5 + .set macro + .set reorder + + sltu $3,$4,9 + .set noreorder + .set nomacro + beq $3,$0,.L42 + subu $6,$0,$5 + .set macro + .set reorder + + subu $3,$0,$5 + sll $3,$3,3 + ld $8,0($7) + addiu $3,$3,63 + subu $4,$0,$4 + li $6,2 # 0x2 + dsll $6,$6,$3 + sll $4,$4,3 + sll $5,$5,3 + li $3,1 # 0x1 + dsll $3,$3,$4 + dsra $2,$2,$5 + dsubu $3,$6,$3 + xor $2,$2,$8 + and $2,$3,$2 + xor $2,$2,$8 + .set noreorder + .set nomacro + b .L19 + sd $2,0($7) + .set macro + .set reorder + +.L41: + subu $9,$0,$5 + ld $11,0($7) + sll $10,$9,3 + addiu $6,$10,63 + sll $5,$5,3 + li $8,2 # 0x2 + dsll $8,$8,$6 + dsra $6,$2,$5 + daddiu $8,$8,-1 + xor $6,$6,$11 + and $6,$8,$6 + xor $6,$6,$11 + sltu $8,$4,17 + .set noreorder + .set nomacro + bne $8,$0,.L121 + sd $6,0($7) + .set macro + .set reorder + + ld $11,16($7) + addiu $6,$10,64 + subu $4,$0,$4 + move $8,$3 + dsll $9,$3,$6 + sll $4,$4,3 + li $3,-1 # 0xffffffffffffffff + dsll $4,$3,$4 + xor $3,$9,$11 + dsll $2,$2,$6 + dsra $5,$8,$5 + and $3,$4,$3 + or $2,$2,$5 + xor $3,$3,$11 + sd $2,8($7) + .set noreorder + .set nomacro + b .L19 + sd $3,16($7) + .set macro + .set reorder + +.L42: + ld $9,0($7) + ld $8,8($7) + sll $6,$6,3 + addiu $10,$6,63 + sll $3,$5,3 + subu $4,$0,$4 + li $5,2 # 0x2 + dsra $3,$2,$3 + dsll $5,$5,$10 + dsll $2,$2,$6 + sll $4,$4,3 + li $6,-1 # 0xffffffffffffffff + daddiu $5,$5,-1 + xor $3,$3,$9 + dsll $4,$6,$4 + xor $2,$2,$8 + and $3,$5,$3 + and $2,$4,$2 + xor $3,$3,$9 + xor $2,$2,$8 + sd $3,0($7) + .set noreorder + .set nomacro + b .L19 + sd $2,8($7) + .set macro + .set reorder + +.L121: + sll $6,$9,2 + addiu $6,$6,32 + ld $8,8($7) + dsll $2,$2,$6 + dsll $6,$2,$6 + dsra $3,$3,$5 + subu $2,$0,$4 + or $3,$6,$3 + sll $2,$2,3 + li $5,-1 # 0xffffffffffffffff + xor $3,$3,$8 + dsll $2,$5,$2 + and $2,$3,$2 + xor $2,$2,$8 + .set noreorder + .set nomacro + b .L19 + sd $2,8($7) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call + .ident "GCC: (GNU) 5.4.0" diff --git a/avcall/avcall-mipsn32eb-macro.S b/avcall/avcall-mipsn32eb-macro.S new file mode 100644 index 0000000..00701b9 --- /dev/null +++ b/avcall/avcall-mipsn32eb-macro.S @@ -0,0 +1,719 @@ +#include "asm-mips.h" + .file 1 "avcall-mipsn32.c" + .text + .align 2 + .align 3 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + DECLARE_FUNCTION(avcall_call) +avcall_call: + .frame $fp,32,$31 + .mask 0xd0010000,-8 + .fmask 0x00000000,0 + lw $5,20($4) + lw $12,24($4) + lw $2,36($4) + addiu $sp,$sp,-32 + sd $fp,16($sp) + sd $16,0($sp) + sd $31,24($sp) + move $fp,$sp + move $16,$4 + addiu $sp,$sp,-2064 + subu $4,$5,$12 + move $3,$sp + .set noreorder + .set nomacro + beq $2,$0,.L2 + sra $4,$4,3 + .set macro + .set reorder + + andi $6,$2,0x1 + .set noreorder + .set nomacro + beq $6,$0,.L124 + andi $6,$2,0x2 + .set macro + .set reorder + + + + lwc1 $f12,44($16) + + + andi $6,$2,0x2 +.L124: + .set noreorder + .set nomacro + beq $6,$0,.L125 + andi $6,$2,0x4 + .set macro + .set reorder + + + + lwc1 $f13,48($16) + + + andi $6,$2,0x4 +.L125: + .set noreorder + .set nomacro + beq $6,$0,.L126 + andi $6,$2,0x8 + .set macro + .set reorder + + + + lwc1 $f14,52($16) + + + andi $6,$2,0x8 +.L126: + .set noreorder + .set nomacro + beq $6,$0,.L127 + andi $6,$2,0x10 + .set macro + .set reorder + + + + lwc1 $f15,56($16) + + + andi $6,$2,0x10 +.L127: + .set noreorder + .set nomacro + beq $6,$0,.L128 + andi $6,$2,0x20 + .set macro + .set reorder + + + + lwc1 $f16,60($16) + + + andi $6,$2,0x20 +.L128: + .set noreorder + .set nomacro + beq $6,$0,.L129 + andi $6,$2,0x40 + .set macro + .set reorder + + + + lwc1 $f17,64($16) + + + andi $6,$2,0x40 +.L129: + .set noreorder + .set nomacro + beql $6,$0,.L130 + andi $2,$2,0x80 + .set macro + .set reorder + + + + lwc1 $f18,68($16) + + + andi $2,$2,0x80 +.L130: + bne $2,$0,.L117 +.L2: + lw $2,40($16) +.L123: + .set noreorder + .set nomacro + beql $2,$0,.L122 + slt $4,$4,9 + .set macro + .set reorder + + andi $6,$2,0x1 + .set noreorder + .set nomacro + beq $6,$0,.L131 + andi $6,$2,0x2 + .set macro + .set reorder + + + + ldc1 $f12,0($12) + + + andi $6,$2,0x2 +.L131: + .set noreorder + .set nomacro + beq $6,$0,.L132 + andi $6,$2,0x4 + .set macro + .set reorder + + + + ldc1 $f13,8($12) + + + andi $6,$2,0x4 +.L132: + .set noreorder + .set nomacro + beq $6,$0,.L133 + andi $6,$2,0x8 + .set macro + .set reorder + + + + ldc1 $f14,16($12) + + + andi $6,$2,0x8 +.L133: + .set noreorder + .set nomacro + beq $6,$0,.L134 + andi $6,$2,0x10 + .set macro + .set reorder + + + + ldc1 $f15,24($12) + + + andi $6,$2,0x10 +.L134: + .set noreorder + .set nomacro + beq $6,$0,.L135 + andi $6,$2,0x20 + .set macro + .set reorder + + + + ldc1 $f16,32($12) + + + andi $6,$2,0x20 +.L135: + .set noreorder + .set nomacro + beq $6,$0,.L136 + andi $6,$2,0x40 + .set macro + .set reorder + + + + ldc1 $f17,40($12) + + + andi $6,$2,0x40 +.L136: + .set noreorder + .set nomacro + beql $6,$0,.L137 + andi $2,$2,0x80 + .set macro + .set reorder + + + + ldc1 $f18,48($12) + + + andi $2,$2,0x80 +.L137: + bne $2,$0,.L118 + slt $4,$4,9 +.L122: + .set noreorder + .set nomacro + bne $4,$0,.L22 + addiu $2,$12,64 + .set macro + .set reorder + + .align 3 +.L82: + ld $4,0($2) + addiu $3,$3,8 + addiu $2,$2,8 + .set noreorder + .set nomacro + bne $5,$2,.L82 + sd $4,-8($3) + .set macro + .set reorder + +.L22: + + + ld $4,0($12) + + + ld $5,8($12) + + + ld $6,16($12) + + + ld $7,24($12) + + + ld $8,32($12) + + + ld $9,40($12) + + + ld $10,48($12) + + + ld $11,56($12) + + + lw $25,4($16) + jalr $25 + lw $4,12($16) + li $5,1 + .set noreorder + .set nomacro + beq $4,$5,.L19 + li $5,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,10 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,11 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L115 + li $5,12 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L115 + li $5,13 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L119 + li $5,14 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L120 + li $5,15 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,16 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,.L138 + move $sp,$fp + .set macro + .set reorder + + lw $4,0($16) + andi $5,$4,0x200 + .set noreorder + .set nomacro + beq $5,$0,.L19 + andi $4,$4,0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $4,$0,.L37 + lw $4,16($16) + .set macro + .set reorder + + lw $3,16($16) + li $4,1 + .set noreorder + .set nomacro + beq $3,$4,.L107 + li $4,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L109 + li $4,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L110 + li $4,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,.L139 + lw $3,8($16) + .set macro + .set reorder + +.L19: + move $sp,$fp +.L138: + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L118: + + + ldc1 $f19,56($12) + + + .set noreorder + .set nomacro + b .L122 + slt $4,$4,9 + .set macro + .set reorder + + .align 3 +.L117: + + + lwc1 $f19,72($16) + + + .set noreorder + .set nomacro + b .L123 + lw $2,40($16) + .set macro + .set reorder + + .align 3 +.L107: + lw $3,8($16) + sb $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L110: + lw $3,8($16) + sw $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L109: + lw $3,8($16) + sh $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + +.L120: + lw $2,8($16) + .set noreorder + .set nomacro + b .L19 + sdc1 $f0,0($2) + .set macro + .set reorder + +.L115: + lw $3,8($16) +.L139: + .set noreorder + .set nomacro + b .L19 + sd $2,0($3) + .set macro + .set reorder + +.L119: + lw $2,8($16) + .set noreorder + .set nomacro + b .L19 + swc1 $f0,0($2) + .set macro + .set reorder + +.L37: + addiu $5,$4,-1 + sltu $5,$5,16 + .set noreorder + .set nomacro + beq $5,$0,.L19 + sltu $8,$4,9 + .set macro + .set reorder + + lw $6,8($16) + li $7,-8 + andi $5,$6,0x7 + and $7,$6,$7 + .set noreorder + .set nomacro + beq $8,$0,.L41 + addu $4,$4,$5 + .set macro + .set reorder + + sltu $3,$4,9 + .set noreorder + .set nomacro + beq $3,$0,.L42 + subu $6,$0,$5 + .set macro + .set reorder + + subu $3,$0,$5 + sll $3,$3,3 + ld $8,0($7) + addiu $3,$3,63 + subu $4,$0,$4 + li $6,2 + dsll $6,$6,$3 + sll $4,$4,3 + sll $5,$5,3 + li $3,1 + dsll $3,$3,$4 + dsra $2,$2,$5 + dsubu $3,$6,$3 + xor $2,$2,$8 + and $2,$3,$2 + xor $2,$2,$8 + .set noreorder + .set nomacro + b .L19 + sd $2,0($7) + .set macro + .set reorder + +.L41: + subu $9,$0,$5 + ld $11,0($7) + sll $10,$9,3 + addiu $6,$10,63 + sll $5,$5,3 + li $8,2 + dsll $8,$8,$6 + dsra $6,$2,$5 + daddiu $8,$8,-1 + xor $6,$6,$11 + and $6,$8,$6 + xor $6,$6,$11 + sltu $8,$4,17 + .set noreorder + .set nomacro + bne $8,$0,.L121 + sd $6,0($7) + .set macro + .set reorder + + ld $11,16($7) + addiu $6,$10,64 + subu $4,$0,$4 + move $8,$3 + dsll $9,$3,$6 + sll $4,$4,3 + li $3,-1 + dsll $4,$3,$4 + xor $3,$9,$11 + dsll $2,$2,$6 + dsra $5,$8,$5 + and $3,$4,$3 + or $2,$2,$5 + xor $3,$3,$11 + sd $2,8($7) + .set noreorder + .set nomacro + b .L19 + sd $3,16($7) + .set macro + .set reorder + +.L42: + ld $9,0($7) + ld $8,8($7) + sll $6,$6,3 + addiu $10,$6,63 + sll $3,$5,3 + subu $4,$0,$4 + li $5,2 + dsra $3,$2,$3 + dsll $5,$5,$10 + dsll $2,$2,$6 + sll $4,$4,3 + li $6,-1 + daddiu $5,$5,-1 + xor $3,$3,$9 + dsll $4,$6,$4 + xor $2,$2,$8 + and $3,$5,$3 + and $2,$4,$2 + xor $3,$3,$9 + xor $2,$2,$8 + sd $3,0($7) + .set noreorder + .set nomacro + b .L19 + sd $2,8($7) + .set macro + .set reorder + +.L121: + sll $6,$9,2 + addiu $6,$6,32 + ld $8,8($7) + dsll $2,$2,$6 + dsll $6,$2,$6 + dsra $3,$3,$5 + subu $2,$0,$4 + or $3,$6,$3 + sll $2,$2,3 + li $5,-1 + xor $3,$3,$8 + dsll $2,$5,$2 + and $2,$3,$2 + xor $2,$2,$8 + .set noreorder + .set nomacro + b .L19 + sd $2,8($7) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call diff --git a/avcall/avcall-mipsn32el-linux.s b/avcall/avcall-mipsn32el-linux.s new file mode 100644 index 0000000..9869217 --- /dev/null +++ b/avcall/avcall-mipsn32el-linux.s @@ -0,0 +1,723 @@ + .file 1 "avcall-mipsn32.c" + .section .mdebug.abiN32 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + .type avcall_call, @function +avcall_call: + .frame $fp,32,$31 # vars= 0, regs= 4/0, args= 0, gp= 0 + .mask 0xd0010000,-8 + .fmask 0x00000000,0 + lw $5,20($4) + lw $12,24($4) + lw $2,36($4) + addiu $sp,$sp,-32 + sd $fp,16($sp) + sd $16,0($sp) + sd $31,24($sp) + move $fp,$sp + move $16,$4 + addiu $sp,$sp,-2064 + subu $4,$5,$12 + move $3,$sp + .set noreorder + .set nomacro + beq $2,$0,.L2 + sra $4,$4,3 + .set macro + .set reorder + + andi $6,$2,0x1 + .set noreorder + .set nomacro + beq $6,$0,.L124 + andi $6,$2,0x2 + .set macro + .set reorder + +#APP + # 78 "avcall-mipsn32.c" 1 + lwc1 $f12,44($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x2 +.L124: + .set noreorder + .set nomacro + beq $6,$0,.L125 + andi $6,$2,0x4 + .set macro + .set reorder + +#APP + # 80 "avcall-mipsn32.c" 1 + lwc1 $f13,48($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x4 +.L125: + .set noreorder + .set nomacro + beq $6,$0,.L126 + andi $6,$2,0x8 + .set macro + .set reorder + +#APP + # 82 "avcall-mipsn32.c" 1 + lwc1 $f14,52($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x8 +.L126: + .set noreorder + .set nomacro + beq $6,$0,.L127 + andi $6,$2,0x10 + .set macro + .set reorder + +#APP + # 84 "avcall-mipsn32.c" 1 + lwc1 $f15,56($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x10 +.L127: + .set noreorder + .set nomacro + beq $6,$0,.L128 + andi $6,$2,0x20 + .set macro + .set reorder + +#APP + # 86 "avcall-mipsn32.c" 1 + lwc1 $f16,60($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x20 +.L128: + .set noreorder + .set nomacro + beq $6,$0,.L129 + andi $6,$2,0x40 + .set macro + .set reorder + +#APP + # 88 "avcall-mipsn32.c" 1 + lwc1 $f17,64($16) + # 0 "" 2 +#NO_APP + andi $6,$2,0x40 +.L129: + .set noreorder + .set nomacro + beql $6,$0,.L130 + andi $2,$2,0x80 + .set macro + .set reorder + +#APP + # 90 "avcall-mipsn32.c" 1 + lwc1 $f18,68($16) + # 0 "" 2 +#NO_APP + andi $2,$2,0x80 +.L130: + bne $2,$0,.L117 +.L2: + lw $2,40($16) +.L123: + .set noreorder + .set nomacro + beql $2,$0,.L122 + slt $4,$4,9 + .set macro + .set reorder + + andi $6,$2,0x1 + .set noreorder + .set nomacro + beq $6,$0,.L131 + andi $6,$2,0x2 + .set macro + .set reorder + +#APP + # 98 "avcall-mipsn32.c" 1 + ldc1 $f12,0($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x2 +.L131: + .set noreorder + .set nomacro + beq $6,$0,.L132 + andi $6,$2,0x4 + .set macro + .set reorder + +#APP + # 100 "avcall-mipsn32.c" 1 + ldc1 $f13,8($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x4 +.L132: + .set noreorder + .set nomacro + beq $6,$0,.L133 + andi $6,$2,0x8 + .set macro + .set reorder + +#APP + # 102 "avcall-mipsn32.c" 1 + ldc1 $f14,16($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x8 +.L133: + .set noreorder + .set nomacro + beq $6,$0,.L134 + andi $6,$2,0x10 + .set macro + .set reorder + +#APP + # 104 "avcall-mipsn32.c" 1 + ldc1 $f15,24($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x10 +.L134: + .set noreorder + .set nomacro + beq $6,$0,.L135 + andi $6,$2,0x20 + .set macro + .set reorder + +#APP + # 106 "avcall-mipsn32.c" 1 + ldc1 $f16,32($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x20 +.L135: + .set noreorder + .set nomacro + beq $6,$0,.L136 + andi $6,$2,0x40 + .set macro + .set reorder + +#APP + # 108 "avcall-mipsn32.c" 1 + ldc1 $f17,40($12) + # 0 "" 2 +#NO_APP + andi $6,$2,0x40 +.L136: + .set noreorder + .set nomacro + beql $6,$0,.L137 + andi $2,$2,0x80 + .set macro + .set reorder + +#APP + # 110 "avcall-mipsn32.c" 1 + ldc1 $f18,48($12) + # 0 "" 2 +#NO_APP + andi $2,$2,0x80 +.L137: + bne $2,$0,.L118 + slt $4,$4,9 +.L122: + .set noreorder + .set nomacro + bne $4,$0,.L22 + addiu $2,$12,64 + .set macro + .set reorder + + .align 3 +.L82: + ld $4,0($2) + addiu $3,$3,8 + addiu $2,$2,8 + .set noreorder + .set nomacro + bne $5,$2,.L82 + sd $4,-8($3) + .set macro + .set reorder + +.L22: +#APP + # 119 "avcall-mipsn32.c" 1 + ld $4,0($12) + # 0 "" 2 + # 120 "avcall-mipsn32.c" 1 + ld $5,8($12) + # 0 "" 2 + # 121 "avcall-mipsn32.c" 1 + ld $6,16($12) + # 0 "" 2 + # 122 "avcall-mipsn32.c" 1 + ld $7,24($12) + # 0 "" 2 + # 123 "avcall-mipsn32.c" 1 + ld $8,32($12) + # 0 "" 2 + # 124 "avcall-mipsn32.c" 1 + ld $9,40($12) + # 0 "" 2 + # 125 "avcall-mipsn32.c" 1 + ld $10,48($12) + # 0 "" 2 + # 126 "avcall-mipsn32.c" 1 + ld $11,56($12) + # 0 "" 2 +#NO_APP + lw $25,4($16) + jalr $25 + lw $4,12($16) + li $5,1 # 0x1 + .set noreorder + .set nomacro + beq $4,$5,.L19 + li $5,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,3 # 0x3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,5 # 0x5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,6 # 0x6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,7 # 0x7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,9 # 0x9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,10 # 0xa + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,11 # 0xb + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L115 + li $5,12 # 0xc + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L115 + li $5,13 # 0xd + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L119 + li $5,14 # 0xe + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L120 + li $5,15 # 0xf + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,16 # 0x10 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,.L138 + move $sp,$fp + .set macro + .set reorder + + lw $4,0($16) + andi $5,$4,0x200 + .set noreorder + .set nomacro + beq $5,$0,.L19 + andi $4,$4,0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $4,$0,.L37 + lw $5,16($16) + .set macro + .set reorder + + lw $3,16($16) + li $4,1 # 0x1 + .set noreorder + .set nomacro + beq $3,$4,.L107 + li $4,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L109 + li $4,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L110 + li $4,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,.L139 + lw $3,8($16) + .set macro + .set reorder + +.L19: + move $sp,$fp +.L138: + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L118: +#APP + # 112 "avcall-mipsn32.c" 1 + ldc1 $f19,56($12) + # 0 "" 2 +#NO_APP + .set noreorder + .set nomacro + b .L122 + slt $4,$4,9 + .set macro + .set reorder + + .align 3 +.L117: +#APP + # 92 "avcall-mipsn32.c" 1 + lwc1 $f19,72($16) + # 0 "" 2 +#NO_APP + .set noreorder + .set nomacro + b .L123 + lw $2,40($16) + .set macro + .set reorder + + .align 3 +.L107: + lw $3,8($16) + sb $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L110: + lw $3,8($16) + sw $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L109: + lw $3,8($16) + sh $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + +.L120: + lw $2,8($16) + .set noreorder + .set nomacro + b .L19 + sdc1 $f0,0($2) + .set macro + .set reorder + +.L115: + lw $3,8($16) +.L139: + .set noreorder + .set nomacro + b .L19 + sd $2,0($3) + .set macro + .set reorder + +.L119: + lw $2,8($16) + .set noreorder + .set nomacro + b .L19 + swc1 $f0,0($2) + .set macro + .set reorder + +.L37: + addiu $4,$5,-1 + sltu $4,$4,16 + .set noreorder + .set nomacro + beq $4,$0,.L19 + sltu $7,$5,9 + .set macro + .set reorder + + lw $6,8($16) + li $8,-8 # 0xfffffffffffffff8 + andi $4,$6,0x7 + addu $5,$5,$4 + .set noreorder + .set nomacro + beq $7,$0,.L41 + and $6,$6,$8 + .set macro + .set reorder + + sltu $3,$5,9 + .set noreorder + .set nomacro + beql $3,$0,.L42 + ld $10,0($6) + .set macro + .set reorder + + sll $5,$5,3 + ld $7,0($6) + li $3,2 # 0x2 + addiu $5,$5,-1 + sll $4,$4,3 + dsll $5,$3,$5 + li $3,1 # 0x1 + dsll $3,$3,$4 + dsll $4,$2,$4 + dsubu $3,$5,$3 + xor $2,$4,$7 + and $2,$3,$2 + xor $2,$2,$7 + .set noreorder + .set nomacro + b .L19 + sd $2,0($6) + .set macro + .set reorder + +.L41: + ld $10,0($6) + sll $9,$4,3 + dsll $7,$2,$9 + li $8,-1 # 0xffffffffffffffff + dsll $8,$8,$9 + xor $7,$7,$10 + and $7,$8,$7 + xor $7,$7,$10 + sltu $8,$5,17 + .set noreorder + .set nomacro + bne $8,$0,.L121 + sd $7,0($6) + .set macro + .set reorder + + subu $4,$0,$4 + ld $10,16($6) + sll $4,$4,3 + sll $5,$5,3 + addiu $4,$4,64 + addiu $5,$5,-129 + li $7,2 # 0x2 + move $8,$3 + dsll $5,$7,$5 + dsra $3,$3,$4 + daddiu $5,$5,-1 + xor $3,$3,$10 + dsra $2,$2,$4 + dsll $8,$8,$9 + and $3,$5,$3 + or $2,$2,$8 + xor $3,$3,$10 + sd $2,8($6) + .set noreorder + .set nomacro + b .L19 + sd $3,16($6) + .set macro + .set reorder + +.L42: + ld $9,8($6) + sll $3,$5,3 + subu $5,$0,$4 + addiu $8,$3,-65 + sll $4,$4,3 + sll $5,$5,3 + li $3,2 # 0x2 + dsll $7,$2,$4 + dsll $3,$3,$8 + dsra $2,$2,$5 + li $5,-1 # 0xffffffffffffffff + dsll $4,$5,$4 + daddiu $3,$3,-1 + xor $5,$7,$10 + xor $2,$2,$9 + and $2,$3,$2 + and $4,$4,$5 + xor $3,$4,$10 + xor $2,$2,$9 + sd $3,0($6) + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + +.L121: + subu $7,$0,$4 + sll $7,$7,2 + addiu $7,$7,32 + ld $10,8($6) + dsra $4,$2,$7 + move $8,$3 + sll $3,$5,3 + addiu $3,$3,-65 + dsra $5,$4,$7 + dsll $2,$8,$9 + li $4,2 # 0x2 + dsll $3,$4,$3 + or $2,$5,$2 + daddiu $3,$3,-1 + xor $2,$2,$10 + and $2,$3,$2 + xor $2,$2,$10 + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call + .ident "GCC: (GNU) 5.4.0" diff --git a/avcall/avcall-mipsn32el-macro.S b/avcall/avcall-mipsn32el-macro.S new file mode 100644 index 0000000..6da6010 --- /dev/null +++ b/avcall/avcall-mipsn32el-macro.S @@ -0,0 +1,717 @@ +#include "asm-mips.h" + .file 1 "avcall-mipsn32.c" + .text + .align 2 + .align 3 + .globl avcall_call + .set nomips16 + .set nomicromips + .ent avcall_call + DECLARE_FUNCTION(avcall_call) +avcall_call: + .frame $fp,32,$31 + .mask 0xd0010000,-8 + .fmask 0x00000000,0 + lw $5,20($4) + lw $12,24($4) + lw $2,36($4) + addiu $sp,$sp,-32 + sd $fp,16($sp) + sd $16,0($sp) + sd $31,24($sp) + move $fp,$sp + move $16,$4 + addiu $sp,$sp,-2064 + subu $4,$5,$12 + move $3,$sp + .set noreorder + .set nomacro + beq $2,$0,.L2 + sra $4,$4,3 + .set macro + .set reorder + + andi $6,$2,0x1 + .set noreorder + .set nomacro + beq $6,$0,.L124 + andi $6,$2,0x2 + .set macro + .set reorder + + + + lwc1 $f12,44($16) + + + andi $6,$2,0x2 +.L124: + .set noreorder + .set nomacro + beq $6,$0,.L125 + andi $6,$2,0x4 + .set macro + .set reorder + + + + lwc1 $f13,48($16) + + + andi $6,$2,0x4 +.L125: + .set noreorder + .set nomacro + beq $6,$0,.L126 + andi $6,$2,0x8 + .set macro + .set reorder + + + + lwc1 $f14,52($16) + + + andi $6,$2,0x8 +.L126: + .set noreorder + .set nomacro + beq $6,$0,.L127 + andi $6,$2,0x10 + .set macro + .set reorder + + + + lwc1 $f15,56($16) + + + andi $6,$2,0x10 +.L127: + .set noreorder + .set nomacro + beq $6,$0,.L128 + andi $6,$2,0x20 + .set macro + .set reorder + + + + lwc1 $f16,60($16) + + + andi $6,$2,0x20 +.L128: + .set noreorder + .set nomacro + beq $6,$0,.L129 + andi $6,$2,0x40 + .set macro + .set reorder + + + + lwc1 $f17,64($16) + + + andi $6,$2,0x40 +.L129: + .set noreorder + .set nomacro + beql $6,$0,.L130 + andi $2,$2,0x80 + .set macro + .set reorder + + + + lwc1 $f18,68($16) + + + andi $2,$2,0x80 +.L130: + bne $2,$0,.L117 +.L2: + lw $2,40($16) +.L123: + .set noreorder + .set nomacro + beql $2,$0,.L122 + slt $4,$4,9 + .set macro + .set reorder + + andi $6,$2,0x1 + .set noreorder + .set nomacro + beq $6,$0,.L131 + andi $6,$2,0x2 + .set macro + .set reorder + + + + ldc1 $f12,0($12) + + + andi $6,$2,0x2 +.L131: + .set noreorder + .set nomacro + beq $6,$0,.L132 + andi $6,$2,0x4 + .set macro + .set reorder + + + + ldc1 $f13,8($12) + + + andi $6,$2,0x4 +.L132: + .set noreorder + .set nomacro + beq $6,$0,.L133 + andi $6,$2,0x8 + .set macro + .set reorder + + + + ldc1 $f14,16($12) + + + andi $6,$2,0x8 +.L133: + .set noreorder + .set nomacro + beq $6,$0,.L134 + andi $6,$2,0x10 + .set macro + .set reorder + + + + ldc1 $f15,24($12) + + + andi $6,$2,0x10 +.L134: + .set noreorder + .set nomacro + beq $6,$0,.L135 + andi $6,$2,0x20 + .set macro + .set reorder + + + + ldc1 $f16,32($12) + + + andi $6,$2,0x20 +.L135: + .set noreorder + .set nomacro + beq $6,$0,.L136 + andi $6,$2,0x40 + .set macro + .set reorder + + + + ldc1 $f17,40($12) + + + andi $6,$2,0x40 +.L136: + .set noreorder + .set nomacro + beql $6,$0,.L137 + andi $2,$2,0x80 + .set macro + .set reorder + + + + ldc1 $f18,48($12) + + + andi $2,$2,0x80 +.L137: + bne $2,$0,.L118 + slt $4,$4,9 +.L122: + .set noreorder + .set nomacro + bne $4,$0,.L22 + addiu $2,$12,64 + .set macro + .set reorder + + .align 3 +.L82: + ld $4,0($2) + addiu $3,$3,8 + addiu $2,$2,8 + .set noreorder + .set nomacro + bne $5,$2,.L82 + sd $4,-8($3) + .set macro + .set reorder + +.L22: + + + ld $4,0($12) + + + ld $5,8($12) + + + ld $6,16($12) + + + ld $7,24($12) + + + ld $8,32($12) + + + ld $9,40($12) + + + ld $10,48($12) + + + ld $11,56($12) + + + lw $25,4($16) + jalr $25 + lw $4,12($16) + li $5,1 + .set noreorder + .set nomacro + beq $4,$5,.L19 + li $5,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L107 + li $5,5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L109 + li $5,7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,10 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,11 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L115 + li $5,12 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L115 + li $5,13 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L119 + li $5,14 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L120 + li $5,15 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,.L110 + li $5,16 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,.L138 + move $sp,$fp + .set macro + .set reorder + + lw $4,0($16) + andi $5,$4,0x200 + .set noreorder + .set nomacro + beq $5,$0,.L19 + andi $4,$4,0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $4,$0,.L37 + lw $5,16($16) + .set macro + .set reorder + + lw $3,16($16) + li $4,1 + .set noreorder + .set nomacro + beq $3,$4,.L107 + li $4,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L109 + li $4,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $3,$4,.L110 + li $4,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beql $3,$4,.L139 + lw $3,8($16) + .set macro + .set reorder + +.L19: + move $sp,$fp +.L138: + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L118: + + + ldc1 $f19,56($12) + + + .set noreorder + .set nomacro + b .L122 + slt $4,$4,9 + .set macro + .set reorder + + .align 3 +.L117: + + + lwc1 $f19,72($16) + + + .set noreorder + .set nomacro + b .L123 + lw $2,40($16) + .set macro + .set reorder + + .align 3 +.L107: + lw $3,8($16) + sb $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L110: + lw $3,8($16) + sw $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + + .align 3 +.L109: + lw $3,8($16) + sh $2,0($3) + move $sp,$fp + ld $31,24($sp) + ld $fp,16($sp) + ld $16,0($sp) + move $2,$0 + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,32 + .set macro + .set reorder + +.L120: + lw $2,8($16) + .set noreorder + .set nomacro + b .L19 + sdc1 $f0,0($2) + .set macro + .set reorder + +.L115: + lw $3,8($16) +.L139: + .set noreorder + .set nomacro + b .L19 + sd $2,0($3) + .set macro + .set reorder + +.L119: + lw $2,8($16) + .set noreorder + .set nomacro + b .L19 + swc1 $f0,0($2) + .set macro + .set reorder + +.L37: + addiu $4,$5,-1 + sltu $4,$4,16 + .set noreorder + .set nomacro + beq $4,$0,.L19 + sltu $7,$5,9 + .set macro + .set reorder + + lw $6,8($16) + li $8,-8 + andi $4,$6,0x7 + addu $5,$5,$4 + .set noreorder + .set nomacro + beq $7,$0,.L41 + and $6,$6,$8 + .set macro + .set reorder + + sltu $3,$5,9 + .set noreorder + .set nomacro + beql $3,$0,.L42 + ld $10,0($6) + .set macro + .set reorder + + sll $5,$5,3 + ld $7,0($6) + li $3,2 + addiu $5,$5,-1 + sll $4,$4,3 + dsll $5,$3,$5 + li $3,1 + dsll $3,$3,$4 + dsll $4,$2,$4 + dsubu $3,$5,$3 + xor $2,$4,$7 + and $2,$3,$2 + xor $2,$2,$7 + .set noreorder + .set nomacro + b .L19 + sd $2,0($6) + .set macro + .set reorder + +.L41: + ld $10,0($6) + sll $9,$4,3 + dsll $7,$2,$9 + li $8,-1 + dsll $8,$8,$9 + xor $7,$7,$10 + and $7,$8,$7 + xor $7,$7,$10 + sltu $8,$5,17 + .set noreorder + .set nomacro + bne $8,$0,.L121 + sd $7,0($6) + .set macro + .set reorder + + subu $4,$0,$4 + ld $10,16($6) + sll $4,$4,3 + sll $5,$5,3 + addiu $4,$4,64 + addiu $5,$5,-129 + li $7,2 + move $8,$3 + dsll $5,$7,$5 + dsra $3,$3,$4 + daddiu $5,$5,-1 + xor $3,$3,$10 + dsra $2,$2,$4 + dsll $8,$8,$9 + and $3,$5,$3 + or $2,$2,$8 + xor $3,$3,$10 + sd $2,8($6) + .set noreorder + .set nomacro + b .L19 + sd $3,16($6) + .set macro + .set reorder + +.L42: + ld $9,8($6) + sll $3,$5,3 + subu $5,$0,$4 + addiu $8,$3,-65 + sll $4,$4,3 + sll $5,$5,3 + li $3,2 + dsll $7,$2,$4 + dsll $3,$3,$8 + dsra $2,$2,$5 + li $5,-1 + dsll $4,$5,$4 + daddiu $3,$3,-1 + xor $5,$7,$10 + xor $2,$2,$9 + and $2,$3,$2 + and $4,$4,$5 + xor $3,$4,$10 + xor $2,$2,$9 + sd $3,0($6) + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + +.L121: + subu $7,$0,$4 + sll $7,$7,2 + addiu $7,$7,32 + ld $10,8($6) + dsra $4,$2,$7 + move $8,$3 + sll $3,$5,3 + addiu $3,$3,-65 + dsra $5,$4,$7 + dsll $2,$8,$9 + li $4,2 + dsll $3,$4,$3 + or $2,$5,$2 + daddiu $3,$3,-1 + xor $2,$2,$10 + and $2,$3,$2 + xor $2,$2,$10 + .set noreorder + .set nomacro + b .L19 + sd $2,8($6) + .set macro + .set reorder + + .end avcall_call + .size avcall_call, .-avcall_call diff --git a/avcall/avcall-powerpc-aix.s b/avcall/avcall-powerpc-aix.s new file mode 100644 index 0000000..b066af7 --- /dev/null +++ b/avcall/avcall-powerpc-aix.s @@ -0,0 +1,212 @@ + .file "avcall-powerpc.c" + .toc + .csect .text[PR] + .align 2 + .globl avcall_call + .globl .avcall_call + .csect avcall_call[DS] +avcall_call: + .long .avcall_call, TOC[tc0], 0 + .csect .text[PR] +.avcall_call: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + mflr 0 + stw 0,8(1) + stw 30,-8(1) + stw 31,-4(1) + stw 29,-12(1) + stwu 1,-72(1) + lwz 0,20(3) + lwz 11,24(3) + mr 30,3 + subfc 0,11,0 + srawi 8,0,2 + li 3,8 + lwz 9,0(1) + cmpw 0,3,8 + mr 31,1 + stwu 9,-1040(1) + addi 0,1,71 + rlwinm 10,0,0,0,27 + bge- 0,L..87 +L..6: + slwi 9,3,2 + addi 3,3,1 + cmpw 0,3,8 + lwzx 0,9,11 + add 9,9,10 + stw 0,-32(9) + blt+ 0,L..6 +L..86: + lwz 9,40(30) + subfc 9,30,9 + addi 9,9,-44 + srawi. 9,9,3 + beq- 0,L..8 + cmpwi 0,9,1 + beq- 0,L..11 + cmpwi 0,9,2 + beq- 0,L..14 + cmpwi 0,9,3 + beq- 0,L..17 + cmpwi 0,9,4 + beq- 0,L..20 + cmpwi 0,9,5 + beq- 0,L..23 + cmpwi 0,9,6 + beq- 0,L..26 + cmpwi 0,9,7 + beq- 0,L..29 + cmpwi 0,9,8 + beq- 0,L..32 + cmpwi 0,9,9 + beq- 0,L..35 + cmpwi 0,9,10 + beq- 0,L..38 + cmpwi 0,9,11 + beq- 0,L..41 + cmpwi 0,9,12 + beq- 0,L..44 +L..47: + lfd 13,140(30) +L..44: + lfd 12,132(30) +L..41: + lfd 11,124(30) +L..38: + lfd 10,116(30) +L..35: + lfd 9,108(30) +L..32: + lfd 8,100(30) +L..29: + lfd 7,92(30) +L..26: + lfd 6,84(30) +L..23: + lfd 5,76(30) +L..20: + lfd 4,68(30) +L..17: + lfd 3,60(30) +L..14: + lfd 2,52(30) +L..11: + lfd 1,44(30) +L..8: + lwz 29,4(30) + lwz 9,24(11) + lwz 0,0(29) + lwz 10,28(11) + lwz 3,0(11) + mtctr 0 + lwz 4,4(11) + lwz 5,8(11) + lwz 6,12(11) + lwz 7,16(11) + lwz 8,20(11) + stw 2,20(1) + lwz 11,8(29) + lwz 2,4(29) + bctrl + lwz 2,20(1) + lwz 9,12(30) + cmpwi 0,9,1 + beq- 0,L..49 + cmpwi 0,9,2 + beq- 0,L..90 + cmpwi 0,9,3 + beq- 0,L..90 + cmpwi 0,9,4 + beq- 0,L..90 + cmpwi 0,9,5 + beq- 0,L..89 + cmpwi 0,9,6 + beq- 0,L..89 + cmpwi 0,9,7 + beq- 0,L..96 + cmpwi 0,9,8 + beq- 0,L..96 + cmpwi 0,9,9 + beq- 0,L..96 + cmpwi 0,9,10 + beq- 0,L..96 + addi 0,9,-11 + cmplwi 0,0,1 + ble- 0,L..95 + cmpwi 0,9,13 + beq- 0,L..97 + cmpwi 0,9,14 + beq- 0,L..98 + cmpwi 0,9,15 + beq- 0,L..96 + cmpwi 0,9,16 + beq- 0,L..99 +L..49: + lwz 1,0(1) + li 3,0 + lwz 0,8(1) + lwz 29,-12(1) + mtlr 0 + lwz 30,-8(1) + lwz 31,-4(1) + blr +L..99: + lwz 0,0(30) + andi. 9,0,512 + beq- 0,L..49 + lwz 0,16(30) + cmpwi 0,0,1 + beq- 0,L..90 + cmpwi 0,0,2 + beq- 0,L..89 + cmpwi 0,0,4 + beq- 0,L..96 + cmpwi 0,0,8 + bne+ 0,L..49 +L..95: + lwz 9,8(30) + stw 4,4(9) +L..88: + stw 3,0(9) + b L..49 +L..96: + lwz 9,8(30) + b L..88 +L..89: + lwz 9,8(30) + sth 3,0(9) + b L..49 +L..90: + lwz 9,8(30) + stb 3,0(9) + b L..49 +L..98: + lwz 9,8(30) + stfd 1,0(9) + b L..49 +L..97: + lwz 9,8(30) + frsp 0,1 + stfs 0,0(9) + b L..49 +L..87: + lwz 11,24(30) + b L..86 +LT..avcall_call: + .long 0 + .byte 0,0,32,97,128,3,1,0 + .long 0 + .long LT..avcall_call-.avcall_call + .short 11 + .byte "avcall_call" + .byte 31 + .align 2 +_section_.text: + .csect .data[RW],3 + .long _section_.text diff --git a/avcall/avcall-powerpc-linux-macro.S b/avcall/avcall-powerpc-linux-macro.S new file mode 100644 index 0000000..cb6d606 --- /dev/null +++ b/avcall/avcall-powerpc-linux-macro.S @@ -0,0 +1,167 @@ + .file "avcall-powerpc.c" + .section ".text" + .align 2 + .globl avcall_call + .type avcall_call, @function +avcall_call: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-1056(1) + mflr 0 + stw 0,1060(1) + addi 10,1,8 + stw 30,1048(1) + mr 30,3 + lwz 0,20(30) + li 3,0 + lwz 11,24(30) + stw 31,1052(1) + mr 31,1 + subfc 0,11,0 + srawi 0,0,2 + cmpw 0,3,0 + bge- 0,.L71 + mtctr 0 +.L72: + slwi 9,3,2 + addi 3,3,1 + lwzx 0,9,11 + stwx 0,9,10 + bdnz .L72 +.L71: + lwz 9,76(30) + subfc 9,30,9 + addi 9,9,-80 + srawi. 9,9,3 + beq- 0,.L8 + cmpwi 0,9,1 + beq- 0,.L11 + cmpwi 0,9,2 + beq- 0,.L14 + cmpwi 0,9,3 + beq- 0,.L17 + cmpwi 0,9,4 + beq- 0,.L20 + cmpwi 0,9,5 + beq- 0,.L23 + cmpwi 0,9,6 + beq- 0,.L26 + cmpwi 0,9,7 + beq- 0,.L29 +.L32: + lfd 8,136(30) +.L29: + lfd 7,128(30) +.L26: + lfd 6,120(30) +.L23: + lfd 5,112(30) +.L20: + lfd 4,104(30) +.L17: + lfd 3,96(30) +.L14: + lfd 2,88(30) +.L11: + lfd 1,80(30) +.L8: + lwz 0,4(30) + lwz 9,68(30) + lwz 3,44(30) + mtctr 0 + lwz 4,48(30) + lwz 5,52(30) + lwz 6,56(30) + lwz 7,60(30) + lwz 8,64(30) + lwz 10,72(30) + crxor 6,6,6 + bctrl + lwz 9,12(30) + cmpwi 0,9,1 + beq- 0,.L34 + cmpwi 0,9,2 + beq- 0,.L75 + cmpwi 0,9,3 + beq- 0,.L75 + cmpwi 0,9,4 + beq- 0,.L75 + cmpwi 0,9,5 + beq- 0,.L74 + cmpwi 0,9,6 + beq- 0,.L74 + cmpwi 0,9,7 + beq- 0,.L81 + cmpwi 0,9,8 + beq- 0,.L81 + cmpwi 0,9,9 + beq- 0,.L81 + cmpwi 0,9,10 + beq- 0,.L81 + addi 0,9,-11 + cmplwi 0,0,1 + ble- 0,.L80 + cmpwi 0,9,13 + beq- 0,.L82 + cmpwi 0,9,14 + beq- 0,.L83 + cmpwi 0,9,15 + beq- 0,.L81 + cmpwi 0,9,16 + beq- 0,.L84 +.L34: + lwz 11,0(1) + li 3,0 + lwz 0,4(11) + lwz 30,-8(11) + lwz 31,-4(11) + mtlr 0 + mr 1,11 + blr +.L84: + lwz 0,0(30) + andi. 9,0,512 + beq- 0,.L34 + lwz 0,16(30) + cmpwi 0,0,1 + beq- 0,.L75 + cmpwi 0,0,2 + beq- 0,.L74 + cmpwi 0,0,4 + beq- 0,.L81 + cmpwi 0,0,8 + bne+ 0,.L34 +.L80: + lwz 9,8(30) + stw 4,4(9) +.L73: + stw 3,0(9) + b .L34 +.L81: + lwz 9,8(30) + b .L73 +.L74: + lwz 9,8(30) + sth 3,0(9) + b .L34 +.L75: + lwz 9,8(30) + stb 3,0(9) + b .L34 +.L83: + lwz 9,8(30) + stfd 1,0(9) + b .L34 +.L82: + frsp 0,1 + lwz 9,8(30) + stfs 0,0(9) + b .L34 + .size avcall_call, .-avcall_call +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-powerpc-linux.s b/avcall/avcall-powerpc-linux.s new file mode 100644 index 0000000..876ef84 --- /dev/null +++ b/avcall/avcall-powerpc-linux.s @@ -0,0 +1,166 @@ + .file "avcall-powerpc.c" + .section ".text" + .align 2 + .globl avcall_call + .type avcall_call, @function +avcall_call: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-1056(1) + mflr 0 + stw 0,1060(1) + addi 10,1,8 + stw 30,1048(1) + mr 30,3 + lwz 0,20(30) + li 3,0 + lwz 11,24(30) + stw 31,1052(1) + mr 31,1 + subfc 0,11,0 + srawi 0,0,2 + cmpw 0,3,0 + bge- 0,.L71 + mtctr 0 +.L72: + slwi 9,3,2 + addi 3,3,1 + lwzx 0,9,11 + stwx 0,9,10 + bdnz .L72 +.L71: + lwz 9,76(30) + subfc 9,30,9 + addi 9,9,-80 + srawi. 9,9,3 + beq- 0,.L8 + cmpwi 0,9,1 + beq- 0,.L11 + cmpwi 0,9,2 + beq- 0,.L14 + cmpwi 0,9,3 + beq- 0,.L17 + cmpwi 0,9,4 + beq- 0,.L20 + cmpwi 0,9,5 + beq- 0,.L23 + cmpwi 0,9,6 + beq- 0,.L26 + cmpwi 0,9,7 + beq- 0,.L29 +.L32: + lfd 8,136(30) +.L29: + lfd 7,128(30) +.L26: + lfd 6,120(30) +.L23: + lfd 5,112(30) +.L20: + lfd 4,104(30) +.L17: + lfd 3,96(30) +.L14: + lfd 2,88(30) +.L11: + lfd 1,80(30) +.L8: + lwz 0,4(30) + lwz 9,68(30) + lwz 3,44(30) + mtctr 0 + lwz 4,48(30) + lwz 5,52(30) + lwz 6,56(30) + lwz 7,60(30) + lwz 8,64(30) + lwz 10,72(30) + crxor 6,6,6 + bctrl + lwz 9,12(30) + cmpwi 0,9,1 + beq- 0,.L34 + cmpwi 0,9,2 + beq- 0,.L75 + cmpwi 0,9,3 + beq- 0,.L75 + cmpwi 0,9,4 + beq- 0,.L75 + cmpwi 0,9,5 + beq- 0,.L74 + cmpwi 0,9,6 + beq- 0,.L74 + cmpwi 0,9,7 + beq- 0,.L81 + cmpwi 0,9,8 + beq- 0,.L81 + cmpwi 0,9,9 + beq- 0,.L81 + cmpwi 0,9,10 + beq- 0,.L81 + addi 0,9,-11 + cmplwi 0,0,1 + ble- 0,.L80 + cmpwi 0,9,13 + beq- 0,.L82 + cmpwi 0,9,14 + beq- 0,.L83 + cmpwi 0,9,15 + beq- 0,.L81 + cmpwi 0,9,16 + beq- 0,.L84 +.L34: + lwz 11,0(1) + li 3,0 + lwz 0,4(11) + lwz 30,-8(11) + lwz 31,-4(11) + mtlr 0 + mr 1,11 + blr +.L84: + lwz 0,0(30) + andi. 9,0,512 + beq- 0,.L34 + lwz 0,16(30) + cmpwi 0,0,1 + beq- 0,.L75 + cmpwi 0,0,2 + beq- 0,.L74 + cmpwi 0,0,4 + beq- 0,.L81 + cmpwi 0,0,8 + bne+ 0,.L34 +.L80: + lwz 9,8(30) + stw 4,4(9) +.L73: + stw 3,0(9) + b .L34 +.L81: + lwz 9,8(30) + b .L73 +.L74: + lwz 9,8(30) + sth 3,0(9) + b .L34 +.L75: + lwz 9,8(30) + stb 3,0(9) + b .L34 +.L83: + lwz 9,8(30) + stfd 1,0(9) + b .L34 +.L82: + frsp 0,1 + lwz 9,8(30) + stfs 0,0(9) + b .L34 + .size avcall_call, .-avcall_call + .section .note.GNU-stack,"",@progbits + .ident "GCC: (GNU) 3.3.6" diff --git a/avcall/avcall-powerpc-macos.s b/avcall/avcall-powerpc-macos.s new file mode 100644 index 0000000..60c66a0 --- /dev/null +++ b/avcall/avcall-powerpc-macos.s @@ -0,0 +1,175 @@ +.text + .align 2 + .globl _avcall_call +_avcall_call: + mflr r0 + stmw r29,-12(r1) + stw r0,8(r1) + mr r29,r3 + stwu r1,-1104(r1) + li r3,8 + lwz r0,20(r29) + mr r30,r1 + lwz r9,24(r29) + addi r10,r1,56 + subf r0,r9,r0 + srawi r11,r0,2 + cmpw cr0,r3,r11 + bge- cr0,L87 + mr r12,r9 +L6: + slwi r9,r3,2 + addi r3,r3,1 + cmpw cr0,r3,r11 + lwzx r0,r9,r12 + add r9,r9,r10 + stw r0,-32(r9) + blt+ cr0,L6 +L86: + lwz r9,40(r29) + subf r9,r29,r9 + addi r9,r9,-44 + srawi. r9,r9,3 + beq- cr0,L8 + cmpwi cr0,r9,1 + beq- cr0,L11 + cmpwi cr0,r9,2 + beq- cr0,L14 + cmpwi cr0,r9,3 + beq- cr0,L17 + cmpwi cr0,r9,4 + beq- cr0,L20 + cmpwi cr0,r9,5 + beq- cr0,L23 + cmpwi cr0,r9,6 + beq- cr0,L26 + cmpwi cr0,r9,7 + beq- cr0,L29 + cmpwi cr0,r9,8 + beq- cr0,L32 + cmpwi cr0,r9,9 + beq- cr0,L35 + cmpwi cr0,r9,10 + beq- cr0,L38 + cmpwi cr0,r9,11 + beq- cr0,L41 + cmpwi cr0,r9,12 + beq- cr0,L44 +L47: + lfd f13,140(r29) +L44: + lfd f12,132(r29) +L41: + lfd f11,124(r29) +L38: + lfd f10,116(r29) +L35: + lfd f9,108(r29) +L32: + lfd f8,100(r29) +L29: + lfd f7,92(r29) +L26: + lfd f6,84(r29) +L23: + lfd f5,76(r29) +L20: + lfd f4,68(r29) +L17: + lfd f3,60(r29) +L14: + lfd f2,52(r29) +L11: + lfd f1,44(r29) +L8: + lwz r0,4(r29) + lwz r9,24(r12) + lwz r10,28(r12) + mtctr r0 + lwz r3,0(r12) + lwz r4,4(r12) + lwz r5,8(r12) + lwz r6,12(r12) + lwz r7,16(r12) + lwz r8,20(r12) + bctrl + lwz r9,12(r29) + cmpwi cr0,r9,1 + beq- cr0,L49 + cmpwi cr0,r9,2 + beq- cr0,L90 + cmpwi cr0,r9,3 + beq- cr0,L90 + cmpwi cr0,r9,4 + beq- cr0,L90 + cmpwi cr0,r9,5 + beq- cr0,L89 + cmpwi cr0,r9,6 + beq- cr0,L89 + cmpwi cr0,r9,7 + beq- cr0,L96 + cmpwi cr0,r9,8 + beq- cr0,L96 + cmpwi cr0,r9,9 + beq- cr0,L96 + cmpwi cr0,r9,10 + beq- cr0,L96 + addi r0,r9,-11 + cmplwi cr0,r0,1 + ble- cr0,L95 + cmpwi cr0,r9,13 + beq- cr0,L97 + cmpwi cr0,r9,14 + beq- cr0,L98 + cmpwi cr0,r9,15 + beq- cr0,L96 + cmpwi cr0,r9,16 + beq- cr0,L99 +L49: + lwz r1,0(r1) + li r3,0 + lwz r0,8(r1) + lmw r29,-12(r1) + mtlr r0 + blr +L99: + lwz r0,0(r29) + andi. r9,r0,512 + beq- cr0,L49 + lwz r0,16(r29) + cmpwi cr0,r0,1 + beq- cr0,L90 + cmpwi cr0,r0,2 + beq- cr0,L89 + cmpwi cr0,r0,4 + beq- cr0,L96 + cmpwi cr0,r0,8 + bne+ cr0,L49 +L95: + lwz r9,8(r29) + stw r4,4(r9) +L88: + stw r3,0(r9) + b L49 +L96: + lwz r9,8(r29) + b L88 +L89: + lwz r9,8(r29) + sth r3,0(r9) + b L49 +L90: + lwz r9,8(r29) + stb r3,0(r9) + b L49 +L98: + lwz r9,8(r29) + stfd f1,0(r9) + b L49 +L97: + lwz r9,8(r29) + stfs f1,0(r9) + b L49 +L87: + lwz r12,24(r29) + b L86 diff --git a/avcall/avcall-powerpc-sysv4-macro.S b/avcall/avcall-powerpc-sysv4-macro.S new file mode 100644 index 0000000..cb6d606 --- /dev/null +++ b/avcall/avcall-powerpc-sysv4-macro.S @@ -0,0 +1,167 @@ + .file "avcall-powerpc.c" + .section ".text" + .align 2 + .globl avcall_call + .type avcall_call, @function +avcall_call: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-1056(1) + mflr 0 + stw 0,1060(1) + addi 10,1,8 + stw 30,1048(1) + mr 30,3 + lwz 0,20(30) + li 3,0 + lwz 11,24(30) + stw 31,1052(1) + mr 31,1 + subfc 0,11,0 + srawi 0,0,2 + cmpw 0,3,0 + bge- 0,.L71 + mtctr 0 +.L72: + slwi 9,3,2 + addi 3,3,1 + lwzx 0,9,11 + stwx 0,9,10 + bdnz .L72 +.L71: + lwz 9,76(30) + subfc 9,30,9 + addi 9,9,-80 + srawi. 9,9,3 + beq- 0,.L8 + cmpwi 0,9,1 + beq- 0,.L11 + cmpwi 0,9,2 + beq- 0,.L14 + cmpwi 0,9,3 + beq- 0,.L17 + cmpwi 0,9,4 + beq- 0,.L20 + cmpwi 0,9,5 + beq- 0,.L23 + cmpwi 0,9,6 + beq- 0,.L26 + cmpwi 0,9,7 + beq- 0,.L29 +.L32: + lfd 8,136(30) +.L29: + lfd 7,128(30) +.L26: + lfd 6,120(30) +.L23: + lfd 5,112(30) +.L20: + lfd 4,104(30) +.L17: + lfd 3,96(30) +.L14: + lfd 2,88(30) +.L11: + lfd 1,80(30) +.L8: + lwz 0,4(30) + lwz 9,68(30) + lwz 3,44(30) + mtctr 0 + lwz 4,48(30) + lwz 5,52(30) + lwz 6,56(30) + lwz 7,60(30) + lwz 8,64(30) + lwz 10,72(30) + crxor 6,6,6 + bctrl + lwz 9,12(30) + cmpwi 0,9,1 + beq- 0,.L34 + cmpwi 0,9,2 + beq- 0,.L75 + cmpwi 0,9,3 + beq- 0,.L75 + cmpwi 0,9,4 + beq- 0,.L75 + cmpwi 0,9,5 + beq- 0,.L74 + cmpwi 0,9,6 + beq- 0,.L74 + cmpwi 0,9,7 + beq- 0,.L81 + cmpwi 0,9,8 + beq- 0,.L81 + cmpwi 0,9,9 + beq- 0,.L81 + cmpwi 0,9,10 + beq- 0,.L81 + addi 0,9,-11 + cmplwi 0,0,1 + ble- 0,.L80 + cmpwi 0,9,13 + beq- 0,.L82 + cmpwi 0,9,14 + beq- 0,.L83 + cmpwi 0,9,15 + beq- 0,.L81 + cmpwi 0,9,16 + beq- 0,.L84 +.L34: + lwz 11,0(1) + li 3,0 + lwz 0,4(11) + lwz 30,-8(11) + lwz 31,-4(11) + mtlr 0 + mr 1,11 + blr +.L84: + lwz 0,0(30) + andi. 9,0,512 + beq- 0,.L34 + lwz 0,16(30) + cmpwi 0,0,1 + beq- 0,.L75 + cmpwi 0,0,2 + beq- 0,.L74 + cmpwi 0,0,4 + beq- 0,.L81 + cmpwi 0,0,8 + bne+ 0,.L34 +.L80: + lwz 9,8(30) + stw 4,4(9) +.L73: + stw 3,0(9) + b .L34 +.L81: + lwz 9,8(30) + b .L73 +.L74: + lwz 9,8(30) + sth 3,0(9) + b .L34 +.L75: + lwz 9,8(30) + stb 3,0(9) + b .L34 +.L83: + lwz 9,8(30) + stfd 1,0(9) + b .L34 +.L82: + frsp 0,1 + lwz 9,8(30) + stfs 0,0(9) + b .L34 + .size avcall_call, .-avcall_call +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-powerpc.c b/avcall/avcall-powerpc.c new file mode 100644 index 0000000..6ae16b4 --- /dev/null +++ b/avcall/avcall-powerpc.c @@ -0,0 +1,213 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + Copyright 2000 Adam Fedor + Copyright 2004 Paul Guyot + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for an IBM RS/6000 with gcc + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + RS6000 Argument Passing Conventions: + + All arguments, except the first 8 words, are passed on the stack with + word alignment. Doubles take two words. The first 13 doubles and floats + are also passed in floating-point-registers. + To return a structure, the called function copies the value to space + pointed to by its first argument, and all other arguments are shifted + down by one. + + Differences between AIX and SysV.4 argument passing conventions: + - AIX: the first 13 doubles and floats are passed in FP registers, + and when they do, there is still room allocated for them in the + argument sequence (integer regs or stack). + SysV.4: the first 8 doubles and floats are passed in FP registers, + and no room is allocated for them in the argument sequence. + - AIX: Structures are passed in the argument sequence. + SysV.4: Structures are passed by reference: only a pointer appears in + the argument sequence. + - AIX: Long longs are only word aligned. + SysV.4: Long longs are two-word aligned, both when passed in registers + (pairs: 3/4, 5/6, 7/8, 9/10) and when passed on the stack. (Recall + that the stack is always 8-byte aligned). + + Compile this routine with gcc -O (or -O2 -fno-omit-frame-pointer or -g -O) + to get the right register variables. For other compilers use the + pre-compiled assembler version. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)) /* __powerpc_aix__ */ +#define STACK_OFFSET 14 +#else /* __powerpc_sysv4__ */ +#define STACK_OFFSET 2 +#endif + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +register double farg1 __asm__("fr1"); +register double farg2 __asm__("fr2"); +register double farg3 __asm__("fr3"); +register double farg4 __asm__("fr4"); +register double farg5 __asm__("fr5"); +register double farg6 __asm__("fr6"); +register double farg7 __asm__("fr7"); +register double farg8 __asm__("fr8"); +register double farg9 __asm__("fr9"); +register double farg10 __asm__("fr10"); +register double farg11 __asm__("fr11"); +register double farg12 __asm__("fr12"); +register double farg13 __asm__("fr13"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("r1"); /* C names for registers */ +/*register __avrword iret __asm__("r3"); */ + register __avrword iret2 __asm__("r4"); + register float fret __asm__("fr1"); + register double dret __asm__("fr1"); + + __av_alist* l = &AV_LIST_INNER(list); + +#if defined(_AIX) /* for some reason, this does not work on Mac OS X and Linux! */ + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ +#else + __avword space[__AV_ALIST_WORDS]; /* space for callee's stack frame */ + __avword* argframe = sp + STACK_OFFSET;/* stack offset for argument list */ +#endif + int arglen = l->aptr - l->args; + __avrword i; +#if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)) /* __powerpc_aix__ */ + int farglen = 0; + + for (i = (8-farglen); i < arglen; i++) /* push function args onto stack */ + argframe[i-8+farglen] = l->args[i]; +#else /* __powerpc_sysv4__ */ + for (i = 0; i < arglen; i++) /* push function args onto stack */ + argframe[i] = l->args[i]; +#endif + + /* pass first 13 floating-point args in registers */ + arglen = l->faptr - l->fargs; + if (arglen == 0) goto fargs0; + else if (arglen == 1) goto fargs1; + else if (arglen == 2) goto fargs2; + else if (arglen == 3) goto fargs3; + else if (arglen == 4) goto fargs4; + else if (arglen == 5) goto fargs5; + else if (arglen == 6) goto fargs6; + else if (arglen == 7) goto fargs7; + else if (arglen == 8) goto fargs8; +#if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)) /* __powerpc_aix__ */ + else if (arglen == 9) goto fargs9; + else if (arglen == 10) goto fargs10; + else if (arglen == 11) goto fargs11; + else if (arglen == 12) goto fargs12; + else if (arglen == 13) goto fargs13; + fargs13: farg13 = l->fargs[12]; + fargs12: farg12 = l->fargs[11]; + fargs11: farg11 = l->fargs[10]; + fargs10: farg10 = l->fargs[9]; + fargs9: farg9 = l->fargs[8]; +#endif + fargs8: farg8 = l->fargs[7]; + fargs7: farg7 = l->fargs[6]; + fargs6: farg6 = l->fargs[5]; + fargs5: farg5 = l->fargs[4]; + fargs4: farg4 = l->fargs[3]; + fargs3: farg3 = l->fargs[2]; + fargs2: farg2 = l->fargs[1]; + fargs1: farg1 = l->fargs[0]; + fargs0: ; + +#if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)) /* __powerpc_aix__ */ + /* call function, pass 8 args in registers */ + i = (*l->func)(l->args[0], l->args[1], l->args[2], l->args[3], + l->args[4], l->args[5], l->args[6], l->args[7]); +#else /* __powerpc_sysv4__ */ + i = (*l->func)(l->iargs[0], l->iargs[1], l->iargs[2], l->iargs[3], + l->iargs[4], l->iargs[5], l->iargs[6], l->iargs[7]); +#endif + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, i); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, i); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, i); + } else + if (l->rtype == __AVshort) { + RETURN(short, i); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, i); + } else + if (l->rtype == __AVint) { + RETURN(int, i); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, i); + } else + if (l->rtype == __AVlong) { + RETURN(long, i); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, i); + } else + if (l->rtype == __AVlonglong || l->rtype == __AVulonglong) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = iret2; + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, i); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + if (l->rsize == sizeof(char)) { + RETURN(char, i); + } else + if (l->rsize == sizeof(short)) { + RETURN(short, i); + } else + if (l->rsize == sizeof(int)) { + RETURN(int, i); + } else + if (l->rsize == 2*sizeof(__avrword)) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = iret2; + } + } + } + return 0; +} diff --git a/avcall/avcall-powerpc64-aix.s b/avcall/avcall-powerpc64-aix.s new file mode 100644 index 0000000..e1a9c6c --- /dev/null +++ b/avcall/avcall-powerpc64-aix.s @@ -0,0 +1,212 @@ + .file "avcall-powerpc64.c" + .csect .text[PR] + .toc + .csect .text[PR] + .align 2 + .align 4 + .globl avcall_call + .globl .avcall_call + .csect avcall_call[DS],3 +avcall_call: + .llong .avcall_call, TOC[tc0], 0 + .csect .text[PR] +.avcall_call: + mflr 0 + std 30,-16(1) + std 31,-8(1) + mr 30,3 + std 0,16(1) + stdu 1,-128(1) + ld 3,48(3) + ld 9,40(30) + ld 10,0(1) + mr 31,1 + subf 9,3,9 + stdu 10,-2064(1) + sradi 9,9,3 + cmpwi 7,9,8 + ble 7,L..6 + addi 10,9,-9 + addi 8,1,112 + rldicl 10,10,0,32 + addi 9,3,56 + addi 10,10,8 + addi 8,8,-8 + sldi 10,10,3 + add 10,3,10 + .align 4 +L..5: + ldu 7,8(9) + stdu 7,8(8) + cmpld 7,10,9 + bne 7,L..5 +L..6: + ld 10,64(30) + addi 9,30,72 + subf 9,9,10 + sradi 9,9,3 + extsw 9,9 + cmpwi 7,9,0 + ble 7,L..4 + cmpwi 7,9,1 + beq 7,L..7 + cmpwi 7,9,2 + beq 7,L..8 + cmpwi 7,9,3 + beq 7,L..9 + cmpwi 7,9,4 + beq 7,L..10 + cmpwi 7,9,5 + beq 7,L..11 + cmpwi 7,9,6 + beq 7,L..12 + cmpwi 7,9,7 + beq 7,L..13 + cmpwi 7,9,8 + beq 7,L..14 + cmpwi 7,9,9 + beq 7,L..15 + cmpwi 7,9,10 + beq 7,L..16 + cmpwi 7,9,11 + beq 7,L..17 + cmpwi 7,9,12 + beq 7,L..18 + lfd 13,168(30) +L..18: + lfd 12,160(30) +L..17: + lfd 11,152(30) +L..16: + lfd 10,144(30) +L..15: + lfd 9,136(30) +L..14: + lfd 8,128(30) +L..13: + lfd 7,120(30) +L..12: + lfd 6,112(30) +L..11: + lfd 5,104(30) +L..10: + lfd 4,96(30) +L..9: + lfd 3,88(30) +L..8: + lfd 2,80(30) +L..7: + lfd 1,72(30) +L..4: + ld 9,48(3) + ld 10,56(3) + ld 8,40(3) + ld 7,32(3) + ld 6,24(3) + ld 5,16(3) + ld 4,8(3) + ld 3,0(3) + std 2,40(1) + ld 12,8(30) + ld 0,0(12) + ld 11,16(12) + mtctr 0 + ld 2,8(12) + bctrl + ld 2,40(1) + lwz 9,24(30) + cmplwi 7,9,1 + beq 7,L..19 + cmplwi 7,9,2 + beq 7,L..36 + cmplwi 7,9,3 + beq 7,L..36 + cmplwi 7,9,4 + beq 7,L..36 + cmplwi 7,9,5 + beq 7,L..37 + cmplwi 7,9,6 + beq 7,L..37 + cmplwi 7,9,7 + beq 7,L..38 + cmplwi 7,9,8 + beq 7,L..38 + cmplwi 7,9,9 + beq 7,L..39 + cmplwi 7,9,10 + beq 7,L..39 + cmplwi 7,9,11 + beq 7,L..39 + cmplwi 7,9,12 + beq 7,L..39 + cmplwi 7,9,13 + beq 7,L..41 + cmplwi 7,9,14 + beq 7,L..42 + cmplwi 7,9,15 + beq 7,L..39 +L..19: + addi 1,31,128 + ld 0,16(1) + ld 30,-16(1) + li 3,0 + ld 31,-8(1) + mtlr 0 + blr + .align 4 +L..36: + ld 9,16(30) + stb 3,0(9) + addi 1,31,128 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr +L..38: + ld 9,16(30) + stw 3,0(9) + b L..19 + .align 4 +L..37: + ld 9,16(30) + sth 3,0(9) + addi 1,31,128 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .align 4 +L..39: + ld 9,16(30) + std 3,0(9) + addi 1,31,128 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr +L..42: + ld 9,16(30) + stfd 1,0(9) + b L..19 +L..41: + ld 9,16(30) + stfs 1,0(9) + b L..19 +LT..avcall_call: + .long 0 + .byte 0,0,32,97,128,2,1,0 + .long 0 + .long LT..avcall_call-.avcall_call + .short 11 + .byte "avcall_call" + .byte 31 + .align 2 +_section_.text: + .csect .data[RW],4 + .llong _section_.text diff --git a/avcall/avcall-powerpc64-elfv2-linux.S b/avcall/avcall-powerpc64-elfv2-linux.S new file mode 100644 index 0000000..c635a1d --- /dev/null +++ b/avcall/avcall-powerpc64-elfv2-linux.S @@ -0,0 +1,309 @@ + .file "avcall-powerpc64.c" + .machine power4 + .abiversion 2 + .section ".toc","aw" + .section ".text" + .align 2 + .p2align 4,,15 + .globl avcall_call + .type avcall_call, @function +avcall_call: +0: addis 2,12,.TOC.-0b@ha + addi 2,2,.TOC.-0b@l + .localentry avcall_call,.-avcall_call + mflr 0 + std 30,-16(1) + std 31,-8(1) + mr 30,3 + std 0,16(1) + stdu 1,-112(1) + ld 3,48(3) + ld 9,40(30) + mr 31,1 + ld 10,0(1) + subf 9,3,9 + stdu 10,-2064(1) + sradi 9,9,3 + cmpwi 7,9,8 + ble 7,.L6 + addi 10,9,-9 + addi 8,1,96 + addi 9,3,56 + rldicl 10,10,0,32 + addi 8,8,-8 + addi 10,10,8 + sldi 10,10,3 + add 10,3,10 + .p2align 4,,15 +.L5: + ldu 7,8(9) + cmpld 7,10,9 + stdu 7,8(8) + bne 7,.L5 +.L6: + ld 10,64(30) + addi 9,30,72 + subf 9,9,10 + sradi 9,9,3 + extsw 9,9 + cmpwi 7,9,0 + ble 7,.L4 + cmpwi 7,9,1 + beq 7,.L7 + cmpwi 7,9,2 + beq 7,.L8 + cmpwi 7,9,3 + beq 7,.L9 + cmpwi 7,9,4 + beq 7,.L10 + cmpwi 7,9,5 + beq 7,.L11 + cmpwi 7,9,6 + beq 7,.L12 + cmpwi 7,9,7 + beq 7,.L13 + cmpwi 7,9,8 + beq 7,.L14 + cmpwi 7,9,9 + beq 7,.L15 + cmpwi 7,9,10 + beq 7,.L16 + cmpwi 7,9,11 + beq 7,.L17 + cmpwi 7,9,12 + beq 7,.L18 + lfd 13,168(30) +.L18: + lfd 12,160(30) +.L17: + lfd 11,152(30) +.L16: + lfd 10,144(30) +.L15: + lfd 9,136(30) +.L14: + lfd 8,128(30) +.L13: + lfd 7,120(30) +.L12: + lfd 6,112(30) +.L11: + lfd 5,104(30) +.L10: + lfd 4,96(30) +.L9: + lfd 3,88(30) +.L8: + lfd 2,80(30) +.L7: + lfd 1,72(30) +.L4: + ld 11,8(30) + ld 9,48(3) + ld 10,56(3) + ld 8,40(3) + ld 7,32(3) + ld 6,24(3) + ld 5,16(3) + ld 4,8(3) + mtctr 11 + ld 3,0(3) + mr 12,11 + std 2,24(1) + bctrl + ld 2,24(1) + lwz 9,24(30) + cmplwi 7,9,1 + beq 7,.L19 + cmplwi 7,9,2 + beq 7,.L43 + cmplwi 7,9,3 + beq 7,.L43 + cmplwi 7,9,4 + beq 7,.L43 + cmplwi 7,9,5 + beq 7,.L44 + cmplwi 7,9,6 + beq 7,.L44 + cmplwi 7,9,7 + beq 7,.L45 + cmplwi 7,9,8 + beq 7,.L45 + cmplwi 7,9,9 + beq 7,.L49 + cmplwi 7,9,10 + beq 7,.L49 + cmplwi 7,9,11 + beq 7,.L49 + cmplwi 7,9,12 + beq 7,.L49 + cmplwi 7,9,13 + beq 7,.L51 + cmplwi 7,9,14 + beq 7,.L52 + cmplwi 7,9,15 + beq 7,.L49 + cmplwi 7,9,16 + bne 7,.L19 + lwz 9,0(30) + rldicl. 10,9,55,63 + beq 0,.L19 + ld 10,32(30) + addi 9,10,-1 + cmpldi 7,9,15 + bgt 7,.L19 + ld 8,16(30) + cmpldi 7,10,8 + rldicl 9,8,0,61 + rldicr 8,8,0,60 + add 10,10,9 + bgt 7,.L34 + cmpldi 7,10,8 + bgt 7,.L35 + slwi 10,10,3 + li 7,2 + ld 6,0(8) + slwi 9,9,3 + addi 10,10,-1 + sld 10,7,10 + li 7,1 + sld 7,7,9 + sld 9,3,9 + subf 10,7,10 + xor 9,9,6 + and 9,10,9 + xor 9,9,6 + std 9,0(8) +.L19: + addi 1,31,112 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L43: + ld 9,16(30) + stb 3,0(9) + addi 1,31,112 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr +.L45: + ld 9,16(30) + stw 3,0(9) + b .L19 + .p2align 4,,15 +.L44: + ld 9,16(30) + sth 3,0(9) + addi 1,31,112 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L49: + ld 9,16(30) + std 3,0(9) + addi 1,31,112 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr +.L52: + ld 9,16(30) + stfd 1,0(9) + b .L19 +.L51: + ld 9,16(30) + stfs 1,0(9) + b .L19 +.L34: + rldicl 9,9,0,32 + ld 11,0(8) + li 6,-1 + cmpldi 7,10,16 + slwi 5,9,3 + sld 7,3,5 + sld 6,6,5 + xor 7,7,11 + and 7,6,7 + xor 7,7,11 + std 7,0(8) + ble 7,.L53 + mulli 9,9,-8 + ld 11,16(8) + slwi 10,10,3 + li 7,2 + addi 10,10,-129 + addi 9,9,64 + sld 7,7,10 + srad 6,4,9 + srad 3,3,9 + addi 7,7,-1 + sld 9,4,5 + xor 10,6,11 + or 9,3,9 + and 10,7,10 + std 9,8(8) + xor 10,10,11 + std 10,16(8) + b .L19 +.L35: + rldicl 9,9,0,32 + slwi 10,10,3 + ld 11,0(8) + ld 4,8(8) + li 7,2 + mulli 6,9,-8 + addi 10,10,-65 + slwi 9,9,3 + sld 10,7,10 + sld 5,3,9 + li 7,-1 + addi 6,6,64 + addi 10,10,-1 + sld 7,7,9 + srad 3,3,6 + xor 6,5,11 + xor 9,3,4 + and 7,7,6 + and 9,10,9 + xor 10,7,11 + xor 9,9,4 + std 10,0(8) + std 9,8(8) + b .L19 +.L53: + mulli 9,9,-4 + slwi 10,10,3 + ld 11,8(8) + sld 4,4,5 + addi 10,10,-65 + li 6,2 + addi 9,9,32 + sld 10,6,10 + srad 3,3,9 + srad 9,3,9 + or 7,9,4 + addi 9,10,-1 + xor 10,7,11 + and 9,10,9 + xor 9,9,11 + std 9,8(8) + b .L19 + .long 0 + .byte 0,0,0,1,128,2,0,0 + .size avcall_call,.-avcall_call +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-powerpc64-linux.S b/avcall/avcall-powerpc64-linux.S new file mode 100644 index 0000000..cf3e763 --- /dev/null +++ b/avcall/avcall-powerpc64-linux.S @@ -0,0 +1,207 @@ + .file "avcall-powerpc64.c" + .machine power4 + .section ".toc","aw" + .section ".text" + .align 2 + .p2align 4,,15 + .globl avcall_call + .section ".opd","aw" + .align 3 +avcall_call: + .quad .L.avcall_call,.TOC.@tocbase,0 + .previous + .type avcall_call, @function +.L.avcall_call: + mflr 0 + std 30,-16(1) + std 31,-8(1) + mr 30,3 + std 0,16(1) + stdu 1,-128(1) + ld 3,48(3) + ld 9,40(30) + mr 31,1 + ld 10,0(1) + subf 9,3,9 + stdu 10,-2064(1) + sradi 9,9,3 + cmpwi 7,9,8 + ble 7,.L6 + addi 10,9,-9 + addi 8,1,112 + addi 9,3,56 + rldicl 10,10,0,32 + addi 8,8,-8 + addi 10,10,8 + sldi 10,10,3 + add 10,3,10 + .p2align 4,,15 +.L5: + ldu 7,8(9) + cmpld 7,10,9 + stdu 7,8(8) + bne 7,.L5 +.L6: + ld 10,64(30) + addi 9,30,72 + subf 9,9,10 + sradi 9,9,3 + extsw 9,9 + cmpwi 7,9,0 + ble 7,.L4 + cmpwi 7,9,1 + beq 7,.L7 + cmpwi 7,9,2 + beq 7,.L8 + cmpwi 7,9,3 + beq 7,.L9 + cmpwi 7,9,4 + beq 7,.L10 + cmpwi 7,9,5 + beq 7,.L11 + cmpwi 7,9,6 + beq 7,.L12 + cmpwi 7,9,7 + beq 7,.L13 + cmpwi 7,9,8 + beq 7,.L14 + cmpwi 7,9,9 + beq 7,.L15 + cmpwi 7,9,10 + beq 7,.L16 + cmpwi 7,9,11 + beq 7,.L17 + cmpwi 7,9,12 + beq 7,.L18 + lfd 13,168(30) +.L18: + lfd 12,160(30) +.L17: + lfd 11,152(30) +.L16: + lfd 10,144(30) +.L15: + lfd 9,136(30) +.L14: + lfd 8,128(30) +.L13: + lfd 7,120(30) +.L12: + lfd 6,112(30) +.L11: + lfd 5,104(30) +.L10: + lfd 4,96(30) +.L9: + lfd 3,88(30) +.L8: + lfd 2,80(30) +.L7: + lfd 1,72(30) +.L4: + ld 9,48(3) + ld 10,56(3) + ld 8,40(3) + ld 7,32(3) + ld 6,24(3) + ld 5,16(3) + ld 4,8(3) + ld 3,0(3) + std 2,40(1) + ld 12,8(30) + ld 0,0(12) + ld 11,16(12) + mtctr 0 + ld 2,8(12) + bctrl + ld 2,40(1) + lwz 9,24(30) + cmplwi 7,9,1 + beq 7,.L19 + cmplwi 7,9,2 + beq 7,.L36 + cmplwi 7,9,3 + beq 7,.L36 + cmplwi 7,9,4 + beq 7,.L36 + cmplwi 7,9,5 + beq 7,.L37 + cmplwi 7,9,6 + beq 7,.L37 + cmplwi 7,9,7 + beq 7,.L38 + cmplwi 7,9,8 + beq 7,.L38 + cmplwi 7,9,9 + beq 7,.L39 + cmplwi 7,9,10 + beq 7,.L39 + cmplwi 7,9,11 + beq 7,.L39 + cmplwi 7,9,12 + beq 7,.L39 + cmplwi 7,9,13 + beq 7,.L41 + cmplwi 7,9,14 + beq 7,.L42 + cmplwi 7,9,15 + beq 7,.L39 +.L19: + addi 1,31,128 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L36: + ld 9,16(30) + stb 3,0(9) + addi 1,31,128 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr +.L38: + ld 9,16(30) + stw 3,0(9) + b .L19 + .p2align 4,,15 +.L37: + ld 9,16(30) + sth 3,0(9) + addi 1,31,128 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L39: + ld 9,16(30) + std 3,0(9) + addi 1,31,128 + li 3,0 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr +.L42: + ld 9,16(30) + stfd 1,0(9) + b .L19 +.L41: + ld 9,16(30) + stfs 1,0(9) + b .L19 + .long 0 + .byte 0,0,0,1,128,2,0,0 + .size avcall_call,.-.L.avcall_call +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-powerpc64.c b/avcall/avcall-powerpc64.c new file mode 100644 index 0000000..d3f71fb --- /dev/null +++ b/avcall/avcall-powerpc64.c @@ -0,0 +1,327 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + Copyright 2000 Adam Fedor + Copyright 2004 Paul Guyot + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for a 64-bit PowerPC with gcc + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + PowerPC64 Argument Passing Conventions: + + All arguments, except the first 8 words, are passed on the stack with + word alignment. The first 13 doubles and floats are also passed in + floating-point-registers. + To return a structure, the called function copies the value to space + pointed to by its first argument, and all other arguments are shifted + down by one. + + The AIX argument passing conventions are used: + - the first 13 doubles and floats are passed in FP registers, + and when they do, there is still room allocated for them in the + argument sequence (integer regs or stack). + - Structures are passed in the argument sequence. But structures + containing floats or doubles are passed in FP registers?! + + Compile this routine with gcc -O (or -O2 -fno-omit-frame-pointer or -g -O) + to get the right register variables. For other compilers use the + pre-compiled assembler version. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +register double farg1 __asm__("fr1"); +register double farg2 __asm__("fr2"); +register double farg3 __asm__("fr3"); +register double farg4 __asm__("fr4"); +register double farg5 __asm__("fr5"); +register double farg6 __asm__("fr6"); +register double farg7 __asm__("fr7"); +register double farg8 __asm__("fr8"); +register double farg9 __asm__("fr9"); +register double farg10 __asm__("fr10"); +register double farg11 __asm__("fr11"); +register double farg12 __asm__("fr12"); +register double farg13 __asm__("fr13"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("r1"); /* C names for registers */ +/*register __avrword iret __asm__("r3"); */ + register __avrword iret2 __asm__("r4"); + register float fret __asm__("fr1"); + register double dret __asm__("fr1"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + __avrword iret; + int i; + + for (i = 8; i < arglen; i++) /* push function args onto stack */ + argframe[i-8] = l->args[i]; + + /* pass first 13 floating-point args in registers */ + arglen = l->faptr - l->fargs; + if (arglen > 0) { + if (arglen > 1) { + if (arglen > 2) { + if (arglen > 3) { + if (arglen > 4) { + if (arglen > 5) { + if (arglen > 6) { + if (arglen > 7) { + if (arglen > 8) { + if (arglen > 9) { + if (arglen > 10) { + if (arglen > 11) { + if (arglen > 12) { + farg13 = l->fargs[12]; + } + farg12 = l->fargs[11]; + } + farg11 = l->fargs[10]; + } + farg10 = l->fargs[9]; + } + farg9 = l->fargs[8]; + } + farg8 = l->fargs[7]; + } + farg7 = l->fargs[6]; + } + farg6 = l->fargs[5]; + } + farg5 = l->fargs[4]; + } + farg4 = l->fargs[3]; + } + farg3 = l->fargs[2]; + } + farg2 = l->fargs[1]; + } + farg1 = l->fargs[0]; + } + /* call function, pass 8 args in registers */ + iret = (*l->func)(l->args[0], l->args[1], l->args[2], l->args[3], + l->args[4], l->args[5], l->args[6], l->args[7]); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, iret); + } else + if (l->rtype == __AVlonglong) { + RETURN(long long, iret); + } else + if (l->rtype == __AVulonglong) { + RETURN(unsigned long long, iret); + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { +#ifdef __powerpc64_elfv2__ + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + /* In the ELFv2 ABI, gcc returns structs of size <= 16 in registers. */ + if (l->rsize > 0 && l->rsize <= 16) { + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize == 1) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + } else + if (l->rsize == 2) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + } else + if (l->rsize == 3) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + } else + if (l->rsize == 4) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + } else + if (l->rsize == 5) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + } else + if (l->rsize == 6) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + } else + if (l->rsize == 7) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + } else + if (l->rsize >= 8 && l->rsize <= 16) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[7] = (unsigned char)(iret>>56); + if (l->rsize == 8) { + } else + if (l->rsize == 9) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + } else + if (l->rsize == 10) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + } else + if (l->rsize == 11) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + } else + if (l->rsize == 12) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + } else + if (l->rsize == 13) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + } else + if (l->rsize == 14) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + } else + if (l->rsize == 15) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + } else + if (l->rsize == 16) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+7] = (unsigned char)(iret2>>56); + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 2*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__avrword) */ + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (end_offset*8-1)) - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret >> (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[1] ^= (wordaddr[1] ^ ((iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = ((__avrword)2 << (end_offset*8-2*sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*8-start_offset*8)) | (iret2 << (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 >> (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } + #endif + } + } +#endif + } + return 0; +} diff --git a/avcall/avcall-riscv32-ilp32d-linux.s b/avcall/avcall-riscv32-ilp32d-linux.s new file mode 100644 index 0000000..bc12190 --- /dev/null +++ b/avcall/avcall-riscv32-ilp32d-linux.s @@ -0,0 +1,325 @@ + .file "avcall-riscv32.c" + .option pic + .text + .align 1 + .globl avcall_call + .type avcall_call, @function +avcall_call: + add sp,sp,-32 + sw ra,28(sp) + sw s0,24(sp) + sw s1,20(sp) + sw s2,16(sp) + sw s3,12(sp) + sw s4,8(sp) + add s0,sp,32 + lw t2,24(a0) + lw t0,20(a0) + li t3,32 + mv s1,a0 + sub t0,t0,t2 + add sp,sp,-1040 + lw ra,40(a0) + ble t0,t3,.L2 + mv t1,sp + sra t6,t0,2 + add t4,t2,32 + li t3,8 +.L3: + lw t5,0(t4) + add t3,t3,1 + add t4,t4,4 + sw t5,0(t1) + add t1,t1,4 + bgt t6,t3,.L3 +.L4: + li t1,4 + lw a0,0(t2) + bgt t0,t1,.L79 +.L5: + beqz ra,.L8 + lw t1,48(s1) + and t3,t1,1 + beqz t3,.L9 + fld fa0,88(s1) +.L10: + li t3,1 + bleu ra,t3,.L8 + and t3,t1,2 + bnez t3,.L80 + lw t3,44(s1) + and t3,t3,2 + beqz t3,.L13 + flw fa1,56(s1) +.L13: + li t3,2 + beq ra,t3,.L8 + and t3,t1,4 + beqz t3,.L14 + fld fa2,104(s1) +.L15: + li t3,3 + beq ra,t3,.L8 + and t3,t1,8 + bnez t3,.L81 + lw t3,44(s1) + and t3,t3,8 + beqz t3,.L17 + flw fa3,64(s1) +.L17: + li t3,4 + beq ra,t3,.L8 + and t3,t1,16 + beqz t3,.L18 + fld fa4,120(s1) +.L19: + li t3,5 + beq ra,t3,.L8 + and t3,t1,32 + beqz t3,.L20 + fld fa5,128(s1) +.L21: + li t3,6 + beq ra,t3,.L8 + and t3,t1,64 + beqz t3,.L22 + fld fa6,136(s1) +.L23: + li t3,7 + beq ra,t3,.L8 + and t1,t1,128 + beqz t1,.L24 + fld fa7,144(s1) +.L8: + lw t1,12(s1) + li t3,13 + lw t4,4(s1) + bne t1,t3,.L25 + lw s1,8(s1) + jalr t4 + fsw fa0,0(s1) +.L26: + add sp,s0,-32 + lw ra,28(sp) + li a0,0 + lw s0,24(sp) + lw s1,20(sp) + lw s2,16(sp) + lw s3,12(sp) + lw s4,8(sp) + add sp,sp,32 + jr ra +.L79: + li t1,8 + lw a1,4(t2) + ble t0,t1,.L5 + li t1,12 + lw a2,8(t2) + ble t0,t1,.L5 + li t1,16 + lw a3,12(t2) + ble t0,t1,.L5 + li t1,20 + lw a4,16(t2) + ble t0,t1,.L5 + li t1,24 + lw a5,20(t2) + ble t0,t1,.L5 + li t1,28 + lw a6,24(t2) + ble t0,t1,.L5 + lw a7,28(t2) + j .L5 +.L9: + lw t3,44(s1) + and t3,t3,1 + beqz t3,.L10 + flw fa0,52(s1) + j .L10 +.L25: + li t3,14 + beq t1,t3,.L82 + jalr t4 + lw t1,12(s1) + li t4,1 + mv t3,a0 + beq t1,t4,.L26 + li t4,2 + beq t1,t4,.L72 + li t4,3 + beq t1,t4,.L72 + li t4,4 + beq t1,t4,.L72 + li t4,5 + beq t1,t4,.L73 + li t4,6 + beq t1,t4,.L73 + li t4,7 + beq t1,t4,.L77 + li t4,8 + beq t1,t4,.L77 + li t4,9 + beq t1,t4,.L77 + li t4,10 + beq t1,t4,.L77 + add t6,t1,-11 + li t4,1 + bleu t6,t4,.L83 + li t6,15 + beq t1,t6,.L77 + li t6,16 + bne t1,t6,.L26 + lw t1,0(s1) + and t1,t1,2 + beqz t1,.L26 + lw s3,16(s1) + li t1,7 + add t6,s3,-1 + bgtu t6,t1,.L26 + lw t6,8(s1) + li s4,4 + and t0,t6,-4 + lw t2,0(t0) + and t6,t6,3 + sll s2,t6,3 + sll s1,a0,s2 + add t1,s3,t6 + sll t4,t4,s2 + xor s1,s1,t2 + bgtu s3,s4,.L39 + bgtu t1,s4,.L40 + sll t1,t1,3 + add t3,t1,-1 + li t1,2 + sll t1,t1,t3 + sub t1,t1,t4 + and t1,t1,s1 + xor t1,t1,t2 + sw t1,0(t0) + j .L26 +.L80: + fld fa1,96(s1) + j .L13 +.L82: + lw s1,8(s1) + jalr t4 + fsd fa0,0(s1) + j .L26 +.L72: + lw t1,8(s1) + sb t3,0(t1) + j .L26 +.L2: + blez t0,.L5 + j .L4 +.L14: + lw t3,44(s1) + and t3,t3,4 + beqz t3,.L15 + flw fa2,60(s1) + j .L15 +.L81: + fld fa3,112(s1) + j .L17 +.L73: + lw t1,8(s1) + sh t3,0(t1) + j .L26 +.L18: + lw t3,44(s1) + and t3,t3,16 + beqz t3,.L19 + flw fa4,68(s1) + j .L19 +.L77: + lw t1,8(s1) + sw t3,0(t1) + j .L26 +.L20: + lw t3,44(s1) + and t3,t3,32 + beqz t3,.L21 + flw fa5,72(s1) + j .L21 +.L22: + lw t3,44(s1) + and t3,t3,64 + beqz t3,.L23 + flw fa6,76(s1) + j .L23 +.L24: + lw t1,44(s1) + and t1,t1,128 + beqz t1,.L8 + flw fa7,80(s1) + j .L8 +.L83: + lw t1,8(s1) + sw a0,0(t1) + sw a1,4(t1) + j .L26 +.L40: + li t5,-8 + mul t6,t6,t5 + lw s2,4(t0) + sll t1,t1,3 + add t5,t1,-33 + li t1,2 + sll t1,t1,t5 + sub t4,zero,t4 + add t1,t1,-1 + and t4,t4,s1 + xor t4,t4,t2 + sra t3,a0,t6 + xor t3,t3,s2 + and t1,t1,t3 + xor t1,t1,s2 + sw t4,0(t0) + sw t1,4(t0) + j .L26 +.L39: + sub t4,zero,t4 + and t4,t4,s1 + xor t4,t4,t2 + sw t4,0(t0) + li t4,8 + sll s1,a1,s2 + bleu t1,t4,.L84 + li t4,-8 + mul t6,t6,t4 + sll t1,t1,3 + li t2,2 + add t1,t1,-65 + lw s2,8(t0) + sll t1,t2,t1 + add t2,t1,-1 + add t1,t6,32 + sra t4,a1,t1 + xor t4,t4,s2 + sra t1,a0,t1 + and t3,t2,t4 + or t1,t1,s1 + xor t3,t3,s2 + sw t1,4(t0) + sw t3,8(t0) + j .L26 +.L84: + li t4,-4 + mul t4,t6,t4 + sll t1,t1,3 + lw t6,4(t0) + add t5,t1,-33 + li t1,2 + sll t1,t1,t5 + add t1,t1,-1 + add t4,t4,16 + sra t3,a0,t4 + sra t3,t3,t4 + or t3,t3,s1 + xor t3,t3,t6 + and t1,t1,t3 + xor t1,t1,t6 + sw t1,4(t0) + j .L26 + .size avcall_call, .-avcall_call + .ident "GCC: (GNU) 7.3.0" diff --git a/avcall/avcall-riscv32-ilp32d-macro.S b/avcall/avcall-riscv32-ilp32d-macro.S new file mode 100644 index 0000000..418a57f --- /dev/null +++ b/avcall/avcall-riscv32-ilp32d-macro.S @@ -0,0 +1,327 @@ + .file "avcall-riscv32.c" + .option pic + .text + .align 1 + .globl avcall_call + .type avcall_call, @function +avcall_call: + add sp,sp,-32 + sw ra,28(sp) + sw s0,24(sp) + sw s1,20(sp) + sw s2,16(sp) + sw s3,12(sp) + sw s4,8(sp) + add s0,sp,32 + lw t2,24(a0) + lw t0,20(a0) + li t3,32 + mv s1,a0 + sub t0,t0,t2 + add sp,sp,-1040 + lw ra,40(a0) + ble t0,t3,.L2 + mv t1,sp + sra t6,t0,2 + add t4,t2,32 + li t3,8 +.L3: + lw t5,0(t4) + add t3,t3,1 + add t4,t4,4 + sw t5,0(t1) + add t1,t1,4 + bgt t6,t3,.L3 +.L4: + li t1,4 + lw a0,0(t2) + bgt t0,t1,.L79 +.L5: + beqz ra,.L8 + lw t1,48(s1) + and t3,t1,1 + beqz t3,.L9 + fld fa0,88(s1) +.L10: + li t3,1 + bleu ra,t3,.L8 + and t3,t1,2 + bnez t3,.L80 + lw t3,44(s1) + and t3,t3,2 + beqz t3,.L13 + flw fa1,56(s1) +.L13: + li t3,2 + beq ra,t3,.L8 + and t3,t1,4 + beqz t3,.L14 + fld fa2,104(s1) +.L15: + li t3,3 + beq ra,t3,.L8 + and t3,t1,8 + bnez t3,.L81 + lw t3,44(s1) + and t3,t3,8 + beqz t3,.L17 + flw fa3,64(s1) +.L17: + li t3,4 + beq ra,t3,.L8 + and t3,t1,16 + beqz t3,.L18 + fld fa4,120(s1) +.L19: + li t3,5 + beq ra,t3,.L8 + and t3,t1,32 + beqz t3,.L20 + fld fa5,128(s1) +.L21: + li t3,6 + beq ra,t3,.L8 + and t3,t1,64 + beqz t3,.L22 + fld fa6,136(s1) +.L23: + li t3,7 + beq ra,t3,.L8 + and t1,t1,128 + beqz t1,.L24 + fld fa7,144(s1) +.L8: + lw t1,12(s1) + li t3,13 + lw t4,4(s1) + bne t1,t3,.L25 + lw s1,8(s1) + jalr t4 + fsw fa0,0(s1) +.L26: + add sp,s0,-32 + lw ra,28(sp) + li a0,0 + lw s0,24(sp) + lw s1,20(sp) + lw s2,16(sp) + lw s3,12(sp) + lw s4,8(sp) + add sp,sp,32 + jr ra +.L79: + li t1,8 + lw a1,4(t2) + ble t0,t1,.L5 + li t1,12 + lw a2,8(t2) + ble t0,t1,.L5 + li t1,16 + lw a3,12(t2) + ble t0,t1,.L5 + li t1,20 + lw a4,16(t2) + ble t0,t1,.L5 + li t1,24 + lw a5,20(t2) + ble t0,t1,.L5 + li t1,28 + lw a6,24(t2) + ble t0,t1,.L5 + lw a7,28(t2) + j .L5 +.L9: + lw t3,44(s1) + and t3,t3,1 + beqz t3,.L10 + flw fa0,52(s1) + j .L10 +.L25: + li t3,14 + beq t1,t3,.L82 + jalr t4 + lw t1,12(s1) + li t4,1 + mv t3,a0 + beq t1,t4,.L26 + li t4,2 + beq t1,t4,.L72 + li t4,3 + beq t1,t4,.L72 + li t4,4 + beq t1,t4,.L72 + li t4,5 + beq t1,t4,.L73 + li t4,6 + beq t1,t4,.L73 + li t4,7 + beq t1,t4,.L77 + li t4,8 + beq t1,t4,.L77 + li t4,9 + beq t1,t4,.L77 + li t4,10 + beq t1,t4,.L77 + add t6,t1,-11 + li t4,1 + bleu t6,t4,.L83 + li t6,15 + beq t1,t6,.L77 + li t6,16 + bne t1,t6,.L26 + lw t1,0(s1) + and t1,t1,2 + beqz t1,.L26 + lw s3,16(s1) + li t1,7 + add t6,s3,-1 + bgtu t6,t1,.L26 + lw t6,8(s1) + li s4,4 + and t0,t6,-4 + lw t2,0(t0) + and t6,t6,3 + sll s2,t6,3 + sll s1,a0,s2 + add t1,s3,t6 + sll t4,t4,s2 + xor s1,s1,t2 + bgtu s3,s4,.L39 + bgtu t1,s4,.L40 + sll t1,t1,3 + add t3,t1,-1 + li t1,2 + sll t1,t1,t3 + sub t1,t1,t4 + and t1,t1,s1 + xor t1,t1,t2 + sw t1,0(t0) + j .L26 +.L80: + fld fa1,96(s1) + j .L13 +.L82: + lw s1,8(s1) + jalr t4 + fsd fa0,0(s1) + j .L26 +.L72: + lw t1,8(s1) + sb t3,0(t1) + j .L26 +.L2: + blez t0,.L5 + j .L4 +.L14: + lw t3,44(s1) + and t3,t3,4 + beqz t3,.L15 + flw fa2,60(s1) + j .L15 +.L81: + fld fa3,112(s1) + j .L17 +.L73: + lw t1,8(s1) + sh t3,0(t1) + j .L26 +.L18: + lw t3,44(s1) + and t3,t3,16 + beqz t3,.L19 + flw fa4,68(s1) + j .L19 +.L77: + lw t1,8(s1) + sw t3,0(t1) + j .L26 +.L20: + lw t3,44(s1) + and t3,t3,32 + beqz t3,.L21 + flw fa5,72(s1) + j .L21 +.L22: + lw t3,44(s1) + and t3,t3,64 + beqz t3,.L23 + flw fa6,76(s1) + j .L23 +.L24: + lw t1,44(s1) + and t1,t1,128 + beqz t1,.L8 + flw fa7,80(s1) + j .L8 +.L83: + lw t1,8(s1) + sw a0,0(t1) + sw a1,4(t1) + j .L26 +.L40: + li t5,-8 + mul t6,t6,t5 + lw s2,4(t0) + sll t1,t1,3 + add t5,t1,-33 + li t1,2 + sll t1,t1,t5 + sub t4,zero,t4 + add t1,t1,-1 + and t4,t4,s1 + xor t4,t4,t2 + sra t3,a0,t6 + xor t3,t3,s2 + and t1,t1,t3 + xor t1,t1,s2 + sw t4,0(t0) + sw t1,4(t0) + j .L26 +.L39: + sub t4,zero,t4 + and t4,t4,s1 + xor t4,t4,t2 + sw t4,0(t0) + li t4,8 + sll s1,a1,s2 + bleu t1,t4,.L84 + li t4,-8 + mul t6,t6,t4 + sll t1,t1,3 + li t2,2 + add t1,t1,-65 + lw s2,8(t0) + sll t1,t2,t1 + add t2,t1,-1 + add t1,t6,32 + sra t4,a1,t1 + xor t4,t4,s2 + sra t1,a0,t1 + and t3,t2,t4 + or t1,t1,s1 + xor t3,t3,s2 + sw t1,4(t0) + sw t3,8(t0) + j .L26 +.L84: + li t4,-4 + mul t4,t6,t4 + sll t1,t1,3 + lw t6,4(t0) + add t5,t1,-33 + li t1,2 + sll t1,t1,t5 + add t1,t1,-1 + add t4,t4,16 + sra t3,a0,t4 + sra t3,t3,t4 + or t3,t3,s1 + xor t3,t3,t6 + and t1,t1,t3 + xor t1,t1,t6 + sw t1,4(t0) + j .L26 + .size avcall_call, .-avcall_call +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-riscv32.c b/avcall/avcall-riscv32.c new file mode 100644 index 0000000..0b05c66 --- /dev/null +++ b/avcall/avcall-riscv32.c @@ -0,0 +1,277 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + Foreign function interface for a Linux riscv32 with ILP32 ABI. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + RISC-V Argument Passing Conventions are documented in + https://people.eecs.berkeley.edu/~krste/papers/riscv-spec-v2.1.pdf + chapter 20. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +register __avrword iarg1 __asm__("a0"); +register __avrword iarg2 __asm__("a1"); +register __avrword iarg3 __asm__("a2"); +register __avrword iarg4 __asm__("a3"); +register __avrword iarg5 __asm__("a4"); +register __avrword iarg6 __asm__("a5"); +register __avrword iarg7 __asm__("a6"); +register __avrword iarg8 __asm__("a7"); + +register float farg1 __asm__("fa0"); +register float farg2 __asm__("fa1"); +register float farg3 __asm__("fa2"); +register float farg4 __asm__("fa3"); +register float farg5 __asm__("fa4"); +register float farg6 __asm__("fa5"); +register float farg7 __asm__("fa6"); +register float farg8 __asm__("fa7"); + +register double darg1 __asm__("fa0"); +register double darg2 __asm__("fa1"); +register double darg3 __asm__("fa2"); +register double darg4 __asm__("fa3"); +register double darg5 __asm__("fa4"); +register double darg6 __asm__("fa5"); +register double darg7 __asm__("fa6"); +register double darg8 __asm__("fa7"); + +int +avcall_call(av_alist* list) +{ + register __avrword iretreg __asm__("a0"); + register __avrword iret2reg __asm__("a1"); + register double dret __asm__("fa0"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + unsigned int fanum = l->fanum; + + { + int i; + for (i = 8; i < arglen; i++) /* push function args onto stack */ + argframe[i-8] = l->args[i]; + } + + /* Put up to 8 integer args into registers. */ + if (arglen >= 1) { + iarg1 = l->args[0]; + if (arglen >= 2) { + iarg2 = l->args[1]; + if (arglen >= 3) { + iarg3 = l->args[2]; + if (arglen >= 4) { + iarg4 = l->args[3]; + if (arglen >= 5) { + iarg5 = l->args[4]; + if (arglen >= 6) { + iarg6 = l->args[5]; + if (arglen >= 7) { + iarg7 = l->args[6]; + if (arglen >= 8) { + iarg8 = l->args[7]; + } + } + } + } + } + } + } + } + + /* Put upto 8 floating-point args into registers. */ + if (fanum >= 1) { + if (l->darg_mask & (1 << 0)) darg1 = l->dargs[0]; + else if (l->farg_mask & (1 << 0)) farg1 = l->fargs[0]; + if (fanum >= 2) { + if (l->darg_mask & (1 << 1)) darg2 = l->dargs[1]; + else if (l->farg_mask & (1 << 1)) farg2 = l->fargs[1]; + if (fanum >= 3) { + if (l->darg_mask & (1 << 2)) darg3 = l->dargs[2]; + else if (l->farg_mask & (1 << 2)) farg3 = l->fargs[2]; + if (fanum >= 4) { + if (l->darg_mask & (1 << 3)) darg4 = l->dargs[3]; + else if (l->farg_mask & (1 << 3)) farg4 = l->fargs[3]; + if (fanum >= 5) { + if (l->darg_mask & (1 << 4)) darg5 = l->dargs[4]; + else if (l->farg_mask & (1 << 4)) farg5 = l->fargs[4]; + if (fanum >= 6) { + if (l->darg_mask & (1 << 5)) darg6 = l->dargs[5]; + else if (l->farg_mask & (1 << 5)) farg6 = l->fargs[5]; + if (fanum >= 7) { + if (l->darg_mask & (1 << 6)) darg7 = l->dargs[6]; + else if (l->farg_mask & (1 << 6)) farg7 = l->fargs[6]; + if (fanum >= 8) { + if (l->darg_mask & (1 << 7)) darg8 = l->dargs[7]; + else if (l->farg_mask & (1 << 7)) farg8 = l->fargs[7]; + } + } + } + } + } + } + } + } + + /* Call function. */ + if (l->rtype == __AVfloat) { + *(float*)l->raddr = (*(float(*)())l->func)(); + } else + if (l->rtype == __AVdouble) { + *(double*)l->raddr = (*(double(*)())l->func)(); + } else { + __avrword iret, iret2; + + iret = (*l->func)(); + iret2 = iret2reg; + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, iret); + } else + if (l->rtype == __AVlonglong || l->rtype == __AVulonglong) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = iret; + ((__avrword*)raddr)[1] = iret2; + } else + /* see above + if (l->rtype == __AVfloat) { + } else + if (l->rtype == __AVdouble) { + } else + */ + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_SMALL_STRUCT_RETURN) { + /* Return structs of size <= 8 in registers. */ + if (l->rsize > 0 && l->rsize <= 8) { + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize == 1) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + } else + if (l->rsize == 2) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + } else + if (l->rsize == 3) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + } else + if (l->rsize >= 4 && l->rsize <= 8) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + if (l->rsize == 4) { + } else + if (l->rsize == 5) { + ((unsigned char *)raddr)[4+0] = (unsigned char)(iret2); + } else + if (l->rsize == 6) { + ((unsigned char *)raddr)[4+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[4+1] = (unsigned char)(iret2>>8); + } else + if (l->rsize == 7) { + ((unsigned char *)raddr)[4+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[4+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[4+2] = (unsigned char)(iret2>>16); + } else + if (l->rsize == 8) { + ((unsigned char *)raddr)[4+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[4+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[4+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[4+3] = (unsigned char)(iret2>>24); + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 2*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__avrword) */ + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (end_offset*8-1)) - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret >> (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[1] ^= (wordaddr[1] ^ ((iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = ((__avrword)2 << (end_offset*8-2*sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*8-start_offset*8)) | (iret2 << (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 >> (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } + #endif + } + } + } + } + return 0; +} diff --git a/avcall/avcall-riscv64-lp64d-linux.s b/avcall/avcall-riscv64-lp64d-linux.s new file mode 100644 index 0000000..08d1455 --- /dev/null +++ b/avcall/avcall-riscv64-lp64d-linux.s @@ -0,0 +1,329 @@ + .file "avcall-riscv64.c" + .option pic + .text + .align 1 + .globl avcall_call + .type avcall_call, @function +avcall_call: + add sp,sp,-64 + sd s0,48(sp) + sd s1,40(sp) + sd ra,56(sp) + sd s2,32(sp) + sd s3,24(sp) + sd s4,16(sp) + sd s5,8(sp) + sd s6,0(sp) + add s0,sp,64 + ld t6,48(a0) + ld t3,40(a0) + li t1,-4096 + add t1,t1,2032 + sub t3,t3,t6 + sra t3,t3,3 + sext.w t0,t3 + li t4,8 + mv s1,a0 + add sp,sp,t1 + lw t2,64(a0) + ble t0,t4,.L2 + addw t3,t3,-9 + sll t3,t3,32 + srl t3,t3,29 + mv t1,sp + add t3,t3,8 + add t4,t6,64 + add t3,t1,t3 +.L3: + ld t5,0(t4) + add t1,t1,8 + add t4,t4,8 + sd t5,-8(t1) + bne t3,t1,.L3 +.L4: + li t1,1 + ld a0,0(t6) + beq t0,t1,.L5 + li t1,2 + ld a1,8(t6) + beq t0,t1,.L5 + li t1,3 + ld a2,16(t6) + beq t0,t1,.L5 + li t1,4 + ld a3,24(t6) + beq t0,t1,.L5 + li t1,5 + ld a4,32(t6) + beq t0,t1,.L5 + li t1,6 + ld a5,40(t6) + beq t0,t1,.L5 + li t1,7 + ld a6,48(t6) + beq t0,t1,.L5 + ld a7,56(t6) +.L5: + beqz t2,.L8 + lw t1,72(s1) + and t3,t1,1 + beqz t3,.L9 + fld fa0,112(s1) +.L10: + li t3,1 + bleu t2,t3,.L8 + and t3,t1,2 + bnez t3,.L77 + lw t3,68(s1) + and t3,t3,2 + beqz t3,.L13 + flw fa1,80(s1) +.L13: + li t3,2 + beq t2,t3,.L8 + and t3,t1,4 + beqz t3,.L14 + fld fa2,128(s1) +.L15: + li t3,3 + beq t2,t3,.L8 + and t3,t1,8 + bnez t3,.L78 + lw t3,68(s1) + and t3,t3,8 + beqz t3,.L17 + flw fa3,88(s1) +.L17: + li t3,4 + beq t2,t3,.L8 + and t3,t1,16 + beqz t3,.L18 + fld fa4,144(s1) +.L19: + li t3,5 + beq t2,t3,.L8 + and t3,t1,32 + beqz t3,.L20 + fld fa5,152(s1) +.L21: + li t3,6 + beq t2,t3,.L8 + and t3,t1,64 + beqz t3,.L22 + fld fa6,160(s1) +.L23: + li t3,7 + beq t2,t3,.L8 + and t1,t1,128 + beqz t1,.L24 + fld fa7,168(s1) +.L8: + lw t1,24(s1) + li t3,13 + ld t4,8(s1) + bne t1,t3,.L25 + ld s1,16(s1) + jalr t4 + fsw fa0,0(s1) +.L26: + add sp,s0,-64 + ld ra,56(sp) + li a0,0 + ld s0,48(sp) + ld s1,40(sp) + ld s2,32(sp) + ld s3,24(sp) + ld s4,16(sp) + ld s5,8(sp) + ld s6,0(sp) + add sp,sp,64 + jr ra +.L9: + lw t3,68(s1) + and t3,t3,1 + beqz t3,.L10 + flw fa0,76(s1) + j .L10 +.L25: + li t3,14 + beq t1,t3,.L79 + jalr t4 + lw t1,24(s1) + li t4,1 + mv t3,a0 + beq t1,t4,.L26 + li t4,2 + beq t1,t4,.L71 + li t4,3 + beq t1,t4,.L71 + li t4,4 + beq t1,t4,.L71 + li t4,5 + beq t1,t4,.L72 + li t4,6 + beq t1,t4,.L72 + li t4,7 + beq t1,t4,.L73 + li t4,8 + beq t1,t4,.L73 + and t4,t1,-3 + li t6,9 + beq t4,t6,.L75 + addw t4,t1,-10 + and t4,t4,-3 + sext.w t4,t4 + beqz t4,.L75 + li t6,15 + beq t1,t6,.L75 + li t4,16 + bne t1,t4,.L26 + lw t4,0(s1) + and t4,t4,512 + beqz t4,.L26 + ld s6,32(s1) + add t4,s6,-1 + bgtu t4,t6,.L26 + ld t6,16(s1) + li t4,1 + li s4,8 + and s1,t6,7 + and t6,t6,-8 + sext.w s3,s1 + ld t0,0(t6) + sll s5,s3,3 + add s1,s6,s1 + sll t2,a0,s5 + sll t4,t4,s5 + xor t2,t2,t0 + sllw s2,s1,3 + bgtu s6,s4,.L38 + bgtu s1,s4,.L39 + addw s2,s2,-1 + li t1,2 + sll t1,t1,s2 + sub t1,t1,t4 + and t1,t1,t2 + xor t1,t1,t0 + sd t1,0(t6) + j .L26 +.L77: + fld fa1,120(s1) + j .L13 +.L79: + ld s1,16(s1) + jalr t4 + fsd fa0,0(s1) + j .L26 +.L71: + ld t1,16(s1) + sb t3,0(t1) + j .L26 +.L2: + blez t0,.L5 + j .L4 +.L14: + lw t3,68(s1) + and t3,t3,4 + beqz t3,.L15 + flw fa2,84(s1) + j .L15 +.L78: + fld fa3,136(s1) + j .L17 +.L72: + ld t1,16(s1) + sh t3,0(t1) + j .L26 +.L18: + lw t3,68(s1) + and t3,t3,16 + beqz t3,.L19 + flw fa4,92(s1) + j .L19 +.L73: + ld t1,16(s1) + sw t3,0(t1) + j .L26 +.L20: + lw t3,68(s1) + and t3,t3,32 + beqz t3,.L21 + flw fa5,96(s1) + j .L21 +.L75: + ld t1,16(s1) + sd t3,0(t1) + j .L26 +.L22: + lw t3,68(s1) + and t3,t3,64 + beqz t3,.L23 + flw fa6,100(s1) + j .L23 +.L24: + lw t1,68(s1) + and t1,t1,128 + beqz t1,.L8 + flw fa7,104(s1) + j .L8 +.L39: + li t1,-8 + mulw t1,t1,s3 + ld s1,8(t6) + addw s2,s2,-65 + li t5,2 + sll t5,t5,s2 + sub t4,zero,t4 + add t5,t5,-1 + and t4,t4,t2 + xor t4,t4,t0 + sd t4,0(t6) + sra t1,a0,t1 + xor t1,t1,s1 + and t1,t1,t5 + xor t1,t1,s1 + sd t1,8(t6) + j .L26 +.L38: + sub t4,zero,t4 + and t4,t4,t2 + xor t4,t4,t0 + sd t4,0(t6) + sll t2,a1,s5 + bleu s1,t1,.L80 + li t1,-8 + mulw t1,t1,s3 + ld s1,16(t6) + addw t4,s2,-129 + li t0,2 + sll t0,t0,t4 + add t0,t0,-1 + addw t1,t1,64 + sra t4,a1,t1 + xor t4,t4,s1 + sra t1,a0,t1 + and t3,t0,t4 + or t1,t1,t2 + xor t3,t3,s1 + sd t1,8(t6) + sd t3,16(t6) + j .L26 +.L80: + li t1,-4 + mulw t1,t1,s3 + addw t4,s2,-65 + li t5,2 + sll t5,t5,t4 + ld t0,8(t6) + add t5,t5,-1 + addw t4,t1,32 + sra t1,a0,t4 + sra t1,t1,t4 + or t1,t1,t2 + xor t1,t1,t0 + and t1,t1,t5 + xor t1,t1,t0 + sd t1,8(t6) + j .L26 + .size avcall_call, .-avcall_call + .ident "GCC: (GNU) 7.3.0" diff --git a/avcall/avcall-riscv64-lp64d-macro.S b/avcall/avcall-riscv64-lp64d-macro.S new file mode 100644 index 0000000..3b61101 --- /dev/null +++ b/avcall/avcall-riscv64-lp64d-macro.S @@ -0,0 +1,331 @@ + .file "avcall-riscv64.c" + .option pic + .text + .align 1 + .globl avcall_call + .type avcall_call, @function +avcall_call: + add sp,sp,-64 + sd s0,48(sp) + sd s1,40(sp) + sd ra,56(sp) + sd s2,32(sp) + sd s3,24(sp) + sd s4,16(sp) + sd s5,8(sp) + sd s6,0(sp) + add s0,sp,64 + ld t6,48(a0) + ld t3,40(a0) + li t1,-4096 + add t1,t1,2032 + sub t3,t3,t6 + sra t3,t3,3 + sext.w t0,t3 + li t4,8 + mv s1,a0 + add sp,sp,t1 + lw t2,64(a0) + ble t0,t4,.L2 + addw t3,t3,-9 + sll t3,t3,32 + srl t3,t3,29 + mv t1,sp + add t3,t3,8 + add t4,t6,64 + add t3,t1,t3 +.L3: + ld t5,0(t4) + add t1,t1,8 + add t4,t4,8 + sd t5,-8(t1) + bne t3,t1,.L3 +.L4: + li t1,1 + ld a0,0(t6) + beq t0,t1,.L5 + li t1,2 + ld a1,8(t6) + beq t0,t1,.L5 + li t1,3 + ld a2,16(t6) + beq t0,t1,.L5 + li t1,4 + ld a3,24(t6) + beq t0,t1,.L5 + li t1,5 + ld a4,32(t6) + beq t0,t1,.L5 + li t1,6 + ld a5,40(t6) + beq t0,t1,.L5 + li t1,7 + ld a6,48(t6) + beq t0,t1,.L5 + ld a7,56(t6) +.L5: + beqz t2,.L8 + lw t1,72(s1) + and t3,t1,1 + beqz t3,.L9 + fld fa0,112(s1) +.L10: + li t3,1 + bleu t2,t3,.L8 + and t3,t1,2 + bnez t3,.L77 + lw t3,68(s1) + and t3,t3,2 + beqz t3,.L13 + flw fa1,80(s1) +.L13: + li t3,2 + beq t2,t3,.L8 + and t3,t1,4 + beqz t3,.L14 + fld fa2,128(s1) +.L15: + li t3,3 + beq t2,t3,.L8 + and t3,t1,8 + bnez t3,.L78 + lw t3,68(s1) + and t3,t3,8 + beqz t3,.L17 + flw fa3,88(s1) +.L17: + li t3,4 + beq t2,t3,.L8 + and t3,t1,16 + beqz t3,.L18 + fld fa4,144(s1) +.L19: + li t3,5 + beq t2,t3,.L8 + and t3,t1,32 + beqz t3,.L20 + fld fa5,152(s1) +.L21: + li t3,6 + beq t2,t3,.L8 + and t3,t1,64 + beqz t3,.L22 + fld fa6,160(s1) +.L23: + li t3,7 + beq t2,t3,.L8 + and t1,t1,128 + beqz t1,.L24 + fld fa7,168(s1) +.L8: + lw t1,24(s1) + li t3,13 + ld t4,8(s1) + bne t1,t3,.L25 + ld s1,16(s1) + jalr t4 + fsw fa0,0(s1) +.L26: + add sp,s0,-64 + ld ra,56(sp) + li a0,0 + ld s0,48(sp) + ld s1,40(sp) + ld s2,32(sp) + ld s3,24(sp) + ld s4,16(sp) + ld s5,8(sp) + ld s6,0(sp) + add sp,sp,64 + jr ra +.L9: + lw t3,68(s1) + and t3,t3,1 + beqz t3,.L10 + flw fa0,76(s1) + j .L10 +.L25: + li t3,14 + beq t1,t3,.L79 + jalr t4 + lw t1,24(s1) + li t4,1 + mv t3,a0 + beq t1,t4,.L26 + li t4,2 + beq t1,t4,.L71 + li t4,3 + beq t1,t4,.L71 + li t4,4 + beq t1,t4,.L71 + li t4,5 + beq t1,t4,.L72 + li t4,6 + beq t1,t4,.L72 + li t4,7 + beq t1,t4,.L73 + li t4,8 + beq t1,t4,.L73 + and t4,t1,-3 + li t6,9 + beq t4,t6,.L75 + addw t4,t1,-10 + and t4,t4,-3 + sext.w t4,t4 + beqz t4,.L75 + li t6,15 + beq t1,t6,.L75 + li t4,16 + bne t1,t4,.L26 + lw t4,0(s1) + and t4,t4,512 + beqz t4,.L26 + ld s6,32(s1) + add t4,s6,-1 + bgtu t4,t6,.L26 + ld t6,16(s1) + li t4,1 + li s4,8 + and s1,t6,7 + and t6,t6,-8 + sext.w s3,s1 + ld t0,0(t6) + sll s5,s3,3 + add s1,s6,s1 + sll t2,a0,s5 + sll t4,t4,s5 + xor t2,t2,t0 + sllw s2,s1,3 + bgtu s6,s4,.L38 + bgtu s1,s4,.L39 + addw s2,s2,-1 + li t1,2 + sll t1,t1,s2 + sub t1,t1,t4 + and t1,t1,t2 + xor t1,t1,t0 + sd t1,0(t6) + j .L26 +.L77: + fld fa1,120(s1) + j .L13 +.L79: + ld s1,16(s1) + jalr t4 + fsd fa0,0(s1) + j .L26 +.L71: + ld t1,16(s1) + sb t3,0(t1) + j .L26 +.L2: + blez t0,.L5 + j .L4 +.L14: + lw t3,68(s1) + and t3,t3,4 + beqz t3,.L15 + flw fa2,84(s1) + j .L15 +.L78: + fld fa3,136(s1) + j .L17 +.L72: + ld t1,16(s1) + sh t3,0(t1) + j .L26 +.L18: + lw t3,68(s1) + and t3,t3,16 + beqz t3,.L19 + flw fa4,92(s1) + j .L19 +.L73: + ld t1,16(s1) + sw t3,0(t1) + j .L26 +.L20: + lw t3,68(s1) + and t3,t3,32 + beqz t3,.L21 + flw fa5,96(s1) + j .L21 +.L75: + ld t1,16(s1) + sd t3,0(t1) + j .L26 +.L22: + lw t3,68(s1) + and t3,t3,64 + beqz t3,.L23 + flw fa6,100(s1) + j .L23 +.L24: + lw t1,68(s1) + and t1,t1,128 + beqz t1,.L8 + flw fa7,104(s1) + j .L8 +.L39: + li t1,-8 + mulw t1,t1,s3 + ld s1,8(t6) + addw s2,s2,-65 + li t5,2 + sll t5,t5,s2 + sub t4,zero,t4 + add t5,t5,-1 + and t4,t4,t2 + xor t4,t4,t0 + sd t4,0(t6) + sra t1,a0,t1 + xor t1,t1,s1 + and t1,t1,t5 + xor t1,t1,s1 + sd t1,8(t6) + j .L26 +.L38: + sub t4,zero,t4 + and t4,t4,t2 + xor t4,t4,t0 + sd t4,0(t6) + sll t2,a1,s5 + bleu s1,t1,.L80 + li t1,-8 + mulw t1,t1,s3 + ld s1,16(t6) + addw t4,s2,-129 + li t0,2 + sll t0,t0,t4 + add t0,t0,-1 + addw t1,t1,64 + sra t4,a1,t1 + xor t4,t4,s1 + sra t1,a0,t1 + and t3,t0,t4 + or t1,t1,t2 + xor t3,t3,s1 + sd t1,8(t6) + sd t3,16(t6) + j .L26 +.L80: + li t1,-4 + mulw t1,t1,s3 + addw t4,s2,-65 + li t5,2 + sll t5,t5,t4 + ld t0,8(t6) + add t5,t5,-1 + addw t4,t1,32 + sra t1,a0,t4 + sra t1,t1,t4 + or t1,t1,t2 + xor t1,t1,t0 + and t1,t1,t5 + xor t1,t1,t0 + sd t1,8(t6) + j .L26 + .size avcall_call, .-avcall_call +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-riscv64.c b/avcall/avcall-riscv64.c new file mode 100644 index 0000000..299f959 --- /dev/null +++ b/avcall/avcall-riscv64.c @@ -0,0 +1,340 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + Foreign function interface for a Linux riscv64 with LP64 ABI. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + RISC-V Argument Passing Conventions are documented in + https://people.eecs.berkeley.edu/~krste/papers/riscv-spec-v2.1.pdf + chapter 20. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +register __avrword iarg1 __asm__("a0"); +register __avrword iarg2 __asm__("a1"); +register __avrword iarg3 __asm__("a2"); +register __avrword iarg4 __asm__("a3"); +register __avrword iarg5 __asm__("a4"); +register __avrword iarg6 __asm__("a5"); +register __avrword iarg7 __asm__("a6"); +register __avrword iarg8 __asm__("a7"); + +register float farg1 __asm__("fa0"); +register float farg2 __asm__("fa1"); +register float farg3 __asm__("fa2"); +register float farg4 __asm__("fa3"); +register float farg5 __asm__("fa4"); +register float farg6 __asm__("fa5"); +register float farg7 __asm__("fa6"); +register float farg8 __asm__("fa7"); + +register double darg1 __asm__("fa0"); +register double darg2 __asm__("fa1"); +register double darg3 __asm__("fa2"); +register double darg4 __asm__("fa3"); +register double darg5 __asm__("fa4"); +register double darg6 __asm__("fa5"); +register double darg7 __asm__("fa6"); +register double darg8 __asm__("fa7"); + +int +avcall_call(av_alist* list) +{ + register __avrword iretreg __asm__("a0"); + register __avrword iret2reg __asm__("a1"); + register double dret __asm__("fa0"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + unsigned int fanum = l->fanum; + + { + int i; + for (i = 8; i < arglen; i++) /* push function args onto stack */ + argframe[i-8] = l->args[i]; + } + + /* Put up to 8 integer args into registers. */ + if (arglen >= 1) { + iarg1 = l->args[0]; + if (arglen >= 2) { + iarg2 = l->args[1]; + if (arglen >= 3) { + iarg3 = l->args[2]; + if (arglen >= 4) { + iarg4 = l->args[3]; + if (arglen >= 5) { + iarg5 = l->args[4]; + if (arglen >= 6) { + iarg6 = l->args[5]; + if (arglen >= 7) { + iarg7 = l->args[6]; + if (arglen >= 8) { + iarg8 = l->args[7]; + } + } + } + } + } + } + } + } + + /* Put upto 8 floating-point args into registers. */ + if (fanum >= 1) { + if (l->darg_mask & (1 << 0)) darg1 = l->dargs[0]; + else if (l->farg_mask & (1 << 0)) farg1 = l->fargs[0]; + if (fanum >= 2) { + if (l->darg_mask & (1 << 1)) darg2 = l->dargs[1]; + else if (l->farg_mask & (1 << 1)) farg2 = l->fargs[1]; + if (fanum >= 3) { + if (l->darg_mask & (1 << 2)) darg3 = l->dargs[2]; + else if (l->farg_mask & (1 << 2)) farg3 = l->fargs[2]; + if (fanum >= 4) { + if (l->darg_mask & (1 << 3)) darg4 = l->dargs[3]; + else if (l->farg_mask & (1 << 3)) farg4 = l->fargs[3]; + if (fanum >= 5) { + if (l->darg_mask & (1 << 4)) darg5 = l->dargs[4]; + else if (l->farg_mask & (1 << 4)) farg5 = l->fargs[4]; + if (fanum >= 6) { + if (l->darg_mask & (1 << 5)) darg6 = l->dargs[5]; + else if (l->farg_mask & (1 << 5)) farg6 = l->fargs[5]; + if (fanum >= 7) { + if (l->darg_mask & (1 << 6)) darg7 = l->dargs[6]; + else if (l->farg_mask & (1 << 6)) farg7 = l->fargs[6]; + if (fanum >= 8) { + if (l->darg_mask & (1 << 7)) darg8 = l->dargs[7]; + else if (l->farg_mask & (1 << 7)) farg8 = l->fargs[7]; + } + } + } + } + } + } + } + } + + /* Call function. */ + if (l->rtype == __AVfloat) { + *(float*)l->raddr = (*(float(*)())l->func)(); + } else + if (l->rtype == __AVdouble) { + *(double*)l->raddr = (*(double(*)())l->func)(); + } else { + __avrword iret, iret2; + + iret = (*l->func)(); + iret2 = iret2reg; + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong || l->rtype == __AVlonglong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong || l->rtype == __AVulonglong) { + RETURN(unsigned long, iret); + } else + /* see above + if (l->rtype == __AVfloat) { + } else + if (l->rtype == __AVdouble) { + } else + */ + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + /* Return structs of size <= 16 in registers. */ + if (l->rsize > 0 && l->rsize <= 16) { + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize == 1) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + } else + if (l->rsize == 2) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + } else + if (l->rsize == 3) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + } else + if (l->rsize == 4) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + } else + if (l->rsize == 5) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + } else + if (l->rsize == 6) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + } else + if (l->rsize == 7) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + } else + if (l->rsize >= 8 && l->rsize <= 16) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[7] = (unsigned char)(iret>>56); + if (l->rsize == 8) { + } else + if (l->rsize == 9) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + } else + if (l->rsize == 10) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + } else + if (l->rsize == 11) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + } else + if (l->rsize == 12) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + } else + if (l->rsize == 13) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + } else + if (l->rsize == 14) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + } else + if (l->rsize == 15) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + } else + if (l->rsize == 16) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+7] = (unsigned char)(iret2>>56); + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 2*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__avrword) */ + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (end_offset*8-1)) - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret >> (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[1] ^= (wordaddr[1] ^ ((iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = ((__avrword)2 << (end_offset*8-2*sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*8-start_offset*8)) | (iret2 << (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 >> (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } + #endif + } + } + } + } + return 0; +} diff --git a/avcall/avcall-s390-linux.s b/avcall/avcall-s390-linux.s new file mode 100644 index 0000000..fc28853 --- /dev/null +++ b/avcall/avcall-s390-linux.s @@ -0,0 +1,146 @@ + .file "avcall-s390.c" +.text + .align 4 +.globl avcall_call + .type avcall_call,@function +avcall_call: + stm %r6,%r15,24(%r15) + bras %r13,.LTN0_0 +.LT0_0: +.LC0: + .long 1 +.LTN0_0: + lr %r14,%r15 + ahi %r15,-96 + lr %r10,%r2 + lr %r11,%r15 + lhi %r2,0 + st %r14,0(%r15) + l %r1,0(%r15) + ahi %r15,-1032 + l %r3,20(%r10) + l %r4,24(%r10) + sr %r3,%r4 + sra %r3,2 + la %r5,96(%r15) + st %r1,0(%r15) + cr %r2,%r3 + l %r0,64(%r10) + jhe .L53 +.L6: + lr %r1,%r2 + sll %r1,2 + ahi %r2,1 + cr %r2,%r3 + l %r9,0(%r1,%r4) + st %r9,0(%r1,%r5) + jl .L6 +.L53: + ltr %r0,%r0 + je .L7 + l %r1,72(%r10) + tml %r1,1 + je .L8 + ld %f0,88(%r10) +.L9: + cl %r0,.LC0-.LT0_0(%r13) + jle .L7 + tml %r1,2 + je .L12 + ld %f2,96(%r10) +.L7: + l %r1,4(%r10) + l %r4,52(%r10) + l %r2,44(%r10) + l %r3,48(%r10) + l %r5,56(%r10) + l %r6,60(%r10) + basr %r14,%r1 + l %r4,12(%r10) + chi %r4,1 + je .L16 + chi %r4,2 + je .L56 + chi %r4,3 + je .L56 + chi %r4,4 + je .L56 + chi %r4,5 + je .L55 + chi %r4,6 + je .L55 + chi %r4,7 + je .L62 + chi %r4,8 + je .L62 + chi %r4,9 + je .L62 + chi %r4,10 + je .L62 + lr %r1,%r4 + ahi %r1,-11 + cl %r1,.LC0-.LT0_0(%r13) + jle .L61 + chi %r4,13 + je .L63 + chi %r4,14 + je .L64 + chi %r4,15 + je .L62 + chi %r4,16 + je .L65 +.L16: + lhi %r2,0 + l %r4,152(%r11) + lm %r6,%r15,120(%r11) + br %r4 +.L65: + tm 2(%r10),2 + je .L16 + l %r1,16(%r10) + chi %r1,1 + je .L56 + chi %r1,2 + je .L55 + chi %r1,4 + je .L62 + chi %r1,8 + jne .L16 +.L61: + l %r1,8(%r10) + st %r3,4(%r1) +.L54: + st %r2,0(%r1) + j .L16 +.L62: + l %r1,8(%r10) + j .L54 +.L55: + l %r1,8(%r10) + sth %r2,0(%r1) + j .L16 +.L56: + l %r1,8(%r10) + stc %r2,0(%r1) + j .L16 +.L64: + l %r1,8(%r10) + std %f0,0(%r1) + j .L16 +.L63: + l %r1,8(%r10) + ste %f0,0(%r1) + j .L16 +.L12: + tm 71(%r10),2 + je .L7 + le %f2,80(%r10) + j .L7 +.L8: + tm 71(%r10),1 + je .L9 + le %f0,76(%r10) + j .L9 +.Lfe1: + .size avcall_call,.Lfe1-avcall_call + .ident "GCC: (GNU) 3.1" diff --git a/avcall/avcall-s390-macro.S b/avcall/avcall-s390-macro.S new file mode 100644 index 0000000..c37cf7a --- /dev/null +++ b/avcall/avcall-s390-macro.S @@ -0,0 +1,148 @@ + .file "avcall-s390.c" +.text + .align 4 +.globl avcall_call + .type avcall_call,@function +avcall_call: + stm %r6,%r15,24(%r15) + bras %r13,.LTN0_0 +.LT0_0: +.LC0: + .long 1 +.LTN0_0: + lr %r14,%r15 + ahi %r15,-96 + lr %r10,%r2 + lr %r11,%r15 + lhi %r2,0 + st %r14,0(%r15) + l %r1,0(%r15) + ahi %r15,-1032 + l %r3,20(%r10) + l %r4,24(%r10) + sr %r3,%r4 + sra %r3,2 + la %r5,96(%r15) + st %r1,0(%r15) + cr %r2,%r3 + l %r0,64(%r10) + jhe .L53 +.L6: + lr %r1,%r2 + sll %r1,2 + ahi %r2,1 + cr %r2,%r3 + l %r9,0(%r1,%r4) + st %r9,0(%r1,%r5) + jl .L6 +.L53: + ltr %r0,%r0 + je .L7 + l %r1,72(%r10) + tml %r1,1 + je .L8 + ld %f0,88(%r10) +.L9: + cl %r0,.LC0-.LT0_0(%r13) + jle .L7 + tml %r1,2 + je .L12 + ld %f2,96(%r10) +.L7: + l %r1,4(%r10) + l %r4,52(%r10) + l %r2,44(%r10) + l %r3,48(%r10) + l %r5,56(%r10) + l %r6,60(%r10) + basr %r14,%r1 + l %r4,12(%r10) + chi %r4,1 + je .L16 + chi %r4,2 + je .L56 + chi %r4,3 + je .L56 + chi %r4,4 + je .L56 + chi %r4,5 + je .L55 + chi %r4,6 + je .L55 + chi %r4,7 + je .L62 + chi %r4,8 + je .L62 + chi %r4,9 + je .L62 + chi %r4,10 + je .L62 + lr %r1,%r4 + ahi %r1,-11 + cl %r1,.LC0-.LT0_0(%r13) + jle .L61 + chi %r4,13 + je .L63 + chi %r4,14 + je .L64 + chi %r4,15 + je .L62 + chi %r4,16 + je .L65 +.L16: + lhi %r2,0 + l %r4,152(%r11) + lm %r6,%r15,120(%r11) + br %r4 +.L65: + tm 2(%r10),2 + je .L16 + l %r1,16(%r10) + chi %r1,1 + je .L56 + chi %r1,2 + je .L55 + chi %r1,4 + je .L62 + chi %r1,8 + jne .L16 +.L61: + l %r1,8(%r10) + st %r3,4(%r1) +.L54: + st %r2,0(%r1) + j .L16 +.L62: + l %r1,8(%r10) + j .L54 +.L55: + l %r1,8(%r10) + sth %r2,0(%r1) + j .L16 +.L56: + l %r1,8(%r10) + stc %r2,0(%r1) + j .L16 +.L64: + l %r1,8(%r10) + std %f0,0(%r1) + j .L16 +.L63: + l %r1,8(%r10) + ste %f0,0(%r1) + j .L16 +.L12: + tm 71(%r10),2 + je .L7 + le %f2,80(%r10) + j .L7 +.L8: + tm 71(%r10),1 + je .L9 + le %f0,76(%r10) + j .L9 +.Lfe1: + .size avcall_call,.Lfe1-avcall_call +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-s390.c b/avcall/avcall-s390.c new file mode 100644 index 0000000..c2e5eb2 --- /dev/null +++ b/avcall/avcall-s390.c @@ -0,0 +1,143 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + Copyright 2001 Gerhard Tonn + + 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, see . +**/ +/*---------------------------------------------------------------------- + + Foreign function interface for an IBM S/390 with gcc + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + S390 Argument Passing Conventions: + + All arguments, except the first 5 words, are passed on the stack with + word alignment. Doubles take two words. The first 2 doubles and floats + are also passed in floating-point-registers. + To return a structure, the called function copies the value to space + pointed to by its first argument, and all other arguments are shifted + down by one. + + Compile this routine with gcc -O2 to get the right register variables. + For other compilers use the pre-compiled assembler version. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +register float farg1 __asm__("f0"); +register float farg2 __asm__("f2"); +register double darg1 __asm__("f0"); +register double darg2 __asm__("f2"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("r15"); /* C names for registers */ +/*register __avrword iret __asm__("r2"); */ + register __avrword iret2 __asm__("r3"); + register float fret __asm__("f0"); + register double dret __asm__("f0"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + unsigned int fanum = l->fanum; + __avrword i; + + for (i = 0; i < arglen; i++) /* push function args onto stack */ + argframe[i] = l->args[i]; + + /* Put upto 2 floating-point args into registers. */ + if (fanum >= 1) { + if (l->darg_mask & (1 << 0)) darg1 = l->dargs[0]; + else if (l->farg_mask & (1 << 0)) farg1 = l->fargs[0]; + if (fanum >= 2) { + if (l->darg_mask & (1 << 1)) darg2 = l->dargs[1]; + else if (l->farg_mask & (1 << 1)) farg2 = l->fargs[1]; + } + } + + /* call function, pass 5 args in registers */ + i = (*l->func)(l->iargs[0], l->iargs[1], l->iargs[2], l->iargs[3], + l->iargs[4]); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, i); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, i); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, i); + } else + if (l->rtype == __AVshort) { + RETURN(short, i); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, i); + } else + if (l->rtype == __AVint) { + RETURN(int, i); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, i); + } else + if (l->rtype == __AVlong) { + RETURN(long, i); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, i); + } else + if (l->rtype == __AVlonglong || l->rtype == __AVulonglong) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = iret2; + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, i); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + if (l->rsize == sizeof(char)) { + RETURN(char, i); + } else + if (l->rsize == sizeof(short)) { + RETURN(short, i); + } else + if (l->rsize == sizeof(int)) { + RETURN(int, i); + } else + if (l->rsize == 2*sizeof(__avrword)) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = iret2; + } + } + } + return 0; +} diff --git a/avcall/avcall-s390x-linux.s b/avcall/avcall-s390x-linux.s new file mode 100644 index 0000000..b11a298 --- /dev/null +++ b/avcall/avcall-s390x-linux.s @@ -0,0 +1,267 @@ + .file "avcall-s390x.c" +.text + .align 8 +.globl avcall_call + .type avcall_call, @function +avcall_call: +.LFB0: + .cfi_startproc + stmg %r7,%r15,56(%r15) + .cfi_offset 7, -104 + .cfi_offset 8, -96 + .cfi_offset 9, -88 + .cfi_offset 10, -80 + .cfi_offset 11, -72 + .cfi_offset 12, -64 + .cfi_offset 13, -56 + .cfi_offset 14, -48 + .cfi_offset 15, -40 + larl %r13,.L77 + aghi %r15,-176 + .cfi_def_cfa_offset 336 + lgr %r11,%r15 + .cfi_def_cfa_register 11 + aghi %r15,-2056 + lg %r9,48(%r2) + lg %r1,40(%r2) + sgr %r1,%r9 + srag %r1,%r1,3 + stg %r2,168(%r11) + stg %r6,160(%r11) + ltr %r1,%r1 + la %r8,160(%r15) + l %r0,64(%r2) + l %r7,112(%r2) + jle .L6 + ahi %r1,-1 + llgfr %r1,%r1 + aghi %r1,1 + lghi %r14,0 +.L5: + lg %r10,0(%r14,%r9) + stg %r10,0(%r14,%r8) + aghi %r14,8 + brctg %r1,.L5 +.L6: + ltr %r0,%r0 + je .L7 + lg %r1,168(%r11) + cl %r0,.L78-.L77(%r13) + lg %r2,72(%r1) + jle .L7 + chi %r0,2 + lg %r3,80(%r1) + je .L7 + chi %r0,3 + lg %r4,88(%r1) + je .L7 + chi %r0,4 + lg %r5,96(%r1) + jne .L72 +.L7: + ltr %r7,%r7 + je .L9 + lg %r10,168(%r11) + l %r1,120(%r10) + tmll %r1,1 + je .L10 + ld %f0,144(%r10) +.L11: + cl %r7,.L78-.L77(%r13) + jle .L9 + tmll %r1,2 + lg %r10,168(%r11) + jne .L73 + tm 119(%r10),2 + je .L14 + le %f2,128(%r10) +.L14: + chi %r7,2 + je .L9 + tmll %r1,4 + lg %r10,168(%r11) + je .L15 + ld %f4,160(%r10) +.L16: + chi %r7,3 + je .L9 + tmll %r1,8 + lg %r1,168(%r11) + jne .L74 + tm 119(%r1),8 + je .L9 + le %f6,136(%r1) +.L9: + lg %r1,168(%r11) + l %r1,24(%r1) + chi %r1,13 + je .L75 + chi %r1,14 + je .L76 + lg %r10,168(%r11) + lg %r1,8(%r10) + basr %r14,%r1 + l %r1,24(%r10) + chi %r1,1 + lgr %r0,%r2 + je .L19 + chi %r1,2 + je .L68 + chi %r1,3 + je .L68 + chi %r1,4 + je .L68 + chi %r1,5 + je .L69 + chi %r1,6 + je .L69 + chi %r1,7 + je .L70 + chi %r1,8 + je .L70 + lr %r9,%r1 + nill %r9,65533 + chi %r9,9 + je .L67 + chi %r1,10 + je .L67 + chi %r1,12 + je .L67 + chi %r1,15 + je .L67 +.L19: + lg %r4,288(%r11) + lg %r6,160(%r11) + lghi %r2,0 + lmg %r7,%r15,232(%r11) + .cfi_remember_state + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_restore 11 + .cfi_restore 10 + .cfi_restore 9 + .cfi_restore 8 + .cfi_restore 7 + .cfi_def_cfa 15, 160 + br %r4 +.L10: + .cfi_restore_state + lg %r10,168(%r11) + tm 119(%r10),1 + je .L11 + le %f0,124(%r10) + j .L11 +.L68: + lg %r1,168(%r11) + lghi %r2,0 + lg %r1,16(%r1) + stc %r0,0(%r1) + lg %r4,288(%r11) + lg %r6,160(%r11) + lmg %r7,%r15,232(%r11) + .cfi_remember_state + .cfi_restore 7 + .cfi_restore 8 + .cfi_restore 9 + .cfi_restore 10 + .cfi_restore 11 + .cfi_restore 12 + .cfi_restore 13 + .cfi_restore 14 + .cfi_restore 15 + .cfi_def_cfa 15, 160 + br %r4 +.L73: + .cfi_restore_state + ld %f2,152(%r10) + j .L14 +.L69: + lg %r1,168(%r11) + lg %r4,288(%r11) + lg %r6,160(%r11) + lg %r1,16(%r1) + lghi %r2,0 + lmg %r7,%r15,232(%r11) + .cfi_remember_state + .cfi_restore 7 + .cfi_restore 8 + .cfi_restore 9 + .cfi_restore 10 + .cfi_restore 11 + .cfi_restore 12 + .cfi_restore 13 + .cfi_restore 14 + .cfi_restore 15 + .cfi_def_cfa 15, 160 + sth %r0,0(%r1) + br %r4 +.L67: + .cfi_restore_state + lg %r1,168(%r11) + lg %r1,16(%r1) + stg %r0,0(%r1) + j .L19 +.L76: + lg %r0,168(%r11) + lgr %r1,%r0 + lgr %r10,%r0 + lg %r1,8(%r1) + lg %r10,16(%r10) + basr %r14,%r1 + lg %r4,288(%r11) + std %f0,0(%r10) + lg %r6,160(%r11) + lghi %r2,0 + lmg %r7,%r15,232(%r11) + .cfi_remember_state + .cfi_restore 7 + .cfi_restore 8 + .cfi_restore 9 + .cfi_restore 10 + .cfi_restore 11 + .cfi_restore 12 + .cfi_restore 13 + .cfi_restore 14 + .cfi_restore 15 + .cfi_def_cfa 15, 160 + br %r4 +.L75: + .cfi_restore_state + lg %r0,168(%r11) + lgr %r1,%r0 + lgr %r10,%r0 + lg %r1,8(%r1) + lg %r10,16(%r10) + basr %r14,%r1 + ste %f0,0(%r10) + j .L19 +.L15: + tm 119(%r10),4 + je .L16 + le %f4,132(%r10) + j .L16 +.L70: + lg %r1,168(%r11) + lg %r1,16(%r1) + st %r0,0(%r1) + j .L19 +.L72: + lg %r6,104(%r1) + j .L7 +.L74: + ld %f6,168(%r1) + j .L9 + .section .rodata + .align 8 +.L77: +.L78: + .long 1 + .align 2 + .previous + .cfi_endproc +.LFE0: + .size avcall_call, .-avcall_call + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/avcall/avcall-s390x-macro.S b/avcall/avcall-s390x-macro.S new file mode 100644 index 0000000..f6ff71a --- /dev/null +++ b/avcall/avcall-s390x-macro.S @@ -0,0 +1,268 @@ + .file "avcall-s390x.c" +.text + .align 8 +.globl avcall_call + .type avcall_call, @function +avcall_call: +.LFB0: + .cfi_startproc + stmg %r7,%r15,56(%r15) + .cfi_offset 7, -104 + .cfi_offset 8, -96 + .cfi_offset 9, -88 + .cfi_offset 10, -80 + .cfi_offset 11, -72 + .cfi_offset 12, -64 + .cfi_offset 13, -56 + .cfi_offset 14, -48 + .cfi_offset 15, -40 + larl %r13,.L77 + aghi %r15,-176 + .cfi_def_cfa_offset 336 + lgr %r11,%r15 + .cfi_def_cfa_register 11 + aghi %r15,-2056 + lg %r9,48(%r2) + lg %r1,40(%r2) + sgr %r1,%r9 + srag %r1,%r1,3 + stg %r2,168(%r11) + stg %r6,160(%r11) + ltr %r1,%r1 + la %r8,160(%r15) + l %r0,64(%r2) + l %r7,112(%r2) + jle .L6 + ahi %r1,-1 + llgfr %r1,%r1 + aghi %r1,1 + lghi %r14,0 +.L5: + lg %r10,0(%r14,%r9) + stg %r10,0(%r14,%r8) + aghi %r14,8 + brctg %r1,.L5 +.L6: + ltr %r0,%r0 + je .L7 + lg %r1,168(%r11) + cl %r0,.L78-.L77(%r13) + lg %r2,72(%r1) + jle .L7 + chi %r0,2 + lg %r3,80(%r1) + je .L7 + chi %r0,3 + lg %r4,88(%r1) + je .L7 + chi %r0,4 + lg %r5,96(%r1) + jne .L72 +.L7: + ltr %r7,%r7 + je .L9 + lg %r10,168(%r11) + l %r1,120(%r10) + tmll %r1,1 + je .L10 + ld %f0,144(%r10) +.L11: + cl %r7,.L78-.L77(%r13) + jle .L9 + tmll %r1,2 + lg %r10,168(%r11) + jne .L73 + tm 119(%r10),2 + je .L14 + le %f2,128(%r10) +.L14: + chi %r7,2 + je .L9 + tmll %r1,4 + lg %r10,168(%r11) + je .L15 + ld %f4,160(%r10) +.L16: + chi %r7,3 + je .L9 + tmll %r1,8 + lg %r1,168(%r11) + jne .L74 + tm 119(%r1),8 + je .L9 + le %f6,136(%r1) +.L9: + lg %r1,168(%r11) + l %r1,24(%r1) + chi %r1,13 + je .L75 + chi %r1,14 + je .L76 + lg %r10,168(%r11) + lg %r1,8(%r10) + basr %r14,%r1 + l %r1,24(%r10) + chi %r1,1 + lgr %r0,%r2 + je .L19 + chi %r1,2 + je .L68 + chi %r1,3 + je .L68 + chi %r1,4 + je .L68 + chi %r1,5 + je .L69 + chi %r1,6 + je .L69 + chi %r1,7 + je .L70 + chi %r1,8 + je .L70 + lr %r9,%r1 + nill %r9,65533 + chi %r9,9 + je .L67 + chi %r1,10 + je .L67 + chi %r1,12 + je .L67 + chi %r1,15 + je .L67 +.L19: + lg %r4,288(%r11) + lg %r6,160(%r11) + lghi %r2,0 + lmg %r7,%r15,232(%r11) + .cfi_remember_state + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_restore 11 + .cfi_restore 10 + .cfi_restore 9 + .cfi_restore 8 + .cfi_restore 7 + .cfi_def_cfa 15, 160 + br %r4 +.L10: + .cfi_restore_state + lg %r10,168(%r11) + tm 119(%r10),1 + je .L11 + le %f0,124(%r10) + j .L11 +.L68: + lg %r1,168(%r11) + lghi %r2,0 + lg %r1,16(%r1) + stc %r0,0(%r1) + lg %r4,288(%r11) + lg %r6,160(%r11) + lmg %r7,%r15,232(%r11) + .cfi_remember_state + .cfi_restore 7 + .cfi_restore 8 + .cfi_restore 9 + .cfi_restore 10 + .cfi_restore 11 + .cfi_restore 12 + .cfi_restore 13 + .cfi_restore 14 + .cfi_restore 15 + .cfi_def_cfa 15, 160 + br %r4 +.L73: + .cfi_restore_state + ld %f2,152(%r10) + j .L14 +.L69: + lg %r1,168(%r11) + lg %r4,288(%r11) + lg %r6,160(%r11) + lg %r1,16(%r1) + lghi %r2,0 + lmg %r7,%r15,232(%r11) + .cfi_remember_state + .cfi_restore 7 + .cfi_restore 8 + .cfi_restore 9 + .cfi_restore 10 + .cfi_restore 11 + .cfi_restore 12 + .cfi_restore 13 + .cfi_restore 14 + .cfi_restore 15 + .cfi_def_cfa 15, 160 + sth %r0,0(%r1) + br %r4 +.L67: + .cfi_restore_state + lg %r1,168(%r11) + lg %r1,16(%r1) + stg %r0,0(%r1) + j .L19 +.L76: + lg %r0,168(%r11) + lgr %r1,%r0 + lgr %r10,%r0 + lg %r1,8(%r1) + lg %r10,16(%r10) + basr %r14,%r1 + lg %r4,288(%r11) + std %f0,0(%r10) + lg %r6,160(%r11) + lghi %r2,0 + lmg %r7,%r15,232(%r11) + .cfi_remember_state + .cfi_restore 7 + .cfi_restore 8 + .cfi_restore 9 + .cfi_restore 10 + .cfi_restore 11 + .cfi_restore 12 + .cfi_restore 13 + .cfi_restore 14 + .cfi_restore 15 + .cfi_def_cfa 15, 160 + br %r4 +.L75: + .cfi_restore_state + lg %r0,168(%r11) + lgr %r1,%r0 + lgr %r10,%r0 + lg %r1,8(%r1) + lg %r10,16(%r10) + basr %r14,%r1 + ste %f0,0(%r10) + j .L19 +.L15: + tm 119(%r10),4 + je .L16 + le %f4,132(%r10) + j .L16 +.L70: + lg %r1,168(%r11) + lg %r1,16(%r1) + st %r0,0(%r1) + j .L19 +.L72: + lg %r6,104(%r1) + j .L7 +.L74: + ld %f6,168(%r1) + j .L9 + .section .rodata + .align 8 +.L77: +.L78: + .long 1 + .align 2 + .previous + .cfi_endproc +.LFE0: + .size avcall_call, .-avcall_call +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-s390x.c b/avcall/avcall-s390x.c new file mode 100644 index 0000000..822fb63 --- /dev/null +++ b/avcall/avcall-s390x.c @@ -0,0 +1,190 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O -fno-omit-frame-pointer !!! + + Foreign function interface for an s390x 64-bit CPU. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + s390x 64-bit Argument Passing Conventions + + * Arguments: + - The first 5 integer or pointer arguments get passed in + r2, r3, r4, r5, r6; the remaining ones (as an entire word each) + on the stack. + - The first 4 float or double arguments get passed in + f0, f2, f4, f6; the remaining ones on the stack (as an entire + word each, floats in the upper half of a word). + - Structures of sizes 1, 2, 4, 8 are passed as follows: + - Structures consisting only of a float or double are passed + like an immediate float or double, that is, in f0, f2, f4, f6 + and on the stack (floats in the upper half of their respective + word). But we don't support this kind of structure. + - Other structures get passed as an entire word, like integers + and pointers. + When in r2, ..., r6: as the 8*sizeof(S) low bits of the register + (a.k.a. "right-adjusted"). + When on the stack: they occupy an entire word and are adjusted + on the high end of the word: + - sizeof(S) == 1: at an address == 7 mod 8, + - sizeof(S) == 2: at an address == 6 mod 8, + - sizeof(S) == 4: at an address == 4 mod 8, + - Structures of other sizes are passed as references. + * Return value: + - An integer or pointer is returned in r2. + - A float or double is returned in f0. + - Structure return convention: The caller passes a pointer to the + destination area (quasi as an additional first pointer argument) + in r2. The callee fills it and returns the same pointer in r2. + + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +register __avrword iarg1 __asm__("r2"); +register __avrword iarg2 __asm__("r3"); +register __avrword iarg3 __asm__("r4"); +register __avrword iarg4 __asm__("r5"); +register __avrword iarg5 __asm__("r6"); + +register float farg1 __asm__("f0"); +register float farg2 __asm__("f2"); +register float farg3 __asm__("f4"); +register float farg4 __asm__("f6"); + +register double darg1 __asm__("f0"); +register double darg2 __asm__("f2"); +register double darg3 __asm__("f4"); +register double darg4 __asm__("f6"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("r15"); /* C names for registers */ + register __avrword iretreg __asm__("r2"); + register double dret __asm__("f0"); + + /* We need to put a value in r6, but it's a call-saved register. */ + __avrword saved_iarg5 = iarg5; + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + unsigned int ianum = l->ianum; + unsigned int fanum = l->fanum; + + { + int i; + for (i = 0; i < arglen; i++) /* push function args onto stack */ + argframe[i] = l->args[i]; + } + + /* Put up to 5 integer args into registers. */ + if (ianum >= 1) { + iarg1 = l->iargs[0]; + if (ianum >= 2) { + iarg2 = l->iargs[1]; + if (ianum >= 3) { + iarg3 = l->iargs[2]; + if (ianum >= 4) { + iarg4 = l->iargs[3]; + if (ianum >= 5) { + iarg5 = l->iargs[4]; + } + } + } + } + } + + /* Put upto 4 floating-point args into registers. */ + if (fanum >= 1) { + if (l->darg_mask & (1 << 0)) darg1 = l->dargs[0]; + else if (l->farg_mask & (1 << 0)) farg1 = l->fargs[0]; + if (fanum >= 2) { + if (l->darg_mask & (1 << 1)) darg2 = l->dargs[1]; + else if (l->farg_mask & (1 << 1)) farg2 = l->fargs[1]; + if (fanum >= 3) { + if (l->darg_mask & (1 << 2)) darg3 = l->dargs[2]; + else if (l->farg_mask & (1 << 2)) farg3 = l->fargs[2]; + if (fanum >= 4) { + if (l->darg_mask & (1 << 3)) darg4 = l->dargs[3]; + else if (l->farg_mask & (1 << 3)) farg4 = l->fargs[3]; + } + } + } + } + + /* Call function. */ + if (l->rtype == __AVfloat) { + *(float*)l->raddr = (*(float(*)())l->func)(); + } else + if (l->rtype == __AVdouble) { + *(double*)l->raddr = (*(double(*)())l->func)(); + } else { + __avrword iret = (*l->func)(); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong || l->rtype == __AVlonglong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong || l->rtype == __AVulonglong) { + RETURN(unsigned long, iret); + } else + /* see above + if (l->rtype == __AVfloat) { + } else + if (l->rtype == __AVdouble) { + } else + */ + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + /* normal struct return convention */ + } + } + iarg5 = saved_iarg5; + return 0; +} diff --git a/avcall/avcall-sparc-linux.s b/avcall/avcall-sparc-linux.s new file mode 100644 index 0000000..d5a3315 --- /dev/null +++ b/avcall/avcall-sparc-linux.s @@ -0,0 +1,125 @@ + .file "avcall-sparc.c" + .section ".text" + .align 4 + .global avcall_call + .type avcall_call,#function + .proc 04 +avcall_call: + !#PROLOGUE# 0 + save %sp, -1128, %sp + ld [%i0+20], %g3 + add %sp, 68, %l1 + ld [%i0+24], %o7 + ld [%i0+12], %l0 + sub %g3, %o7, %g3 + cmp %l0, 16 + be .LL51 + sra %g3, 2, %g4 +.LL2: + mov 6, %g1 + cmp %g1, %g4 + bge .LL46 + ld [%i0+24], %l0 +.LL7: + sll %g1, 2, %g3 + ld [%l0+%g3], %o7 + add %g1, 1, %g1 + cmp %g1, %g4 + bl .LL7 + st %o7, [%l1+%g3] +.LL46: + ld [%l0+20], %o5 + ld [%i0+4], %g3 + ld [%l0], %o0 + ld [%l0+4], %o1 + ld [%l0+8], %o2 + ld [%l0+12], %o3 + call %g3, 0 + ld [%l0+16], %o4 + nop + ld [%i0+12], %o7 + cmp %o7, 1 + be .LL9 + mov %o0, %l0 + cmp %o7, 2 + be .LL50 + cmp %o7, 3 + be .LL50 + cmp %o7, 4 + be .LL50 + cmp %o7, 5 + be .LL49 + cmp %o7, 6 + be .LL49 + cmp %o7, 7 + be .LL48 + cmp %o7, 8 + be .LL48 + cmp %o7, 9 + be .LL48 + cmp %o7, 10 + be .LL48 + add %o7, -11, %g3 + cmp %g3, 1 + bgu .LL28 + cmp %o7, 13 + ld [%i0+8], %g3 + st %o0, [%g3] + b .LL9 + st %o1, [%g3+4] +.LL28: + be .LL52 + cmp %o7, 14 + be .LL53 + cmp %o7, 15 + be .LL48 + cmp %o7, 16 + bne .LL9 + nop + ld [%i0], %g3 + andcc %g3, 2, %g0 + be .LL9 + nop + ld [%i0+16], %g3 + cmp %g3, 1 + be .LL50 + cmp %g3, 2 + be .LL49 + cmp %g3, 4 + bne .LL9 + nop +.LL48: + ld [%i0+8], %g3 + b .LL9 + st %l0, [%g3] +.LL49: + ld [%i0+8], %g3 + b .LL9 + sth %l0, [%g3] +.LL50: + ld [%i0+8], %g3 + b .LL9 + stb %l0, [%g3] +.LL53: + ld [%i0+8], %g3 + b .LL9 + std %f0, [%g3] +.LL52: + ld [%i0], %g3 + andcc %g3, 32, %g0 + bne,a .LL31 + fdtos %f0, %f0 +.LL31: + ld [%i0+8], %g3 + b .LL9 + st %f0, [%g3] +.LL51: + ld [%i0+8], %g3 + b .LL2 + st %g3, [%sp+64] +.LL9: + ret + restore %g0, 0, %o0 +.LLfe1: + .size avcall_call,.LLfe1-avcall_call + .ident "GCC: (GNU) 3.1" diff --git a/avcall/avcall-sparc-macro.S b/avcall/avcall-sparc-macro.S new file mode 100644 index 0000000..5748586 --- /dev/null +++ b/avcall/avcall-sparc-macro.S @@ -0,0 +1,127 @@ +#include "asm-sparc.h" + .section ".text" + .align 4 + .global C(avcall_call) + DECLARE_FUNCTION(avcall_call) + .proc 04 +FUNBEGIN(avcall_call) + !$PROLOGUE$ 0 + save %sp, -1128, %sp + ld [%i0+20], %g3 + add %sp, 68, %l1 + ld [%i0+24], %o7 + ld [%i0+12], %l0 + sub %g3, %o7, %g3 + cmp %l0, 16 + be L(L51) + sra %g3, 2, %g4 +L(L2): + mov 6, %g1 + cmp %g1, %g4 + bge L(L46) + ld [%i0+24], %l0 +L(L7): + sll %g1, 2, %g3 + ld [%l0+%g3], %o7 + add %g1, 1, %g1 + cmp %g1, %g4 + bl L(L7) + st %o7, [%l1+%g3] +L(L46): + ld [%l0+20], %o5 + ld [%i0+4], %g3 + ld [%l0], %o0 + ld [%l0+4], %o1 + ld [%l0+8], %o2 + ld [%l0+12], %o3 + call %g3, 0 + ld [%l0+16], %o4 + nop + ld [%i0+12], %o7 + cmp %o7, 1 + be L(L9) + mov %o0, %l0 + cmp %o7, 2 + be L(L50) + cmp %o7, 3 + be L(L50) + cmp %o7, 4 + be L(L50) + cmp %o7, 5 + be L(L49) + cmp %o7, 6 + be L(L49) + cmp %o7, 7 + be L(L48) + cmp %o7, 8 + be L(L48) + cmp %o7, 9 + be L(L48) + cmp %o7, 10 + be L(L48) + add %o7, -11, %g3 + cmp %g3, 1 + bgu L(L28) + cmp %o7, 13 + ld [%i0+8], %g3 + st %o0, [%g3] + b L(L9) + st %o1, [%g3+4] +L(L28): + be L(L52) + cmp %o7, 14 + be L(L53) + cmp %o7, 15 + be L(L48) + cmp %o7, 16 + bne L(L9) + nop + ld [%i0], %g3 + andcc %g3, 2, %g0 + be L(L9) + nop + ld [%i0+16], %g3 + cmp %g3, 1 + be L(L50) + cmp %g3, 2 + be L(L49) + cmp %g3, 4 + bne L(L9) + nop +L(L48): + ld [%i0+8], %g3 + b L(L9) + st %l0, [%g3] +L(L49): + ld [%i0+8], %g3 + b L(L9) + sth %l0, [%g3] +L(L50): + ld [%i0+8], %g3 + b L(L9) + stb %l0, [%g3] +L(L53): + ld [%i0+8], %g3 + b L(L9) + std %f0, [%g3] +L(L52): + ld [%i0], %g3 + andcc %g3, 32, %g0 + bne,a L(L31) + fdtos %f0, %f0 +L(L31): + ld [%i0+8], %g3 + b L(L9) + st %f0, [%g3] +L(L51): + ld [%i0+8], %g3 + b L(L2) + st %g3, [%sp+64] +L(L9): + ret + restore %g0, 0, %o0 +L(Lfe1): + FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-sparc-solaris-macro.S b/avcall/avcall-sparc-solaris-macro.S new file mode 100644 index 0000000..239ce93 --- /dev/null +++ b/avcall/avcall-sparc-solaris-macro.S @@ -0,0 +1,24746 @@ +#include "asm-sparc.h" + .section ".text" + .align 4 +L(LGETPC0): + retl + add %o7, %l7, %l7 + .align 4 + .global C(avcall_call) + DECLARE_FUNCTION(avcall_call) + .proc 04 +FUNBEGIN(avcall_call) + !$PROLOGUE$ 0 + save %sp, -1128, %sp + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7 + call L(LGETPC0) + add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7 + add %sp, 68, %l1 + ld [%i0+20], %o7 + ld [%i0+24], %g3 + sub %o7, %g3, %g1 + ld [%i0+12], %g3 + cmp %g3, 16 + bne L(L2) + sra %g1, 2, %g1 + ld [%i0+8], %g3 + st %g3, [%sp+64] +L(L2): + mov 6, %l0 + cmp %l0, %g1 + bge,a L(L53) + ld [%i0+12], %g3 + ld [%i0+24], %g4 +L(L7): + sll %l0, 2, %o7 + ld [%g4+%o7], %g3 + add %l0, 1, %l0 + cmp %l0, %g1 + bl L(L7) + st %g3, [%l1+%o7] + ld [%i0+12], %g3 +L(L53): + cmp %g3, 16 + bne,a L(L54) + ld [%i0+24], %g3 + ld [%i0], %g3 + andcc %g3, 16, %g0 + be,a L(L54) + ld [%i0+24], %g3 + ld [%i0+16], %g3 + sll %g3, 1, %o7 + add %o7, %g3, %o7 + sll %o7, 3, %o7 + sethi %hi(_GLOBAL_OFFSET_TABLE_-(L(L9)-.)), %g3 + or %g3, %lo(_GLOBAL_OFFSET_TABLE_-(L(L9)-.)), %g3 + sub %l7, %g3, %g3 + add %o7, %g3, %o7 + ld [%i0+24], %g3 + ld [%g3],%o0 + ld [%g3+4],%o1 + ld [%g3+8],%o2 + ld [%g3+12],%o3 + ld [%g3+16],%o4 + ld [%g3+20],%o5 + ld [%i0+4], %g2 + jmp %o7 + nop +L(L9): + call %g2 + nop + .long 0 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 5 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 6 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 7 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 8 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 9 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 10 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 11 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 12 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 13 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 14 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 15 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 16 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 17 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 18 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 19 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 20 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 21 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 22 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 23 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 24 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 25 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 26 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 27 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 28 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 29 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 30 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 31 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 32 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 33 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 34 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 35 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 36 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 37 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 38 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 39 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 40 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 41 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 42 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 43 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 44 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 45 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 46 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 47 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 48 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 49 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 50 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 51 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 52 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 53 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 54 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 55 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 56 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 57 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 58 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 59 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 60 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 61 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 62 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 63 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 64 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 65 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 66 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 67 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 68 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 69 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 70 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 71 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 72 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 73 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 74 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 75 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 76 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 77 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 78 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 79 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 80 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 81 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 82 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 83 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 84 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 85 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 86 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 87 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 88 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 89 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 90 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 91 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 92 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 93 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 94 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 95 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 96 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 97 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 98 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 99 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 100 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 101 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 102 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 103 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 104 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 105 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 106 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 107 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 108 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 109 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 110 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 111 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 112 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 113 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 114 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 115 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 116 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 117 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 118 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 119 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 120 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 121 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 122 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 123 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 124 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 125 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 126 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 127 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 128 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 129 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 130 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 131 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 132 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 133 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 134 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 135 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 136 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 137 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 138 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 139 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 140 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 141 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 142 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 143 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 144 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 145 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 146 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 147 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 148 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 149 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 150 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 151 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 152 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 153 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 154 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 155 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 156 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 157 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 158 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 159 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 160 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 161 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 162 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 163 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 164 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 165 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 166 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 167 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 168 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 169 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 170 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 171 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 172 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 173 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 174 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 175 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 176 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 177 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 178 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 179 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 180 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 181 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 182 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 183 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 184 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 185 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 186 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 187 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 188 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 189 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 190 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 191 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 192 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 193 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 194 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 195 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 196 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 197 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 198 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 199 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 200 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 201 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 202 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 203 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 204 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 205 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 206 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 207 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 208 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 209 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 210 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 211 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 212 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 213 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 214 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 215 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 216 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 217 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 218 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 219 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 220 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 221 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 222 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 223 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 224 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 225 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 226 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 227 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 228 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 229 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 230 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 231 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 232 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 233 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 234 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 235 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 236 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 237 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 238 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 239 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 240 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 241 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 242 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 243 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 244 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 245 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 246 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 247 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 248 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 249 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 250 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 251 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 252 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 253 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 254 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 255 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 256 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 257 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 258 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 259 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 260 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 261 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 262 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 263 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 264 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 265 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 266 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 267 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 268 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 269 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 270 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 271 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 272 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 273 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 274 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 275 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 276 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 277 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 278 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 279 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 280 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 281 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 282 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 283 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 284 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 285 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 286 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 287 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 288 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 289 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 290 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 291 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 292 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 293 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 294 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 295 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 296 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 297 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 298 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 299 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 300 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 301 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 302 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 303 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 304 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 305 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 306 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 307 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 308 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 309 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 310 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 311 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 312 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 313 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 314 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 315 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 316 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 317 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 318 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 319 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 320 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 321 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 322 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 323 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 324 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 325 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 326 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 327 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 328 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 329 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 330 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 331 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 332 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 333 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 334 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 335 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 336 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 337 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 338 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 339 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 340 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 341 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 342 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 343 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 344 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 345 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 346 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 347 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 348 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 349 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 350 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 351 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 352 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 353 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 354 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 355 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 356 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 357 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 358 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 359 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 360 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 361 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 362 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 363 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 364 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 365 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 366 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 367 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 368 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 369 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 370 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 371 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 372 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 373 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 374 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 375 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 376 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 377 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 378 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 379 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 380 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 381 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 382 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 383 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 384 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 385 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 386 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 387 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 388 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 389 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 390 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 391 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 392 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 393 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 394 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 395 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 396 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 397 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 398 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 399 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 400 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 401 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 402 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 403 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 404 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 405 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 406 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 407 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 408 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 409 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 410 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 411 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 412 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 413 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 414 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 415 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 416 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 417 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 418 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 419 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 420 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 421 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 422 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 423 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 424 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 425 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 426 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 427 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 428 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 429 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 430 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 431 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 432 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 433 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 434 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 435 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 436 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 437 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 438 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 439 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 440 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 441 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 442 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 443 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 444 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 445 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 446 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 447 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 448 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 449 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 450 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 451 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 452 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 453 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 454 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 455 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 456 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 457 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 458 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 459 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 460 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 461 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 462 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 463 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 464 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 465 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 466 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 467 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 468 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 469 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 470 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 471 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 472 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 473 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 474 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 475 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 476 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 477 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 478 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 479 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 480 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 481 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 482 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 483 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 484 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 485 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 486 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 487 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 488 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 489 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 490 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 491 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 492 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 493 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 494 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 495 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 496 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 497 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 498 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 499 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 500 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 501 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 502 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 503 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 504 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 505 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 506 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 507 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 508 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 509 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 510 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 511 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 512 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 513 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 514 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 515 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 516 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 517 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 518 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 519 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 520 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 521 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 522 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 523 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 524 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 525 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 526 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 527 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 528 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 529 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 530 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 531 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 532 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 533 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 534 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 535 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 536 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 537 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 538 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 539 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 540 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 541 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 542 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 543 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 544 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 545 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 546 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 547 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 548 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 549 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 550 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 551 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 552 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 553 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 554 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 555 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 556 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 557 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 558 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 559 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 560 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 561 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 562 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 563 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 564 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 565 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 566 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 567 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 568 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 569 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 570 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 571 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 572 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 573 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 574 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 575 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 576 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 577 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 578 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 579 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 580 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 581 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 582 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 583 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 584 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 585 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 586 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 587 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 588 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 589 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 590 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 591 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 592 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 593 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 594 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 595 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 596 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 597 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 598 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 599 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 600 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 601 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 602 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 603 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 604 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 605 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 606 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 607 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 608 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 609 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 610 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 611 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 612 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 613 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 614 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 615 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 616 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 617 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 618 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 619 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 620 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 621 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 622 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 623 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 624 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 625 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 626 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 627 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 628 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 629 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 630 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 631 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 632 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 633 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 634 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 635 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 636 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 637 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 638 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 639 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 640 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 641 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 642 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 643 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 644 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 645 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 646 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 647 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 648 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 649 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 650 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 651 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 652 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 653 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 654 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 655 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 656 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 657 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 658 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 659 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 660 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 661 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 662 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 663 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 664 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 665 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 666 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 667 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 668 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 669 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 670 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 671 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 672 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 673 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 674 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 675 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 676 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 677 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 678 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 679 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 680 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 681 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 682 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 683 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 684 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 685 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 686 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 687 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 688 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 689 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 690 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 691 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 692 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 693 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 694 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 695 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 696 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 697 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 698 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 699 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 700 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 701 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 702 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 703 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 704 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 705 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 706 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 707 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 708 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 709 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 710 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 711 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 712 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 713 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 714 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 715 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 716 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 717 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 718 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 719 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 720 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 721 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 722 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 723 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 724 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 725 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 726 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 727 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 728 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 729 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 730 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 731 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 732 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 733 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 734 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 735 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 736 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 737 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 738 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 739 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 740 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 741 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 742 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 743 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 744 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 745 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 746 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 747 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 748 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 749 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 750 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 751 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 752 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 753 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 754 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 755 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 756 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 757 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 758 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 759 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 760 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 761 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 762 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 763 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 764 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 765 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 766 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 767 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 768 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 769 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 770 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 771 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 772 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 773 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 774 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 775 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 776 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 777 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 778 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 779 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 780 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 781 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 782 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 783 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 784 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 785 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 786 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 787 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 788 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 789 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 790 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 791 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 792 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 793 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 794 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 795 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 796 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 797 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 798 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 799 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 800 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 801 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 802 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 803 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 804 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 805 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 806 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 807 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 808 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 809 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 810 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 811 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 812 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 813 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 814 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 815 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 816 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 817 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 818 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 819 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 820 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 821 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 822 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 823 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 824 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 825 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 826 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 827 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 828 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 829 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 830 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 831 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 832 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 833 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 834 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 835 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 836 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 837 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 838 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 839 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 840 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 841 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 842 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 843 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 844 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 845 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 846 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 847 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 848 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 849 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 850 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 851 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 852 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 853 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 854 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 855 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 856 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 857 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 858 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 859 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 860 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 861 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 862 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 863 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 864 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 865 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 866 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 867 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 868 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 869 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 870 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 871 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 872 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 873 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 874 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 875 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 876 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 877 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 878 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 879 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 880 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 881 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 882 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 883 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 884 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 885 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 886 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 887 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 888 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 889 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 890 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 891 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 892 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 893 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 894 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 895 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 896 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 897 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 898 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 899 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 900 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 901 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 902 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 903 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 904 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 905 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 906 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 907 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 908 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 909 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 910 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 911 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 912 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 913 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 914 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 915 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 916 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 917 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 918 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 919 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 920 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 921 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 922 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 923 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 924 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 925 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 926 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 927 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 928 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 929 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 930 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 931 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 932 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 933 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 934 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 935 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 936 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 937 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 938 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 939 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 940 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 941 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 942 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 943 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 944 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 945 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 946 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 947 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 948 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 949 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 950 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 951 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 952 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 953 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 954 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 955 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 956 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 957 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 958 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 959 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 960 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 961 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 962 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 963 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 964 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 965 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 966 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 967 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 968 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 969 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 970 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 971 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 972 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 973 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 974 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 975 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 976 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 977 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 978 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 979 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 980 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 981 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 982 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 983 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 984 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 985 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 986 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 987 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 988 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 989 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 990 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 991 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 992 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 993 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 994 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 995 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 996 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 997 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 998 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 999 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1000 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1001 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1002 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1003 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1004 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1005 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1006 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1007 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1008 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1009 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1010 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1011 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1012 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1013 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1014 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1015 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1016 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1017 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1018 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1019 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1020 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1021 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1022 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1023 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1024 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1025 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1026 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1027 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1028 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1029 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1030 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1031 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1032 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1033 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1034 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1035 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1036 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1037 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1038 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1039 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1040 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1041 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1042 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1043 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1044 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1045 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1046 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1047 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1048 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1049 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1050 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1051 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1052 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1053 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1054 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1055 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1056 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1057 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1058 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1059 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1060 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1061 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1062 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1063 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1064 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1065 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1066 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1067 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1068 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1069 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1070 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1071 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1072 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1073 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1074 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1075 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1076 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1077 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1078 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1079 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1080 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1081 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1082 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1083 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1084 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1085 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1086 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1087 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1088 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1089 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1090 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1091 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1092 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1093 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1094 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1095 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1096 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1097 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1098 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1099 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1100 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1101 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1102 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1103 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1104 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1105 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1106 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1107 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1108 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1109 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1110 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1111 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1112 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1113 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1114 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1115 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1116 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1117 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1118 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1119 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1120 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1121 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1122 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1123 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1124 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1125 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1126 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1127 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1128 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1129 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1130 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1131 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1132 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1133 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1134 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1135 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1136 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1137 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1138 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1139 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1140 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1141 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1142 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1143 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1144 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1145 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1146 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1147 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1148 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1149 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1150 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1151 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1152 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1153 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1154 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1155 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1156 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1157 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1158 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1159 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1160 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1161 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1162 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1163 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1164 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1165 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1166 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1167 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1168 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1169 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1170 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1171 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1172 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1173 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1174 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1175 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1176 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1177 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1178 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1179 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1180 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1181 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1182 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1183 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1184 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1185 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1186 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1187 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1188 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1189 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1190 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1191 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1192 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1193 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1194 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1195 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1196 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1197 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1198 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1199 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1200 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1201 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1202 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1203 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1204 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1205 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1206 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1207 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1208 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1209 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1210 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1211 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1212 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1213 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1214 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1215 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1216 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1217 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1218 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1219 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1220 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1221 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1222 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1223 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1224 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1225 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1226 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1227 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1228 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1229 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1230 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1231 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1232 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1233 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1234 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1235 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1236 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1237 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1238 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1239 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1240 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1241 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1242 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1243 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1244 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1245 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1246 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1247 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1248 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1249 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1250 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1251 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1252 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1253 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1254 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1255 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1256 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1257 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1258 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1259 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1260 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1261 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1262 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1263 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1264 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1265 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1266 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1267 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1268 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1269 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1270 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1271 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1272 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1273 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1274 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1275 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1276 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1277 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1278 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1279 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1280 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1281 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1282 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1283 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1284 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1285 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1286 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1287 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1288 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1289 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1290 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1291 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1292 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1293 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1294 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1295 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1296 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1297 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1298 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1299 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1300 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1301 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1302 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1303 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1304 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1305 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1306 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1307 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1308 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1309 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1310 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1311 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1312 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1313 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1314 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1315 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1316 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1317 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1318 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1319 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1320 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1321 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1322 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1323 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1324 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1325 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1326 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1327 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1328 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1329 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1330 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1331 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1332 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1333 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1334 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1335 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1336 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1337 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1338 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1339 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1340 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1341 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1342 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1343 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1344 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1345 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1346 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1347 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1348 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1349 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1350 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1351 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1352 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1353 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1354 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1355 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1356 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1357 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1358 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1359 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1360 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1361 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1362 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1363 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1364 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1365 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1366 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1367 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1368 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1369 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1370 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1371 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1372 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1373 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1374 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1375 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1376 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1377 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1378 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1379 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1380 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1381 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1382 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1383 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1384 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1385 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1386 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1387 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1388 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1389 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1390 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1391 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1392 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1393 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1394 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1395 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1396 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1397 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1398 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1399 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1400 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1401 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1402 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1403 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1404 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1405 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1406 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1407 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1408 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1409 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1410 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1411 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1412 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1413 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1414 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1415 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1416 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1417 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1418 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1419 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1420 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1421 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1422 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1423 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1424 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1425 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1426 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1427 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1428 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1429 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1430 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1431 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1432 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1433 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1434 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1435 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1436 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1437 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1438 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1439 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1440 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1441 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1442 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1443 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1444 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1445 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1446 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1447 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1448 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1449 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1450 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1451 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1452 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1453 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1454 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1455 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1456 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1457 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1458 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1459 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1460 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1461 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1462 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1463 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1464 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1465 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1466 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1467 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1468 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1469 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1470 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1471 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1472 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1473 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1474 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1475 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1476 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1477 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1478 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1479 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1480 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1481 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1482 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1483 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1484 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1485 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1486 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1487 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1488 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1489 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1490 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1491 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1492 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1493 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1494 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1495 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1496 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1497 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1498 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1499 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1500 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1501 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1502 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1503 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1504 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1505 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1506 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1507 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1508 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1509 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1510 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1511 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1512 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1513 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1514 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1515 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1516 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1517 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1518 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1519 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1520 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1521 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1522 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1523 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1524 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1525 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1526 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1527 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1528 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1529 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1530 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1531 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1532 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1533 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1534 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1535 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1536 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1537 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1538 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1539 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1540 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1541 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1542 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1543 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1544 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1545 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1546 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1547 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1548 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1549 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1550 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1551 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1552 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1553 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1554 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1555 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1556 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1557 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1558 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1559 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1560 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1561 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1562 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1563 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1564 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1565 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1566 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1567 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1568 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1569 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1570 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1571 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1572 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1573 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1574 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1575 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1576 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1577 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1578 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1579 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1580 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1581 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1582 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1583 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1584 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1585 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1586 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1587 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1588 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1589 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1590 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1591 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1592 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1593 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1594 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1595 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1596 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1597 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1598 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1599 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1600 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1601 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1602 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1603 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1604 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1605 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1606 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1607 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1608 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1609 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1610 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1611 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1612 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1613 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1614 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1615 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1616 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1617 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1618 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1619 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1620 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1621 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1622 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1623 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1624 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1625 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1626 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1627 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1628 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1629 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1630 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1631 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1632 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1633 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1634 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1635 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1636 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1637 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1638 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1639 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1640 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1641 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1642 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1643 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1644 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1645 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1646 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1647 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1648 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1649 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1650 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1651 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1652 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1653 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1654 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1655 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1656 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1657 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1658 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1659 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1660 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1661 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1662 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1663 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1664 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1665 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1666 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1667 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1668 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1669 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1670 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1671 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1672 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1673 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1674 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1675 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1676 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1677 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1678 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1679 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1680 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1681 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1682 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1683 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1684 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1685 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1686 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1687 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1688 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1689 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1690 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1691 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1692 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1693 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1694 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1695 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1696 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1697 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1698 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1699 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1700 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1701 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1702 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1703 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1704 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1705 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1706 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1707 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1708 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1709 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1710 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1711 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1712 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1713 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1714 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1715 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1716 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1717 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1718 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1719 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1720 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1721 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1722 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1723 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1724 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1725 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1726 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1727 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1728 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1729 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1730 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1731 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1732 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1733 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1734 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1735 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1736 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1737 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1738 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1739 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1740 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1741 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1742 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1743 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1744 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1745 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1746 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1747 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1748 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1749 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1750 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1751 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1752 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1753 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1754 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1755 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1756 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1757 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1758 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1759 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1760 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1761 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1762 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1763 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1764 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1765 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1766 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1767 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1768 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1769 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1770 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1771 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1772 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1773 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1774 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1775 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1776 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1777 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1778 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1779 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1780 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1781 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1782 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1783 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1784 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1785 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1786 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1787 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1788 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1789 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1790 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1791 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1792 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1793 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1794 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1795 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1796 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1797 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1798 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1799 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1800 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1801 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1802 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1803 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1804 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1805 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1806 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1807 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1808 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1809 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1810 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1811 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1812 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1813 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1814 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1815 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1816 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1817 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1818 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1819 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1820 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1821 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1822 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1823 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1824 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1825 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1826 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1827 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1828 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1829 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1830 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1831 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1832 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1833 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1834 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1835 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1836 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1837 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1838 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1839 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1840 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1841 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1842 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1843 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1844 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1845 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1846 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1847 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1848 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1849 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1850 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1851 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1852 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1853 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1854 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1855 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1856 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1857 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1858 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1859 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1860 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1861 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1862 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1863 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1864 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1865 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1866 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1867 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1868 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1869 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1870 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1871 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1872 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1873 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1874 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1875 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1876 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1877 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1878 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1879 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1880 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1881 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1882 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1883 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1884 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1885 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1886 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1887 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1888 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1889 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1890 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1891 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1892 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1893 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1894 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1895 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1896 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1897 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1898 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1899 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1900 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1901 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1902 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1903 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1904 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1905 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1906 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1907 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1908 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1909 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1910 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1911 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1912 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1913 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1914 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1915 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1916 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1917 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1918 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1919 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1920 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1921 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1922 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1923 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1924 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1925 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1926 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1927 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1928 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1929 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1930 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1931 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1932 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1933 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1934 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1935 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1936 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1937 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1938 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1939 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1940 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1941 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1942 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1943 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1944 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1945 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1946 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1947 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1948 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1949 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1950 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1951 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1952 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1953 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1954 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1955 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1956 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1957 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1958 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1959 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1960 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1961 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1962 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1963 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1964 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1965 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1966 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1967 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1968 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1969 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1970 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1971 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1972 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1973 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1974 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1975 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1976 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1977 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1978 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1979 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1980 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1981 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1982 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1983 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1984 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1985 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1986 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1987 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1988 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1989 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1990 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1991 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1992 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1993 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1994 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1995 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1996 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1997 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1998 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1999 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2000 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2001 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2002 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2003 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2004 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2005 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2006 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2007 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2008 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2009 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2010 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2011 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2012 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2013 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2014 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2015 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2016 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2017 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2018 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2019 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2020 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2021 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2022 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2023 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2024 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2025 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2026 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2027 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2028 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2029 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2030 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2031 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2032 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2033 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2034 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2035 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2036 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2037 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2038 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2039 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2040 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2041 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2042 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2043 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2044 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2045 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2046 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2047 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2048 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2049 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2050 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2051 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2052 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2053 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2054 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2055 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2056 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2057 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2058 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2059 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2060 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2061 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2062 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2063 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2064 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2065 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2066 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2067 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2068 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2069 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2070 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2071 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2072 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2073 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2074 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2075 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2076 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2077 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2078 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2079 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2080 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2081 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2082 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2083 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2084 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2085 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2086 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2087 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2088 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2089 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2090 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2091 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2092 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2093 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2094 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2095 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2096 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2097 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2098 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2099 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2100 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2101 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2102 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2103 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2104 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2105 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2106 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2107 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2108 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2109 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2110 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2111 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2112 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2113 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2114 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2115 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2116 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2117 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2118 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2119 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2120 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2121 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2122 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2123 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2124 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2125 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2126 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2127 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2128 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2129 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2130 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2131 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2132 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2133 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2134 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2135 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2136 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2137 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2138 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2139 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2140 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2141 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2142 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2143 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2144 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2145 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2146 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2147 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2148 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2149 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2150 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2151 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2152 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2153 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2154 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2155 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2156 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2157 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2158 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2159 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2160 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2161 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2162 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2163 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2164 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2165 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2166 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2167 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2168 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2169 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2170 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2171 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2172 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2173 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2174 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2175 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2176 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2177 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2178 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2179 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2180 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2181 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2182 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2183 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2184 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2185 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2186 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2187 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2188 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2189 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2190 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2191 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2192 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2193 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2194 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2195 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2196 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2197 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2198 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2199 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2200 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2201 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2202 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2203 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2204 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2205 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2206 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2207 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2208 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2209 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2210 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2211 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2212 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2213 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2214 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2215 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2216 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2217 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2218 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2219 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2220 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2221 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2222 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2223 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2224 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2225 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2226 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2227 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2228 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2229 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2230 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2231 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2232 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2233 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2234 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2235 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2236 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2237 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2238 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2239 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2240 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2241 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2242 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2243 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2244 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2245 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2246 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2247 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2248 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2249 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2250 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2251 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2252 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2253 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2254 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2255 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2256 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2257 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2258 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2259 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2260 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2261 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2262 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2263 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2264 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2265 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2266 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2267 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2268 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2269 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2270 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2271 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2272 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2273 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2274 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2275 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2276 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2277 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2278 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2279 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2280 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2281 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2282 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2283 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2284 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2285 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2286 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2287 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2288 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2289 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2290 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2291 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2292 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2293 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2294 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2295 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2296 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2297 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2298 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2299 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2300 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2301 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2302 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2303 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2304 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2305 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2306 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2307 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2308 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2309 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2310 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2311 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2312 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2313 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2314 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2315 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2316 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2317 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2318 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2319 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2320 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2321 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2322 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2323 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2324 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2325 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2326 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2327 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2328 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2329 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2330 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2331 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2332 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2333 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2334 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2335 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2336 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2337 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2338 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2339 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2340 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2341 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2342 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2343 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2344 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2345 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2346 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2347 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2348 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2349 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2350 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2351 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2352 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2353 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2354 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2355 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2356 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2357 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2358 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2359 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2360 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2361 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2362 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2363 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2364 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2365 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2366 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2367 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2368 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2369 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2370 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2371 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2372 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2373 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2374 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2375 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2376 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2377 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2378 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2379 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2380 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2381 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2382 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2383 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2384 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2385 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2386 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2387 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2388 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2389 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2390 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2391 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2392 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2393 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2394 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2395 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2396 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2397 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2398 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2399 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2400 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2401 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2402 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2403 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2404 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2405 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2406 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2407 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2408 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2409 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2410 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2411 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2412 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2413 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2414 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2415 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2416 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2417 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2418 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2419 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2420 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2421 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2422 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2423 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2424 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2425 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2426 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2427 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2428 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2429 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2430 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2431 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2432 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2433 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2434 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2435 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2436 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2437 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2438 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2439 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2440 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2441 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2442 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2443 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2444 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2445 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2446 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2447 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2448 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2449 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2450 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2451 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2452 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2453 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2454 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2455 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2456 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2457 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2458 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2459 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2460 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2461 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2462 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2463 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2464 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2465 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2466 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2467 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2468 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2469 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2470 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2471 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2472 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2473 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2474 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2475 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2476 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2477 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2478 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2479 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2480 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2481 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2482 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2483 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2484 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2485 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2486 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2487 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2488 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2489 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2490 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2491 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2492 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2493 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2494 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2495 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2496 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2497 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2498 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2499 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2500 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2501 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2502 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2503 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2504 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2505 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2506 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2507 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2508 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2509 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2510 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2511 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2512 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2513 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2514 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2515 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2516 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2517 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2518 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2519 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2520 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2521 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2522 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2523 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2524 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2525 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2526 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2527 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2528 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2529 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2530 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2531 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2532 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2533 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2534 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2535 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2536 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2537 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2538 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2539 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2540 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2541 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2542 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2543 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2544 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2545 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2546 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2547 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2548 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2549 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2550 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2551 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2552 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2553 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2554 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2555 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2556 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2557 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2558 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2559 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2560 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2561 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2562 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2563 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2564 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2565 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2566 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2567 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2568 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2569 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2570 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2571 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2572 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2573 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2574 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2575 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2576 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2577 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2578 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2579 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2580 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2581 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2582 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2583 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2584 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2585 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2586 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2587 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2588 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2589 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2590 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2591 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2592 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2593 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2594 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2595 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2596 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2597 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2598 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2599 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2600 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2601 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2602 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2603 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2604 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2605 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2606 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2607 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2608 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2609 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2610 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2611 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2612 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2613 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2614 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2615 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2616 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2617 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2618 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2619 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2620 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2621 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2622 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2623 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2624 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2625 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2626 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2627 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2628 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2629 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2630 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2631 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2632 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2633 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2634 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2635 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2636 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2637 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2638 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2639 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2640 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2641 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2642 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2643 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2644 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2645 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2646 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2647 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2648 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2649 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2650 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2651 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2652 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2653 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2654 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2655 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2656 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2657 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2658 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2659 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2660 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2661 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2662 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2663 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2664 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2665 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2666 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2667 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2668 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2669 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2670 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2671 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2672 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2673 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2674 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2675 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2676 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2677 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2678 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2679 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2680 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2681 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2682 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2683 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2684 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2685 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2686 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2687 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2688 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2689 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2690 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2691 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2692 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2693 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2694 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2695 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2696 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2697 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2698 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2699 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2700 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2701 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2702 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2703 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2704 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2705 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2706 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2707 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2708 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2709 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2710 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2711 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2712 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2713 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2714 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2715 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2716 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2717 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2718 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2719 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2720 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2721 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2722 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2723 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2724 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2725 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2726 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2727 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2728 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2729 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2730 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2731 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2732 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2733 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2734 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2735 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2736 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2737 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2738 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2739 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2740 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2741 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2742 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2743 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2744 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2745 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2746 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2747 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2748 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2749 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2750 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2751 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2752 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2753 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2754 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2755 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2756 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2757 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2758 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2759 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2760 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2761 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2762 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2763 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2764 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2765 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2766 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2767 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2768 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2769 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2770 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2771 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2772 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2773 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2774 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2775 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2776 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2777 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2778 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2779 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2780 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2781 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2782 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2783 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2784 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2785 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2786 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2787 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2788 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2789 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2790 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2791 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2792 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2793 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2794 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2795 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2796 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2797 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2798 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2799 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2800 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2801 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2802 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2803 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2804 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2805 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2806 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2807 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2808 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2809 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2810 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2811 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2812 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2813 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2814 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2815 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2816 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2817 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2818 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2819 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2820 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2821 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2822 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2823 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2824 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2825 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2826 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2827 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2828 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2829 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2830 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2831 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2832 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2833 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2834 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2835 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2836 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2837 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2838 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2839 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2840 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2841 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2842 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2843 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2844 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2845 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2846 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2847 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2848 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2849 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2850 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2851 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2852 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2853 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2854 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2855 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2856 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2857 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2858 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2859 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2860 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2861 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2862 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2863 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2864 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2865 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2866 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2867 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2868 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2869 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2870 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2871 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2872 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2873 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2874 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2875 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2876 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2877 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2878 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2879 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2880 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2881 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2882 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2883 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2884 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2885 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2886 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2887 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2888 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2889 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2890 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2891 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2892 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2893 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2894 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2895 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2896 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2897 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2898 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2899 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2900 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2901 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2902 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2903 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2904 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2905 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2906 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2907 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2908 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2909 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2910 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2911 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2912 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2913 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2914 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2915 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2916 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2917 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2918 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2919 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2920 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2921 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2922 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2923 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2924 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2925 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2926 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2927 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2928 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2929 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2930 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2931 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2932 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2933 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2934 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2935 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2936 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2937 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2938 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2939 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2940 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2941 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2942 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2943 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2944 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2945 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2946 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2947 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2948 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2949 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2950 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2951 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2952 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2953 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2954 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2955 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2956 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2957 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2958 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2959 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2960 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2961 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2962 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2963 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2964 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2965 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2966 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2967 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2968 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2969 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2970 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2971 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2972 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2973 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2974 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2975 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2976 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2977 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2978 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2979 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2980 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2981 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2982 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2983 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2984 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2985 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2986 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2987 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2988 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2989 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2990 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2991 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2992 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2993 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2994 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2995 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2996 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2997 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2998 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2999 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3000 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3001 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3002 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3003 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3004 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3005 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3006 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3007 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3008 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3009 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3010 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3011 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3012 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3013 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3014 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3015 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3016 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3017 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3018 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3019 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3020 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3021 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3022 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3023 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3024 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3025 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3026 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3027 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3028 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3029 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3030 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3031 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3032 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3033 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3034 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3035 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3036 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3037 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3038 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3039 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3040 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3041 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3042 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3043 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3044 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3045 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3046 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3047 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3048 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3049 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3050 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3051 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3052 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3053 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3054 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3055 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3056 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3057 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3058 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3059 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3060 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3061 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3062 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3063 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3064 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3065 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3066 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3067 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3068 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3069 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3070 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3071 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3072 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3073 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3074 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3075 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3076 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3077 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3078 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3079 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3080 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3081 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3082 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3083 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3084 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3085 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3086 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3087 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3088 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3089 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3090 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3091 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3092 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3093 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3094 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3095 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3096 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3097 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3098 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3099 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3100 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3101 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3102 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3103 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3104 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3105 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3106 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3107 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3108 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3109 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3110 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3111 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3112 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3113 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3114 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3115 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3116 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3117 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3118 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3119 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3120 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3121 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3122 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3123 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3124 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3125 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3126 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3127 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3128 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3129 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3130 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3131 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3132 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3133 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3134 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3135 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3136 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3137 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3138 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3139 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3140 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3141 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3142 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3143 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3144 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3145 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3146 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3147 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3148 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3149 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3150 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3151 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3152 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3153 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3154 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3155 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3156 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3157 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3158 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3159 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3160 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3161 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3162 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3163 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3164 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3165 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3166 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3167 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3168 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3169 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3170 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3171 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3172 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3173 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3174 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3175 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3176 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3177 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3178 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3179 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3180 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3181 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3182 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3183 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3184 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3185 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3186 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3187 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3188 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3189 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3190 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3191 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3192 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3193 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3194 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3195 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3196 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3197 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3198 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3199 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3200 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3201 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3202 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3203 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3204 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3205 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3206 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3207 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3208 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3209 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3210 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3211 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3212 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3213 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3214 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3215 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3216 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3217 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3218 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3219 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3220 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3221 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3222 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3223 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3224 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3225 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3226 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3227 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3228 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3229 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3230 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3231 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3232 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3233 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3234 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3235 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3236 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3237 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3238 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3239 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3240 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3241 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3242 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3243 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3244 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3245 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3246 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3247 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3248 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3249 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3250 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3251 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3252 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3253 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3254 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3255 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3256 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3257 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3258 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3259 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3260 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3261 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3262 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3263 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3264 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3265 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3266 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3267 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3268 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3269 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3270 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3271 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3272 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3273 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3274 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3275 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3276 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3277 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3278 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3279 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3280 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3281 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3282 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3283 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3284 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3285 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3286 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3287 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3288 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3289 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3290 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3291 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3292 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3293 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3294 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3295 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3296 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3297 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3298 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3299 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3300 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3301 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3302 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3303 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3304 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3305 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3306 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3307 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3308 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3309 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3310 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3311 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3312 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3313 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3314 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3315 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3316 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3317 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3318 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3319 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3320 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3321 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3322 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3323 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3324 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3325 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3326 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3327 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3328 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3329 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3330 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3331 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3332 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3333 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3334 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3335 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3336 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3337 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3338 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3339 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3340 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3341 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3342 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3343 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3344 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3345 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3346 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3347 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3348 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3349 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3350 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3351 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3352 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3353 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3354 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3355 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3356 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3357 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3358 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3359 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3360 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3361 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3362 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3363 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3364 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3365 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3366 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3367 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3368 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3369 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3370 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3371 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3372 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3373 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3374 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3375 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3376 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3377 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3378 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3379 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3380 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3381 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3382 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3383 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3384 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3385 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3386 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3387 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3388 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3389 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3390 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3391 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3392 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3393 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3394 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3395 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3396 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3397 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3398 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3399 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3400 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3401 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3402 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3403 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3404 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3405 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3406 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3407 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3408 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3409 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3410 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3411 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3412 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3413 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3414 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3415 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3416 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3417 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3418 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3419 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3420 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3421 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3422 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3423 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3424 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3425 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3426 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3427 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3428 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3429 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3430 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3431 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3432 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3433 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3434 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3435 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3436 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3437 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3438 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3439 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3440 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3441 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3442 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3443 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3444 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3445 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3446 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3447 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3448 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3449 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3450 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3451 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3452 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3453 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3454 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3455 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3456 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3457 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3458 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3459 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3460 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3461 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3462 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3463 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3464 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3465 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3466 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3467 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3468 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3469 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3470 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3471 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3472 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3473 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3474 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3475 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3476 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3477 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3478 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3479 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3480 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3481 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3482 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3483 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3484 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3485 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3486 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3487 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3488 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3489 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3490 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3491 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3492 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3493 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3494 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3495 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3496 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3497 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3498 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3499 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3500 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3501 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3502 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3503 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3504 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3505 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3506 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3507 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3508 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3509 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3510 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3511 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3512 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3513 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3514 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3515 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3516 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3517 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3518 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3519 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3520 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3521 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3522 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3523 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3524 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3525 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3526 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3527 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3528 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3529 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3530 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3531 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3532 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3533 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3534 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3535 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3536 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3537 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3538 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3539 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3540 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3541 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3542 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3543 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3544 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3545 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3546 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3547 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3548 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3549 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3550 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3551 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3552 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3553 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3554 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3555 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3556 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3557 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3558 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3559 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3560 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3561 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3562 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3563 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3564 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3565 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3566 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3567 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3568 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3569 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3570 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3571 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3572 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3573 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3574 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3575 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3576 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3577 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3578 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3579 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3580 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3581 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3582 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3583 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3584 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3585 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3586 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3587 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3588 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3589 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3590 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3591 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3592 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3593 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3594 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3595 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3596 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3597 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3598 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3599 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3600 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3601 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3602 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3603 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3604 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3605 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3606 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3607 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3608 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3609 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3610 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3611 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3612 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3613 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3614 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3615 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3616 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3617 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3618 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3619 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3620 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3621 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3622 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3623 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3624 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3625 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3626 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3627 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3628 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3629 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3630 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3631 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3632 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3633 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3634 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3635 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3636 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3637 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3638 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3639 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3640 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3641 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3642 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3643 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3644 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3645 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3646 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3647 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3648 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3649 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3650 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3651 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3652 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3653 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3654 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3655 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3656 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3657 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3658 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3659 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3660 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3661 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3662 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3663 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3664 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3665 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3666 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3667 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3668 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3669 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3670 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3671 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3672 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3673 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3674 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3675 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3676 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3677 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3678 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3679 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3680 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3681 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3682 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3683 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3684 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3685 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3686 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3687 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3688 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3689 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3690 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3691 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3692 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3693 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3694 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3695 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3696 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3697 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3698 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3699 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3700 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3701 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3702 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3703 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3704 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3705 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3706 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3707 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3708 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3709 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3710 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3711 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3712 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3713 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3714 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3715 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3716 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3717 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3718 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3719 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3720 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3721 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3722 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3723 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3724 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3725 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3726 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3727 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3728 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3729 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3730 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3731 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3732 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3733 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3734 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3735 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3736 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3737 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3738 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3739 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3740 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3741 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3742 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3743 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3744 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3745 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3746 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3747 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3748 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3749 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3750 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3751 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3752 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3753 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3754 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3755 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3756 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3757 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3758 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3759 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3760 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3761 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3762 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3763 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3764 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3765 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3766 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3767 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3768 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3769 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3770 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3771 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3772 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3773 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3774 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3775 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3776 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3777 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3778 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3779 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3780 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3781 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3782 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3783 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3784 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3785 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3786 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3787 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3788 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3789 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3790 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3791 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3792 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3793 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3794 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3795 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3796 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3797 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3798 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3799 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3800 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3801 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3802 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3803 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3804 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3805 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3806 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3807 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3808 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3809 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3810 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3811 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3812 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3813 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3814 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3815 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3816 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3817 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3818 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3819 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3820 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3821 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3822 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3823 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3824 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3825 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3826 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3827 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3828 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3829 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3830 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3831 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3832 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3833 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3834 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3835 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3836 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3837 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3838 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3839 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3840 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3841 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3842 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3843 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3844 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3845 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3846 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3847 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3848 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3849 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3850 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3851 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3852 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3853 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3854 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3855 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3856 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3857 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3858 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3859 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3860 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3861 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3862 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3863 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3864 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3865 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3866 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3867 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3868 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3869 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3870 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3871 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3872 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3873 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3874 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3875 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3876 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3877 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3878 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3879 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3880 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3881 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3882 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3883 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3884 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3885 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3886 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3887 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3888 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3889 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3890 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3891 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3892 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3893 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3894 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3895 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3896 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3897 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3898 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3899 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3900 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3901 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3902 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3903 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3904 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3905 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3906 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3907 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3908 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3909 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3910 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3911 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3912 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3913 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3914 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3915 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3916 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3917 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3918 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3919 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3920 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3921 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3922 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3923 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3924 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3925 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3926 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3927 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3928 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3929 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3930 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3931 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3932 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3933 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3934 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3935 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3936 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3937 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3938 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3939 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3940 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3941 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3942 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3943 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3944 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3945 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3946 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3947 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3948 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3949 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3950 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3951 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3952 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3953 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3954 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3955 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3956 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3957 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3958 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3959 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3960 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3961 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3962 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3963 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3964 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3965 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3966 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3967 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3968 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3969 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3970 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3971 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3972 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3973 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3974 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3975 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3976 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3977 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3978 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3979 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3980 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3981 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3982 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3983 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3984 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3985 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3986 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3987 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3988 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3989 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3990 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3991 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3992 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3993 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3994 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3995 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3996 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3997 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3998 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3999 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4000 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4001 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4002 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4003 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4004 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4005 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4006 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4007 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4008 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4009 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4010 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4011 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4012 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4013 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4014 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4015 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4016 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4017 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4018 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4019 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4020 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4021 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4022 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4023 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4024 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4025 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4026 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4027 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4028 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4029 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4030 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4031 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4032 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4033 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4034 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4035 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4036 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4037 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4038 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4039 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4040 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4041 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4042 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4043 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4044 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4045 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4046 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4047 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4048 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4049 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4050 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4051 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4052 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4053 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4054 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4055 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4056 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4057 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4058 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4059 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4060 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4061 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4062 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4063 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4064 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4065 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4066 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4067 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4068 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4069 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4070 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4071 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4072 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4073 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4074 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4075 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4076 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4077 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4078 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4079 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4080 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4081 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4082 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4083 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4084 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4085 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4086 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4087 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4088 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4089 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4090 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4091 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4092 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4093 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4094 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4095 + mov 0,%i0 + ret + restore + ld [%i0+24], %g3 +L(L54): + ld [%i0+4], %l0 + ld [%g3], %o0 + ld [%g3+4], %o1 + ld [%g3+8], %o2 + ld [%g3+12], %o3 + ld [%g3+16], %o4 + call %l0, 0 + ld [%g3+20], %o5 + nop + ld [%i0+12], %g3 + cmp %g3, 1 + be L(L11) + mov %o0, %o7 + cmp %g3, 2 + be L(L52) + cmp %g3, 3 + be L(L52) + cmp %g3, 4 + be L(L52) + cmp %g3, 5 + be L(L51) + cmp %g3, 6 + be L(L51) + cmp %g3, 7 + be L(L49) + cmp %g3, 8 + be L(L49) + cmp %g3, 9 + be L(L49) + cmp %g3, 10 + be L(L49) + add %g3, -11, %g3 + cmp %g3, 1 + bgu,a L(L30) + ld [%i0+12], %g3 + ld [%i0+8], %g3 + st %o0, [%g3] + b L(L11) + st %o1, [%g3+4] +L(L30): + cmp %g3, 13 + bne,a L(L32) + ld [%i0+12], %g3 + ld [%i0], %g3 + andcc %g3, 32, %g0 + be L(L33) + ld [%i0+8], %g3 + fdtos %f0, %f0 +L(L33): + b L(L11) + st %f0, [%g3] +L(L32): + cmp %g3, 14 + bne,a L(L36) + ld [%i0+12], %g3 + ld [%i0+8], %g3 + b L(L11) + std %f0, [%g3] +L(L36): + cmp %g3, 15 + be,a L(L55) + ld [%i0+8], %g3 + ld [%i0+12], %g3 + cmp %g3, 16 + bne L(L11) + nop + ld [%i0], %g3 + andcc %g3, 2, %g0 + be L(L11) + nop + ld [%i0+16], %g3 + cmp %g3, 1 + bne L(L42) + cmp %g3, 2 +L(L52): + ld [%i0+8], %g3 + b L(L11) + stb %o7, [%g3] +L(L42): + bne,a L(L44) + ld [%i0+16], %g3 +L(L51): + ld [%i0+8], %g3 + b L(L11) + sth %o7, [%g3] +L(L44): + cmp %g3, 4 + bne L(L11) + nop +L(L49): + ld [%i0+8], %g3 +L(L55): + st %o7, [%g3] +L(L11): + ret + restore %g0, 0, %o0 +L(Lfe1): + FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-sparc-solaris.s b/avcall/avcall-sparc-solaris.s new file mode 100644 index 0000000..efaa99c --- /dev/null +++ b/avcall/avcall-sparc-solaris.s @@ -0,0 +1,24744 @@ + .file "avcall-sparc.c" + .section ".text" + .align 4 +.LLGETPC0: + retl + add %o7, %l7, %l7 + .align 4 + .global avcall_call + .type avcall_call,#function + .proc 04 +avcall_call: + !#PROLOGUE# 0 + save %sp, -1128, %sp + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7 + call .LLGETPC0 + add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7 + add %sp, 68, %l1 + ld [%i0+20], %o7 + ld [%i0+24], %g3 + sub %o7, %g3, %g1 + ld [%i0+12], %g3 + cmp %g3, 16 + bne .LL2 + sra %g1, 2, %g1 + ld [%i0+8], %g3 + st %g3, [%sp+64] +.LL2: + mov 6, %l0 + cmp %l0, %g1 + bge,a .LL53 + ld [%i0+12], %g3 + ld [%i0+24], %g4 +.LL7: + sll %l0, 2, %o7 + ld [%g4+%o7], %g3 + add %l0, 1, %l0 + cmp %l0, %g1 + bl .LL7 + st %g3, [%l1+%o7] + ld [%i0+12], %g3 +.LL53: + cmp %g3, 16 + bne,a .LL54 + ld [%i0+24], %g3 + ld [%i0], %g3 + andcc %g3, 16, %g0 + be,a .LL54 + ld [%i0+24], %g3 + ld [%i0+16], %g3 + sll %g3, 1, %o7 + add %o7, %g3, %o7 + sll %o7, 3, %o7 + sethi %hi(_GLOBAL_OFFSET_TABLE_-(.LL9-.)), %g3 + or %g3, %lo(_GLOBAL_OFFSET_TABLE_-(.LL9-.)), %g3 + sub %l7, %g3, %g3 + add %o7, %g3, %o7 + ld [%i0+24], %g3 + ld [%g3],%o0 + ld [%g3+4],%o1 + ld [%g3+8],%o2 + ld [%g3+12],%o3 + ld [%g3+16],%o4 + ld [%g3+20],%o5 + ld [%i0+4], %g2 + jmp %o7 + nop +.LL9: + call %g2 + nop + .long 0 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 5 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 6 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 7 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 8 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 9 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 10 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 11 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 12 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 13 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 14 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 15 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 16 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 17 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 18 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 19 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 20 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 21 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 22 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 23 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 24 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 25 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 26 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 27 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 28 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 29 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 30 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 31 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 32 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 33 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 34 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 35 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 36 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 37 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 38 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 39 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 40 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 41 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 42 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 43 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 44 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 45 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 46 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 47 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 48 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 49 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 50 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 51 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 52 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 53 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 54 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 55 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 56 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 57 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 58 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 59 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 60 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 61 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 62 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 63 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 64 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 65 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 66 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 67 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 68 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 69 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 70 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 71 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 72 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 73 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 74 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 75 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 76 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 77 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 78 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 79 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 80 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 81 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 82 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 83 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 84 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 85 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 86 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 87 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 88 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 89 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 90 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 91 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 92 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 93 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 94 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 95 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 96 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 97 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 98 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 99 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 100 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 101 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 102 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 103 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 104 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 105 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 106 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 107 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 108 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 109 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 110 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 111 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 112 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 113 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 114 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 115 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 116 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 117 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 118 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 119 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 120 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 121 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 122 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 123 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 124 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 125 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 126 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 127 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 128 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 129 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 130 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 131 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 132 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 133 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 134 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 135 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 136 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 137 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 138 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 139 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 140 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 141 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 142 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 143 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 144 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 145 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 146 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 147 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 148 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 149 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 150 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 151 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 152 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 153 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 154 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 155 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 156 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 157 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 158 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 159 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 160 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 161 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 162 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 163 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 164 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 165 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 166 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 167 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 168 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 169 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 170 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 171 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 172 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 173 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 174 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 175 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 176 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 177 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 178 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 179 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 180 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 181 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 182 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 183 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 184 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 185 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 186 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 187 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 188 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 189 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 190 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 191 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 192 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 193 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 194 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 195 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 196 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 197 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 198 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 199 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 200 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 201 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 202 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 203 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 204 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 205 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 206 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 207 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 208 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 209 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 210 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 211 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 212 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 213 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 214 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 215 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 216 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 217 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 218 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 219 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 220 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 221 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 222 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 223 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 224 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 225 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 226 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 227 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 228 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 229 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 230 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 231 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 232 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 233 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 234 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 235 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 236 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 237 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 238 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 239 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 240 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 241 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 242 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 243 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 244 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 245 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 246 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 247 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 248 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 249 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 250 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 251 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 252 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 253 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 254 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 255 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 256 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 257 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 258 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 259 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 260 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 261 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 262 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 263 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 264 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 265 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 266 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 267 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 268 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 269 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 270 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 271 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 272 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 273 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 274 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 275 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 276 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 277 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 278 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 279 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 280 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 281 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 282 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 283 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 284 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 285 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 286 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 287 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 288 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 289 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 290 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 291 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 292 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 293 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 294 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 295 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 296 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 297 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 298 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 299 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 300 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 301 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 302 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 303 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 304 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 305 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 306 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 307 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 308 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 309 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 310 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 311 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 312 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 313 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 314 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 315 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 316 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 317 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 318 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 319 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 320 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 321 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 322 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 323 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 324 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 325 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 326 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 327 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 328 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 329 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 330 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 331 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 332 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 333 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 334 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 335 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 336 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 337 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 338 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 339 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 340 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 341 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 342 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 343 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 344 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 345 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 346 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 347 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 348 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 349 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 350 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 351 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 352 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 353 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 354 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 355 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 356 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 357 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 358 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 359 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 360 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 361 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 362 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 363 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 364 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 365 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 366 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 367 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 368 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 369 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 370 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 371 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 372 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 373 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 374 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 375 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 376 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 377 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 378 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 379 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 380 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 381 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 382 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 383 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 384 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 385 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 386 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 387 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 388 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 389 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 390 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 391 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 392 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 393 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 394 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 395 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 396 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 397 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 398 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 399 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 400 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 401 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 402 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 403 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 404 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 405 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 406 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 407 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 408 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 409 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 410 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 411 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 412 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 413 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 414 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 415 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 416 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 417 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 418 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 419 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 420 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 421 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 422 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 423 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 424 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 425 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 426 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 427 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 428 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 429 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 430 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 431 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 432 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 433 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 434 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 435 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 436 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 437 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 438 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 439 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 440 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 441 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 442 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 443 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 444 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 445 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 446 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 447 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 448 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 449 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 450 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 451 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 452 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 453 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 454 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 455 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 456 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 457 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 458 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 459 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 460 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 461 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 462 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 463 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 464 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 465 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 466 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 467 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 468 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 469 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 470 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 471 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 472 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 473 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 474 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 475 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 476 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 477 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 478 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 479 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 480 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 481 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 482 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 483 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 484 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 485 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 486 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 487 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 488 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 489 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 490 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 491 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 492 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 493 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 494 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 495 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 496 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 497 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 498 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 499 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 500 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 501 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 502 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 503 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 504 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 505 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 506 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 507 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 508 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 509 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 510 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 511 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 512 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 513 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 514 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 515 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 516 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 517 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 518 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 519 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 520 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 521 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 522 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 523 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 524 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 525 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 526 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 527 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 528 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 529 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 530 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 531 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 532 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 533 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 534 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 535 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 536 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 537 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 538 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 539 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 540 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 541 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 542 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 543 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 544 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 545 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 546 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 547 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 548 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 549 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 550 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 551 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 552 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 553 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 554 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 555 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 556 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 557 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 558 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 559 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 560 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 561 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 562 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 563 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 564 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 565 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 566 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 567 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 568 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 569 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 570 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 571 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 572 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 573 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 574 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 575 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 576 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 577 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 578 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 579 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 580 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 581 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 582 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 583 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 584 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 585 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 586 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 587 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 588 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 589 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 590 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 591 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 592 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 593 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 594 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 595 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 596 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 597 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 598 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 599 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 600 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 601 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 602 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 603 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 604 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 605 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 606 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 607 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 608 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 609 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 610 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 611 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 612 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 613 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 614 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 615 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 616 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 617 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 618 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 619 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 620 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 621 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 622 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 623 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 624 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 625 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 626 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 627 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 628 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 629 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 630 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 631 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 632 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 633 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 634 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 635 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 636 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 637 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 638 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 639 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 640 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 641 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 642 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 643 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 644 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 645 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 646 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 647 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 648 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 649 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 650 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 651 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 652 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 653 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 654 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 655 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 656 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 657 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 658 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 659 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 660 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 661 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 662 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 663 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 664 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 665 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 666 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 667 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 668 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 669 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 670 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 671 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 672 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 673 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 674 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 675 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 676 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 677 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 678 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 679 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 680 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 681 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 682 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 683 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 684 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 685 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 686 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 687 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 688 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 689 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 690 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 691 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 692 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 693 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 694 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 695 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 696 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 697 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 698 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 699 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 700 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 701 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 702 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 703 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 704 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 705 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 706 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 707 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 708 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 709 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 710 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 711 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 712 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 713 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 714 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 715 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 716 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 717 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 718 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 719 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 720 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 721 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 722 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 723 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 724 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 725 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 726 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 727 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 728 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 729 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 730 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 731 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 732 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 733 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 734 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 735 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 736 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 737 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 738 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 739 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 740 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 741 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 742 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 743 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 744 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 745 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 746 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 747 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 748 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 749 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 750 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 751 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 752 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 753 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 754 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 755 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 756 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 757 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 758 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 759 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 760 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 761 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 762 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 763 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 764 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 765 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 766 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 767 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 768 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 769 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 770 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 771 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 772 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 773 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 774 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 775 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 776 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 777 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 778 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 779 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 780 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 781 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 782 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 783 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 784 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 785 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 786 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 787 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 788 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 789 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 790 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 791 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 792 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 793 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 794 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 795 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 796 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 797 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 798 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 799 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 800 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 801 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 802 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 803 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 804 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 805 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 806 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 807 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 808 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 809 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 810 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 811 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 812 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 813 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 814 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 815 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 816 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 817 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 818 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 819 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 820 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 821 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 822 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 823 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 824 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 825 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 826 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 827 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 828 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 829 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 830 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 831 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 832 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 833 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 834 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 835 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 836 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 837 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 838 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 839 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 840 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 841 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 842 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 843 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 844 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 845 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 846 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 847 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 848 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 849 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 850 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 851 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 852 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 853 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 854 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 855 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 856 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 857 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 858 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 859 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 860 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 861 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 862 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 863 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 864 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 865 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 866 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 867 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 868 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 869 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 870 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 871 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 872 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 873 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 874 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 875 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 876 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 877 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 878 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 879 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 880 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 881 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 882 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 883 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 884 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 885 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 886 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 887 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 888 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 889 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 890 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 891 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 892 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 893 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 894 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 895 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 896 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 897 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 898 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 899 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 900 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 901 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 902 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 903 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 904 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 905 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 906 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 907 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 908 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 909 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 910 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 911 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 912 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 913 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 914 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 915 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 916 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 917 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 918 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 919 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 920 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 921 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 922 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 923 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 924 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 925 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 926 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 927 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 928 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 929 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 930 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 931 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 932 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 933 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 934 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 935 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 936 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 937 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 938 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 939 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 940 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 941 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 942 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 943 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 944 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 945 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 946 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 947 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 948 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 949 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 950 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 951 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 952 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 953 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 954 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 955 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 956 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 957 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 958 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 959 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 960 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 961 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 962 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 963 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 964 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 965 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 966 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 967 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 968 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 969 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 970 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 971 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 972 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 973 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 974 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 975 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 976 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 977 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 978 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 979 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 980 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 981 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 982 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 983 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 984 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 985 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 986 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 987 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 988 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 989 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 990 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 991 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 992 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 993 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 994 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 995 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 996 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 997 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 998 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 999 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1000 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1001 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1002 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1003 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1004 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1005 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1006 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1007 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1008 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1009 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1010 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1011 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1012 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1013 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1014 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1015 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1016 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1017 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1018 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1019 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1020 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1021 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1022 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1023 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1024 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1025 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1026 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1027 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1028 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1029 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1030 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1031 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1032 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1033 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1034 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1035 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1036 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1037 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1038 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1039 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1040 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1041 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1042 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1043 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1044 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1045 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1046 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1047 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1048 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1049 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1050 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1051 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1052 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1053 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1054 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1055 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1056 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1057 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1058 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1059 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1060 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1061 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1062 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1063 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1064 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1065 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1066 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1067 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1068 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1069 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1070 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1071 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1072 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1073 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1074 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1075 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1076 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1077 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1078 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1079 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1080 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1081 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1082 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1083 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1084 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1085 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1086 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1087 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1088 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1089 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1090 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1091 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1092 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1093 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1094 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1095 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1096 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1097 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1098 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1099 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1100 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1101 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1102 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1103 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1104 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1105 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1106 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1107 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1108 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1109 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1110 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1111 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1112 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1113 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1114 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1115 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1116 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1117 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1118 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1119 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1120 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1121 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1122 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1123 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1124 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1125 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1126 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1127 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1128 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1129 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1130 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1131 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1132 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1133 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1134 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1135 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1136 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1137 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1138 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1139 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1140 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1141 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1142 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1143 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1144 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1145 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1146 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1147 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1148 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1149 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1150 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1151 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1152 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1153 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1154 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1155 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1156 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1157 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1158 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1159 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1160 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1161 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1162 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1163 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1164 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1165 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1166 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1167 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1168 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1169 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1170 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1171 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1172 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1173 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1174 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1175 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1176 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1177 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1178 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1179 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1180 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1181 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1182 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1183 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1184 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1185 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1186 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1187 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1188 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1189 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1190 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1191 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1192 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1193 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1194 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1195 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1196 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1197 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1198 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1199 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1200 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1201 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1202 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1203 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1204 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1205 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1206 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1207 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1208 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1209 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1210 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1211 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1212 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1213 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1214 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1215 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1216 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1217 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1218 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1219 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1220 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1221 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1222 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1223 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1224 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1225 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1226 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1227 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1228 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1229 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1230 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1231 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1232 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1233 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1234 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1235 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1236 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1237 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1238 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1239 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1240 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1241 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1242 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1243 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1244 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1245 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1246 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1247 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1248 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1249 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1250 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1251 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1252 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1253 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1254 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1255 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1256 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1257 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1258 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1259 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1260 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1261 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1262 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1263 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1264 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1265 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1266 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1267 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1268 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1269 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1270 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1271 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1272 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1273 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1274 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1275 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1276 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1277 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1278 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1279 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1280 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1281 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1282 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1283 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1284 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1285 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1286 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1287 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1288 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1289 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1290 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1291 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1292 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1293 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1294 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1295 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1296 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1297 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1298 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1299 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1300 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1301 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1302 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1303 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1304 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1305 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1306 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1307 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1308 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1309 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1310 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1311 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1312 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1313 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1314 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1315 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1316 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1317 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1318 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1319 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1320 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1321 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1322 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1323 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1324 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1325 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1326 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1327 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1328 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1329 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1330 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1331 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1332 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1333 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1334 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1335 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1336 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1337 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1338 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1339 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1340 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1341 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1342 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1343 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1344 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1345 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1346 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1347 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1348 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1349 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1350 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1351 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1352 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1353 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1354 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1355 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1356 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1357 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1358 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1359 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1360 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1361 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1362 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1363 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1364 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1365 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1366 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1367 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1368 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1369 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1370 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1371 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1372 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1373 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1374 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1375 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1376 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1377 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1378 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1379 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1380 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1381 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1382 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1383 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1384 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1385 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1386 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1387 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1388 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1389 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1390 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1391 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1392 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1393 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1394 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1395 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1396 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1397 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1398 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1399 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1400 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1401 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1402 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1403 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1404 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1405 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1406 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1407 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1408 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1409 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1410 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1411 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1412 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1413 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1414 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1415 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1416 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1417 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1418 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1419 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1420 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1421 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1422 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1423 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1424 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1425 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1426 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1427 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1428 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1429 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1430 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1431 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1432 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1433 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1434 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1435 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1436 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1437 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1438 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1439 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1440 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1441 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1442 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1443 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1444 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1445 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1446 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1447 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1448 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1449 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1450 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1451 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1452 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1453 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1454 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1455 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1456 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1457 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1458 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1459 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1460 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1461 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1462 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1463 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1464 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1465 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1466 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1467 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1468 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1469 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1470 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1471 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1472 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1473 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1474 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1475 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1476 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1477 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1478 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1479 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1480 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1481 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1482 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1483 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1484 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1485 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1486 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1487 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1488 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1489 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1490 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1491 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1492 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1493 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1494 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1495 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1496 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1497 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1498 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1499 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1500 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1501 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1502 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1503 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1504 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1505 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1506 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1507 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1508 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1509 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1510 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1511 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1512 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1513 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1514 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1515 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1516 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1517 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1518 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1519 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1520 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1521 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1522 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1523 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1524 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1525 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1526 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1527 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1528 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1529 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1530 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1531 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1532 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1533 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1534 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1535 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1536 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1537 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1538 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1539 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1540 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1541 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1542 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1543 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1544 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1545 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1546 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1547 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1548 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1549 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1550 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1551 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1552 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1553 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1554 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1555 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1556 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1557 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1558 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1559 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1560 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1561 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1562 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1563 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1564 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1565 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1566 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1567 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1568 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1569 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1570 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1571 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1572 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1573 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1574 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1575 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1576 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1577 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1578 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1579 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1580 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1581 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1582 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1583 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1584 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1585 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1586 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1587 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1588 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1589 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1590 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1591 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1592 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1593 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1594 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1595 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1596 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1597 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1598 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1599 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1600 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1601 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1602 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1603 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1604 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1605 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1606 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1607 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1608 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1609 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1610 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1611 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1612 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1613 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1614 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1615 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1616 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1617 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1618 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1619 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1620 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1621 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1622 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1623 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1624 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1625 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1626 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1627 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1628 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1629 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1630 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1631 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1632 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1633 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1634 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1635 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1636 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1637 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1638 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1639 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1640 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1641 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1642 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1643 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1644 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1645 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1646 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1647 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1648 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1649 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1650 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1651 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1652 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1653 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1654 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1655 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1656 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1657 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1658 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1659 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1660 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1661 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1662 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1663 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1664 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1665 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1666 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1667 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1668 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1669 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1670 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1671 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1672 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1673 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1674 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1675 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1676 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1677 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1678 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1679 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1680 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1681 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1682 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1683 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1684 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1685 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1686 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1687 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1688 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1689 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1690 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1691 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1692 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1693 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1694 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1695 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1696 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1697 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1698 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1699 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1700 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1701 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1702 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1703 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1704 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1705 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1706 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1707 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1708 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1709 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1710 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1711 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1712 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1713 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1714 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1715 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1716 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1717 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1718 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1719 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1720 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1721 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1722 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1723 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1724 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1725 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1726 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1727 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1728 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1729 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1730 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1731 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1732 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1733 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1734 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1735 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1736 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1737 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1738 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1739 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1740 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1741 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1742 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1743 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1744 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1745 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1746 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1747 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1748 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1749 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1750 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1751 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1752 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1753 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1754 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1755 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1756 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1757 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1758 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1759 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1760 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1761 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1762 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1763 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1764 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1765 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1766 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1767 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1768 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1769 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1770 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1771 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1772 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1773 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1774 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1775 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1776 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1777 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1778 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1779 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1780 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1781 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1782 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1783 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1784 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1785 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1786 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1787 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1788 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1789 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1790 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1791 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1792 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1793 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1794 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1795 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1796 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1797 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1798 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1799 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1800 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1801 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1802 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1803 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1804 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1805 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1806 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1807 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1808 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1809 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1810 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1811 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1812 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1813 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1814 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1815 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1816 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1817 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1818 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1819 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1820 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1821 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1822 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1823 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1824 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1825 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1826 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1827 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1828 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1829 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1830 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1831 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1832 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1833 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1834 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1835 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1836 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1837 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1838 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1839 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1840 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1841 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1842 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1843 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1844 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1845 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1846 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1847 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1848 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1849 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1850 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1851 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1852 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1853 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1854 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1855 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1856 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1857 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1858 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1859 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1860 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1861 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1862 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1863 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1864 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1865 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1866 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1867 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1868 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1869 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1870 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1871 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1872 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1873 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1874 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1875 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1876 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1877 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1878 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1879 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1880 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1881 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1882 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1883 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1884 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1885 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1886 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1887 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1888 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1889 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1890 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1891 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1892 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1893 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1894 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1895 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1896 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1897 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1898 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1899 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1900 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1901 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1902 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1903 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1904 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1905 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1906 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1907 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1908 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1909 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1910 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1911 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1912 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1913 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1914 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1915 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1916 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1917 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1918 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1919 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1920 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1921 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1922 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1923 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1924 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1925 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1926 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1927 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1928 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1929 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1930 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1931 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1932 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1933 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1934 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1935 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1936 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1937 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1938 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1939 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1940 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1941 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1942 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1943 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1944 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1945 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1946 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1947 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1948 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1949 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1950 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1951 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1952 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1953 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1954 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1955 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1956 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1957 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1958 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1959 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1960 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1961 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1962 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1963 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1964 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1965 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1966 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1967 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1968 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1969 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1970 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1971 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1972 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1973 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1974 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1975 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1976 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1977 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1978 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1979 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1980 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1981 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1982 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1983 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1984 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1985 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1986 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1987 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1988 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1989 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1990 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1991 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1992 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1993 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1994 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1995 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1996 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1997 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1998 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 1999 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2000 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2001 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2002 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2003 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2004 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2005 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2006 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2007 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2008 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2009 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2010 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2011 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2012 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2013 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2014 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2015 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2016 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2017 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2018 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2019 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2020 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2021 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2022 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2023 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2024 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2025 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2026 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2027 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2028 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2029 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2030 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2031 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2032 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2033 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2034 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2035 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2036 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2037 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2038 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2039 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2040 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2041 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2042 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2043 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2044 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2045 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2046 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2047 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2048 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2049 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2050 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2051 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2052 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2053 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2054 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2055 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2056 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2057 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2058 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2059 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2060 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2061 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2062 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2063 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2064 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2065 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2066 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2067 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2068 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2069 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2070 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2071 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2072 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2073 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2074 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2075 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2076 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2077 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2078 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2079 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2080 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2081 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2082 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2083 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2084 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2085 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2086 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2087 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2088 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2089 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2090 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2091 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2092 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2093 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2094 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2095 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2096 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2097 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2098 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2099 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2100 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2101 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2102 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2103 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2104 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2105 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2106 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2107 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2108 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2109 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2110 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2111 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2112 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2113 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2114 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2115 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2116 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2117 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2118 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2119 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2120 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2121 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2122 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2123 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2124 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2125 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2126 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2127 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2128 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2129 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2130 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2131 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2132 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2133 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2134 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2135 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2136 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2137 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2138 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2139 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2140 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2141 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2142 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2143 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2144 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2145 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2146 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2147 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2148 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2149 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2150 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2151 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2152 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2153 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2154 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2155 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2156 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2157 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2158 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2159 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2160 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2161 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2162 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2163 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2164 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2165 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2166 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2167 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2168 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2169 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2170 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2171 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2172 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2173 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2174 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2175 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2176 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2177 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2178 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2179 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2180 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2181 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2182 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2183 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2184 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2185 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2186 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2187 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2188 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2189 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2190 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2191 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2192 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2193 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2194 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2195 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2196 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2197 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2198 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2199 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2200 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2201 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2202 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2203 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2204 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2205 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2206 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2207 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2208 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2209 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2210 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2211 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2212 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2213 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2214 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2215 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2216 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2217 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2218 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2219 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2220 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2221 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2222 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2223 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2224 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2225 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2226 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2227 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2228 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2229 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2230 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2231 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2232 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2233 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2234 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2235 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2236 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2237 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2238 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2239 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2240 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2241 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2242 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2243 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2244 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2245 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2246 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2247 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2248 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2249 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2250 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2251 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2252 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2253 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2254 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2255 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2256 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2257 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2258 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2259 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2260 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2261 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2262 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2263 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2264 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2265 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2266 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2267 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2268 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2269 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2270 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2271 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2272 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2273 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2274 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2275 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2276 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2277 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2278 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2279 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2280 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2281 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2282 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2283 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2284 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2285 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2286 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2287 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2288 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2289 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2290 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2291 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2292 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2293 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2294 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2295 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2296 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2297 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2298 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2299 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2300 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2301 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2302 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2303 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2304 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2305 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2306 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2307 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2308 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2309 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2310 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2311 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2312 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2313 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2314 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2315 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2316 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2317 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2318 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2319 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2320 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2321 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2322 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2323 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2324 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2325 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2326 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2327 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2328 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2329 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2330 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2331 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2332 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2333 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2334 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2335 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2336 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2337 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2338 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2339 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2340 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2341 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2342 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2343 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2344 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2345 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2346 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2347 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2348 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2349 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2350 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2351 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2352 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2353 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2354 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2355 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2356 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2357 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2358 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2359 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2360 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2361 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2362 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2363 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2364 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2365 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2366 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2367 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2368 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2369 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2370 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2371 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2372 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2373 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2374 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2375 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2376 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2377 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2378 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2379 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2380 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2381 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2382 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2383 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2384 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2385 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2386 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2387 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2388 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2389 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2390 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2391 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2392 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2393 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2394 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2395 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2396 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2397 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2398 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2399 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2400 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2401 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2402 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2403 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2404 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2405 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2406 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2407 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2408 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2409 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2410 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2411 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2412 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2413 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2414 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2415 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2416 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2417 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2418 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2419 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2420 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2421 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2422 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2423 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2424 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2425 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2426 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2427 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2428 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2429 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2430 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2431 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2432 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2433 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2434 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2435 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2436 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2437 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2438 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2439 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2440 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2441 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2442 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2443 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2444 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2445 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2446 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2447 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2448 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2449 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2450 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2451 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2452 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2453 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2454 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2455 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2456 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2457 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2458 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2459 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2460 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2461 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2462 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2463 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2464 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2465 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2466 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2467 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2468 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2469 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2470 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2471 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2472 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2473 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2474 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2475 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2476 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2477 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2478 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2479 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2480 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2481 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2482 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2483 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2484 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2485 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2486 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2487 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2488 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2489 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2490 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2491 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2492 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2493 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2494 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2495 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2496 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2497 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2498 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2499 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2500 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2501 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2502 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2503 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2504 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2505 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2506 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2507 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2508 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2509 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2510 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2511 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2512 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2513 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2514 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2515 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2516 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2517 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2518 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2519 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2520 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2521 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2522 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2523 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2524 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2525 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2526 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2527 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2528 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2529 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2530 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2531 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2532 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2533 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2534 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2535 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2536 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2537 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2538 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2539 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2540 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2541 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2542 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2543 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2544 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2545 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2546 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2547 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2548 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2549 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2550 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2551 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2552 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2553 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2554 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2555 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2556 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2557 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2558 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2559 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2560 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2561 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2562 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2563 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2564 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2565 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2566 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2567 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2568 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2569 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2570 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2571 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2572 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2573 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2574 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2575 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2576 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2577 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2578 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2579 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2580 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2581 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2582 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2583 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2584 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2585 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2586 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2587 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2588 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2589 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2590 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2591 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2592 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2593 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2594 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2595 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2596 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2597 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2598 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2599 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2600 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2601 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2602 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2603 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2604 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2605 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2606 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2607 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2608 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2609 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2610 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2611 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2612 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2613 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2614 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2615 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2616 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2617 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2618 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2619 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2620 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2621 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2622 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2623 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2624 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2625 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2626 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2627 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2628 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2629 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2630 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2631 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2632 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2633 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2634 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2635 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2636 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2637 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2638 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2639 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2640 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2641 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2642 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2643 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2644 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2645 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2646 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2647 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2648 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2649 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2650 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2651 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2652 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2653 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2654 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2655 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2656 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2657 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2658 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2659 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2660 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2661 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2662 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2663 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2664 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2665 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2666 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2667 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2668 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2669 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2670 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2671 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2672 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2673 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2674 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2675 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2676 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2677 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2678 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2679 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2680 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2681 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2682 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2683 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2684 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2685 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2686 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2687 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2688 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2689 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2690 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2691 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2692 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2693 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2694 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2695 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2696 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2697 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2698 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2699 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2700 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2701 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2702 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2703 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2704 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2705 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2706 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2707 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2708 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2709 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2710 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2711 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2712 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2713 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2714 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2715 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2716 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2717 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2718 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2719 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2720 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2721 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2722 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2723 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2724 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2725 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2726 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2727 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2728 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2729 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2730 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2731 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2732 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2733 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2734 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2735 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2736 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2737 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2738 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2739 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2740 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2741 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2742 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2743 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2744 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2745 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2746 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2747 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2748 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2749 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2750 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2751 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2752 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2753 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2754 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2755 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2756 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2757 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2758 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2759 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2760 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2761 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2762 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2763 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2764 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2765 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2766 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2767 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2768 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2769 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2770 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2771 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2772 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2773 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2774 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2775 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2776 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2777 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2778 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2779 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2780 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2781 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2782 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2783 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2784 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2785 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2786 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2787 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2788 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2789 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2790 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2791 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2792 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2793 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2794 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2795 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2796 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2797 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2798 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2799 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2800 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2801 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2802 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2803 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2804 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2805 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2806 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2807 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2808 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2809 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2810 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2811 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2812 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2813 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2814 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2815 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2816 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2817 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2818 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2819 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2820 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2821 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2822 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2823 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2824 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2825 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2826 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2827 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2828 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2829 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2830 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2831 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2832 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2833 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2834 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2835 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2836 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2837 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2838 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2839 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2840 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2841 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2842 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2843 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2844 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2845 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2846 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2847 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2848 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2849 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2850 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2851 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2852 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2853 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2854 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2855 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2856 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2857 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2858 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2859 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2860 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2861 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2862 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2863 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2864 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2865 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2866 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2867 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2868 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2869 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2870 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2871 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2872 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2873 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2874 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2875 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2876 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2877 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2878 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2879 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2880 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2881 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2882 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2883 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2884 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2885 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2886 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2887 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2888 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2889 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2890 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2891 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2892 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2893 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2894 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2895 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2896 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2897 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2898 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2899 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2900 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2901 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2902 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2903 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2904 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2905 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2906 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2907 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2908 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2909 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2910 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2911 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2912 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2913 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2914 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2915 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2916 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2917 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2918 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2919 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2920 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2921 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2922 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2923 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2924 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2925 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2926 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2927 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2928 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2929 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2930 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2931 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2932 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2933 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2934 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2935 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2936 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2937 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2938 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2939 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2940 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2941 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2942 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2943 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2944 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2945 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2946 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2947 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2948 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2949 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2950 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2951 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2952 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2953 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2954 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2955 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2956 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2957 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2958 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2959 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2960 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2961 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2962 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2963 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2964 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2965 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2966 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2967 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2968 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2969 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2970 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2971 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2972 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2973 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2974 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2975 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2976 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2977 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2978 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2979 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2980 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2981 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2982 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2983 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2984 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2985 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2986 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2987 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2988 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2989 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2990 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2991 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2992 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2993 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2994 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2995 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2996 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2997 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2998 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 2999 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3000 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3001 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3002 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3003 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3004 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3005 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3006 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3007 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3008 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3009 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3010 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3011 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3012 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3013 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3014 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3015 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3016 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3017 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3018 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3019 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3020 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3021 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3022 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3023 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3024 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3025 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3026 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3027 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3028 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3029 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3030 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3031 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3032 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3033 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3034 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3035 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3036 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3037 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3038 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3039 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3040 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3041 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3042 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3043 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3044 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3045 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3046 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3047 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3048 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3049 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3050 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3051 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3052 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3053 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3054 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3055 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3056 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3057 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3058 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3059 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3060 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3061 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3062 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3063 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3064 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3065 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3066 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3067 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3068 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3069 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3070 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3071 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3072 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3073 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3074 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3075 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3076 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3077 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3078 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3079 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3080 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3081 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3082 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3083 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3084 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3085 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3086 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3087 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3088 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3089 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3090 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3091 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3092 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3093 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3094 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3095 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3096 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3097 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3098 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3099 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3100 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3101 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3102 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3103 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3104 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3105 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3106 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3107 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3108 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3109 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3110 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3111 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3112 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3113 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3114 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3115 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3116 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3117 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3118 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3119 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3120 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3121 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3122 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3123 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3124 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3125 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3126 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3127 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3128 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3129 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3130 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3131 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3132 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3133 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3134 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3135 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3136 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3137 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3138 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3139 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3140 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3141 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3142 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3143 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3144 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3145 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3146 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3147 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3148 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3149 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3150 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3151 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3152 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3153 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3154 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3155 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3156 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3157 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3158 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3159 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3160 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3161 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3162 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3163 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3164 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3165 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3166 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3167 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3168 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3169 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3170 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3171 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3172 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3173 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3174 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3175 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3176 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3177 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3178 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3179 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3180 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3181 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3182 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3183 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3184 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3185 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3186 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3187 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3188 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3189 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3190 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3191 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3192 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3193 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3194 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3195 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3196 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3197 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3198 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3199 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3200 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3201 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3202 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3203 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3204 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3205 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3206 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3207 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3208 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3209 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3210 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3211 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3212 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3213 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3214 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3215 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3216 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3217 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3218 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3219 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3220 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3221 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3222 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3223 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3224 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3225 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3226 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3227 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3228 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3229 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3230 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3231 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3232 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3233 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3234 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3235 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3236 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3237 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3238 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3239 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3240 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3241 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3242 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3243 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3244 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3245 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3246 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3247 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3248 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3249 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3250 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3251 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3252 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3253 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3254 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3255 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3256 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3257 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3258 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3259 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3260 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3261 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3262 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3263 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3264 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3265 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3266 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3267 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3268 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3269 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3270 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3271 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3272 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3273 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3274 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3275 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3276 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3277 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3278 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3279 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3280 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3281 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3282 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3283 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3284 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3285 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3286 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3287 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3288 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3289 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3290 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3291 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3292 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3293 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3294 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3295 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3296 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3297 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3298 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3299 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3300 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3301 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3302 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3303 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3304 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3305 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3306 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3307 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3308 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3309 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3310 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3311 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3312 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3313 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3314 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3315 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3316 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3317 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3318 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3319 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3320 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3321 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3322 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3323 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3324 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3325 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3326 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3327 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3328 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3329 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3330 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3331 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3332 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3333 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3334 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3335 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3336 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3337 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3338 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3339 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3340 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3341 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3342 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3343 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3344 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3345 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3346 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3347 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3348 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3349 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3350 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3351 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3352 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3353 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3354 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3355 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3356 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3357 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3358 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3359 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3360 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3361 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3362 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3363 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3364 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3365 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3366 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3367 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3368 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3369 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3370 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3371 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3372 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3373 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3374 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3375 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3376 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3377 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3378 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3379 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3380 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3381 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3382 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3383 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3384 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3385 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3386 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3387 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3388 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3389 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3390 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3391 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3392 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3393 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3394 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3395 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3396 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3397 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3398 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3399 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3400 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3401 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3402 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3403 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3404 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3405 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3406 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3407 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3408 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3409 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3410 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3411 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3412 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3413 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3414 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3415 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3416 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3417 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3418 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3419 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3420 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3421 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3422 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3423 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3424 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3425 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3426 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3427 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3428 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3429 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3430 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3431 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3432 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3433 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3434 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3435 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3436 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3437 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3438 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3439 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3440 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3441 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3442 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3443 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3444 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3445 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3446 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3447 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3448 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3449 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3450 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3451 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3452 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3453 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3454 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3455 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3456 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3457 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3458 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3459 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3460 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3461 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3462 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3463 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3464 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3465 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3466 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3467 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3468 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3469 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3470 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3471 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3472 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3473 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3474 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3475 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3476 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3477 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3478 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3479 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3480 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3481 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3482 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3483 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3484 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3485 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3486 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3487 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3488 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3489 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3490 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3491 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3492 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3493 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3494 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3495 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3496 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3497 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3498 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3499 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3500 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3501 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3502 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3503 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3504 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3505 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3506 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3507 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3508 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3509 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3510 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3511 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3512 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3513 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3514 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3515 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3516 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3517 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3518 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3519 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3520 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3521 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3522 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3523 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3524 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3525 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3526 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3527 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3528 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3529 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3530 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3531 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3532 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3533 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3534 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3535 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3536 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3537 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3538 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3539 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3540 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3541 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3542 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3543 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3544 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3545 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3546 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3547 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3548 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3549 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3550 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3551 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3552 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3553 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3554 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3555 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3556 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3557 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3558 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3559 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3560 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3561 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3562 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3563 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3564 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3565 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3566 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3567 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3568 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3569 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3570 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3571 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3572 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3573 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3574 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3575 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3576 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3577 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3578 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3579 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3580 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3581 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3582 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3583 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3584 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3585 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3586 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3587 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3588 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3589 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3590 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3591 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3592 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3593 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3594 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3595 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3596 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3597 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3598 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3599 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3600 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3601 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3602 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3603 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3604 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3605 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3606 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3607 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3608 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3609 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3610 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3611 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3612 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3613 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3614 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3615 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3616 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3617 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3618 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3619 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3620 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3621 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3622 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3623 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3624 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3625 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3626 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3627 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3628 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3629 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3630 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3631 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3632 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3633 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3634 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3635 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3636 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3637 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3638 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3639 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3640 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3641 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3642 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3643 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3644 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3645 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3646 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3647 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3648 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3649 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3650 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3651 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3652 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3653 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3654 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3655 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3656 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3657 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3658 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3659 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3660 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3661 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3662 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3663 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3664 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3665 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3666 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3667 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3668 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3669 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3670 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3671 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3672 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3673 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3674 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3675 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3676 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3677 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3678 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3679 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3680 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3681 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3682 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3683 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3684 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3685 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3686 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3687 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3688 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3689 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3690 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3691 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3692 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3693 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3694 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3695 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3696 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3697 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3698 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3699 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3700 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3701 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3702 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3703 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3704 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3705 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3706 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3707 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3708 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3709 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3710 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3711 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3712 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3713 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3714 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3715 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3716 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3717 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3718 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3719 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3720 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3721 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3722 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3723 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3724 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3725 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3726 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3727 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3728 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3729 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3730 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3731 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3732 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3733 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3734 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3735 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3736 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3737 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3738 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3739 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3740 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3741 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3742 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3743 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3744 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3745 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3746 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3747 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3748 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3749 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3750 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3751 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3752 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3753 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3754 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3755 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3756 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3757 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3758 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3759 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3760 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3761 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3762 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3763 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3764 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3765 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3766 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3767 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3768 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3769 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3770 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3771 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3772 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3773 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3774 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3775 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3776 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3777 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3778 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3779 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3780 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3781 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3782 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3783 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3784 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3785 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3786 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3787 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3788 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3789 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3790 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3791 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3792 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3793 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3794 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3795 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3796 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3797 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3798 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3799 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3800 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3801 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3802 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3803 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3804 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3805 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3806 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3807 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3808 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3809 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3810 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3811 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3812 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3813 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3814 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3815 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3816 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3817 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3818 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3819 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3820 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3821 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3822 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3823 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3824 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3825 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3826 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3827 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3828 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3829 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3830 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3831 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3832 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3833 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3834 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3835 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3836 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3837 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3838 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3839 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3840 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3841 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3842 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3843 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3844 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3845 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3846 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3847 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3848 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3849 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3850 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3851 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3852 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3853 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3854 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3855 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3856 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3857 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3858 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3859 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3860 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3861 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3862 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3863 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3864 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3865 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3866 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3867 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3868 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3869 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3870 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3871 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3872 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3873 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3874 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3875 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3876 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3877 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3878 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3879 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3880 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3881 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3882 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3883 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3884 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3885 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3886 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3887 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3888 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3889 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3890 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3891 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3892 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3893 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3894 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3895 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3896 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3897 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3898 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3899 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3900 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3901 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3902 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3903 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3904 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3905 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3906 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3907 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3908 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3909 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3910 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3911 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3912 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3913 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3914 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3915 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3916 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3917 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3918 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3919 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3920 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3921 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3922 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3923 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3924 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3925 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3926 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3927 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3928 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3929 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3930 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3931 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3932 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3933 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3934 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3935 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3936 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3937 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3938 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3939 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3940 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3941 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3942 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3943 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3944 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3945 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3946 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3947 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3948 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3949 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3950 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3951 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3952 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3953 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3954 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3955 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3956 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3957 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3958 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3959 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3960 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3961 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3962 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3963 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3964 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3965 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3966 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3967 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3968 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3969 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3970 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3971 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3972 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3973 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3974 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3975 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3976 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3977 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3978 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3979 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3980 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3981 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3982 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3983 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3984 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3985 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3986 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3987 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3988 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3989 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3990 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3991 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3992 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3993 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3994 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3995 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3996 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3997 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3998 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 3999 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4000 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4001 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4002 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4003 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4004 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4005 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4006 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4007 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4008 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4009 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4010 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4011 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4012 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4013 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4014 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4015 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4016 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4017 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4018 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4019 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4020 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4021 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4022 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4023 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4024 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4025 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4026 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4027 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4028 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4029 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4030 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4031 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4032 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4033 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4034 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4035 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4036 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4037 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4038 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4039 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4040 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4041 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4042 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4043 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4044 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4045 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4046 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4047 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4048 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4049 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4050 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4051 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4052 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4053 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4054 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4055 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4056 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4057 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4058 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4059 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4060 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4061 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4062 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4063 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4064 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4065 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4066 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4067 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4068 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4069 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4070 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4071 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4072 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4073 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4074 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4075 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4076 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4077 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4078 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4079 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4080 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4081 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4082 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4083 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4084 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4085 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4086 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4087 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4088 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4089 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4090 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4091 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4092 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4093 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4094 + mov 0,%i0 + ret + restore + call %g2 + nop + .long 4095 + mov 0,%i0 + ret + restore + ld [%i0+24], %g3 +.LL54: + ld [%i0+4], %l0 + ld [%g3], %o0 + ld [%g3+4], %o1 + ld [%g3+8], %o2 + ld [%g3+12], %o3 + ld [%g3+16], %o4 + call %l0, 0 + ld [%g3+20], %o5 + nop + ld [%i0+12], %g3 + cmp %g3, 1 + be .LL11 + mov %o0, %o7 + cmp %g3, 2 + be .LL52 + cmp %g3, 3 + be .LL52 + cmp %g3, 4 + be .LL52 + cmp %g3, 5 + be .LL51 + cmp %g3, 6 + be .LL51 + cmp %g3, 7 + be .LL49 + cmp %g3, 8 + be .LL49 + cmp %g3, 9 + be .LL49 + cmp %g3, 10 + be .LL49 + add %g3, -11, %g3 + cmp %g3, 1 + bgu,a .LL30 + ld [%i0+12], %g3 + ld [%i0+8], %g3 + st %o0, [%g3] + b .LL11 + st %o1, [%g3+4] +.LL30: + cmp %g3, 13 + bne,a .LL32 + ld [%i0+12], %g3 + ld [%i0], %g3 + andcc %g3, 32, %g0 + be .LL33 + ld [%i0+8], %g3 + fdtos %f0, %f0 +.LL33: + b .LL11 + st %f0, [%g3] +.LL32: + cmp %g3, 14 + bne,a .LL36 + ld [%i0+12], %g3 + ld [%i0+8], %g3 + b .LL11 + std %f0, [%g3] +.LL36: + cmp %g3, 15 + be,a .LL55 + ld [%i0+8], %g3 + ld [%i0+12], %g3 + cmp %g3, 16 + bne .LL11 + nop + ld [%i0], %g3 + andcc %g3, 2, %g0 + be .LL11 + nop + ld [%i0+16], %g3 + cmp %g3, 1 + bne .LL42 + cmp %g3, 2 +.LL52: + ld [%i0+8], %g3 + b .LL11 + stb %o7, [%g3] +.LL42: + bne,a .LL44 + ld [%i0+16], %g3 +.LL51: + ld [%i0+8], %g3 + b .LL11 + sth %o7, [%g3] +.LL44: + cmp %g3, 4 + bne .LL11 + nop +.LL49: + ld [%i0+8], %g3 +.LL55: + st %o7, [%g3] +.LL11: + ret + restore %g0, 0, %o0 +.LLfe1: + .size avcall_call,.LLfe1-avcall_call + .ident "GCC: (GNU) 3.1" diff --git a/avcall/avcall-sparc.c b/avcall/avcall-sparc.c new file mode 100644 index 0000000..82d5fdb --- /dev/null +++ b/avcall/avcall-sparc.c @@ -0,0 +1,4315 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for a Sun4 Sparc with gcc/sun-cc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + Sparc Argument Passing Conventions + + The first 6 words of arguments are passed in integer registers o0-o5 + regardless of type or alignment. (Registers are windowed: o0-o5 become + i0-i5 if the called function executes a ‘save’ instruction.) Remaining + arguments are pushed onto the stack starting at a fixed offset + ("argframe"). Space is left on the stack frame for temporary storage of + the register arguments as well. + + Doubles may be cut in half and misaligned. Shorter integers are + always promoted to word-length. Functions with K&R-style declarations + and float args pass them as doubles and truncate them on function entry. + Structures are passed as pointers to a local copy of the structure made + by the caller. + + Integers and pointers are returned in o0, floats in f0, doubles in + f0/f1. If the function returns a structure a pointer to space + allocated by the caller is pushed onto the stack immediately + before the function arguments. Gcc without -fpcc-struct-return returns + <= 4 byte structures as integers. + + Sun cc allocates temporary space for a returned structure just below + the current frame pointer $fp (the $sp of the caller), and the caller + must copy them from there. It also returns the temp address in $o0, but + that gets nuked in the return in the code below so we can't use it. + **The Sun cc struct return stuff below is a kludge**, but seems to work + on the test cases... + + Compile this routine with gcc for the __asm__ extensions and with + optimisation on (-O or -O2 or -g -O) so that argframe is set to the + correct offset. (%sp is used differently in non-optimized code). + For Sun cc, use the pre-compiled assembler version of this routine. + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +register void* callee __asm__("%g2"); /* any global or local register */ +register __avrword o0 __asm__("%o0"); +register __avrword o1 __asm__("%o1"); +register __avrword o2 __asm__("%o2"); +register __avrword o3 __asm__("%o3"); +register __avrword o4 __asm__("%o4"); +register __avrword o5 __asm__("%o5"); + +int +avcall_call(av_alist* list) +{ + /*?? We probably need to make space for Sun cc + struct return somewhere here. */ + register __avword* sp __asm__("%sp"); /* C names for registers */ + register float fret __asm__("%f0"); /* %f0 */ + register double dret __asm__("%f0"); /* %f0,%f1 */ + + __av_alist* l = &AV_LIST_INNER(list); + + __avword space[__AV_ALIST_WORDS]; /* space for callee's stack frame */ + __avword *argframe = sp + 17; /* stack offset for argument list */ + int arglen = l->aptr - l->args; + __avrword i; + + if (l->rtype == __AVstruct) + argframe[-1] = (__avword)l->raddr; /* push struct return address */ + + { + int i; + for (i = 6; i < arglen; i++) /* push excess function args */ + argframe[i] = l->args[i]; + } + +#if defined(__sun) + if ((l->rtype == __AVstruct) && (l->flags & __AV_SUNPROCC_STRUCT_RETURN)) + /* SUNWspro cc compiled functions don't copy the structure to the area + * pointed to by argframe[-1] unless the caller has a proper "unimp n" + * instruction. We used to generate the calling instructions on the stack, + * but that does not work on Solaris 11, where the stack is not executable. + * For its trampolines, GCC uses a function __enable_execute_stack that + * invokes mprotect(); but that it excessive for the use-case here. + * So, instead use an array of precompiled trampolines. + */ + { + unsigned int n = l->rsize; + /* FRAGILE: This use of a local label does not work when compiled with + gcc-3.1 -O2! */ + void *trampoline = (char *) &&trampolines + n * 24; + #if 0 + o0 = l->args[0]; /* This instruction gets omitted! */ + o1 = l->args[1]; + o2 = l->args[2]; + o3 = l->args[3]; + o4 = l->args[4]; + o5 = l->args[5]; + #else + void *ptr = l->args; + __asm__ __volatile__ ("ld [%0],%%o0" : : "r" (ptr)); + __asm__ __volatile__ ("ld [%0+4],%%o1" : : "r" (ptr)); + __asm__ __volatile__ ("ld [%0+8],%%o2" : : "r" (ptr)); + __asm__ __volatile__ ("ld [%0+12],%%o3" : : "r" (ptr)); + __asm__ __volatile__ ("ld [%0+16],%%o4" : : "r" (ptr)); + __asm__ __volatile__ ("ld [%0+20],%%o5" : : "r" (ptr)); + #endif + callee = l->func; + __asm__ __volatile__ ("jmp %0" "\n\t" "nop" : : "r" (trampoline)); + trampolines: + /* Each of these trampolines has the form + call %g2 0x9FC08000 + nop 0x01000000 + unimp n n + mov 0,%i0 0xB0102000 + ret 0x81C7E008 + restore 0x81E80000 + */ + #define TRAMPOLINE(n) \ + __asm__ __volatile__ ( "call %g2" \ + "\n\t" "nop" \ + "\n\t" ".long " #n \ + "\n\t" "mov 0,%i0" \ + "\n\t" "ret" \ + "\n\t" "restore"); + TRAMPOLINE(0); + TRAMPOLINE(1) + TRAMPOLINE(2) + TRAMPOLINE(3) + TRAMPOLINE(4) + TRAMPOLINE(5) + TRAMPOLINE(6) + TRAMPOLINE(7) + TRAMPOLINE(8) + TRAMPOLINE(9) + TRAMPOLINE(10) + TRAMPOLINE(11) + TRAMPOLINE(12) + TRAMPOLINE(13) + TRAMPOLINE(14) + TRAMPOLINE(15) + TRAMPOLINE(16) + TRAMPOLINE(17) + TRAMPOLINE(18) + TRAMPOLINE(19) + TRAMPOLINE(20) + TRAMPOLINE(21) + TRAMPOLINE(22) + TRAMPOLINE(23) + TRAMPOLINE(24) + TRAMPOLINE(25) + TRAMPOLINE(26) + TRAMPOLINE(27) + TRAMPOLINE(28) + TRAMPOLINE(29) + TRAMPOLINE(30) + TRAMPOLINE(31) + TRAMPOLINE(32) + TRAMPOLINE(33) + TRAMPOLINE(34) + TRAMPOLINE(35) + TRAMPOLINE(36) + TRAMPOLINE(37) + TRAMPOLINE(38) + TRAMPOLINE(39) + TRAMPOLINE(40) + TRAMPOLINE(41) + TRAMPOLINE(42) + TRAMPOLINE(43) + TRAMPOLINE(44) + TRAMPOLINE(45) + TRAMPOLINE(46) + TRAMPOLINE(47) + TRAMPOLINE(48) + TRAMPOLINE(49) + TRAMPOLINE(50) + TRAMPOLINE(51) + TRAMPOLINE(52) + TRAMPOLINE(53) + TRAMPOLINE(54) + TRAMPOLINE(55) + TRAMPOLINE(56) + TRAMPOLINE(57) + TRAMPOLINE(58) + TRAMPOLINE(59) + TRAMPOLINE(60) + TRAMPOLINE(61) + TRAMPOLINE(62) + TRAMPOLINE(63) + TRAMPOLINE(64) + TRAMPOLINE(65) + TRAMPOLINE(66) + TRAMPOLINE(67) + TRAMPOLINE(68) + TRAMPOLINE(69) + TRAMPOLINE(70) + TRAMPOLINE(71) + TRAMPOLINE(72) + TRAMPOLINE(73) + TRAMPOLINE(74) + TRAMPOLINE(75) + TRAMPOLINE(76) + TRAMPOLINE(77) + TRAMPOLINE(78) + TRAMPOLINE(79) + TRAMPOLINE(80) + TRAMPOLINE(81) + TRAMPOLINE(82) + TRAMPOLINE(83) + TRAMPOLINE(84) + TRAMPOLINE(85) + TRAMPOLINE(86) + TRAMPOLINE(87) + TRAMPOLINE(88) + TRAMPOLINE(89) + TRAMPOLINE(90) + TRAMPOLINE(91) + TRAMPOLINE(92) + TRAMPOLINE(93) + TRAMPOLINE(94) + TRAMPOLINE(95) + TRAMPOLINE(96) + TRAMPOLINE(97) + TRAMPOLINE(98) + TRAMPOLINE(99) + TRAMPOLINE(100) + TRAMPOLINE(101) + TRAMPOLINE(102) + TRAMPOLINE(103) + TRAMPOLINE(104) + TRAMPOLINE(105) + TRAMPOLINE(106) + TRAMPOLINE(107) + TRAMPOLINE(108) + TRAMPOLINE(109) + TRAMPOLINE(110) + TRAMPOLINE(111) + TRAMPOLINE(112) + TRAMPOLINE(113) + TRAMPOLINE(114) + TRAMPOLINE(115) + TRAMPOLINE(116) + TRAMPOLINE(117) + TRAMPOLINE(118) + TRAMPOLINE(119) + TRAMPOLINE(120) + TRAMPOLINE(121) + TRAMPOLINE(122) + TRAMPOLINE(123) + TRAMPOLINE(124) + TRAMPOLINE(125) + TRAMPOLINE(126) + TRAMPOLINE(127) + TRAMPOLINE(128) + TRAMPOLINE(129) + TRAMPOLINE(130) + TRAMPOLINE(131) + TRAMPOLINE(132) + TRAMPOLINE(133) + TRAMPOLINE(134) + TRAMPOLINE(135) + TRAMPOLINE(136) + TRAMPOLINE(137) + TRAMPOLINE(138) + TRAMPOLINE(139) + TRAMPOLINE(140) + TRAMPOLINE(141) + TRAMPOLINE(142) + TRAMPOLINE(143) + TRAMPOLINE(144) + TRAMPOLINE(145) + TRAMPOLINE(146) + TRAMPOLINE(147) + TRAMPOLINE(148) + TRAMPOLINE(149) + TRAMPOLINE(150) + TRAMPOLINE(151) + TRAMPOLINE(152) + TRAMPOLINE(153) + TRAMPOLINE(154) + TRAMPOLINE(155) + TRAMPOLINE(156) + TRAMPOLINE(157) + TRAMPOLINE(158) + TRAMPOLINE(159) + TRAMPOLINE(160) + TRAMPOLINE(161) + TRAMPOLINE(162) + TRAMPOLINE(163) + TRAMPOLINE(164) + TRAMPOLINE(165) + TRAMPOLINE(166) + TRAMPOLINE(167) + TRAMPOLINE(168) + TRAMPOLINE(169) + TRAMPOLINE(170) + TRAMPOLINE(171) + TRAMPOLINE(172) + TRAMPOLINE(173) + TRAMPOLINE(174) + TRAMPOLINE(175) + TRAMPOLINE(176) + TRAMPOLINE(177) + TRAMPOLINE(178) + TRAMPOLINE(179) + TRAMPOLINE(180) + TRAMPOLINE(181) + TRAMPOLINE(182) + TRAMPOLINE(183) + TRAMPOLINE(184) + TRAMPOLINE(185) + TRAMPOLINE(186) + TRAMPOLINE(187) + TRAMPOLINE(188) + TRAMPOLINE(189) + TRAMPOLINE(190) + TRAMPOLINE(191) + TRAMPOLINE(192) + TRAMPOLINE(193) + TRAMPOLINE(194) + TRAMPOLINE(195) + TRAMPOLINE(196) + TRAMPOLINE(197) + TRAMPOLINE(198) + TRAMPOLINE(199) + TRAMPOLINE(200) + TRAMPOLINE(201) + TRAMPOLINE(202) + TRAMPOLINE(203) + TRAMPOLINE(204) + TRAMPOLINE(205) + TRAMPOLINE(206) + TRAMPOLINE(207) + TRAMPOLINE(208) + TRAMPOLINE(209) + TRAMPOLINE(210) + TRAMPOLINE(211) + TRAMPOLINE(212) + TRAMPOLINE(213) + TRAMPOLINE(214) + TRAMPOLINE(215) + TRAMPOLINE(216) + TRAMPOLINE(217) + TRAMPOLINE(218) + TRAMPOLINE(219) + TRAMPOLINE(220) + TRAMPOLINE(221) + TRAMPOLINE(222) + TRAMPOLINE(223) + TRAMPOLINE(224) + TRAMPOLINE(225) + TRAMPOLINE(226) + TRAMPOLINE(227) + TRAMPOLINE(228) + TRAMPOLINE(229) + TRAMPOLINE(230) + TRAMPOLINE(231) + TRAMPOLINE(232) + TRAMPOLINE(233) + TRAMPOLINE(234) + TRAMPOLINE(235) + TRAMPOLINE(236) + TRAMPOLINE(237) + TRAMPOLINE(238) + TRAMPOLINE(239) + TRAMPOLINE(240) + TRAMPOLINE(241) + TRAMPOLINE(242) + TRAMPOLINE(243) + TRAMPOLINE(244) + TRAMPOLINE(245) + TRAMPOLINE(246) + TRAMPOLINE(247) + TRAMPOLINE(248) + TRAMPOLINE(249) + TRAMPOLINE(250) + TRAMPOLINE(251) + TRAMPOLINE(252) + TRAMPOLINE(253) + TRAMPOLINE(254) + TRAMPOLINE(255) + TRAMPOLINE(256) + TRAMPOLINE(257) + TRAMPOLINE(258) + TRAMPOLINE(259) + TRAMPOLINE(260) + TRAMPOLINE(261) + TRAMPOLINE(262) + TRAMPOLINE(263) + TRAMPOLINE(264) + TRAMPOLINE(265) + TRAMPOLINE(266) + TRAMPOLINE(267) + TRAMPOLINE(268) + TRAMPOLINE(269) + TRAMPOLINE(270) + TRAMPOLINE(271) + TRAMPOLINE(272) + TRAMPOLINE(273) + TRAMPOLINE(274) + TRAMPOLINE(275) + TRAMPOLINE(276) + TRAMPOLINE(277) + TRAMPOLINE(278) + TRAMPOLINE(279) + TRAMPOLINE(280) + TRAMPOLINE(281) + TRAMPOLINE(282) + TRAMPOLINE(283) + TRAMPOLINE(284) + TRAMPOLINE(285) + TRAMPOLINE(286) + TRAMPOLINE(287) + TRAMPOLINE(288) + TRAMPOLINE(289) + TRAMPOLINE(290) + TRAMPOLINE(291) + TRAMPOLINE(292) + TRAMPOLINE(293) + TRAMPOLINE(294) + TRAMPOLINE(295) + TRAMPOLINE(296) + TRAMPOLINE(297) + TRAMPOLINE(298) + TRAMPOLINE(299) + TRAMPOLINE(300) + TRAMPOLINE(301) + TRAMPOLINE(302) + TRAMPOLINE(303) + TRAMPOLINE(304) + TRAMPOLINE(305) + TRAMPOLINE(306) + TRAMPOLINE(307) + TRAMPOLINE(308) + TRAMPOLINE(309) + TRAMPOLINE(310) + TRAMPOLINE(311) + TRAMPOLINE(312) + TRAMPOLINE(313) + TRAMPOLINE(314) + TRAMPOLINE(315) + TRAMPOLINE(316) + TRAMPOLINE(317) + TRAMPOLINE(318) + TRAMPOLINE(319) + TRAMPOLINE(320) + TRAMPOLINE(321) + TRAMPOLINE(322) + TRAMPOLINE(323) + TRAMPOLINE(324) + TRAMPOLINE(325) + TRAMPOLINE(326) + TRAMPOLINE(327) + TRAMPOLINE(328) + TRAMPOLINE(329) + TRAMPOLINE(330) + TRAMPOLINE(331) + TRAMPOLINE(332) + TRAMPOLINE(333) + TRAMPOLINE(334) + TRAMPOLINE(335) + TRAMPOLINE(336) + TRAMPOLINE(337) + TRAMPOLINE(338) + TRAMPOLINE(339) + TRAMPOLINE(340) + TRAMPOLINE(341) + TRAMPOLINE(342) + TRAMPOLINE(343) + TRAMPOLINE(344) + TRAMPOLINE(345) + TRAMPOLINE(346) + TRAMPOLINE(347) + TRAMPOLINE(348) + TRAMPOLINE(349) + TRAMPOLINE(350) + TRAMPOLINE(351) + TRAMPOLINE(352) + TRAMPOLINE(353) + TRAMPOLINE(354) + TRAMPOLINE(355) + TRAMPOLINE(356) + TRAMPOLINE(357) + TRAMPOLINE(358) + TRAMPOLINE(359) + TRAMPOLINE(360) + TRAMPOLINE(361) + TRAMPOLINE(362) + TRAMPOLINE(363) + TRAMPOLINE(364) + TRAMPOLINE(365) + TRAMPOLINE(366) + TRAMPOLINE(367) + TRAMPOLINE(368) + TRAMPOLINE(369) + TRAMPOLINE(370) + TRAMPOLINE(371) + TRAMPOLINE(372) + TRAMPOLINE(373) + TRAMPOLINE(374) + TRAMPOLINE(375) + TRAMPOLINE(376) + TRAMPOLINE(377) + TRAMPOLINE(378) + TRAMPOLINE(379) + TRAMPOLINE(380) + TRAMPOLINE(381) + TRAMPOLINE(382) + TRAMPOLINE(383) + TRAMPOLINE(384) + TRAMPOLINE(385) + TRAMPOLINE(386) + TRAMPOLINE(387) + TRAMPOLINE(388) + TRAMPOLINE(389) + TRAMPOLINE(390) + TRAMPOLINE(391) + TRAMPOLINE(392) + TRAMPOLINE(393) + TRAMPOLINE(394) + TRAMPOLINE(395) + TRAMPOLINE(396) + TRAMPOLINE(397) + TRAMPOLINE(398) + TRAMPOLINE(399) + TRAMPOLINE(400) + TRAMPOLINE(401) + TRAMPOLINE(402) + TRAMPOLINE(403) + TRAMPOLINE(404) + TRAMPOLINE(405) + TRAMPOLINE(406) + TRAMPOLINE(407) + TRAMPOLINE(408) + TRAMPOLINE(409) + TRAMPOLINE(410) + TRAMPOLINE(411) + TRAMPOLINE(412) + TRAMPOLINE(413) + TRAMPOLINE(414) + TRAMPOLINE(415) + TRAMPOLINE(416) + TRAMPOLINE(417) + TRAMPOLINE(418) + TRAMPOLINE(419) + TRAMPOLINE(420) + TRAMPOLINE(421) + TRAMPOLINE(422) + TRAMPOLINE(423) + TRAMPOLINE(424) + TRAMPOLINE(425) + TRAMPOLINE(426) + TRAMPOLINE(427) + TRAMPOLINE(428) + TRAMPOLINE(429) + TRAMPOLINE(430) + TRAMPOLINE(431) + TRAMPOLINE(432) + TRAMPOLINE(433) + TRAMPOLINE(434) + TRAMPOLINE(435) + TRAMPOLINE(436) + TRAMPOLINE(437) + TRAMPOLINE(438) + TRAMPOLINE(439) + TRAMPOLINE(440) + TRAMPOLINE(441) + TRAMPOLINE(442) + TRAMPOLINE(443) + TRAMPOLINE(444) + TRAMPOLINE(445) + TRAMPOLINE(446) + TRAMPOLINE(447) + TRAMPOLINE(448) + TRAMPOLINE(449) + TRAMPOLINE(450) + TRAMPOLINE(451) + TRAMPOLINE(452) + TRAMPOLINE(453) + TRAMPOLINE(454) + TRAMPOLINE(455) + TRAMPOLINE(456) + TRAMPOLINE(457) + TRAMPOLINE(458) + TRAMPOLINE(459) + TRAMPOLINE(460) + TRAMPOLINE(461) + TRAMPOLINE(462) + TRAMPOLINE(463) + TRAMPOLINE(464) + TRAMPOLINE(465) + TRAMPOLINE(466) + TRAMPOLINE(467) + TRAMPOLINE(468) + TRAMPOLINE(469) + TRAMPOLINE(470) + TRAMPOLINE(471) + TRAMPOLINE(472) + TRAMPOLINE(473) + TRAMPOLINE(474) + TRAMPOLINE(475) + TRAMPOLINE(476) + TRAMPOLINE(477) + TRAMPOLINE(478) + TRAMPOLINE(479) + TRAMPOLINE(480) + TRAMPOLINE(481) + TRAMPOLINE(482) + TRAMPOLINE(483) + TRAMPOLINE(484) + TRAMPOLINE(485) + TRAMPOLINE(486) + TRAMPOLINE(487) + TRAMPOLINE(488) + TRAMPOLINE(489) + TRAMPOLINE(490) + TRAMPOLINE(491) + TRAMPOLINE(492) + TRAMPOLINE(493) + TRAMPOLINE(494) + TRAMPOLINE(495) + TRAMPOLINE(496) + TRAMPOLINE(497) + TRAMPOLINE(498) + TRAMPOLINE(499) + TRAMPOLINE(500) + TRAMPOLINE(501) + TRAMPOLINE(502) + TRAMPOLINE(503) + TRAMPOLINE(504) + TRAMPOLINE(505) + TRAMPOLINE(506) + TRAMPOLINE(507) + TRAMPOLINE(508) + TRAMPOLINE(509) + TRAMPOLINE(510) + TRAMPOLINE(511) + TRAMPOLINE(512) + TRAMPOLINE(513) + TRAMPOLINE(514) + TRAMPOLINE(515) + TRAMPOLINE(516) + TRAMPOLINE(517) + TRAMPOLINE(518) + TRAMPOLINE(519) + TRAMPOLINE(520) + TRAMPOLINE(521) + TRAMPOLINE(522) + TRAMPOLINE(523) + TRAMPOLINE(524) + TRAMPOLINE(525) + TRAMPOLINE(526) + TRAMPOLINE(527) + TRAMPOLINE(528) + TRAMPOLINE(529) + TRAMPOLINE(530) + TRAMPOLINE(531) + TRAMPOLINE(532) + TRAMPOLINE(533) + TRAMPOLINE(534) + TRAMPOLINE(535) + TRAMPOLINE(536) + TRAMPOLINE(537) + TRAMPOLINE(538) + TRAMPOLINE(539) + TRAMPOLINE(540) + TRAMPOLINE(541) + TRAMPOLINE(542) + TRAMPOLINE(543) + TRAMPOLINE(544) + TRAMPOLINE(545) + TRAMPOLINE(546) + TRAMPOLINE(547) + TRAMPOLINE(548) + TRAMPOLINE(549) + TRAMPOLINE(550) + TRAMPOLINE(551) + TRAMPOLINE(552) + TRAMPOLINE(553) + TRAMPOLINE(554) + TRAMPOLINE(555) + TRAMPOLINE(556) + TRAMPOLINE(557) + TRAMPOLINE(558) + TRAMPOLINE(559) + TRAMPOLINE(560) + TRAMPOLINE(561) + TRAMPOLINE(562) + TRAMPOLINE(563) + TRAMPOLINE(564) + TRAMPOLINE(565) + TRAMPOLINE(566) + TRAMPOLINE(567) + TRAMPOLINE(568) + TRAMPOLINE(569) + TRAMPOLINE(570) + TRAMPOLINE(571) + TRAMPOLINE(572) + TRAMPOLINE(573) + TRAMPOLINE(574) + TRAMPOLINE(575) + TRAMPOLINE(576) + TRAMPOLINE(577) + TRAMPOLINE(578) + TRAMPOLINE(579) + TRAMPOLINE(580) + TRAMPOLINE(581) + TRAMPOLINE(582) + TRAMPOLINE(583) + TRAMPOLINE(584) + TRAMPOLINE(585) + TRAMPOLINE(586) + TRAMPOLINE(587) + TRAMPOLINE(588) + TRAMPOLINE(589) + TRAMPOLINE(590) + TRAMPOLINE(591) + TRAMPOLINE(592) + TRAMPOLINE(593) + TRAMPOLINE(594) + TRAMPOLINE(595) + TRAMPOLINE(596) + TRAMPOLINE(597) + TRAMPOLINE(598) + TRAMPOLINE(599) + TRAMPOLINE(600) + TRAMPOLINE(601) + TRAMPOLINE(602) + TRAMPOLINE(603) + TRAMPOLINE(604) + TRAMPOLINE(605) + TRAMPOLINE(606) + TRAMPOLINE(607) + TRAMPOLINE(608) + TRAMPOLINE(609) + TRAMPOLINE(610) + TRAMPOLINE(611) + TRAMPOLINE(612) + TRAMPOLINE(613) + TRAMPOLINE(614) + TRAMPOLINE(615) + TRAMPOLINE(616) + TRAMPOLINE(617) + TRAMPOLINE(618) + TRAMPOLINE(619) + TRAMPOLINE(620) + TRAMPOLINE(621) + TRAMPOLINE(622) + TRAMPOLINE(623) + TRAMPOLINE(624) + TRAMPOLINE(625) + TRAMPOLINE(626) + TRAMPOLINE(627) + TRAMPOLINE(628) + TRAMPOLINE(629) + TRAMPOLINE(630) + TRAMPOLINE(631) + TRAMPOLINE(632) + TRAMPOLINE(633) + TRAMPOLINE(634) + TRAMPOLINE(635) + TRAMPOLINE(636) + TRAMPOLINE(637) + TRAMPOLINE(638) + TRAMPOLINE(639) + TRAMPOLINE(640) + TRAMPOLINE(641) + TRAMPOLINE(642) + TRAMPOLINE(643) + TRAMPOLINE(644) + TRAMPOLINE(645) + TRAMPOLINE(646) + TRAMPOLINE(647) + TRAMPOLINE(648) + TRAMPOLINE(649) + TRAMPOLINE(650) + TRAMPOLINE(651) + TRAMPOLINE(652) + TRAMPOLINE(653) + TRAMPOLINE(654) + TRAMPOLINE(655) + TRAMPOLINE(656) + TRAMPOLINE(657) + TRAMPOLINE(658) + TRAMPOLINE(659) + TRAMPOLINE(660) + TRAMPOLINE(661) + TRAMPOLINE(662) + TRAMPOLINE(663) + TRAMPOLINE(664) + TRAMPOLINE(665) + TRAMPOLINE(666) + TRAMPOLINE(667) + TRAMPOLINE(668) + TRAMPOLINE(669) + TRAMPOLINE(670) + TRAMPOLINE(671) + TRAMPOLINE(672) + TRAMPOLINE(673) + TRAMPOLINE(674) + TRAMPOLINE(675) + TRAMPOLINE(676) + TRAMPOLINE(677) + TRAMPOLINE(678) + TRAMPOLINE(679) + TRAMPOLINE(680) + TRAMPOLINE(681) + TRAMPOLINE(682) + TRAMPOLINE(683) + TRAMPOLINE(684) + TRAMPOLINE(685) + TRAMPOLINE(686) + TRAMPOLINE(687) + TRAMPOLINE(688) + TRAMPOLINE(689) + TRAMPOLINE(690) + TRAMPOLINE(691) + TRAMPOLINE(692) + TRAMPOLINE(693) + TRAMPOLINE(694) + TRAMPOLINE(695) + TRAMPOLINE(696) + TRAMPOLINE(697) + TRAMPOLINE(698) + TRAMPOLINE(699) + TRAMPOLINE(700) + TRAMPOLINE(701) + TRAMPOLINE(702) + TRAMPOLINE(703) + TRAMPOLINE(704) + TRAMPOLINE(705) + TRAMPOLINE(706) + TRAMPOLINE(707) + TRAMPOLINE(708) + TRAMPOLINE(709) + TRAMPOLINE(710) + TRAMPOLINE(711) + TRAMPOLINE(712) + TRAMPOLINE(713) + TRAMPOLINE(714) + TRAMPOLINE(715) + TRAMPOLINE(716) + TRAMPOLINE(717) + TRAMPOLINE(718) + TRAMPOLINE(719) + TRAMPOLINE(720) + TRAMPOLINE(721) + TRAMPOLINE(722) + TRAMPOLINE(723) + TRAMPOLINE(724) + TRAMPOLINE(725) + TRAMPOLINE(726) + TRAMPOLINE(727) + TRAMPOLINE(728) + TRAMPOLINE(729) + TRAMPOLINE(730) + TRAMPOLINE(731) + TRAMPOLINE(732) + TRAMPOLINE(733) + TRAMPOLINE(734) + TRAMPOLINE(735) + TRAMPOLINE(736) + TRAMPOLINE(737) + TRAMPOLINE(738) + TRAMPOLINE(739) + TRAMPOLINE(740) + TRAMPOLINE(741) + TRAMPOLINE(742) + TRAMPOLINE(743) + TRAMPOLINE(744) + TRAMPOLINE(745) + TRAMPOLINE(746) + TRAMPOLINE(747) + TRAMPOLINE(748) + TRAMPOLINE(749) + TRAMPOLINE(750) + TRAMPOLINE(751) + TRAMPOLINE(752) + TRAMPOLINE(753) + TRAMPOLINE(754) + TRAMPOLINE(755) + TRAMPOLINE(756) + TRAMPOLINE(757) + TRAMPOLINE(758) + TRAMPOLINE(759) + TRAMPOLINE(760) + TRAMPOLINE(761) + TRAMPOLINE(762) + TRAMPOLINE(763) + TRAMPOLINE(764) + TRAMPOLINE(765) + TRAMPOLINE(766) + TRAMPOLINE(767) + TRAMPOLINE(768) + TRAMPOLINE(769) + TRAMPOLINE(770) + TRAMPOLINE(771) + TRAMPOLINE(772) + TRAMPOLINE(773) + TRAMPOLINE(774) + TRAMPOLINE(775) + TRAMPOLINE(776) + TRAMPOLINE(777) + TRAMPOLINE(778) + TRAMPOLINE(779) + TRAMPOLINE(780) + TRAMPOLINE(781) + TRAMPOLINE(782) + TRAMPOLINE(783) + TRAMPOLINE(784) + TRAMPOLINE(785) + TRAMPOLINE(786) + TRAMPOLINE(787) + TRAMPOLINE(788) + TRAMPOLINE(789) + TRAMPOLINE(790) + TRAMPOLINE(791) + TRAMPOLINE(792) + TRAMPOLINE(793) + TRAMPOLINE(794) + TRAMPOLINE(795) + TRAMPOLINE(796) + TRAMPOLINE(797) + TRAMPOLINE(798) + TRAMPOLINE(799) + TRAMPOLINE(800) + TRAMPOLINE(801) + TRAMPOLINE(802) + TRAMPOLINE(803) + TRAMPOLINE(804) + TRAMPOLINE(805) + TRAMPOLINE(806) + TRAMPOLINE(807) + TRAMPOLINE(808) + TRAMPOLINE(809) + TRAMPOLINE(810) + TRAMPOLINE(811) + TRAMPOLINE(812) + TRAMPOLINE(813) + TRAMPOLINE(814) + TRAMPOLINE(815) + TRAMPOLINE(816) + TRAMPOLINE(817) + TRAMPOLINE(818) + TRAMPOLINE(819) + TRAMPOLINE(820) + TRAMPOLINE(821) + TRAMPOLINE(822) + TRAMPOLINE(823) + TRAMPOLINE(824) + TRAMPOLINE(825) + TRAMPOLINE(826) + TRAMPOLINE(827) + TRAMPOLINE(828) + TRAMPOLINE(829) + TRAMPOLINE(830) + TRAMPOLINE(831) + TRAMPOLINE(832) + TRAMPOLINE(833) + TRAMPOLINE(834) + TRAMPOLINE(835) + TRAMPOLINE(836) + TRAMPOLINE(837) + TRAMPOLINE(838) + TRAMPOLINE(839) + TRAMPOLINE(840) + TRAMPOLINE(841) + TRAMPOLINE(842) + TRAMPOLINE(843) + TRAMPOLINE(844) + TRAMPOLINE(845) + TRAMPOLINE(846) + TRAMPOLINE(847) + TRAMPOLINE(848) + TRAMPOLINE(849) + TRAMPOLINE(850) + TRAMPOLINE(851) + TRAMPOLINE(852) + TRAMPOLINE(853) + TRAMPOLINE(854) + TRAMPOLINE(855) + TRAMPOLINE(856) + TRAMPOLINE(857) + TRAMPOLINE(858) + TRAMPOLINE(859) + TRAMPOLINE(860) + TRAMPOLINE(861) + TRAMPOLINE(862) + TRAMPOLINE(863) + TRAMPOLINE(864) + TRAMPOLINE(865) + TRAMPOLINE(866) + TRAMPOLINE(867) + TRAMPOLINE(868) + TRAMPOLINE(869) + TRAMPOLINE(870) + TRAMPOLINE(871) + TRAMPOLINE(872) + TRAMPOLINE(873) + TRAMPOLINE(874) + TRAMPOLINE(875) + TRAMPOLINE(876) + TRAMPOLINE(877) + TRAMPOLINE(878) + TRAMPOLINE(879) + TRAMPOLINE(880) + TRAMPOLINE(881) + TRAMPOLINE(882) + TRAMPOLINE(883) + TRAMPOLINE(884) + TRAMPOLINE(885) + TRAMPOLINE(886) + TRAMPOLINE(887) + TRAMPOLINE(888) + TRAMPOLINE(889) + TRAMPOLINE(890) + TRAMPOLINE(891) + TRAMPOLINE(892) + TRAMPOLINE(893) + TRAMPOLINE(894) + TRAMPOLINE(895) + TRAMPOLINE(896) + TRAMPOLINE(897) + TRAMPOLINE(898) + TRAMPOLINE(899) + TRAMPOLINE(900) + TRAMPOLINE(901) + TRAMPOLINE(902) + TRAMPOLINE(903) + TRAMPOLINE(904) + TRAMPOLINE(905) + TRAMPOLINE(906) + TRAMPOLINE(907) + TRAMPOLINE(908) + TRAMPOLINE(909) + TRAMPOLINE(910) + TRAMPOLINE(911) + TRAMPOLINE(912) + TRAMPOLINE(913) + TRAMPOLINE(914) + TRAMPOLINE(915) + TRAMPOLINE(916) + TRAMPOLINE(917) + TRAMPOLINE(918) + TRAMPOLINE(919) + TRAMPOLINE(920) + TRAMPOLINE(921) + TRAMPOLINE(922) + TRAMPOLINE(923) + TRAMPOLINE(924) + TRAMPOLINE(925) + TRAMPOLINE(926) + TRAMPOLINE(927) + TRAMPOLINE(928) + TRAMPOLINE(929) + TRAMPOLINE(930) + TRAMPOLINE(931) + TRAMPOLINE(932) + TRAMPOLINE(933) + TRAMPOLINE(934) + TRAMPOLINE(935) + TRAMPOLINE(936) + TRAMPOLINE(937) + TRAMPOLINE(938) + TRAMPOLINE(939) + TRAMPOLINE(940) + TRAMPOLINE(941) + TRAMPOLINE(942) + TRAMPOLINE(943) + TRAMPOLINE(944) + TRAMPOLINE(945) + TRAMPOLINE(946) + TRAMPOLINE(947) + TRAMPOLINE(948) + TRAMPOLINE(949) + TRAMPOLINE(950) + TRAMPOLINE(951) + TRAMPOLINE(952) + TRAMPOLINE(953) + TRAMPOLINE(954) + TRAMPOLINE(955) + TRAMPOLINE(956) + TRAMPOLINE(957) + TRAMPOLINE(958) + TRAMPOLINE(959) + TRAMPOLINE(960) + TRAMPOLINE(961) + TRAMPOLINE(962) + TRAMPOLINE(963) + TRAMPOLINE(964) + TRAMPOLINE(965) + TRAMPOLINE(966) + TRAMPOLINE(967) + TRAMPOLINE(968) + TRAMPOLINE(969) + TRAMPOLINE(970) + TRAMPOLINE(971) + TRAMPOLINE(972) + TRAMPOLINE(973) + TRAMPOLINE(974) + TRAMPOLINE(975) + TRAMPOLINE(976) + TRAMPOLINE(977) + TRAMPOLINE(978) + TRAMPOLINE(979) + TRAMPOLINE(980) + TRAMPOLINE(981) + TRAMPOLINE(982) + TRAMPOLINE(983) + TRAMPOLINE(984) + TRAMPOLINE(985) + TRAMPOLINE(986) + TRAMPOLINE(987) + TRAMPOLINE(988) + TRAMPOLINE(989) + TRAMPOLINE(990) + TRAMPOLINE(991) + TRAMPOLINE(992) + TRAMPOLINE(993) + TRAMPOLINE(994) + TRAMPOLINE(995) + TRAMPOLINE(996) + TRAMPOLINE(997) + TRAMPOLINE(998) + TRAMPOLINE(999) + TRAMPOLINE(1000) + TRAMPOLINE(1001) + TRAMPOLINE(1002) + TRAMPOLINE(1003) + TRAMPOLINE(1004) + TRAMPOLINE(1005) + TRAMPOLINE(1006) + TRAMPOLINE(1007) + TRAMPOLINE(1008) + TRAMPOLINE(1009) + TRAMPOLINE(1010) + TRAMPOLINE(1011) + TRAMPOLINE(1012) + TRAMPOLINE(1013) + TRAMPOLINE(1014) + TRAMPOLINE(1015) + TRAMPOLINE(1016) + TRAMPOLINE(1017) + TRAMPOLINE(1018) + TRAMPOLINE(1019) + TRAMPOLINE(1020) + TRAMPOLINE(1021) + TRAMPOLINE(1022) + TRAMPOLINE(1023) + TRAMPOLINE(1024) + TRAMPOLINE(1025) + TRAMPOLINE(1026) + TRAMPOLINE(1027) + TRAMPOLINE(1028) + TRAMPOLINE(1029) + TRAMPOLINE(1030) + TRAMPOLINE(1031) + TRAMPOLINE(1032) + TRAMPOLINE(1033) + TRAMPOLINE(1034) + TRAMPOLINE(1035) + TRAMPOLINE(1036) + TRAMPOLINE(1037) + TRAMPOLINE(1038) + TRAMPOLINE(1039) + TRAMPOLINE(1040) + TRAMPOLINE(1041) + TRAMPOLINE(1042) + TRAMPOLINE(1043) + TRAMPOLINE(1044) + TRAMPOLINE(1045) + TRAMPOLINE(1046) + TRAMPOLINE(1047) + TRAMPOLINE(1048) + TRAMPOLINE(1049) + TRAMPOLINE(1050) + TRAMPOLINE(1051) + TRAMPOLINE(1052) + TRAMPOLINE(1053) + TRAMPOLINE(1054) + TRAMPOLINE(1055) + TRAMPOLINE(1056) + TRAMPOLINE(1057) + TRAMPOLINE(1058) + TRAMPOLINE(1059) + TRAMPOLINE(1060) + TRAMPOLINE(1061) + TRAMPOLINE(1062) + TRAMPOLINE(1063) + TRAMPOLINE(1064) + TRAMPOLINE(1065) + TRAMPOLINE(1066) + TRAMPOLINE(1067) + TRAMPOLINE(1068) + TRAMPOLINE(1069) + TRAMPOLINE(1070) + TRAMPOLINE(1071) + TRAMPOLINE(1072) + TRAMPOLINE(1073) + TRAMPOLINE(1074) + TRAMPOLINE(1075) + TRAMPOLINE(1076) + TRAMPOLINE(1077) + TRAMPOLINE(1078) + TRAMPOLINE(1079) + TRAMPOLINE(1080) + TRAMPOLINE(1081) + TRAMPOLINE(1082) + TRAMPOLINE(1083) + TRAMPOLINE(1084) + TRAMPOLINE(1085) + TRAMPOLINE(1086) + TRAMPOLINE(1087) + TRAMPOLINE(1088) + TRAMPOLINE(1089) + TRAMPOLINE(1090) + TRAMPOLINE(1091) + TRAMPOLINE(1092) + TRAMPOLINE(1093) + TRAMPOLINE(1094) + TRAMPOLINE(1095) + TRAMPOLINE(1096) + TRAMPOLINE(1097) + TRAMPOLINE(1098) + TRAMPOLINE(1099) + TRAMPOLINE(1100) + TRAMPOLINE(1101) + TRAMPOLINE(1102) + TRAMPOLINE(1103) + TRAMPOLINE(1104) + TRAMPOLINE(1105) + TRAMPOLINE(1106) + TRAMPOLINE(1107) + TRAMPOLINE(1108) + TRAMPOLINE(1109) + TRAMPOLINE(1110) + TRAMPOLINE(1111) + TRAMPOLINE(1112) + TRAMPOLINE(1113) + TRAMPOLINE(1114) + TRAMPOLINE(1115) + TRAMPOLINE(1116) + TRAMPOLINE(1117) + TRAMPOLINE(1118) + TRAMPOLINE(1119) + TRAMPOLINE(1120) + TRAMPOLINE(1121) + TRAMPOLINE(1122) + TRAMPOLINE(1123) + TRAMPOLINE(1124) + TRAMPOLINE(1125) + TRAMPOLINE(1126) + TRAMPOLINE(1127) + TRAMPOLINE(1128) + TRAMPOLINE(1129) + TRAMPOLINE(1130) + TRAMPOLINE(1131) + TRAMPOLINE(1132) + TRAMPOLINE(1133) + TRAMPOLINE(1134) + TRAMPOLINE(1135) + TRAMPOLINE(1136) + TRAMPOLINE(1137) + TRAMPOLINE(1138) + TRAMPOLINE(1139) + TRAMPOLINE(1140) + TRAMPOLINE(1141) + TRAMPOLINE(1142) + TRAMPOLINE(1143) + TRAMPOLINE(1144) + TRAMPOLINE(1145) + TRAMPOLINE(1146) + TRAMPOLINE(1147) + TRAMPOLINE(1148) + TRAMPOLINE(1149) + TRAMPOLINE(1150) + TRAMPOLINE(1151) + TRAMPOLINE(1152) + TRAMPOLINE(1153) + TRAMPOLINE(1154) + TRAMPOLINE(1155) + TRAMPOLINE(1156) + TRAMPOLINE(1157) + TRAMPOLINE(1158) + TRAMPOLINE(1159) + TRAMPOLINE(1160) + TRAMPOLINE(1161) + TRAMPOLINE(1162) + TRAMPOLINE(1163) + TRAMPOLINE(1164) + TRAMPOLINE(1165) + TRAMPOLINE(1166) + TRAMPOLINE(1167) + TRAMPOLINE(1168) + TRAMPOLINE(1169) + TRAMPOLINE(1170) + TRAMPOLINE(1171) + TRAMPOLINE(1172) + TRAMPOLINE(1173) + TRAMPOLINE(1174) + TRAMPOLINE(1175) + TRAMPOLINE(1176) + TRAMPOLINE(1177) + TRAMPOLINE(1178) + TRAMPOLINE(1179) + TRAMPOLINE(1180) + TRAMPOLINE(1181) + TRAMPOLINE(1182) + TRAMPOLINE(1183) + TRAMPOLINE(1184) + TRAMPOLINE(1185) + TRAMPOLINE(1186) + TRAMPOLINE(1187) + TRAMPOLINE(1188) + TRAMPOLINE(1189) + TRAMPOLINE(1190) + TRAMPOLINE(1191) + TRAMPOLINE(1192) + TRAMPOLINE(1193) + TRAMPOLINE(1194) + TRAMPOLINE(1195) + TRAMPOLINE(1196) + TRAMPOLINE(1197) + TRAMPOLINE(1198) + TRAMPOLINE(1199) + TRAMPOLINE(1200) + TRAMPOLINE(1201) + TRAMPOLINE(1202) + TRAMPOLINE(1203) + TRAMPOLINE(1204) + TRAMPOLINE(1205) + TRAMPOLINE(1206) + TRAMPOLINE(1207) + TRAMPOLINE(1208) + TRAMPOLINE(1209) + TRAMPOLINE(1210) + TRAMPOLINE(1211) + TRAMPOLINE(1212) + TRAMPOLINE(1213) + TRAMPOLINE(1214) + TRAMPOLINE(1215) + TRAMPOLINE(1216) + TRAMPOLINE(1217) + TRAMPOLINE(1218) + TRAMPOLINE(1219) + TRAMPOLINE(1220) + TRAMPOLINE(1221) + TRAMPOLINE(1222) + TRAMPOLINE(1223) + TRAMPOLINE(1224) + TRAMPOLINE(1225) + TRAMPOLINE(1226) + TRAMPOLINE(1227) + TRAMPOLINE(1228) + TRAMPOLINE(1229) + TRAMPOLINE(1230) + TRAMPOLINE(1231) + TRAMPOLINE(1232) + TRAMPOLINE(1233) + TRAMPOLINE(1234) + TRAMPOLINE(1235) + TRAMPOLINE(1236) + TRAMPOLINE(1237) + TRAMPOLINE(1238) + TRAMPOLINE(1239) + TRAMPOLINE(1240) + TRAMPOLINE(1241) + TRAMPOLINE(1242) + TRAMPOLINE(1243) + TRAMPOLINE(1244) + TRAMPOLINE(1245) + TRAMPOLINE(1246) + TRAMPOLINE(1247) + TRAMPOLINE(1248) + TRAMPOLINE(1249) + TRAMPOLINE(1250) + TRAMPOLINE(1251) + TRAMPOLINE(1252) + TRAMPOLINE(1253) + TRAMPOLINE(1254) + TRAMPOLINE(1255) + TRAMPOLINE(1256) + TRAMPOLINE(1257) + TRAMPOLINE(1258) + TRAMPOLINE(1259) + TRAMPOLINE(1260) + TRAMPOLINE(1261) + TRAMPOLINE(1262) + TRAMPOLINE(1263) + TRAMPOLINE(1264) + TRAMPOLINE(1265) + TRAMPOLINE(1266) + TRAMPOLINE(1267) + TRAMPOLINE(1268) + TRAMPOLINE(1269) + TRAMPOLINE(1270) + TRAMPOLINE(1271) + TRAMPOLINE(1272) + TRAMPOLINE(1273) + TRAMPOLINE(1274) + TRAMPOLINE(1275) + TRAMPOLINE(1276) + TRAMPOLINE(1277) + TRAMPOLINE(1278) + TRAMPOLINE(1279) + TRAMPOLINE(1280) + TRAMPOLINE(1281) + TRAMPOLINE(1282) + TRAMPOLINE(1283) + TRAMPOLINE(1284) + TRAMPOLINE(1285) + TRAMPOLINE(1286) + TRAMPOLINE(1287) + TRAMPOLINE(1288) + TRAMPOLINE(1289) + TRAMPOLINE(1290) + TRAMPOLINE(1291) + TRAMPOLINE(1292) + TRAMPOLINE(1293) + TRAMPOLINE(1294) + TRAMPOLINE(1295) + TRAMPOLINE(1296) + TRAMPOLINE(1297) + TRAMPOLINE(1298) + TRAMPOLINE(1299) + TRAMPOLINE(1300) + TRAMPOLINE(1301) + TRAMPOLINE(1302) + TRAMPOLINE(1303) + TRAMPOLINE(1304) + TRAMPOLINE(1305) + TRAMPOLINE(1306) + TRAMPOLINE(1307) + TRAMPOLINE(1308) + TRAMPOLINE(1309) + TRAMPOLINE(1310) + TRAMPOLINE(1311) + TRAMPOLINE(1312) + TRAMPOLINE(1313) + TRAMPOLINE(1314) + TRAMPOLINE(1315) + TRAMPOLINE(1316) + TRAMPOLINE(1317) + TRAMPOLINE(1318) + TRAMPOLINE(1319) + TRAMPOLINE(1320) + TRAMPOLINE(1321) + TRAMPOLINE(1322) + TRAMPOLINE(1323) + TRAMPOLINE(1324) + TRAMPOLINE(1325) + TRAMPOLINE(1326) + TRAMPOLINE(1327) + TRAMPOLINE(1328) + TRAMPOLINE(1329) + TRAMPOLINE(1330) + TRAMPOLINE(1331) + TRAMPOLINE(1332) + TRAMPOLINE(1333) + TRAMPOLINE(1334) + TRAMPOLINE(1335) + TRAMPOLINE(1336) + TRAMPOLINE(1337) + TRAMPOLINE(1338) + TRAMPOLINE(1339) + TRAMPOLINE(1340) + TRAMPOLINE(1341) + TRAMPOLINE(1342) + TRAMPOLINE(1343) + TRAMPOLINE(1344) + TRAMPOLINE(1345) + TRAMPOLINE(1346) + TRAMPOLINE(1347) + TRAMPOLINE(1348) + TRAMPOLINE(1349) + TRAMPOLINE(1350) + TRAMPOLINE(1351) + TRAMPOLINE(1352) + TRAMPOLINE(1353) + TRAMPOLINE(1354) + TRAMPOLINE(1355) + TRAMPOLINE(1356) + TRAMPOLINE(1357) + TRAMPOLINE(1358) + TRAMPOLINE(1359) + TRAMPOLINE(1360) + TRAMPOLINE(1361) + TRAMPOLINE(1362) + TRAMPOLINE(1363) + TRAMPOLINE(1364) + TRAMPOLINE(1365) + TRAMPOLINE(1366) + TRAMPOLINE(1367) + TRAMPOLINE(1368) + TRAMPOLINE(1369) + TRAMPOLINE(1370) + TRAMPOLINE(1371) + TRAMPOLINE(1372) + TRAMPOLINE(1373) + TRAMPOLINE(1374) + TRAMPOLINE(1375) + TRAMPOLINE(1376) + TRAMPOLINE(1377) + TRAMPOLINE(1378) + TRAMPOLINE(1379) + TRAMPOLINE(1380) + TRAMPOLINE(1381) + TRAMPOLINE(1382) + TRAMPOLINE(1383) + TRAMPOLINE(1384) + TRAMPOLINE(1385) + TRAMPOLINE(1386) + TRAMPOLINE(1387) + TRAMPOLINE(1388) + TRAMPOLINE(1389) + TRAMPOLINE(1390) + TRAMPOLINE(1391) + TRAMPOLINE(1392) + TRAMPOLINE(1393) + TRAMPOLINE(1394) + TRAMPOLINE(1395) + TRAMPOLINE(1396) + TRAMPOLINE(1397) + TRAMPOLINE(1398) + TRAMPOLINE(1399) + TRAMPOLINE(1400) + TRAMPOLINE(1401) + TRAMPOLINE(1402) + TRAMPOLINE(1403) + TRAMPOLINE(1404) + TRAMPOLINE(1405) + TRAMPOLINE(1406) + TRAMPOLINE(1407) + TRAMPOLINE(1408) + TRAMPOLINE(1409) + TRAMPOLINE(1410) + TRAMPOLINE(1411) + TRAMPOLINE(1412) + TRAMPOLINE(1413) + TRAMPOLINE(1414) + TRAMPOLINE(1415) + TRAMPOLINE(1416) + TRAMPOLINE(1417) + TRAMPOLINE(1418) + TRAMPOLINE(1419) + TRAMPOLINE(1420) + TRAMPOLINE(1421) + TRAMPOLINE(1422) + TRAMPOLINE(1423) + TRAMPOLINE(1424) + TRAMPOLINE(1425) + TRAMPOLINE(1426) + TRAMPOLINE(1427) + TRAMPOLINE(1428) + TRAMPOLINE(1429) + TRAMPOLINE(1430) + TRAMPOLINE(1431) + TRAMPOLINE(1432) + TRAMPOLINE(1433) + TRAMPOLINE(1434) + TRAMPOLINE(1435) + TRAMPOLINE(1436) + TRAMPOLINE(1437) + TRAMPOLINE(1438) + TRAMPOLINE(1439) + TRAMPOLINE(1440) + TRAMPOLINE(1441) + TRAMPOLINE(1442) + TRAMPOLINE(1443) + TRAMPOLINE(1444) + TRAMPOLINE(1445) + TRAMPOLINE(1446) + TRAMPOLINE(1447) + TRAMPOLINE(1448) + TRAMPOLINE(1449) + TRAMPOLINE(1450) + TRAMPOLINE(1451) + TRAMPOLINE(1452) + TRAMPOLINE(1453) + TRAMPOLINE(1454) + TRAMPOLINE(1455) + TRAMPOLINE(1456) + TRAMPOLINE(1457) + TRAMPOLINE(1458) + TRAMPOLINE(1459) + TRAMPOLINE(1460) + TRAMPOLINE(1461) + TRAMPOLINE(1462) + TRAMPOLINE(1463) + TRAMPOLINE(1464) + TRAMPOLINE(1465) + TRAMPOLINE(1466) + TRAMPOLINE(1467) + TRAMPOLINE(1468) + TRAMPOLINE(1469) + TRAMPOLINE(1470) + TRAMPOLINE(1471) + TRAMPOLINE(1472) + TRAMPOLINE(1473) + TRAMPOLINE(1474) + TRAMPOLINE(1475) + TRAMPOLINE(1476) + TRAMPOLINE(1477) + TRAMPOLINE(1478) + TRAMPOLINE(1479) + TRAMPOLINE(1480) + TRAMPOLINE(1481) + TRAMPOLINE(1482) + TRAMPOLINE(1483) + TRAMPOLINE(1484) + TRAMPOLINE(1485) + TRAMPOLINE(1486) + TRAMPOLINE(1487) + TRAMPOLINE(1488) + TRAMPOLINE(1489) + TRAMPOLINE(1490) + TRAMPOLINE(1491) + TRAMPOLINE(1492) + TRAMPOLINE(1493) + TRAMPOLINE(1494) + TRAMPOLINE(1495) + TRAMPOLINE(1496) + TRAMPOLINE(1497) + TRAMPOLINE(1498) + TRAMPOLINE(1499) + TRAMPOLINE(1500) + TRAMPOLINE(1501) + TRAMPOLINE(1502) + TRAMPOLINE(1503) + TRAMPOLINE(1504) + TRAMPOLINE(1505) + TRAMPOLINE(1506) + TRAMPOLINE(1507) + TRAMPOLINE(1508) + TRAMPOLINE(1509) + TRAMPOLINE(1510) + TRAMPOLINE(1511) + TRAMPOLINE(1512) + TRAMPOLINE(1513) + TRAMPOLINE(1514) + TRAMPOLINE(1515) + TRAMPOLINE(1516) + TRAMPOLINE(1517) + TRAMPOLINE(1518) + TRAMPOLINE(1519) + TRAMPOLINE(1520) + TRAMPOLINE(1521) + TRAMPOLINE(1522) + TRAMPOLINE(1523) + TRAMPOLINE(1524) + TRAMPOLINE(1525) + TRAMPOLINE(1526) + TRAMPOLINE(1527) + TRAMPOLINE(1528) + TRAMPOLINE(1529) + TRAMPOLINE(1530) + TRAMPOLINE(1531) + TRAMPOLINE(1532) + TRAMPOLINE(1533) + TRAMPOLINE(1534) + TRAMPOLINE(1535) + TRAMPOLINE(1536) + TRAMPOLINE(1537) + TRAMPOLINE(1538) + TRAMPOLINE(1539) + TRAMPOLINE(1540) + TRAMPOLINE(1541) + TRAMPOLINE(1542) + TRAMPOLINE(1543) + TRAMPOLINE(1544) + TRAMPOLINE(1545) + TRAMPOLINE(1546) + TRAMPOLINE(1547) + TRAMPOLINE(1548) + TRAMPOLINE(1549) + TRAMPOLINE(1550) + TRAMPOLINE(1551) + TRAMPOLINE(1552) + TRAMPOLINE(1553) + TRAMPOLINE(1554) + TRAMPOLINE(1555) + TRAMPOLINE(1556) + TRAMPOLINE(1557) + TRAMPOLINE(1558) + TRAMPOLINE(1559) + TRAMPOLINE(1560) + TRAMPOLINE(1561) + TRAMPOLINE(1562) + TRAMPOLINE(1563) + TRAMPOLINE(1564) + TRAMPOLINE(1565) + TRAMPOLINE(1566) + TRAMPOLINE(1567) + TRAMPOLINE(1568) + TRAMPOLINE(1569) + TRAMPOLINE(1570) + TRAMPOLINE(1571) + TRAMPOLINE(1572) + TRAMPOLINE(1573) + TRAMPOLINE(1574) + TRAMPOLINE(1575) + TRAMPOLINE(1576) + TRAMPOLINE(1577) + TRAMPOLINE(1578) + TRAMPOLINE(1579) + TRAMPOLINE(1580) + TRAMPOLINE(1581) + TRAMPOLINE(1582) + TRAMPOLINE(1583) + TRAMPOLINE(1584) + TRAMPOLINE(1585) + TRAMPOLINE(1586) + TRAMPOLINE(1587) + TRAMPOLINE(1588) + TRAMPOLINE(1589) + TRAMPOLINE(1590) + TRAMPOLINE(1591) + TRAMPOLINE(1592) + TRAMPOLINE(1593) + TRAMPOLINE(1594) + TRAMPOLINE(1595) + TRAMPOLINE(1596) + TRAMPOLINE(1597) + TRAMPOLINE(1598) + TRAMPOLINE(1599) + TRAMPOLINE(1600) + TRAMPOLINE(1601) + TRAMPOLINE(1602) + TRAMPOLINE(1603) + TRAMPOLINE(1604) + TRAMPOLINE(1605) + TRAMPOLINE(1606) + TRAMPOLINE(1607) + TRAMPOLINE(1608) + TRAMPOLINE(1609) + TRAMPOLINE(1610) + TRAMPOLINE(1611) + TRAMPOLINE(1612) + TRAMPOLINE(1613) + TRAMPOLINE(1614) + TRAMPOLINE(1615) + TRAMPOLINE(1616) + TRAMPOLINE(1617) + TRAMPOLINE(1618) + TRAMPOLINE(1619) + TRAMPOLINE(1620) + TRAMPOLINE(1621) + TRAMPOLINE(1622) + TRAMPOLINE(1623) + TRAMPOLINE(1624) + TRAMPOLINE(1625) + TRAMPOLINE(1626) + TRAMPOLINE(1627) + TRAMPOLINE(1628) + TRAMPOLINE(1629) + TRAMPOLINE(1630) + TRAMPOLINE(1631) + TRAMPOLINE(1632) + TRAMPOLINE(1633) + TRAMPOLINE(1634) + TRAMPOLINE(1635) + TRAMPOLINE(1636) + TRAMPOLINE(1637) + TRAMPOLINE(1638) + TRAMPOLINE(1639) + TRAMPOLINE(1640) + TRAMPOLINE(1641) + TRAMPOLINE(1642) + TRAMPOLINE(1643) + TRAMPOLINE(1644) + TRAMPOLINE(1645) + TRAMPOLINE(1646) + TRAMPOLINE(1647) + TRAMPOLINE(1648) + TRAMPOLINE(1649) + TRAMPOLINE(1650) + TRAMPOLINE(1651) + TRAMPOLINE(1652) + TRAMPOLINE(1653) + TRAMPOLINE(1654) + TRAMPOLINE(1655) + TRAMPOLINE(1656) + TRAMPOLINE(1657) + TRAMPOLINE(1658) + TRAMPOLINE(1659) + TRAMPOLINE(1660) + TRAMPOLINE(1661) + TRAMPOLINE(1662) + TRAMPOLINE(1663) + TRAMPOLINE(1664) + TRAMPOLINE(1665) + TRAMPOLINE(1666) + TRAMPOLINE(1667) + TRAMPOLINE(1668) + TRAMPOLINE(1669) + TRAMPOLINE(1670) + TRAMPOLINE(1671) + TRAMPOLINE(1672) + TRAMPOLINE(1673) + TRAMPOLINE(1674) + TRAMPOLINE(1675) + TRAMPOLINE(1676) + TRAMPOLINE(1677) + TRAMPOLINE(1678) + TRAMPOLINE(1679) + TRAMPOLINE(1680) + TRAMPOLINE(1681) + TRAMPOLINE(1682) + TRAMPOLINE(1683) + TRAMPOLINE(1684) + TRAMPOLINE(1685) + TRAMPOLINE(1686) + TRAMPOLINE(1687) + TRAMPOLINE(1688) + TRAMPOLINE(1689) + TRAMPOLINE(1690) + TRAMPOLINE(1691) + TRAMPOLINE(1692) + TRAMPOLINE(1693) + TRAMPOLINE(1694) + TRAMPOLINE(1695) + TRAMPOLINE(1696) + TRAMPOLINE(1697) + TRAMPOLINE(1698) + TRAMPOLINE(1699) + TRAMPOLINE(1700) + TRAMPOLINE(1701) + TRAMPOLINE(1702) + TRAMPOLINE(1703) + TRAMPOLINE(1704) + TRAMPOLINE(1705) + TRAMPOLINE(1706) + TRAMPOLINE(1707) + TRAMPOLINE(1708) + TRAMPOLINE(1709) + TRAMPOLINE(1710) + TRAMPOLINE(1711) + TRAMPOLINE(1712) + TRAMPOLINE(1713) + TRAMPOLINE(1714) + TRAMPOLINE(1715) + TRAMPOLINE(1716) + TRAMPOLINE(1717) + TRAMPOLINE(1718) + TRAMPOLINE(1719) + TRAMPOLINE(1720) + TRAMPOLINE(1721) + TRAMPOLINE(1722) + TRAMPOLINE(1723) + TRAMPOLINE(1724) + TRAMPOLINE(1725) + TRAMPOLINE(1726) + TRAMPOLINE(1727) + TRAMPOLINE(1728) + TRAMPOLINE(1729) + TRAMPOLINE(1730) + TRAMPOLINE(1731) + TRAMPOLINE(1732) + TRAMPOLINE(1733) + TRAMPOLINE(1734) + TRAMPOLINE(1735) + TRAMPOLINE(1736) + TRAMPOLINE(1737) + TRAMPOLINE(1738) + TRAMPOLINE(1739) + TRAMPOLINE(1740) + TRAMPOLINE(1741) + TRAMPOLINE(1742) + TRAMPOLINE(1743) + TRAMPOLINE(1744) + TRAMPOLINE(1745) + TRAMPOLINE(1746) + TRAMPOLINE(1747) + TRAMPOLINE(1748) + TRAMPOLINE(1749) + TRAMPOLINE(1750) + TRAMPOLINE(1751) + TRAMPOLINE(1752) + TRAMPOLINE(1753) + TRAMPOLINE(1754) + TRAMPOLINE(1755) + TRAMPOLINE(1756) + TRAMPOLINE(1757) + TRAMPOLINE(1758) + TRAMPOLINE(1759) + TRAMPOLINE(1760) + TRAMPOLINE(1761) + TRAMPOLINE(1762) + TRAMPOLINE(1763) + TRAMPOLINE(1764) + TRAMPOLINE(1765) + TRAMPOLINE(1766) + TRAMPOLINE(1767) + TRAMPOLINE(1768) + TRAMPOLINE(1769) + TRAMPOLINE(1770) + TRAMPOLINE(1771) + TRAMPOLINE(1772) + TRAMPOLINE(1773) + TRAMPOLINE(1774) + TRAMPOLINE(1775) + TRAMPOLINE(1776) + TRAMPOLINE(1777) + TRAMPOLINE(1778) + TRAMPOLINE(1779) + TRAMPOLINE(1780) + TRAMPOLINE(1781) + TRAMPOLINE(1782) + TRAMPOLINE(1783) + TRAMPOLINE(1784) + TRAMPOLINE(1785) + TRAMPOLINE(1786) + TRAMPOLINE(1787) + TRAMPOLINE(1788) + TRAMPOLINE(1789) + TRAMPOLINE(1790) + TRAMPOLINE(1791) + TRAMPOLINE(1792) + TRAMPOLINE(1793) + TRAMPOLINE(1794) + TRAMPOLINE(1795) + TRAMPOLINE(1796) + TRAMPOLINE(1797) + TRAMPOLINE(1798) + TRAMPOLINE(1799) + TRAMPOLINE(1800) + TRAMPOLINE(1801) + TRAMPOLINE(1802) + TRAMPOLINE(1803) + TRAMPOLINE(1804) + TRAMPOLINE(1805) + TRAMPOLINE(1806) + TRAMPOLINE(1807) + TRAMPOLINE(1808) + TRAMPOLINE(1809) + TRAMPOLINE(1810) + TRAMPOLINE(1811) + TRAMPOLINE(1812) + TRAMPOLINE(1813) + TRAMPOLINE(1814) + TRAMPOLINE(1815) + TRAMPOLINE(1816) + TRAMPOLINE(1817) + TRAMPOLINE(1818) + TRAMPOLINE(1819) + TRAMPOLINE(1820) + TRAMPOLINE(1821) + TRAMPOLINE(1822) + TRAMPOLINE(1823) + TRAMPOLINE(1824) + TRAMPOLINE(1825) + TRAMPOLINE(1826) + TRAMPOLINE(1827) + TRAMPOLINE(1828) + TRAMPOLINE(1829) + TRAMPOLINE(1830) + TRAMPOLINE(1831) + TRAMPOLINE(1832) + TRAMPOLINE(1833) + TRAMPOLINE(1834) + TRAMPOLINE(1835) + TRAMPOLINE(1836) + TRAMPOLINE(1837) + TRAMPOLINE(1838) + TRAMPOLINE(1839) + TRAMPOLINE(1840) + TRAMPOLINE(1841) + TRAMPOLINE(1842) + TRAMPOLINE(1843) + TRAMPOLINE(1844) + TRAMPOLINE(1845) + TRAMPOLINE(1846) + TRAMPOLINE(1847) + TRAMPOLINE(1848) + TRAMPOLINE(1849) + TRAMPOLINE(1850) + TRAMPOLINE(1851) + TRAMPOLINE(1852) + TRAMPOLINE(1853) + TRAMPOLINE(1854) + TRAMPOLINE(1855) + TRAMPOLINE(1856) + TRAMPOLINE(1857) + TRAMPOLINE(1858) + TRAMPOLINE(1859) + TRAMPOLINE(1860) + TRAMPOLINE(1861) + TRAMPOLINE(1862) + TRAMPOLINE(1863) + TRAMPOLINE(1864) + TRAMPOLINE(1865) + TRAMPOLINE(1866) + TRAMPOLINE(1867) + TRAMPOLINE(1868) + TRAMPOLINE(1869) + TRAMPOLINE(1870) + TRAMPOLINE(1871) + TRAMPOLINE(1872) + TRAMPOLINE(1873) + TRAMPOLINE(1874) + TRAMPOLINE(1875) + TRAMPOLINE(1876) + TRAMPOLINE(1877) + TRAMPOLINE(1878) + TRAMPOLINE(1879) + TRAMPOLINE(1880) + TRAMPOLINE(1881) + TRAMPOLINE(1882) + TRAMPOLINE(1883) + TRAMPOLINE(1884) + TRAMPOLINE(1885) + TRAMPOLINE(1886) + TRAMPOLINE(1887) + TRAMPOLINE(1888) + TRAMPOLINE(1889) + TRAMPOLINE(1890) + TRAMPOLINE(1891) + TRAMPOLINE(1892) + TRAMPOLINE(1893) + TRAMPOLINE(1894) + TRAMPOLINE(1895) + TRAMPOLINE(1896) + TRAMPOLINE(1897) + TRAMPOLINE(1898) + TRAMPOLINE(1899) + TRAMPOLINE(1900) + TRAMPOLINE(1901) + TRAMPOLINE(1902) + TRAMPOLINE(1903) + TRAMPOLINE(1904) + TRAMPOLINE(1905) + TRAMPOLINE(1906) + TRAMPOLINE(1907) + TRAMPOLINE(1908) + TRAMPOLINE(1909) + TRAMPOLINE(1910) + TRAMPOLINE(1911) + TRAMPOLINE(1912) + TRAMPOLINE(1913) + TRAMPOLINE(1914) + TRAMPOLINE(1915) + TRAMPOLINE(1916) + TRAMPOLINE(1917) + TRAMPOLINE(1918) + TRAMPOLINE(1919) + TRAMPOLINE(1920) + TRAMPOLINE(1921) + TRAMPOLINE(1922) + TRAMPOLINE(1923) + TRAMPOLINE(1924) + TRAMPOLINE(1925) + TRAMPOLINE(1926) + TRAMPOLINE(1927) + TRAMPOLINE(1928) + TRAMPOLINE(1929) + TRAMPOLINE(1930) + TRAMPOLINE(1931) + TRAMPOLINE(1932) + TRAMPOLINE(1933) + TRAMPOLINE(1934) + TRAMPOLINE(1935) + TRAMPOLINE(1936) + TRAMPOLINE(1937) + TRAMPOLINE(1938) + TRAMPOLINE(1939) + TRAMPOLINE(1940) + TRAMPOLINE(1941) + TRAMPOLINE(1942) + TRAMPOLINE(1943) + TRAMPOLINE(1944) + TRAMPOLINE(1945) + TRAMPOLINE(1946) + TRAMPOLINE(1947) + TRAMPOLINE(1948) + TRAMPOLINE(1949) + TRAMPOLINE(1950) + TRAMPOLINE(1951) + TRAMPOLINE(1952) + TRAMPOLINE(1953) + TRAMPOLINE(1954) + TRAMPOLINE(1955) + TRAMPOLINE(1956) + TRAMPOLINE(1957) + TRAMPOLINE(1958) + TRAMPOLINE(1959) + TRAMPOLINE(1960) + TRAMPOLINE(1961) + TRAMPOLINE(1962) + TRAMPOLINE(1963) + TRAMPOLINE(1964) + TRAMPOLINE(1965) + TRAMPOLINE(1966) + TRAMPOLINE(1967) + TRAMPOLINE(1968) + TRAMPOLINE(1969) + TRAMPOLINE(1970) + TRAMPOLINE(1971) + TRAMPOLINE(1972) + TRAMPOLINE(1973) + TRAMPOLINE(1974) + TRAMPOLINE(1975) + TRAMPOLINE(1976) + TRAMPOLINE(1977) + TRAMPOLINE(1978) + TRAMPOLINE(1979) + TRAMPOLINE(1980) + TRAMPOLINE(1981) + TRAMPOLINE(1982) + TRAMPOLINE(1983) + TRAMPOLINE(1984) + TRAMPOLINE(1985) + TRAMPOLINE(1986) + TRAMPOLINE(1987) + TRAMPOLINE(1988) + TRAMPOLINE(1989) + TRAMPOLINE(1990) + TRAMPOLINE(1991) + TRAMPOLINE(1992) + TRAMPOLINE(1993) + TRAMPOLINE(1994) + TRAMPOLINE(1995) + TRAMPOLINE(1996) + TRAMPOLINE(1997) + TRAMPOLINE(1998) + TRAMPOLINE(1999) + TRAMPOLINE(2000) + TRAMPOLINE(2001) + TRAMPOLINE(2002) + TRAMPOLINE(2003) + TRAMPOLINE(2004) + TRAMPOLINE(2005) + TRAMPOLINE(2006) + TRAMPOLINE(2007) + TRAMPOLINE(2008) + TRAMPOLINE(2009) + TRAMPOLINE(2010) + TRAMPOLINE(2011) + TRAMPOLINE(2012) + TRAMPOLINE(2013) + TRAMPOLINE(2014) + TRAMPOLINE(2015) + TRAMPOLINE(2016) + TRAMPOLINE(2017) + TRAMPOLINE(2018) + TRAMPOLINE(2019) + TRAMPOLINE(2020) + TRAMPOLINE(2021) + TRAMPOLINE(2022) + TRAMPOLINE(2023) + TRAMPOLINE(2024) + TRAMPOLINE(2025) + TRAMPOLINE(2026) + TRAMPOLINE(2027) + TRAMPOLINE(2028) + TRAMPOLINE(2029) + TRAMPOLINE(2030) + TRAMPOLINE(2031) + TRAMPOLINE(2032) + TRAMPOLINE(2033) + TRAMPOLINE(2034) + TRAMPOLINE(2035) + TRAMPOLINE(2036) + TRAMPOLINE(2037) + TRAMPOLINE(2038) + TRAMPOLINE(2039) + TRAMPOLINE(2040) + TRAMPOLINE(2041) + TRAMPOLINE(2042) + TRAMPOLINE(2043) + TRAMPOLINE(2044) + TRAMPOLINE(2045) + TRAMPOLINE(2046) + TRAMPOLINE(2047) + TRAMPOLINE(2048) + TRAMPOLINE(2049) + TRAMPOLINE(2050) + TRAMPOLINE(2051) + TRAMPOLINE(2052) + TRAMPOLINE(2053) + TRAMPOLINE(2054) + TRAMPOLINE(2055) + TRAMPOLINE(2056) + TRAMPOLINE(2057) + TRAMPOLINE(2058) + TRAMPOLINE(2059) + TRAMPOLINE(2060) + TRAMPOLINE(2061) + TRAMPOLINE(2062) + TRAMPOLINE(2063) + TRAMPOLINE(2064) + TRAMPOLINE(2065) + TRAMPOLINE(2066) + TRAMPOLINE(2067) + TRAMPOLINE(2068) + TRAMPOLINE(2069) + TRAMPOLINE(2070) + TRAMPOLINE(2071) + TRAMPOLINE(2072) + TRAMPOLINE(2073) + TRAMPOLINE(2074) + TRAMPOLINE(2075) + TRAMPOLINE(2076) + TRAMPOLINE(2077) + TRAMPOLINE(2078) + TRAMPOLINE(2079) + TRAMPOLINE(2080) + TRAMPOLINE(2081) + TRAMPOLINE(2082) + TRAMPOLINE(2083) + TRAMPOLINE(2084) + TRAMPOLINE(2085) + TRAMPOLINE(2086) + TRAMPOLINE(2087) + TRAMPOLINE(2088) + TRAMPOLINE(2089) + TRAMPOLINE(2090) + TRAMPOLINE(2091) + TRAMPOLINE(2092) + TRAMPOLINE(2093) + TRAMPOLINE(2094) + TRAMPOLINE(2095) + TRAMPOLINE(2096) + TRAMPOLINE(2097) + TRAMPOLINE(2098) + TRAMPOLINE(2099) + TRAMPOLINE(2100) + TRAMPOLINE(2101) + TRAMPOLINE(2102) + TRAMPOLINE(2103) + TRAMPOLINE(2104) + TRAMPOLINE(2105) + TRAMPOLINE(2106) + TRAMPOLINE(2107) + TRAMPOLINE(2108) + TRAMPOLINE(2109) + TRAMPOLINE(2110) + TRAMPOLINE(2111) + TRAMPOLINE(2112) + TRAMPOLINE(2113) + TRAMPOLINE(2114) + TRAMPOLINE(2115) + TRAMPOLINE(2116) + TRAMPOLINE(2117) + TRAMPOLINE(2118) + TRAMPOLINE(2119) + TRAMPOLINE(2120) + TRAMPOLINE(2121) + TRAMPOLINE(2122) + TRAMPOLINE(2123) + TRAMPOLINE(2124) + TRAMPOLINE(2125) + TRAMPOLINE(2126) + TRAMPOLINE(2127) + TRAMPOLINE(2128) + TRAMPOLINE(2129) + TRAMPOLINE(2130) + TRAMPOLINE(2131) + TRAMPOLINE(2132) + TRAMPOLINE(2133) + TRAMPOLINE(2134) + TRAMPOLINE(2135) + TRAMPOLINE(2136) + TRAMPOLINE(2137) + TRAMPOLINE(2138) + TRAMPOLINE(2139) + TRAMPOLINE(2140) + TRAMPOLINE(2141) + TRAMPOLINE(2142) + TRAMPOLINE(2143) + TRAMPOLINE(2144) + TRAMPOLINE(2145) + TRAMPOLINE(2146) + TRAMPOLINE(2147) + TRAMPOLINE(2148) + TRAMPOLINE(2149) + TRAMPOLINE(2150) + TRAMPOLINE(2151) + TRAMPOLINE(2152) + TRAMPOLINE(2153) + TRAMPOLINE(2154) + TRAMPOLINE(2155) + TRAMPOLINE(2156) + TRAMPOLINE(2157) + TRAMPOLINE(2158) + TRAMPOLINE(2159) + TRAMPOLINE(2160) + TRAMPOLINE(2161) + TRAMPOLINE(2162) + TRAMPOLINE(2163) + TRAMPOLINE(2164) + TRAMPOLINE(2165) + TRAMPOLINE(2166) + TRAMPOLINE(2167) + TRAMPOLINE(2168) + TRAMPOLINE(2169) + TRAMPOLINE(2170) + TRAMPOLINE(2171) + TRAMPOLINE(2172) + TRAMPOLINE(2173) + TRAMPOLINE(2174) + TRAMPOLINE(2175) + TRAMPOLINE(2176) + TRAMPOLINE(2177) + TRAMPOLINE(2178) + TRAMPOLINE(2179) + TRAMPOLINE(2180) + TRAMPOLINE(2181) + TRAMPOLINE(2182) + TRAMPOLINE(2183) + TRAMPOLINE(2184) + TRAMPOLINE(2185) + TRAMPOLINE(2186) + TRAMPOLINE(2187) + TRAMPOLINE(2188) + TRAMPOLINE(2189) + TRAMPOLINE(2190) + TRAMPOLINE(2191) + TRAMPOLINE(2192) + TRAMPOLINE(2193) + TRAMPOLINE(2194) + TRAMPOLINE(2195) + TRAMPOLINE(2196) + TRAMPOLINE(2197) + TRAMPOLINE(2198) + TRAMPOLINE(2199) + TRAMPOLINE(2200) + TRAMPOLINE(2201) + TRAMPOLINE(2202) + TRAMPOLINE(2203) + TRAMPOLINE(2204) + TRAMPOLINE(2205) + TRAMPOLINE(2206) + TRAMPOLINE(2207) + TRAMPOLINE(2208) + TRAMPOLINE(2209) + TRAMPOLINE(2210) + TRAMPOLINE(2211) + TRAMPOLINE(2212) + TRAMPOLINE(2213) + TRAMPOLINE(2214) + TRAMPOLINE(2215) + TRAMPOLINE(2216) + TRAMPOLINE(2217) + TRAMPOLINE(2218) + TRAMPOLINE(2219) + TRAMPOLINE(2220) + TRAMPOLINE(2221) + TRAMPOLINE(2222) + TRAMPOLINE(2223) + TRAMPOLINE(2224) + TRAMPOLINE(2225) + TRAMPOLINE(2226) + TRAMPOLINE(2227) + TRAMPOLINE(2228) + TRAMPOLINE(2229) + TRAMPOLINE(2230) + TRAMPOLINE(2231) + TRAMPOLINE(2232) + TRAMPOLINE(2233) + TRAMPOLINE(2234) + TRAMPOLINE(2235) + TRAMPOLINE(2236) + TRAMPOLINE(2237) + TRAMPOLINE(2238) + TRAMPOLINE(2239) + TRAMPOLINE(2240) + TRAMPOLINE(2241) + TRAMPOLINE(2242) + TRAMPOLINE(2243) + TRAMPOLINE(2244) + TRAMPOLINE(2245) + TRAMPOLINE(2246) + TRAMPOLINE(2247) + TRAMPOLINE(2248) + TRAMPOLINE(2249) + TRAMPOLINE(2250) + TRAMPOLINE(2251) + TRAMPOLINE(2252) + TRAMPOLINE(2253) + TRAMPOLINE(2254) + TRAMPOLINE(2255) + TRAMPOLINE(2256) + TRAMPOLINE(2257) + TRAMPOLINE(2258) + TRAMPOLINE(2259) + TRAMPOLINE(2260) + TRAMPOLINE(2261) + TRAMPOLINE(2262) + TRAMPOLINE(2263) + TRAMPOLINE(2264) + TRAMPOLINE(2265) + TRAMPOLINE(2266) + TRAMPOLINE(2267) + TRAMPOLINE(2268) + TRAMPOLINE(2269) + TRAMPOLINE(2270) + TRAMPOLINE(2271) + TRAMPOLINE(2272) + TRAMPOLINE(2273) + TRAMPOLINE(2274) + TRAMPOLINE(2275) + TRAMPOLINE(2276) + TRAMPOLINE(2277) + TRAMPOLINE(2278) + TRAMPOLINE(2279) + TRAMPOLINE(2280) + TRAMPOLINE(2281) + TRAMPOLINE(2282) + TRAMPOLINE(2283) + TRAMPOLINE(2284) + TRAMPOLINE(2285) + TRAMPOLINE(2286) + TRAMPOLINE(2287) + TRAMPOLINE(2288) + TRAMPOLINE(2289) + TRAMPOLINE(2290) + TRAMPOLINE(2291) + TRAMPOLINE(2292) + TRAMPOLINE(2293) + TRAMPOLINE(2294) + TRAMPOLINE(2295) + TRAMPOLINE(2296) + TRAMPOLINE(2297) + TRAMPOLINE(2298) + TRAMPOLINE(2299) + TRAMPOLINE(2300) + TRAMPOLINE(2301) + TRAMPOLINE(2302) + TRAMPOLINE(2303) + TRAMPOLINE(2304) + TRAMPOLINE(2305) + TRAMPOLINE(2306) + TRAMPOLINE(2307) + TRAMPOLINE(2308) + TRAMPOLINE(2309) + TRAMPOLINE(2310) + TRAMPOLINE(2311) + TRAMPOLINE(2312) + TRAMPOLINE(2313) + TRAMPOLINE(2314) + TRAMPOLINE(2315) + TRAMPOLINE(2316) + TRAMPOLINE(2317) + TRAMPOLINE(2318) + TRAMPOLINE(2319) + TRAMPOLINE(2320) + TRAMPOLINE(2321) + TRAMPOLINE(2322) + TRAMPOLINE(2323) + TRAMPOLINE(2324) + TRAMPOLINE(2325) + TRAMPOLINE(2326) + TRAMPOLINE(2327) + TRAMPOLINE(2328) + TRAMPOLINE(2329) + TRAMPOLINE(2330) + TRAMPOLINE(2331) + TRAMPOLINE(2332) + TRAMPOLINE(2333) + TRAMPOLINE(2334) + TRAMPOLINE(2335) + TRAMPOLINE(2336) + TRAMPOLINE(2337) + TRAMPOLINE(2338) + TRAMPOLINE(2339) + TRAMPOLINE(2340) + TRAMPOLINE(2341) + TRAMPOLINE(2342) + TRAMPOLINE(2343) + TRAMPOLINE(2344) + TRAMPOLINE(2345) + TRAMPOLINE(2346) + TRAMPOLINE(2347) + TRAMPOLINE(2348) + TRAMPOLINE(2349) + TRAMPOLINE(2350) + TRAMPOLINE(2351) + TRAMPOLINE(2352) + TRAMPOLINE(2353) + TRAMPOLINE(2354) + TRAMPOLINE(2355) + TRAMPOLINE(2356) + TRAMPOLINE(2357) + TRAMPOLINE(2358) + TRAMPOLINE(2359) + TRAMPOLINE(2360) + TRAMPOLINE(2361) + TRAMPOLINE(2362) + TRAMPOLINE(2363) + TRAMPOLINE(2364) + TRAMPOLINE(2365) + TRAMPOLINE(2366) + TRAMPOLINE(2367) + TRAMPOLINE(2368) + TRAMPOLINE(2369) + TRAMPOLINE(2370) + TRAMPOLINE(2371) + TRAMPOLINE(2372) + TRAMPOLINE(2373) + TRAMPOLINE(2374) + TRAMPOLINE(2375) + TRAMPOLINE(2376) + TRAMPOLINE(2377) + TRAMPOLINE(2378) + TRAMPOLINE(2379) + TRAMPOLINE(2380) + TRAMPOLINE(2381) + TRAMPOLINE(2382) + TRAMPOLINE(2383) + TRAMPOLINE(2384) + TRAMPOLINE(2385) + TRAMPOLINE(2386) + TRAMPOLINE(2387) + TRAMPOLINE(2388) + TRAMPOLINE(2389) + TRAMPOLINE(2390) + TRAMPOLINE(2391) + TRAMPOLINE(2392) + TRAMPOLINE(2393) + TRAMPOLINE(2394) + TRAMPOLINE(2395) + TRAMPOLINE(2396) + TRAMPOLINE(2397) + TRAMPOLINE(2398) + TRAMPOLINE(2399) + TRAMPOLINE(2400) + TRAMPOLINE(2401) + TRAMPOLINE(2402) + TRAMPOLINE(2403) + TRAMPOLINE(2404) + TRAMPOLINE(2405) + TRAMPOLINE(2406) + TRAMPOLINE(2407) + TRAMPOLINE(2408) + TRAMPOLINE(2409) + TRAMPOLINE(2410) + TRAMPOLINE(2411) + TRAMPOLINE(2412) + TRAMPOLINE(2413) + TRAMPOLINE(2414) + TRAMPOLINE(2415) + TRAMPOLINE(2416) + TRAMPOLINE(2417) + TRAMPOLINE(2418) + TRAMPOLINE(2419) + TRAMPOLINE(2420) + TRAMPOLINE(2421) + TRAMPOLINE(2422) + TRAMPOLINE(2423) + TRAMPOLINE(2424) + TRAMPOLINE(2425) + TRAMPOLINE(2426) + TRAMPOLINE(2427) + TRAMPOLINE(2428) + TRAMPOLINE(2429) + TRAMPOLINE(2430) + TRAMPOLINE(2431) + TRAMPOLINE(2432) + TRAMPOLINE(2433) + TRAMPOLINE(2434) + TRAMPOLINE(2435) + TRAMPOLINE(2436) + TRAMPOLINE(2437) + TRAMPOLINE(2438) + TRAMPOLINE(2439) + TRAMPOLINE(2440) + TRAMPOLINE(2441) + TRAMPOLINE(2442) + TRAMPOLINE(2443) + TRAMPOLINE(2444) + TRAMPOLINE(2445) + TRAMPOLINE(2446) + TRAMPOLINE(2447) + TRAMPOLINE(2448) + TRAMPOLINE(2449) + TRAMPOLINE(2450) + TRAMPOLINE(2451) + TRAMPOLINE(2452) + TRAMPOLINE(2453) + TRAMPOLINE(2454) + TRAMPOLINE(2455) + TRAMPOLINE(2456) + TRAMPOLINE(2457) + TRAMPOLINE(2458) + TRAMPOLINE(2459) + TRAMPOLINE(2460) + TRAMPOLINE(2461) + TRAMPOLINE(2462) + TRAMPOLINE(2463) + TRAMPOLINE(2464) + TRAMPOLINE(2465) + TRAMPOLINE(2466) + TRAMPOLINE(2467) + TRAMPOLINE(2468) + TRAMPOLINE(2469) + TRAMPOLINE(2470) + TRAMPOLINE(2471) + TRAMPOLINE(2472) + TRAMPOLINE(2473) + TRAMPOLINE(2474) + TRAMPOLINE(2475) + TRAMPOLINE(2476) + TRAMPOLINE(2477) + TRAMPOLINE(2478) + TRAMPOLINE(2479) + TRAMPOLINE(2480) + TRAMPOLINE(2481) + TRAMPOLINE(2482) + TRAMPOLINE(2483) + TRAMPOLINE(2484) + TRAMPOLINE(2485) + TRAMPOLINE(2486) + TRAMPOLINE(2487) + TRAMPOLINE(2488) + TRAMPOLINE(2489) + TRAMPOLINE(2490) + TRAMPOLINE(2491) + TRAMPOLINE(2492) + TRAMPOLINE(2493) + TRAMPOLINE(2494) + TRAMPOLINE(2495) + TRAMPOLINE(2496) + TRAMPOLINE(2497) + TRAMPOLINE(2498) + TRAMPOLINE(2499) + TRAMPOLINE(2500) + TRAMPOLINE(2501) + TRAMPOLINE(2502) + TRAMPOLINE(2503) + TRAMPOLINE(2504) + TRAMPOLINE(2505) + TRAMPOLINE(2506) + TRAMPOLINE(2507) + TRAMPOLINE(2508) + TRAMPOLINE(2509) + TRAMPOLINE(2510) + TRAMPOLINE(2511) + TRAMPOLINE(2512) + TRAMPOLINE(2513) + TRAMPOLINE(2514) + TRAMPOLINE(2515) + TRAMPOLINE(2516) + TRAMPOLINE(2517) + TRAMPOLINE(2518) + TRAMPOLINE(2519) + TRAMPOLINE(2520) + TRAMPOLINE(2521) + TRAMPOLINE(2522) + TRAMPOLINE(2523) + TRAMPOLINE(2524) + TRAMPOLINE(2525) + TRAMPOLINE(2526) + TRAMPOLINE(2527) + TRAMPOLINE(2528) + TRAMPOLINE(2529) + TRAMPOLINE(2530) + TRAMPOLINE(2531) + TRAMPOLINE(2532) + TRAMPOLINE(2533) + TRAMPOLINE(2534) + TRAMPOLINE(2535) + TRAMPOLINE(2536) + TRAMPOLINE(2537) + TRAMPOLINE(2538) + TRAMPOLINE(2539) + TRAMPOLINE(2540) + TRAMPOLINE(2541) + TRAMPOLINE(2542) + TRAMPOLINE(2543) + TRAMPOLINE(2544) + TRAMPOLINE(2545) + TRAMPOLINE(2546) + TRAMPOLINE(2547) + TRAMPOLINE(2548) + TRAMPOLINE(2549) + TRAMPOLINE(2550) + TRAMPOLINE(2551) + TRAMPOLINE(2552) + TRAMPOLINE(2553) + TRAMPOLINE(2554) + TRAMPOLINE(2555) + TRAMPOLINE(2556) + TRAMPOLINE(2557) + TRAMPOLINE(2558) + TRAMPOLINE(2559) + TRAMPOLINE(2560) + TRAMPOLINE(2561) + TRAMPOLINE(2562) + TRAMPOLINE(2563) + TRAMPOLINE(2564) + TRAMPOLINE(2565) + TRAMPOLINE(2566) + TRAMPOLINE(2567) + TRAMPOLINE(2568) + TRAMPOLINE(2569) + TRAMPOLINE(2570) + TRAMPOLINE(2571) + TRAMPOLINE(2572) + TRAMPOLINE(2573) + TRAMPOLINE(2574) + TRAMPOLINE(2575) + TRAMPOLINE(2576) + TRAMPOLINE(2577) + TRAMPOLINE(2578) + TRAMPOLINE(2579) + TRAMPOLINE(2580) + TRAMPOLINE(2581) + TRAMPOLINE(2582) + TRAMPOLINE(2583) + TRAMPOLINE(2584) + TRAMPOLINE(2585) + TRAMPOLINE(2586) + TRAMPOLINE(2587) + TRAMPOLINE(2588) + TRAMPOLINE(2589) + TRAMPOLINE(2590) + TRAMPOLINE(2591) + TRAMPOLINE(2592) + TRAMPOLINE(2593) + TRAMPOLINE(2594) + TRAMPOLINE(2595) + TRAMPOLINE(2596) + TRAMPOLINE(2597) + TRAMPOLINE(2598) + TRAMPOLINE(2599) + TRAMPOLINE(2600) + TRAMPOLINE(2601) + TRAMPOLINE(2602) + TRAMPOLINE(2603) + TRAMPOLINE(2604) + TRAMPOLINE(2605) + TRAMPOLINE(2606) + TRAMPOLINE(2607) + TRAMPOLINE(2608) + TRAMPOLINE(2609) + TRAMPOLINE(2610) + TRAMPOLINE(2611) + TRAMPOLINE(2612) + TRAMPOLINE(2613) + TRAMPOLINE(2614) + TRAMPOLINE(2615) + TRAMPOLINE(2616) + TRAMPOLINE(2617) + TRAMPOLINE(2618) + TRAMPOLINE(2619) + TRAMPOLINE(2620) + TRAMPOLINE(2621) + TRAMPOLINE(2622) + TRAMPOLINE(2623) + TRAMPOLINE(2624) + TRAMPOLINE(2625) + TRAMPOLINE(2626) + TRAMPOLINE(2627) + TRAMPOLINE(2628) + TRAMPOLINE(2629) + TRAMPOLINE(2630) + TRAMPOLINE(2631) + TRAMPOLINE(2632) + TRAMPOLINE(2633) + TRAMPOLINE(2634) + TRAMPOLINE(2635) + TRAMPOLINE(2636) + TRAMPOLINE(2637) + TRAMPOLINE(2638) + TRAMPOLINE(2639) + TRAMPOLINE(2640) + TRAMPOLINE(2641) + TRAMPOLINE(2642) + TRAMPOLINE(2643) + TRAMPOLINE(2644) + TRAMPOLINE(2645) + TRAMPOLINE(2646) + TRAMPOLINE(2647) + TRAMPOLINE(2648) + TRAMPOLINE(2649) + TRAMPOLINE(2650) + TRAMPOLINE(2651) + TRAMPOLINE(2652) + TRAMPOLINE(2653) + TRAMPOLINE(2654) + TRAMPOLINE(2655) + TRAMPOLINE(2656) + TRAMPOLINE(2657) + TRAMPOLINE(2658) + TRAMPOLINE(2659) + TRAMPOLINE(2660) + TRAMPOLINE(2661) + TRAMPOLINE(2662) + TRAMPOLINE(2663) + TRAMPOLINE(2664) + TRAMPOLINE(2665) + TRAMPOLINE(2666) + TRAMPOLINE(2667) + TRAMPOLINE(2668) + TRAMPOLINE(2669) + TRAMPOLINE(2670) + TRAMPOLINE(2671) + TRAMPOLINE(2672) + TRAMPOLINE(2673) + TRAMPOLINE(2674) + TRAMPOLINE(2675) + TRAMPOLINE(2676) + TRAMPOLINE(2677) + TRAMPOLINE(2678) + TRAMPOLINE(2679) + TRAMPOLINE(2680) + TRAMPOLINE(2681) + TRAMPOLINE(2682) + TRAMPOLINE(2683) + TRAMPOLINE(2684) + TRAMPOLINE(2685) + TRAMPOLINE(2686) + TRAMPOLINE(2687) + TRAMPOLINE(2688) + TRAMPOLINE(2689) + TRAMPOLINE(2690) + TRAMPOLINE(2691) + TRAMPOLINE(2692) + TRAMPOLINE(2693) + TRAMPOLINE(2694) + TRAMPOLINE(2695) + TRAMPOLINE(2696) + TRAMPOLINE(2697) + TRAMPOLINE(2698) + TRAMPOLINE(2699) + TRAMPOLINE(2700) + TRAMPOLINE(2701) + TRAMPOLINE(2702) + TRAMPOLINE(2703) + TRAMPOLINE(2704) + TRAMPOLINE(2705) + TRAMPOLINE(2706) + TRAMPOLINE(2707) + TRAMPOLINE(2708) + TRAMPOLINE(2709) + TRAMPOLINE(2710) + TRAMPOLINE(2711) + TRAMPOLINE(2712) + TRAMPOLINE(2713) + TRAMPOLINE(2714) + TRAMPOLINE(2715) + TRAMPOLINE(2716) + TRAMPOLINE(2717) + TRAMPOLINE(2718) + TRAMPOLINE(2719) + TRAMPOLINE(2720) + TRAMPOLINE(2721) + TRAMPOLINE(2722) + TRAMPOLINE(2723) + TRAMPOLINE(2724) + TRAMPOLINE(2725) + TRAMPOLINE(2726) + TRAMPOLINE(2727) + TRAMPOLINE(2728) + TRAMPOLINE(2729) + TRAMPOLINE(2730) + TRAMPOLINE(2731) + TRAMPOLINE(2732) + TRAMPOLINE(2733) + TRAMPOLINE(2734) + TRAMPOLINE(2735) + TRAMPOLINE(2736) + TRAMPOLINE(2737) + TRAMPOLINE(2738) + TRAMPOLINE(2739) + TRAMPOLINE(2740) + TRAMPOLINE(2741) + TRAMPOLINE(2742) + TRAMPOLINE(2743) + TRAMPOLINE(2744) + TRAMPOLINE(2745) + TRAMPOLINE(2746) + TRAMPOLINE(2747) + TRAMPOLINE(2748) + TRAMPOLINE(2749) + TRAMPOLINE(2750) + TRAMPOLINE(2751) + TRAMPOLINE(2752) + TRAMPOLINE(2753) + TRAMPOLINE(2754) + TRAMPOLINE(2755) + TRAMPOLINE(2756) + TRAMPOLINE(2757) + TRAMPOLINE(2758) + TRAMPOLINE(2759) + TRAMPOLINE(2760) + TRAMPOLINE(2761) + TRAMPOLINE(2762) + TRAMPOLINE(2763) + TRAMPOLINE(2764) + TRAMPOLINE(2765) + TRAMPOLINE(2766) + TRAMPOLINE(2767) + TRAMPOLINE(2768) + TRAMPOLINE(2769) + TRAMPOLINE(2770) + TRAMPOLINE(2771) + TRAMPOLINE(2772) + TRAMPOLINE(2773) + TRAMPOLINE(2774) + TRAMPOLINE(2775) + TRAMPOLINE(2776) + TRAMPOLINE(2777) + TRAMPOLINE(2778) + TRAMPOLINE(2779) + TRAMPOLINE(2780) + TRAMPOLINE(2781) + TRAMPOLINE(2782) + TRAMPOLINE(2783) + TRAMPOLINE(2784) + TRAMPOLINE(2785) + TRAMPOLINE(2786) + TRAMPOLINE(2787) + TRAMPOLINE(2788) + TRAMPOLINE(2789) + TRAMPOLINE(2790) + TRAMPOLINE(2791) + TRAMPOLINE(2792) + TRAMPOLINE(2793) + TRAMPOLINE(2794) + TRAMPOLINE(2795) + TRAMPOLINE(2796) + TRAMPOLINE(2797) + TRAMPOLINE(2798) + TRAMPOLINE(2799) + TRAMPOLINE(2800) + TRAMPOLINE(2801) + TRAMPOLINE(2802) + TRAMPOLINE(2803) + TRAMPOLINE(2804) + TRAMPOLINE(2805) + TRAMPOLINE(2806) + TRAMPOLINE(2807) + TRAMPOLINE(2808) + TRAMPOLINE(2809) + TRAMPOLINE(2810) + TRAMPOLINE(2811) + TRAMPOLINE(2812) + TRAMPOLINE(2813) + TRAMPOLINE(2814) + TRAMPOLINE(2815) + TRAMPOLINE(2816) + TRAMPOLINE(2817) + TRAMPOLINE(2818) + TRAMPOLINE(2819) + TRAMPOLINE(2820) + TRAMPOLINE(2821) + TRAMPOLINE(2822) + TRAMPOLINE(2823) + TRAMPOLINE(2824) + TRAMPOLINE(2825) + TRAMPOLINE(2826) + TRAMPOLINE(2827) + TRAMPOLINE(2828) + TRAMPOLINE(2829) + TRAMPOLINE(2830) + TRAMPOLINE(2831) + TRAMPOLINE(2832) + TRAMPOLINE(2833) + TRAMPOLINE(2834) + TRAMPOLINE(2835) + TRAMPOLINE(2836) + TRAMPOLINE(2837) + TRAMPOLINE(2838) + TRAMPOLINE(2839) + TRAMPOLINE(2840) + TRAMPOLINE(2841) + TRAMPOLINE(2842) + TRAMPOLINE(2843) + TRAMPOLINE(2844) + TRAMPOLINE(2845) + TRAMPOLINE(2846) + TRAMPOLINE(2847) + TRAMPOLINE(2848) + TRAMPOLINE(2849) + TRAMPOLINE(2850) + TRAMPOLINE(2851) + TRAMPOLINE(2852) + TRAMPOLINE(2853) + TRAMPOLINE(2854) + TRAMPOLINE(2855) + TRAMPOLINE(2856) + TRAMPOLINE(2857) + TRAMPOLINE(2858) + TRAMPOLINE(2859) + TRAMPOLINE(2860) + TRAMPOLINE(2861) + TRAMPOLINE(2862) + TRAMPOLINE(2863) + TRAMPOLINE(2864) + TRAMPOLINE(2865) + TRAMPOLINE(2866) + TRAMPOLINE(2867) + TRAMPOLINE(2868) + TRAMPOLINE(2869) + TRAMPOLINE(2870) + TRAMPOLINE(2871) + TRAMPOLINE(2872) + TRAMPOLINE(2873) + TRAMPOLINE(2874) + TRAMPOLINE(2875) + TRAMPOLINE(2876) + TRAMPOLINE(2877) + TRAMPOLINE(2878) + TRAMPOLINE(2879) + TRAMPOLINE(2880) + TRAMPOLINE(2881) + TRAMPOLINE(2882) + TRAMPOLINE(2883) + TRAMPOLINE(2884) + TRAMPOLINE(2885) + TRAMPOLINE(2886) + TRAMPOLINE(2887) + TRAMPOLINE(2888) + TRAMPOLINE(2889) + TRAMPOLINE(2890) + TRAMPOLINE(2891) + TRAMPOLINE(2892) + TRAMPOLINE(2893) + TRAMPOLINE(2894) + TRAMPOLINE(2895) + TRAMPOLINE(2896) + TRAMPOLINE(2897) + TRAMPOLINE(2898) + TRAMPOLINE(2899) + TRAMPOLINE(2900) + TRAMPOLINE(2901) + TRAMPOLINE(2902) + TRAMPOLINE(2903) + TRAMPOLINE(2904) + TRAMPOLINE(2905) + TRAMPOLINE(2906) + TRAMPOLINE(2907) + TRAMPOLINE(2908) + TRAMPOLINE(2909) + TRAMPOLINE(2910) + TRAMPOLINE(2911) + TRAMPOLINE(2912) + TRAMPOLINE(2913) + TRAMPOLINE(2914) + TRAMPOLINE(2915) + TRAMPOLINE(2916) + TRAMPOLINE(2917) + TRAMPOLINE(2918) + TRAMPOLINE(2919) + TRAMPOLINE(2920) + TRAMPOLINE(2921) + TRAMPOLINE(2922) + TRAMPOLINE(2923) + TRAMPOLINE(2924) + TRAMPOLINE(2925) + TRAMPOLINE(2926) + TRAMPOLINE(2927) + TRAMPOLINE(2928) + TRAMPOLINE(2929) + TRAMPOLINE(2930) + TRAMPOLINE(2931) + TRAMPOLINE(2932) + TRAMPOLINE(2933) + TRAMPOLINE(2934) + TRAMPOLINE(2935) + TRAMPOLINE(2936) + TRAMPOLINE(2937) + TRAMPOLINE(2938) + TRAMPOLINE(2939) + TRAMPOLINE(2940) + TRAMPOLINE(2941) + TRAMPOLINE(2942) + TRAMPOLINE(2943) + TRAMPOLINE(2944) + TRAMPOLINE(2945) + TRAMPOLINE(2946) + TRAMPOLINE(2947) + TRAMPOLINE(2948) + TRAMPOLINE(2949) + TRAMPOLINE(2950) + TRAMPOLINE(2951) + TRAMPOLINE(2952) + TRAMPOLINE(2953) + TRAMPOLINE(2954) + TRAMPOLINE(2955) + TRAMPOLINE(2956) + TRAMPOLINE(2957) + TRAMPOLINE(2958) + TRAMPOLINE(2959) + TRAMPOLINE(2960) + TRAMPOLINE(2961) + TRAMPOLINE(2962) + TRAMPOLINE(2963) + TRAMPOLINE(2964) + TRAMPOLINE(2965) + TRAMPOLINE(2966) + TRAMPOLINE(2967) + TRAMPOLINE(2968) + TRAMPOLINE(2969) + TRAMPOLINE(2970) + TRAMPOLINE(2971) + TRAMPOLINE(2972) + TRAMPOLINE(2973) + TRAMPOLINE(2974) + TRAMPOLINE(2975) + TRAMPOLINE(2976) + TRAMPOLINE(2977) + TRAMPOLINE(2978) + TRAMPOLINE(2979) + TRAMPOLINE(2980) + TRAMPOLINE(2981) + TRAMPOLINE(2982) + TRAMPOLINE(2983) + TRAMPOLINE(2984) + TRAMPOLINE(2985) + TRAMPOLINE(2986) + TRAMPOLINE(2987) + TRAMPOLINE(2988) + TRAMPOLINE(2989) + TRAMPOLINE(2990) + TRAMPOLINE(2991) + TRAMPOLINE(2992) + TRAMPOLINE(2993) + TRAMPOLINE(2994) + TRAMPOLINE(2995) + TRAMPOLINE(2996) + TRAMPOLINE(2997) + TRAMPOLINE(2998) + TRAMPOLINE(2999) + TRAMPOLINE(3000) + TRAMPOLINE(3001) + TRAMPOLINE(3002) + TRAMPOLINE(3003) + TRAMPOLINE(3004) + TRAMPOLINE(3005) + TRAMPOLINE(3006) + TRAMPOLINE(3007) + TRAMPOLINE(3008) + TRAMPOLINE(3009) + TRAMPOLINE(3010) + TRAMPOLINE(3011) + TRAMPOLINE(3012) + TRAMPOLINE(3013) + TRAMPOLINE(3014) + TRAMPOLINE(3015) + TRAMPOLINE(3016) + TRAMPOLINE(3017) + TRAMPOLINE(3018) + TRAMPOLINE(3019) + TRAMPOLINE(3020) + TRAMPOLINE(3021) + TRAMPOLINE(3022) + TRAMPOLINE(3023) + TRAMPOLINE(3024) + TRAMPOLINE(3025) + TRAMPOLINE(3026) + TRAMPOLINE(3027) + TRAMPOLINE(3028) + TRAMPOLINE(3029) + TRAMPOLINE(3030) + TRAMPOLINE(3031) + TRAMPOLINE(3032) + TRAMPOLINE(3033) + TRAMPOLINE(3034) + TRAMPOLINE(3035) + TRAMPOLINE(3036) + TRAMPOLINE(3037) + TRAMPOLINE(3038) + TRAMPOLINE(3039) + TRAMPOLINE(3040) + TRAMPOLINE(3041) + TRAMPOLINE(3042) + TRAMPOLINE(3043) + TRAMPOLINE(3044) + TRAMPOLINE(3045) + TRAMPOLINE(3046) + TRAMPOLINE(3047) + TRAMPOLINE(3048) + TRAMPOLINE(3049) + TRAMPOLINE(3050) + TRAMPOLINE(3051) + TRAMPOLINE(3052) + TRAMPOLINE(3053) + TRAMPOLINE(3054) + TRAMPOLINE(3055) + TRAMPOLINE(3056) + TRAMPOLINE(3057) + TRAMPOLINE(3058) + TRAMPOLINE(3059) + TRAMPOLINE(3060) + TRAMPOLINE(3061) + TRAMPOLINE(3062) + TRAMPOLINE(3063) + TRAMPOLINE(3064) + TRAMPOLINE(3065) + TRAMPOLINE(3066) + TRAMPOLINE(3067) + TRAMPOLINE(3068) + TRAMPOLINE(3069) + TRAMPOLINE(3070) + TRAMPOLINE(3071) + TRAMPOLINE(3072) + TRAMPOLINE(3073) + TRAMPOLINE(3074) + TRAMPOLINE(3075) + TRAMPOLINE(3076) + TRAMPOLINE(3077) + TRAMPOLINE(3078) + TRAMPOLINE(3079) + TRAMPOLINE(3080) + TRAMPOLINE(3081) + TRAMPOLINE(3082) + TRAMPOLINE(3083) + TRAMPOLINE(3084) + TRAMPOLINE(3085) + TRAMPOLINE(3086) + TRAMPOLINE(3087) + TRAMPOLINE(3088) + TRAMPOLINE(3089) + TRAMPOLINE(3090) + TRAMPOLINE(3091) + TRAMPOLINE(3092) + TRAMPOLINE(3093) + TRAMPOLINE(3094) + TRAMPOLINE(3095) + TRAMPOLINE(3096) + TRAMPOLINE(3097) + TRAMPOLINE(3098) + TRAMPOLINE(3099) + TRAMPOLINE(3100) + TRAMPOLINE(3101) + TRAMPOLINE(3102) + TRAMPOLINE(3103) + TRAMPOLINE(3104) + TRAMPOLINE(3105) + TRAMPOLINE(3106) + TRAMPOLINE(3107) + TRAMPOLINE(3108) + TRAMPOLINE(3109) + TRAMPOLINE(3110) + TRAMPOLINE(3111) + TRAMPOLINE(3112) + TRAMPOLINE(3113) + TRAMPOLINE(3114) + TRAMPOLINE(3115) + TRAMPOLINE(3116) + TRAMPOLINE(3117) + TRAMPOLINE(3118) + TRAMPOLINE(3119) + TRAMPOLINE(3120) + TRAMPOLINE(3121) + TRAMPOLINE(3122) + TRAMPOLINE(3123) + TRAMPOLINE(3124) + TRAMPOLINE(3125) + TRAMPOLINE(3126) + TRAMPOLINE(3127) + TRAMPOLINE(3128) + TRAMPOLINE(3129) + TRAMPOLINE(3130) + TRAMPOLINE(3131) + TRAMPOLINE(3132) + TRAMPOLINE(3133) + TRAMPOLINE(3134) + TRAMPOLINE(3135) + TRAMPOLINE(3136) + TRAMPOLINE(3137) + TRAMPOLINE(3138) + TRAMPOLINE(3139) + TRAMPOLINE(3140) + TRAMPOLINE(3141) + TRAMPOLINE(3142) + TRAMPOLINE(3143) + TRAMPOLINE(3144) + TRAMPOLINE(3145) + TRAMPOLINE(3146) + TRAMPOLINE(3147) + TRAMPOLINE(3148) + TRAMPOLINE(3149) + TRAMPOLINE(3150) + TRAMPOLINE(3151) + TRAMPOLINE(3152) + TRAMPOLINE(3153) + TRAMPOLINE(3154) + TRAMPOLINE(3155) + TRAMPOLINE(3156) + TRAMPOLINE(3157) + TRAMPOLINE(3158) + TRAMPOLINE(3159) + TRAMPOLINE(3160) + TRAMPOLINE(3161) + TRAMPOLINE(3162) + TRAMPOLINE(3163) + TRAMPOLINE(3164) + TRAMPOLINE(3165) + TRAMPOLINE(3166) + TRAMPOLINE(3167) + TRAMPOLINE(3168) + TRAMPOLINE(3169) + TRAMPOLINE(3170) + TRAMPOLINE(3171) + TRAMPOLINE(3172) + TRAMPOLINE(3173) + TRAMPOLINE(3174) + TRAMPOLINE(3175) + TRAMPOLINE(3176) + TRAMPOLINE(3177) + TRAMPOLINE(3178) + TRAMPOLINE(3179) + TRAMPOLINE(3180) + TRAMPOLINE(3181) + TRAMPOLINE(3182) + TRAMPOLINE(3183) + TRAMPOLINE(3184) + TRAMPOLINE(3185) + TRAMPOLINE(3186) + TRAMPOLINE(3187) + TRAMPOLINE(3188) + TRAMPOLINE(3189) + TRAMPOLINE(3190) + TRAMPOLINE(3191) + TRAMPOLINE(3192) + TRAMPOLINE(3193) + TRAMPOLINE(3194) + TRAMPOLINE(3195) + TRAMPOLINE(3196) + TRAMPOLINE(3197) + TRAMPOLINE(3198) + TRAMPOLINE(3199) + TRAMPOLINE(3200) + TRAMPOLINE(3201) + TRAMPOLINE(3202) + TRAMPOLINE(3203) + TRAMPOLINE(3204) + TRAMPOLINE(3205) + TRAMPOLINE(3206) + TRAMPOLINE(3207) + TRAMPOLINE(3208) + TRAMPOLINE(3209) + TRAMPOLINE(3210) + TRAMPOLINE(3211) + TRAMPOLINE(3212) + TRAMPOLINE(3213) + TRAMPOLINE(3214) + TRAMPOLINE(3215) + TRAMPOLINE(3216) + TRAMPOLINE(3217) + TRAMPOLINE(3218) + TRAMPOLINE(3219) + TRAMPOLINE(3220) + TRAMPOLINE(3221) + TRAMPOLINE(3222) + TRAMPOLINE(3223) + TRAMPOLINE(3224) + TRAMPOLINE(3225) + TRAMPOLINE(3226) + TRAMPOLINE(3227) + TRAMPOLINE(3228) + TRAMPOLINE(3229) + TRAMPOLINE(3230) + TRAMPOLINE(3231) + TRAMPOLINE(3232) + TRAMPOLINE(3233) + TRAMPOLINE(3234) + TRAMPOLINE(3235) + TRAMPOLINE(3236) + TRAMPOLINE(3237) + TRAMPOLINE(3238) + TRAMPOLINE(3239) + TRAMPOLINE(3240) + TRAMPOLINE(3241) + TRAMPOLINE(3242) + TRAMPOLINE(3243) + TRAMPOLINE(3244) + TRAMPOLINE(3245) + TRAMPOLINE(3246) + TRAMPOLINE(3247) + TRAMPOLINE(3248) + TRAMPOLINE(3249) + TRAMPOLINE(3250) + TRAMPOLINE(3251) + TRAMPOLINE(3252) + TRAMPOLINE(3253) + TRAMPOLINE(3254) + TRAMPOLINE(3255) + TRAMPOLINE(3256) + TRAMPOLINE(3257) + TRAMPOLINE(3258) + TRAMPOLINE(3259) + TRAMPOLINE(3260) + TRAMPOLINE(3261) + TRAMPOLINE(3262) + TRAMPOLINE(3263) + TRAMPOLINE(3264) + TRAMPOLINE(3265) + TRAMPOLINE(3266) + TRAMPOLINE(3267) + TRAMPOLINE(3268) + TRAMPOLINE(3269) + TRAMPOLINE(3270) + TRAMPOLINE(3271) + TRAMPOLINE(3272) + TRAMPOLINE(3273) + TRAMPOLINE(3274) + TRAMPOLINE(3275) + TRAMPOLINE(3276) + TRAMPOLINE(3277) + TRAMPOLINE(3278) + TRAMPOLINE(3279) + TRAMPOLINE(3280) + TRAMPOLINE(3281) + TRAMPOLINE(3282) + TRAMPOLINE(3283) + TRAMPOLINE(3284) + TRAMPOLINE(3285) + TRAMPOLINE(3286) + TRAMPOLINE(3287) + TRAMPOLINE(3288) + TRAMPOLINE(3289) + TRAMPOLINE(3290) + TRAMPOLINE(3291) + TRAMPOLINE(3292) + TRAMPOLINE(3293) + TRAMPOLINE(3294) + TRAMPOLINE(3295) + TRAMPOLINE(3296) + TRAMPOLINE(3297) + TRAMPOLINE(3298) + TRAMPOLINE(3299) + TRAMPOLINE(3300) + TRAMPOLINE(3301) + TRAMPOLINE(3302) + TRAMPOLINE(3303) + TRAMPOLINE(3304) + TRAMPOLINE(3305) + TRAMPOLINE(3306) + TRAMPOLINE(3307) + TRAMPOLINE(3308) + TRAMPOLINE(3309) + TRAMPOLINE(3310) + TRAMPOLINE(3311) + TRAMPOLINE(3312) + TRAMPOLINE(3313) + TRAMPOLINE(3314) + TRAMPOLINE(3315) + TRAMPOLINE(3316) + TRAMPOLINE(3317) + TRAMPOLINE(3318) + TRAMPOLINE(3319) + TRAMPOLINE(3320) + TRAMPOLINE(3321) + TRAMPOLINE(3322) + TRAMPOLINE(3323) + TRAMPOLINE(3324) + TRAMPOLINE(3325) + TRAMPOLINE(3326) + TRAMPOLINE(3327) + TRAMPOLINE(3328) + TRAMPOLINE(3329) + TRAMPOLINE(3330) + TRAMPOLINE(3331) + TRAMPOLINE(3332) + TRAMPOLINE(3333) + TRAMPOLINE(3334) + TRAMPOLINE(3335) + TRAMPOLINE(3336) + TRAMPOLINE(3337) + TRAMPOLINE(3338) + TRAMPOLINE(3339) + TRAMPOLINE(3340) + TRAMPOLINE(3341) + TRAMPOLINE(3342) + TRAMPOLINE(3343) + TRAMPOLINE(3344) + TRAMPOLINE(3345) + TRAMPOLINE(3346) + TRAMPOLINE(3347) + TRAMPOLINE(3348) + TRAMPOLINE(3349) + TRAMPOLINE(3350) + TRAMPOLINE(3351) + TRAMPOLINE(3352) + TRAMPOLINE(3353) + TRAMPOLINE(3354) + TRAMPOLINE(3355) + TRAMPOLINE(3356) + TRAMPOLINE(3357) + TRAMPOLINE(3358) + TRAMPOLINE(3359) + TRAMPOLINE(3360) + TRAMPOLINE(3361) + TRAMPOLINE(3362) + TRAMPOLINE(3363) + TRAMPOLINE(3364) + TRAMPOLINE(3365) + TRAMPOLINE(3366) + TRAMPOLINE(3367) + TRAMPOLINE(3368) + TRAMPOLINE(3369) + TRAMPOLINE(3370) + TRAMPOLINE(3371) + TRAMPOLINE(3372) + TRAMPOLINE(3373) + TRAMPOLINE(3374) + TRAMPOLINE(3375) + TRAMPOLINE(3376) + TRAMPOLINE(3377) + TRAMPOLINE(3378) + TRAMPOLINE(3379) + TRAMPOLINE(3380) + TRAMPOLINE(3381) + TRAMPOLINE(3382) + TRAMPOLINE(3383) + TRAMPOLINE(3384) + TRAMPOLINE(3385) + TRAMPOLINE(3386) + TRAMPOLINE(3387) + TRAMPOLINE(3388) + TRAMPOLINE(3389) + TRAMPOLINE(3390) + TRAMPOLINE(3391) + TRAMPOLINE(3392) + TRAMPOLINE(3393) + TRAMPOLINE(3394) + TRAMPOLINE(3395) + TRAMPOLINE(3396) + TRAMPOLINE(3397) + TRAMPOLINE(3398) + TRAMPOLINE(3399) + TRAMPOLINE(3400) + TRAMPOLINE(3401) + TRAMPOLINE(3402) + TRAMPOLINE(3403) + TRAMPOLINE(3404) + TRAMPOLINE(3405) + TRAMPOLINE(3406) + TRAMPOLINE(3407) + TRAMPOLINE(3408) + TRAMPOLINE(3409) + TRAMPOLINE(3410) + TRAMPOLINE(3411) + TRAMPOLINE(3412) + TRAMPOLINE(3413) + TRAMPOLINE(3414) + TRAMPOLINE(3415) + TRAMPOLINE(3416) + TRAMPOLINE(3417) + TRAMPOLINE(3418) + TRAMPOLINE(3419) + TRAMPOLINE(3420) + TRAMPOLINE(3421) + TRAMPOLINE(3422) + TRAMPOLINE(3423) + TRAMPOLINE(3424) + TRAMPOLINE(3425) + TRAMPOLINE(3426) + TRAMPOLINE(3427) + TRAMPOLINE(3428) + TRAMPOLINE(3429) + TRAMPOLINE(3430) + TRAMPOLINE(3431) + TRAMPOLINE(3432) + TRAMPOLINE(3433) + TRAMPOLINE(3434) + TRAMPOLINE(3435) + TRAMPOLINE(3436) + TRAMPOLINE(3437) + TRAMPOLINE(3438) + TRAMPOLINE(3439) + TRAMPOLINE(3440) + TRAMPOLINE(3441) + TRAMPOLINE(3442) + TRAMPOLINE(3443) + TRAMPOLINE(3444) + TRAMPOLINE(3445) + TRAMPOLINE(3446) + TRAMPOLINE(3447) + TRAMPOLINE(3448) + TRAMPOLINE(3449) + TRAMPOLINE(3450) + TRAMPOLINE(3451) + TRAMPOLINE(3452) + TRAMPOLINE(3453) + TRAMPOLINE(3454) + TRAMPOLINE(3455) + TRAMPOLINE(3456) + TRAMPOLINE(3457) + TRAMPOLINE(3458) + TRAMPOLINE(3459) + TRAMPOLINE(3460) + TRAMPOLINE(3461) + TRAMPOLINE(3462) + TRAMPOLINE(3463) + TRAMPOLINE(3464) + TRAMPOLINE(3465) + TRAMPOLINE(3466) + TRAMPOLINE(3467) + TRAMPOLINE(3468) + TRAMPOLINE(3469) + TRAMPOLINE(3470) + TRAMPOLINE(3471) + TRAMPOLINE(3472) + TRAMPOLINE(3473) + TRAMPOLINE(3474) + TRAMPOLINE(3475) + TRAMPOLINE(3476) + TRAMPOLINE(3477) + TRAMPOLINE(3478) + TRAMPOLINE(3479) + TRAMPOLINE(3480) + TRAMPOLINE(3481) + TRAMPOLINE(3482) + TRAMPOLINE(3483) + TRAMPOLINE(3484) + TRAMPOLINE(3485) + TRAMPOLINE(3486) + TRAMPOLINE(3487) + TRAMPOLINE(3488) + TRAMPOLINE(3489) + TRAMPOLINE(3490) + TRAMPOLINE(3491) + TRAMPOLINE(3492) + TRAMPOLINE(3493) + TRAMPOLINE(3494) + TRAMPOLINE(3495) + TRAMPOLINE(3496) + TRAMPOLINE(3497) + TRAMPOLINE(3498) + TRAMPOLINE(3499) + TRAMPOLINE(3500) + TRAMPOLINE(3501) + TRAMPOLINE(3502) + TRAMPOLINE(3503) + TRAMPOLINE(3504) + TRAMPOLINE(3505) + TRAMPOLINE(3506) + TRAMPOLINE(3507) + TRAMPOLINE(3508) + TRAMPOLINE(3509) + TRAMPOLINE(3510) + TRAMPOLINE(3511) + TRAMPOLINE(3512) + TRAMPOLINE(3513) + TRAMPOLINE(3514) + TRAMPOLINE(3515) + TRAMPOLINE(3516) + TRAMPOLINE(3517) + TRAMPOLINE(3518) + TRAMPOLINE(3519) + TRAMPOLINE(3520) + TRAMPOLINE(3521) + TRAMPOLINE(3522) + TRAMPOLINE(3523) + TRAMPOLINE(3524) + TRAMPOLINE(3525) + TRAMPOLINE(3526) + TRAMPOLINE(3527) + TRAMPOLINE(3528) + TRAMPOLINE(3529) + TRAMPOLINE(3530) + TRAMPOLINE(3531) + TRAMPOLINE(3532) + TRAMPOLINE(3533) + TRAMPOLINE(3534) + TRAMPOLINE(3535) + TRAMPOLINE(3536) + TRAMPOLINE(3537) + TRAMPOLINE(3538) + TRAMPOLINE(3539) + TRAMPOLINE(3540) + TRAMPOLINE(3541) + TRAMPOLINE(3542) + TRAMPOLINE(3543) + TRAMPOLINE(3544) + TRAMPOLINE(3545) + TRAMPOLINE(3546) + TRAMPOLINE(3547) + TRAMPOLINE(3548) + TRAMPOLINE(3549) + TRAMPOLINE(3550) + TRAMPOLINE(3551) + TRAMPOLINE(3552) + TRAMPOLINE(3553) + TRAMPOLINE(3554) + TRAMPOLINE(3555) + TRAMPOLINE(3556) + TRAMPOLINE(3557) + TRAMPOLINE(3558) + TRAMPOLINE(3559) + TRAMPOLINE(3560) + TRAMPOLINE(3561) + TRAMPOLINE(3562) + TRAMPOLINE(3563) + TRAMPOLINE(3564) + TRAMPOLINE(3565) + TRAMPOLINE(3566) + TRAMPOLINE(3567) + TRAMPOLINE(3568) + TRAMPOLINE(3569) + TRAMPOLINE(3570) + TRAMPOLINE(3571) + TRAMPOLINE(3572) + TRAMPOLINE(3573) + TRAMPOLINE(3574) + TRAMPOLINE(3575) + TRAMPOLINE(3576) + TRAMPOLINE(3577) + TRAMPOLINE(3578) + TRAMPOLINE(3579) + TRAMPOLINE(3580) + TRAMPOLINE(3581) + TRAMPOLINE(3582) + TRAMPOLINE(3583) + TRAMPOLINE(3584) + TRAMPOLINE(3585) + TRAMPOLINE(3586) + TRAMPOLINE(3587) + TRAMPOLINE(3588) + TRAMPOLINE(3589) + TRAMPOLINE(3590) + TRAMPOLINE(3591) + TRAMPOLINE(3592) + TRAMPOLINE(3593) + TRAMPOLINE(3594) + TRAMPOLINE(3595) + TRAMPOLINE(3596) + TRAMPOLINE(3597) + TRAMPOLINE(3598) + TRAMPOLINE(3599) + TRAMPOLINE(3600) + TRAMPOLINE(3601) + TRAMPOLINE(3602) + TRAMPOLINE(3603) + TRAMPOLINE(3604) + TRAMPOLINE(3605) + TRAMPOLINE(3606) + TRAMPOLINE(3607) + TRAMPOLINE(3608) + TRAMPOLINE(3609) + TRAMPOLINE(3610) + TRAMPOLINE(3611) + TRAMPOLINE(3612) + TRAMPOLINE(3613) + TRAMPOLINE(3614) + TRAMPOLINE(3615) + TRAMPOLINE(3616) + TRAMPOLINE(3617) + TRAMPOLINE(3618) + TRAMPOLINE(3619) + TRAMPOLINE(3620) + TRAMPOLINE(3621) + TRAMPOLINE(3622) + TRAMPOLINE(3623) + TRAMPOLINE(3624) + TRAMPOLINE(3625) + TRAMPOLINE(3626) + TRAMPOLINE(3627) + TRAMPOLINE(3628) + TRAMPOLINE(3629) + TRAMPOLINE(3630) + TRAMPOLINE(3631) + TRAMPOLINE(3632) + TRAMPOLINE(3633) + TRAMPOLINE(3634) + TRAMPOLINE(3635) + TRAMPOLINE(3636) + TRAMPOLINE(3637) + TRAMPOLINE(3638) + TRAMPOLINE(3639) + TRAMPOLINE(3640) + TRAMPOLINE(3641) + TRAMPOLINE(3642) + TRAMPOLINE(3643) + TRAMPOLINE(3644) + TRAMPOLINE(3645) + TRAMPOLINE(3646) + TRAMPOLINE(3647) + TRAMPOLINE(3648) + TRAMPOLINE(3649) + TRAMPOLINE(3650) + TRAMPOLINE(3651) + TRAMPOLINE(3652) + TRAMPOLINE(3653) + TRAMPOLINE(3654) + TRAMPOLINE(3655) + TRAMPOLINE(3656) + TRAMPOLINE(3657) + TRAMPOLINE(3658) + TRAMPOLINE(3659) + TRAMPOLINE(3660) + TRAMPOLINE(3661) + TRAMPOLINE(3662) + TRAMPOLINE(3663) + TRAMPOLINE(3664) + TRAMPOLINE(3665) + TRAMPOLINE(3666) + TRAMPOLINE(3667) + TRAMPOLINE(3668) + TRAMPOLINE(3669) + TRAMPOLINE(3670) + TRAMPOLINE(3671) + TRAMPOLINE(3672) + TRAMPOLINE(3673) + TRAMPOLINE(3674) + TRAMPOLINE(3675) + TRAMPOLINE(3676) + TRAMPOLINE(3677) + TRAMPOLINE(3678) + TRAMPOLINE(3679) + TRAMPOLINE(3680) + TRAMPOLINE(3681) + TRAMPOLINE(3682) + TRAMPOLINE(3683) + TRAMPOLINE(3684) + TRAMPOLINE(3685) + TRAMPOLINE(3686) + TRAMPOLINE(3687) + TRAMPOLINE(3688) + TRAMPOLINE(3689) + TRAMPOLINE(3690) + TRAMPOLINE(3691) + TRAMPOLINE(3692) + TRAMPOLINE(3693) + TRAMPOLINE(3694) + TRAMPOLINE(3695) + TRAMPOLINE(3696) + TRAMPOLINE(3697) + TRAMPOLINE(3698) + TRAMPOLINE(3699) + TRAMPOLINE(3700) + TRAMPOLINE(3701) + TRAMPOLINE(3702) + TRAMPOLINE(3703) + TRAMPOLINE(3704) + TRAMPOLINE(3705) + TRAMPOLINE(3706) + TRAMPOLINE(3707) + TRAMPOLINE(3708) + TRAMPOLINE(3709) + TRAMPOLINE(3710) + TRAMPOLINE(3711) + TRAMPOLINE(3712) + TRAMPOLINE(3713) + TRAMPOLINE(3714) + TRAMPOLINE(3715) + TRAMPOLINE(3716) + TRAMPOLINE(3717) + TRAMPOLINE(3718) + TRAMPOLINE(3719) + TRAMPOLINE(3720) + TRAMPOLINE(3721) + TRAMPOLINE(3722) + TRAMPOLINE(3723) + TRAMPOLINE(3724) + TRAMPOLINE(3725) + TRAMPOLINE(3726) + TRAMPOLINE(3727) + TRAMPOLINE(3728) + TRAMPOLINE(3729) + TRAMPOLINE(3730) + TRAMPOLINE(3731) + TRAMPOLINE(3732) + TRAMPOLINE(3733) + TRAMPOLINE(3734) + TRAMPOLINE(3735) + TRAMPOLINE(3736) + TRAMPOLINE(3737) + TRAMPOLINE(3738) + TRAMPOLINE(3739) + TRAMPOLINE(3740) + TRAMPOLINE(3741) + TRAMPOLINE(3742) + TRAMPOLINE(3743) + TRAMPOLINE(3744) + TRAMPOLINE(3745) + TRAMPOLINE(3746) + TRAMPOLINE(3747) + TRAMPOLINE(3748) + TRAMPOLINE(3749) + TRAMPOLINE(3750) + TRAMPOLINE(3751) + TRAMPOLINE(3752) + TRAMPOLINE(3753) + TRAMPOLINE(3754) + TRAMPOLINE(3755) + TRAMPOLINE(3756) + TRAMPOLINE(3757) + TRAMPOLINE(3758) + TRAMPOLINE(3759) + TRAMPOLINE(3760) + TRAMPOLINE(3761) + TRAMPOLINE(3762) + TRAMPOLINE(3763) + TRAMPOLINE(3764) + TRAMPOLINE(3765) + TRAMPOLINE(3766) + TRAMPOLINE(3767) + TRAMPOLINE(3768) + TRAMPOLINE(3769) + TRAMPOLINE(3770) + TRAMPOLINE(3771) + TRAMPOLINE(3772) + TRAMPOLINE(3773) + TRAMPOLINE(3774) + TRAMPOLINE(3775) + TRAMPOLINE(3776) + TRAMPOLINE(3777) + TRAMPOLINE(3778) + TRAMPOLINE(3779) + TRAMPOLINE(3780) + TRAMPOLINE(3781) + TRAMPOLINE(3782) + TRAMPOLINE(3783) + TRAMPOLINE(3784) + TRAMPOLINE(3785) + TRAMPOLINE(3786) + TRAMPOLINE(3787) + TRAMPOLINE(3788) + TRAMPOLINE(3789) + TRAMPOLINE(3790) + TRAMPOLINE(3791) + TRAMPOLINE(3792) + TRAMPOLINE(3793) + TRAMPOLINE(3794) + TRAMPOLINE(3795) + TRAMPOLINE(3796) + TRAMPOLINE(3797) + TRAMPOLINE(3798) + TRAMPOLINE(3799) + TRAMPOLINE(3800) + TRAMPOLINE(3801) + TRAMPOLINE(3802) + TRAMPOLINE(3803) + TRAMPOLINE(3804) + TRAMPOLINE(3805) + TRAMPOLINE(3806) + TRAMPOLINE(3807) + TRAMPOLINE(3808) + TRAMPOLINE(3809) + TRAMPOLINE(3810) + TRAMPOLINE(3811) + TRAMPOLINE(3812) + TRAMPOLINE(3813) + TRAMPOLINE(3814) + TRAMPOLINE(3815) + TRAMPOLINE(3816) + TRAMPOLINE(3817) + TRAMPOLINE(3818) + TRAMPOLINE(3819) + TRAMPOLINE(3820) + TRAMPOLINE(3821) + TRAMPOLINE(3822) + TRAMPOLINE(3823) + TRAMPOLINE(3824) + TRAMPOLINE(3825) + TRAMPOLINE(3826) + TRAMPOLINE(3827) + TRAMPOLINE(3828) + TRAMPOLINE(3829) + TRAMPOLINE(3830) + TRAMPOLINE(3831) + TRAMPOLINE(3832) + TRAMPOLINE(3833) + TRAMPOLINE(3834) + TRAMPOLINE(3835) + TRAMPOLINE(3836) + TRAMPOLINE(3837) + TRAMPOLINE(3838) + TRAMPOLINE(3839) + TRAMPOLINE(3840) + TRAMPOLINE(3841) + TRAMPOLINE(3842) + TRAMPOLINE(3843) + TRAMPOLINE(3844) + TRAMPOLINE(3845) + TRAMPOLINE(3846) + TRAMPOLINE(3847) + TRAMPOLINE(3848) + TRAMPOLINE(3849) + TRAMPOLINE(3850) + TRAMPOLINE(3851) + TRAMPOLINE(3852) + TRAMPOLINE(3853) + TRAMPOLINE(3854) + TRAMPOLINE(3855) + TRAMPOLINE(3856) + TRAMPOLINE(3857) + TRAMPOLINE(3858) + TRAMPOLINE(3859) + TRAMPOLINE(3860) + TRAMPOLINE(3861) + TRAMPOLINE(3862) + TRAMPOLINE(3863) + TRAMPOLINE(3864) + TRAMPOLINE(3865) + TRAMPOLINE(3866) + TRAMPOLINE(3867) + TRAMPOLINE(3868) + TRAMPOLINE(3869) + TRAMPOLINE(3870) + TRAMPOLINE(3871) + TRAMPOLINE(3872) + TRAMPOLINE(3873) + TRAMPOLINE(3874) + TRAMPOLINE(3875) + TRAMPOLINE(3876) + TRAMPOLINE(3877) + TRAMPOLINE(3878) + TRAMPOLINE(3879) + TRAMPOLINE(3880) + TRAMPOLINE(3881) + TRAMPOLINE(3882) + TRAMPOLINE(3883) + TRAMPOLINE(3884) + TRAMPOLINE(3885) + TRAMPOLINE(3886) + TRAMPOLINE(3887) + TRAMPOLINE(3888) + TRAMPOLINE(3889) + TRAMPOLINE(3890) + TRAMPOLINE(3891) + TRAMPOLINE(3892) + TRAMPOLINE(3893) + TRAMPOLINE(3894) + TRAMPOLINE(3895) + TRAMPOLINE(3896) + TRAMPOLINE(3897) + TRAMPOLINE(3898) + TRAMPOLINE(3899) + TRAMPOLINE(3900) + TRAMPOLINE(3901) + TRAMPOLINE(3902) + TRAMPOLINE(3903) + TRAMPOLINE(3904) + TRAMPOLINE(3905) + TRAMPOLINE(3906) + TRAMPOLINE(3907) + TRAMPOLINE(3908) + TRAMPOLINE(3909) + TRAMPOLINE(3910) + TRAMPOLINE(3911) + TRAMPOLINE(3912) + TRAMPOLINE(3913) + TRAMPOLINE(3914) + TRAMPOLINE(3915) + TRAMPOLINE(3916) + TRAMPOLINE(3917) + TRAMPOLINE(3918) + TRAMPOLINE(3919) + TRAMPOLINE(3920) + TRAMPOLINE(3921) + TRAMPOLINE(3922) + TRAMPOLINE(3923) + TRAMPOLINE(3924) + TRAMPOLINE(3925) + TRAMPOLINE(3926) + TRAMPOLINE(3927) + TRAMPOLINE(3928) + TRAMPOLINE(3929) + TRAMPOLINE(3930) + TRAMPOLINE(3931) + TRAMPOLINE(3932) + TRAMPOLINE(3933) + TRAMPOLINE(3934) + TRAMPOLINE(3935) + TRAMPOLINE(3936) + TRAMPOLINE(3937) + TRAMPOLINE(3938) + TRAMPOLINE(3939) + TRAMPOLINE(3940) + TRAMPOLINE(3941) + TRAMPOLINE(3942) + TRAMPOLINE(3943) + TRAMPOLINE(3944) + TRAMPOLINE(3945) + TRAMPOLINE(3946) + TRAMPOLINE(3947) + TRAMPOLINE(3948) + TRAMPOLINE(3949) + TRAMPOLINE(3950) + TRAMPOLINE(3951) + TRAMPOLINE(3952) + TRAMPOLINE(3953) + TRAMPOLINE(3954) + TRAMPOLINE(3955) + TRAMPOLINE(3956) + TRAMPOLINE(3957) + TRAMPOLINE(3958) + TRAMPOLINE(3959) + TRAMPOLINE(3960) + TRAMPOLINE(3961) + TRAMPOLINE(3962) + TRAMPOLINE(3963) + TRAMPOLINE(3964) + TRAMPOLINE(3965) + TRAMPOLINE(3966) + TRAMPOLINE(3967) + TRAMPOLINE(3968) + TRAMPOLINE(3969) + TRAMPOLINE(3970) + TRAMPOLINE(3971) + TRAMPOLINE(3972) + TRAMPOLINE(3973) + TRAMPOLINE(3974) + TRAMPOLINE(3975) + TRAMPOLINE(3976) + TRAMPOLINE(3977) + TRAMPOLINE(3978) + TRAMPOLINE(3979) + TRAMPOLINE(3980) + TRAMPOLINE(3981) + TRAMPOLINE(3982) + TRAMPOLINE(3983) + TRAMPOLINE(3984) + TRAMPOLINE(3985) + TRAMPOLINE(3986) + TRAMPOLINE(3987) + TRAMPOLINE(3988) + TRAMPOLINE(3989) + TRAMPOLINE(3990) + TRAMPOLINE(3991) + TRAMPOLINE(3992) + TRAMPOLINE(3993) + TRAMPOLINE(3994) + TRAMPOLINE(3995) + TRAMPOLINE(3996) + TRAMPOLINE(3997) + TRAMPOLINE(3998) + TRAMPOLINE(3999) + TRAMPOLINE(4000) + TRAMPOLINE(4001) + TRAMPOLINE(4002) + TRAMPOLINE(4003) + TRAMPOLINE(4004) + TRAMPOLINE(4005) + TRAMPOLINE(4006) + TRAMPOLINE(4007) + TRAMPOLINE(4008) + TRAMPOLINE(4009) + TRAMPOLINE(4010) + TRAMPOLINE(4011) + TRAMPOLINE(4012) + TRAMPOLINE(4013) + TRAMPOLINE(4014) + TRAMPOLINE(4015) + TRAMPOLINE(4016) + TRAMPOLINE(4017) + TRAMPOLINE(4018) + TRAMPOLINE(4019) + TRAMPOLINE(4020) + TRAMPOLINE(4021) + TRAMPOLINE(4022) + TRAMPOLINE(4023) + TRAMPOLINE(4024) + TRAMPOLINE(4025) + TRAMPOLINE(4026) + TRAMPOLINE(4027) + TRAMPOLINE(4028) + TRAMPOLINE(4029) + TRAMPOLINE(4030) + TRAMPOLINE(4031) + TRAMPOLINE(4032) + TRAMPOLINE(4033) + TRAMPOLINE(4034) + TRAMPOLINE(4035) + TRAMPOLINE(4036) + TRAMPOLINE(4037) + TRAMPOLINE(4038) + TRAMPOLINE(4039) + TRAMPOLINE(4040) + TRAMPOLINE(4041) + TRAMPOLINE(4042) + TRAMPOLINE(4043) + TRAMPOLINE(4044) + TRAMPOLINE(4045) + TRAMPOLINE(4046) + TRAMPOLINE(4047) + TRAMPOLINE(4048) + TRAMPOLINE(4049) + TRAMPOLINE(4050) + TRAMPOLINE(4051) + TRAMPOLINE(4052) + TRAMPOLINE(4053) + TRAMPOLINE(4054) + TRAMPOLINE(4055) + TRAMPOLINE(4056) + TRAMPOLINE(4057) + TRAMPOLINE(4058) + TRAMPOLINE(4059) + TRAMPOLINE(4060) + TRAMPOLINE(4061) + TRAMPOLINE(4062) + TRAMPOLINE(4063) + TRAMPOLINE(4064) + TRAMPOLINE(4065) + TRAMPOLINE(4066) + TRAMPOLINE(4067) + TRAMPOLINE(4068) + TRAMPOLINE(4069) + TRAMPOLINE(4070) + TRAMPOLINE(4071) + TRAMPOLINE(4072) + TRAMPOLINE(4073) + TRAMPOLINE(4074) + TRAMPOLINE(4075) + TRAMPOLINE(4076) + TRAMPOLINE(4077) + TRAMPOLINE(4078) + TRAMPOLINE(4079) + TRAMPOLINE(4080) + TRAMPOLINE(4081) + TRAMPOLINE(4082) + TRAMPOLINE(4083) + TRAMPOLINE(4084) + TRAMPOLINE(4085) + TRAMPOLINE(4086) + TRAMPOLINE(4087) + TRAMPOLINE(4088) + TRAMPOLINE(4089) + TRAMPOLINE(4090) + TRAMPOLINE(4091) + TRAMPOLINE(4092) + TRAMPOLINE(4093) + TRAMPOLINE(4094) + TRAMPOLINE(4095) + } +#endif + + /* call function with 1st 6 args */ + i = ({ register __avrword iret __asm__("%o0"); + iret = (*l->func)(l->args[0], l->args[1], l->args[2], + l->args[3], l->args[4], l->args[5]); + asm ("nop"); /* struct returning functions skip this instruction */ + iret; + }); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, i); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, i); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, i); + } else + if (l->rtype == __AVshort) { + RETURN(short, i); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, i); + } else + if (l->rtype == __AVint) { + RETURN(int, i); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, i); + } else + if (l->rtype == __AVlong) { + RETURN(long, i); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, i); + } else + if (l->rtype == __AVlonglong || l->rtype == __AVulonglong) { + void* raddr = l->raddr; + ((__avrword*)raddr)[0] = i; + ((__avrword*)raddr)[1] = o1; + } else + if (l->rtype == __AVfloat) { + /* old Sun cc returns floats as doubles */ + if (l->flags & __AV_SUNCC_FLOAT_RETURN) { + RETURN(float, (float)dret); + } else { + RETURN(float, fret); + } + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, i); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_SMALL_STRUCT_RETURN) { + if (l->rsize == sizeof(char)) { + RETURN(char, i); + } else + if (l->rsize == sizeof(short)) { + RETURN(short, i); + } else + if (l->rsize == sizeof(int)) { + RETURN(int, i); + } + } + } + return 0; +} diff --git a/avcall/avcall-sparc64-linux.s b/avcall/avcall-sparc64-linux.s new file mode 100644 index 0000000..56ee4e1 --- /dev/null +++ b/avcall/avcall-sparc64-linux.s @@ -0,0 +1,520 @@ + .file "avcall-sparc64.c" + .section ".text" + .align 4 + .global avcall_call + .type avcall_call, #function + .proc 04 +avcall_call: + .register %g2, #scratch + .register %g3, #scratch + save %sp, -192, %sp + ldx [%i0+48], %g2 + ldx [%i0+40], %g1 + lduw [%i0+68], %g3 + sub %g1, %g2, %g1 + cmp %g3, 0 + be,pt %icc, .LL2 + srlx %g1, 3, %o7 + andcc %g3, 1, %g0 + bne,pt %xcc, .LL97 + andcc %g3, 2, %g0 + bne,pt %xcc, .LL98 + andcc %g3, 4, %g0 +.LL133: + bne,pt %xcc, .LL99 + andcc %g3, 8, %g0 +.LL132: + bne,pt %xcc, .LL100 + andcc %g3, 16, %g0 +.LL131: + bne,pt %xcc, .LL101 + andcc %g3, 32, %g0 +.LL130: + bne,pt %xcc, .LL102 + andcc %g3, 64, %g0 +.LL129: + bne,pt %xcc, .LL103 + andcc %g3, 128, %g0 +.LL128: + bne,pt %xcc, .LL104 + andcc %g3, 256, %g0 +.LL127: + bne,pt %xcc, .LL105 + andcc %g3, 512, %g0 +.LL126: + bne,pt %xcc, .LL106 + andcc %g3, 1024, %g0 +.LL125: + bne,pt %xcc, .LL107 + andcc %g3, 2048, %g0 +.LL124: + bne,pt %xcc, .LL108 + sethi %hi(4096), %g1 +.LL123: + andcc %g3, %g1, %g0 + bne,pt %icc, .LL109 + sethi %hi(8192), %g1 +.LL122: + andcc %g3, %g1, %g0 + bne,pt %icc, .LL110 + sethi %hi(16384), %g1 +.LL121: + andcc %g3, %g1, %g0 + bne,pt %icc, .LL111 + sethi %hi(32768), %g1 +.LL120: + andcc %g3, %g1, %g0 + bne,pt %icc, .LL112 + nop +.LL2: + cmp %o7, 6 +.LL119: + bg,pn %icc, .LL117 + add %o7, -6, %g1 + ldx [%i0+48], %g3 +.LL118: + ldx [%g3+40], %o5 +.LL116: + ldx [%i0+8], %g1 + ldx [%g3], %o0 + ldx [%g3+8], %o1 + ldx [%g3+16], %o2 + ldx [%g3+24], %o3 + call %g1, 0 + ldx [%g3+32], %o4 + mov %o0, %l3 + nop + lduw [%i0+24], %g1 + cmp %g1, 1 + be,pn %icc, .LL38 + cmp %g1, 2 + be,pn %icc, .LL89 + cmp %g1, 3 + be,pn %icc, .LL89 + cmp %g1, 4 + be,pn %icc, .LL89 + cmp %g1, 5 + be,pn %icc, .LL90 + cmp %g1, 6 + be,pn %icc, .LL90 + cmp %g1, 7 + be,pn %icc, .LL91 + cmp %g1, 8 + be,pn %icc, .LL91 + cmp %g1, 9 + be,pn %icc, .LL95 + cmp %g1, 10 + be,pn %icc, .LL95 + cmp %g1, 11 + be,pn %icc, .LL95 + cmp %g1, 12 + be,pn %icc, .LL95 + cmp %g1, 13 + be,pn %icc, .LL114 + cmp %g1, 14 + be,pn %icc, .LL115 + cmp %g1, 15 + be,pn %icc, .LL95 + cmp %g1, 16 + bne,pt %icc, .LL38 + nop + lduw [%i0], %g1 + andcc %g1, 512, %g0 + be,pn %xcc, .LL38 + nop + ldx [%i0+32], %g2 + add %g2, -1, %g1 + cmp %g1, 31 + bgu,pn %xcc, .LL38 + cmp %g2, 8 + ldx [%i0+16], %g1 + and %g1, 7, %g5 + and %g1, -8, %i0 + bgu,pt %xcc, .LL71 + add %g2, %g5, %g4 + cmp %g4, 8 + bgu,pt %xcc, .LL73 + sllx %g5, 3, %g2 + sllx %g5, 3, %g3 + sllx %g4, 3, %g4 + ldx [%i0], %g5 + srax %o0, %g3, %o7 + sub %g0, %g4, %g4 + xor %g5, %o7, %o7 + xnor %g0, %g3, %g3 + mov 2, %g1 + mov 1, %g2 + sllx %g1, %g3, %g1 + sllx %g2, %g4, %g2 + sub %g1, %g2, %g1 + and %g1, %o7, %g1 + xor %g5, %g1, %g5 + ba,pt %xcc, .LL38 + stx %g5, [%i0] +.LL89: + ldx [%i0+16], %g1 + stb %l3, [%g1] +.LL38: + return %i7+8 + mov 0, %o0 +.LL112: + ldd [%g2+120],%f30 + cmp %o7, 6 + ble,a,pt %icc, .LL118 + ldx [%i0+48], %g3 + add %o7, -6, %g1 +.LL117: + sra %g1, 0, %g1 + sllx %g1, 3, %g1 + add %g1, 15, %g1 + and %g1, -16, %g1 + mov 6, %g4 + sub %sp, %g1, %sp + ldx [%i0+48], %g3 + add %sp, 2238, %g1 + and %g1, -16, %g1 + add %g1, -48, %g5 +.LL37: + sra %g4, 0, %g1 + add %g4, 1, %g4 + sllx %g1, 3, %g1 + cmp %o7, %g4 + ldx [%g1+%g3], %g2 + bne,pt %icc, .LL37 + stx %g2, [%g5+%g1] + ba,pt %xcc, .LL116 + ldx [%g3+40], %o5 +.LL111: + ldd [%g2+112],%f28 + sethi %hi(32768), %g1 + andcc %g3, %g1, %g0 + be,pt %icc, .LL119 + cmp %o7, 6 + ba,pt %xcc, .LL112 + nop +.LL110: + ldd [%g2+104],%f26 + sethi %hi(16384), %g1 + andcc %g3, %g1, %g0 + be,pt %icc, .LL120 + sethi %hi(32768), %g1 + ba,pt %xcc, .LL111 + nop +.LL109: + ldd [%g2+96],%f24 + sethi %hi(8192), %g1 + andcc %g3, %g1, %g0 + be,pt %icc, .LL121 + sethi %hi(16384), %g1 + ba,pt %xcc, .LL110 + nop +.LL108: + ldd [%g2+88],%f22 + sethi %hi(4096), %g1 + andcc %g3, %g1, %g0 + be,pt %icc, .LL122 + sethi %hi(8192), %g1 + ba,pt %xcc, .LL109 + nop +.LL107: + ldd [%g2+80],%f20 + andcc %g3, 2048, %g0 + be,pt %xcc, .LL123 + sethi %hi(4096), %g1 + ba,pt %xcc, .LL108 + nop +.LL106: + ldd [%g2+72],%f18 + andcc %g3, 1024, %g0 + be,pt %xcc, .LL124 + andcc %g3, 2048, %g0 + ba,pt %xcc, .LL107 + nop +.LL105: + ldd [%g2+64],%f16 + andcc %g3, 512, %g0 + be,pt %xcc, .LL125 + andcc %g3, 1024, %g0 + ba,pt %xcc, .LL106 + nop +.LL104: + ldd [%g2+56],%f14 + andcc %g3, 256, %g0 + be,pt %xcc, .LL126 + andcc %g3, 512, %g0 + ba,pt %xcc, .LL105 + nop +.LL103: + ldd [%g2+48],%f12 + andcc %g3, 128, %g0 + be,pt %xcc, .LL127 + andcc %g3, 256, %g0 + ba,pt %xcc, .LL104 + nop +.LL102: + ldd [%g2+40],%f10 + andcc %g3, 64, %g0 + be,pt %xcc, .LL128 + andcc %g3, 128, %g0 + ba,pt %xcc, .LL103 + nop +.LL101: + ldd [%g2+32],%f8 + andcc %g3, 32, %g0 + be,pt %xcc, .LL129 + andcc %g3, 64, %g0 + ba,pt %xcc, .LL102 + nop +.LL100: + ldd [%g2+24],%f6 + andcc %g3, 16, %g0 + be,pt %xcc, .LL130 + andcc %g3, 32, %g0 + ba,pt %xcc, .LL101 + nop +.LL99: + ldd [%g2+16],%f4 + andcc %g3, 8, %g0 + be,pt %xcc, .LL131 + andcc %g3, 16, %g0 + ba,pt %xcc, .LL100 + nop +.LL98: + ldd [%g2+8],%f2 + andcc %g3, 4, %g0 + be,pt %xcc, .LL132 + andcc %g3, 8, %g0 + ba,pt %xcc, .LL99 + nop +.LL97: + ldd [%g2+0],%f0 + andcc %g3, 2, %g0 + be,pt %xcc, .LL133 + andcc %g3, 4, %g0 + ba,pt %xcc, .LL98 + nop +.LL90: + ldx [%i0+16], %g1 + sth %l3, [%g1] + return %i7+8 + mov 0, %o0 +.LL95: + ldx [%i0+16], %g1 + ba,pt %xcc, .LL38 + stx %l3, [%g1] +.LL91: + ldx [%i0+16], %g1 + ba,pt %xcc, .LL38 + st %l3, [%g1] +.LL114: + ldx [%i0+16], %g1 + ba,pt %xcc, .LL38 + st %f0, [%g1] +.LL115: + ldx [%i0+16], %g1 + ba,pt %xcc, .LL38 + std %f0, [%g1] +.LL71: + cmp %g2, 16 + bgu,pt %xcc, .LL75 + cmp %g2, 24 + sll %g5, 3, %l2 + xnor %g0, %l2, %g2 + ldx [%i0], %g3 + mov 2, %g1 + cmp %g4, 16 + sllx %g1, %g2, %g1 + srax %o0, %l2, %g2 + add %g1, -1, %g1 + xor %g3, %g2, %g2 + and %g1, %g2, %g1 + xor %g3, %g1, %g3 + bgu,pt %xcc, .LL77 + stx %g3, [%i0] + sllx %g5, 2, %g5 + mov 32, %g2 + sub %g2, %g5, %g2 + ldx [%i0+8], %g3 + sllx %o0, %g2, %g1 + sllx %g4, 3, %g4 + sllx %g1, %g2, %g1 + srax %o1, %l2, %o7 + sub %g0, %g4, %g4 + or %g1, %o7, %g1 + mov -1, %g2 + xor %g3, %g1, %g1 + sllx %g2, %g4, %g2 + and %g2, %g1, %g2 + xor %g3, %g2, %g3 + ba,pt %xcc, .LL38 + stx %g3, [%i0+8] +.LL73: + sllx %g4, 3, %l0 + ldx [%i0], %g5 + srax %o0, %g2, %g4 + sub %g0, %g2, %g3 + xor %g5, %g4, %g4 + xnor %g0, %g2, %g2 + mov 2, %g1 + sllx %g1, %g2, %g1 + add %g1, -1, %g1 + and %g1, %g4, %g1 + ldx [%i0+8], %o7 + xor %g5, %g1, %g5 + sub %g0, %l0, %l0 + sllx %o0, %g3, %g3 + mov -1, %g1 + xor %o7, %g3, %g3 + sllx %g1, %l0, %g1 + stx %g5, [%i0] + and %g1, %g3, %g1 + xor %o7, %g1, %o7 + ba,pt %xcc, .LL38 + stx %o7, [%i0+8] +.LL77: + srax %o1, %l2, %g5 + mov 64, %g1 + sub %g1, %l2, %g1 + sllx %o1, %g1, %g2 + sllx %o0, %g1, %g1 + or %g1, %g5, %g1 + sllx %g4, 3, %g3 + stx %g1, [%i0+8] + ldx [%i0+16], %g4 + sub %g0, %g3, %g3 + xor %g4, %g2, %g2 + mov -1, %g1 + sllx %g1, %g3, %g1 + and %g1, %g2, %g1 + xor %g4, %g1, %g4 + ba,pt %xcc, .LL38 + stx %g4, [%i0+16] +.LL75: + bgu,pt %xcc, .LL79 + sll %g5, 3, %l4 + sll %g5, 3, %l2 + xnor %g0, %l2, %g2 + ldx [%i0], %g3 + mov 2, %g1 + cmp %g4, 24 + sllx %g1, %g2, %g1 + srax %o0, %l2, %g2 + add %g1, -1, %g1 + xor %g3, %g2, %g2 + and %g1, %g2, %g1 + xor %g3, %g1, %g3 + bgu,pt %xcc, .LL81 + stx %g3, [%i0] + sllx %g5, 2, %g2 + mov 32, %g1 + sub %g1, %g2, %g1 + ldx [%i0+16], %o7 + sllx %g4, 3, %g5 + sllx %o0, %g1, %g3 + sllx %o1, %g1, %g2 + sllx %g3, %g1, %g3 + sllx %g2, %g1, %g2 + srax %o2, %l2, %l0 + sub %g0, %g5, %g5 + or %g2, %l0, %g2 + srax %o1, %l2, %g4 + xor %o7, %g2, %g2 + or %g3, %g4, %g3 + mov -1, %g1 + stx %g3, [%i0+8] + sllx %g1, %g5, %g1 + and %g1, %g2, %g1 + xor %o7, %g1, %o7 + ba,pt %xcc, .LL38 + stx %o7, [%i0+16] +.LL79: + xnor %g0, %l4, %g2 + ldx [%i0], %g3 + mov 2, %g1 + cmp %g4, 32 + sllx %g1, %g2, %g1 + srax %o0, %l4, %g2 + add %g1, -1, %g1 + xor %g3, %g2, %g2 + and %g1, %g2, %g1 + xor %g3, %g1, %g3 + bgu,pt %xcc, .LL83 + stx %g3, [%i0] + sllx %g5, 2, %g2 + mov 32, %g1 + sub %g1, %g2, %g1 + ldx [%i0+24], %l0 + sllx %g4, 3, %l1 + sllx %o0, %g1, %g3 + sllx %o1, %g1, %g4 + sllx %g3, %g1, %g3 + sllx %g4, %g1, %g4 + sllx %o2, %g1, %g2 + srax %o3, %l4, %l2 + sllx %g2, %g1, %g2 + sub %g0, %l1, %l1 + or %g2, %l2, %g2 + srax %o1, %l4, %g5 + xor %l0, %g2, %g2 + or %g3, %g5, %g3 + srax %o2, %l4, %o7 + mov -1, %g1 + or %g4, %o7, %g4 + sllx %g1, %l1, %g1 + stx %g3, [%i0+8] + and %g1, %g2, %g1 + stx %g4, [%i0+16] + xor %l0, %g1, %l0 + ba,pt %xcc, .LL38 + stx %l0, [%i0+24] +.LL81: + sllx %g4, 3, %g5 + srax %o2, %l2, %l0 + mov 64, %g1 + sub %g1, %l2, %g1 + sllx %o2, %g1, %g4 + sllx %o0, %g1, %g2 + sllx %o1, %g1, %g1 + or %g1, %l0, %g1 + ldx [%i0+24], %o7 + sub %g0, %g5, %g5 + xor %o7, %g4, %g4 + stx %g1, [%i0+16] + srax %o1, %l2, %g3 + mov -1, %g1 + or %g2, %g3, %g2 + sllx %g1, %g5, %g1 + stx %g2, [%i0+8] + and %g1, %g4, %g1 + xor %o7, %g1, %o7 + ba,pt %xcc, .LL38 + stx %o7, [%i0+24] +.LL83: + srax %o3, %l4, %l2 + mov 64, %g1 + sub %g1, %l4, %g1 + sllx %o3, %g1, %o7 + sllx %o0, %g1, %g2 + sllx %o1, %g1, %g3 + sllx %o2, %g1, %g1 + or %g1, %l2, %g1 + ldx [%i0+32], %l0 + sllx %g4, 3, %l1 + xor %l0, %o7, %o7 + sub %g0, %l1, %l1 + stx %g1, [%i0+24] + srax %o1, %l4, %g4 + srax %o2, %l4, %g5 + or %g2, %g4, %g2 + or %g3, %g5, %g3 + mov -1, %g1 + stx %g2, [%i0+8] + sllx %g1, %l1, %g1 + stx %g3, [%i0+16] + and %g1, %o7, %g1 + xor %l0, %g1, %l0 + ba,pt %xcc, .LL38 + stx %l0, [%i0+32] + .size avcall_call, .-avcall_call + .ident "GCC: (GNU) 4.0.2" + .section ".note.GNU-stack" diff --git a/avcall/avcall-sparc64-macro.S b/avcall/avcall-sparc64-macro.S new file mode 100644 index 0000000..f9dce0a --- /dev/null +++ b/avcall/avcall-sparc64-macro.S @@ -0,0 +1,521 @@ +#include "asm-sparc.h" + .section ".text" + .align 4 + .global C(avcall_call) + DECLARE_FUNCTION(avcall_call) + .proc 04 +FUNBEGIN(avcall_call) + .register %g2, $scratch + .register %g3, $scratch + save %sp, -192, %sp + ldx [%i0+48], %g2 + ldx [%i0+40], %g1 + lduw [%i0+68], %g3 + sub %g1, %g2, %g1 + cmp %g3, 0 + be,pt %icc, L(L2) + srlx %g1, 3, %o7 + andcc %g3, 1, %g0 + bne,pt %xcc, L(L97) + andcc %g3, 2, %g0 + bne,pt %xcc, L(L98) + andcc %g3, 4, %g0 +L(L133): + bne,pt %xcc, L(L99) + andcc %g3, 8, %g0 +L(L132): + bne,pt %xcc, L(L100) + andcc %g3, 16, %g0 +L(L131): + bne,pt %xcc, L(L101) + andcc %g3, 32, %g0 +L(L130): + bne,pt %xcc, L(L102) + andcc %g3, 64, %g0 +L(L129): + bne,pt %xcc, L(L103) + andcc %g3, 128, %g0 +L(L128): + bne,pt %xcc, L(L104) + andcc %g3, 256, %g0 +L(L127): + bne,pt %xcc, L(L105) + andcc %g3, 512, %g0 +L(L126): + bne,pt %xcc, L(L106) + andcc %g3, 1024, %g0 +L(L125): + bne,pt %xcc, L(L107) + andcc %g3, 2048, %g0 +L(L124): + bne,pt %xcc, L(L108) + sethi %hi(4096), %g1 +L(L123): + andcc %g3, %g1, %g0 + bne,pt %icc, L(L109) + sethi %hi(8192), %g1 +L(L122): + andcc %g3, %g1, %g0 + bne,pt %icc, L(L110) + sethi %hi(16384), %g1 +L(L121): + andcc %g3, %g1, %g0 + bne,pt %icc, L(L111) + sethi %hi(32768), %g1 +L(L120): + andcc %g3, %g1, %g0 + bne,pt %icc, L(L112) + nop +L(L2): + cmp %o7, 6 +L(L119): + bg,pn %icc, L(L117) + add %o7, -6, %g1 + ldx [%i0+48], %g3 +L(L118): + ldx [%g3+40], %o5 +L(L116): + ldx [%i0+8], %g1 + ldx [%g3], %o0 + ldx [%g3+8], %o1 + ldx [%g3+16], %o2 + ldx [%g3+24], %o3 + call %g1, 0 + ldx [%g3+32], %o4 + mov %o0, %l3 + nop + lduw [%i0+24], %g1 + cmp %g1, 1 + be,pn %icc, L(L38) + cmp %g1, 2 + be,pn %icc, L(L89) + cmp %g1, 3 + be,pn %icc, L(L89) + cmp %g1, 4 + be,pn %icc, L(L89) + cmp %g1, 5 + be,pn %icc, L(L90) + cmp %g1, 6 + be,pn %icc, L(L90) + cmp %g1, 7 + be,pn %icc, L(L91) + cmp %g1, 8 + be,pn %icc, L(L91) + cmp %g1, 9 + be,pn %icc, L(L95) + cmp %g1, 10 + be,pn %icc, L(L95) + cmp %g1, 11 + be,pn %icc, L(L95) + cmp %g1, 12 + be,pn %icc, L(L95) + cmp %g1, 13 + be,pn %icc, L(L114) + cmp %g1, 14 + be,pn %icc, L(L115) + cmp %g1, 15 + be,pn %icc, L(L95) + cmp %g1, 16 + bne,pt %icc, L(L38) + nop + lduw [%i0], %g1 + andcc %g1, 512, %g0 + be,pn %xcc, L(L38) + nop + ldx [%i0+32], %g2 + add %g2, -1, %g1 + cmp %g1, 31 + bgu,pn %xcc, L(L38) + cmp %g2, 8 + ldx [%i0+16], %g1 + and %g1, 7, %g5 + and %g1, -8, %i0 + bgu,pt %xcc, L(L71) + add %g2, %g5, %g4 + cmp %g4, 8 + bgu,pt %xcc, L(L73) + sllx %g5, 3, %g2 + sllx %g5, 3, %g3 + sllx %g4, 3, %g4 + ldx [%i0], %g5 + srax %o0, %g3, %o7 + sub %g0, %g4, %g4 + xor %g5, %o7, %o7 + xnor %g0, %g3, %g3 + mov 2, %g1 + mov 1, %g2 + sllx %g1, %g3, %g1 + sllx %g2, %g4, %g2 + sub %g1, %g2, %g1 + and %g1, %o7, %g1 + xor %g5, %g1, %g5 + ba,pt %xcc, L(L38) + stx %g5, [%i0] +L(L89): + ldx [%i0+16], %g1 + stb %l3, [%g1] +L(L38): + return %i7+8 + mov 0, %o0 +L(L112): + ldd [%g2+120],%f30 + cmp %o7, 6 + ble,a,pt %icc, L(L118) + ldx [%i0+48], %g3 + add %o7, -6, %g1 +L(L117): + sra %g1, 0, %g1 + sllx %g1, 3, %g1 + add %g1, 15, %g1 + and %g1, -16, %g1 + mov 6, %g4 + sub %sp, %g1, %sp + ldx [%i0+48], %g3 + add %sp, 2238, %g1 + and %g1, -16, %g1 + add %g1, -48, %g5 +L(L37): + sra %g4, 0, %g1 + add %g4, 1, %g4 + sllx %g1, 3, %g1 + cmp %o7, %g4 + ldx [%g1+%g3], %g2 + bne,pt %icc, L(L37) + stx %g2, [%g5+%g1] + ba,pt %xcc, L(L116) + ldx [%g3+40], %o5 +L(L111): + ldd [%g2+112],%f28 + sethi %hi(32768), %g1 + andcc %g3, %g1, %g0 + be,pt %icc, L(L119) + cmp %o7, 6 + ba,pt %xcc, L(L112) + nop +L(L110): + ldd [%g2+104],%f26 + sethi %hi(16384), %g1 + andcc %g3, %g1, %g0 + be,pt %icc, L(L120) + sethi %hi(32768), %g1 + ba,pt %xcc, L(L111) + nop +L(L109): + ldd [%g2+96],%f24 + sethi %hi(8192), %g1 + andcc %g3, %g1, %g0 + be,pt %icc, L(L121) + sethi %hi(16384), %g1 + ba,pt %xcc, L(L110) + nop +L(L108): + ldd [%g2+88],%f22 + sethi %hi(4096), %g1 + andcc %g3, %g1, %g0 + be,pt %icc, L(L122) + sethi %hi(8192), %g1 + ba,pt %xcc, L(L109) + nop +L(L107): + ldd [%g2+80],%f20 + andcc %g3, 2048, %g0 + be,pt %xcc, L(L123) + sethi %hi(4096), %g1 + ba,pt %xcc, L(L108) + nop +L(L106): + ldd [%g2+72],%f18 + andcc %g3, 1024, %g0 + be,pt %xcc, L(L124) + andcc %g3, 2048, %g0 + ba,pt %xcc, L(L107) + nop +L(L105): + ldd [%g2+64],%f16 + andcc %g3, 512, %g0 + be,pt %xcc, L(L125) + andcc %g3, 1024, %g0 + ba,pt %xcc, L(L106) + nop +L(L104): + ldd [%g2+56],%f14 + andcc %g3, 256, %g0 + be,pt %xcc, L(L126) + andcc %g3, 512, %g0 + ba,pt %xcc, L(L105) + nop +L(L103): + ldd [%g2+48],%f12 + andcc %g3, 128, %g0 + be,pt %xcc, L(L127) + andcc %g3, 256, %g0 + ba,pt %xcc, L(L104) + nop +L(L102): + ldd [%g2+40],%f10 + andcc %g3, 64, %g0 + be,pt %xcc, L(L128) + andcc %g3, 128, %g0 + ba,pt %xcc, L(L103) + nop +L(L101): + ldd [%g2+32],%f8 + andcc %g3, 32, %g0 + be,pt %xcc, L(L129) + andcc %g3, 64, %g0 + ba,pt %xcc, L(L102) + nop +L(L100): + ldd [%g2+24],%f6 + andcc %g3, 16, %g0 + be,pt %xcc, L(L130) + andcc %g3, 32, %g0 + ba,pt %xcc, L(L101) + nop +L(L99): + ldd [%g2+16],%f4 + andcc %g3, 8, %g0 + be,pt %xcc, L(L131) + andcc %g3, 16, %g0 + ba,pt %xcc, L(L100) + nop +L(L98): + ldd [%g2+8],%f2 + andcc %g3, 4, %g0 + be,pt %xcc, L(L132) + andcc %g3, 8, %g0 + ba,pt %xcc, L(L99) + nop +L(L97): + ldd [%g2+0],%f0 + andcc %g3, 2, %g0 + be,pt %xcc, L(L133) + andcc %g3, 4, %g0 + ba,pt %xcc, L(L98) + nop +L(L90): + ldx [%i0+16], %g1 + sth %l3, [%g1] + return %i7+8 + mov 0, %o0 +L(L95): + ldx [%i0+16], %g1 + ba,pt %xcc, L(L38) + stx %l3, [%g1] +L(L91): + ldx [%i0+16], %g1 + ba,pt %xcc, L(L38) + st %l3, [%g1] +L(L114): + ldx [%i0+16], %g1 + ba,pt %xcc, L(L38) + st %f0, [%g1] +L(L115): + ldx [%i0+16], %g1 + ba,pt %xcc, L(L38) + std %f0, [%g1] +L(L71): + cmp %g2, 16 + bgu,pt %xcc, L(L75) + cmp %g2, 24 + sll %g5, 3, %l2 + xnor %g0, %l2, %g2 + ldx [%i0], %g3 + mov 2, %g1 + cmp %g4, 16 + sllx %g1, %g2, %g1 + srax %o0, %l2, %g2 + add %g1, -1, %g1 + xor %g3, %g2, %g2 + and %g1, %g2, %g1 + xor %g3, %g1, %g3 + bgu,pt %xcc, L(L77) + stx %g3, [%i0] + sllx %g5, 2, %g5 + mov 32, %g2 + sub %g2, %g5, %g2 + ldx [%i0+8], %g3 + sllx %o0, %g2, %g1 + sllx %g4, 3, %g4 + sllx %g1, %g2, %g1 + srax %o1, %l2, %o7 + sub %g0, %g4, %g4 + or %g1, %o7, %g1 + mov -1, %g2 + xor %g3, %g1, %g1 + sllx %g2, %g4, %g2 + and %g2, %g1, %g2 + xor %g3, %g2, %g3 + ba,pt %xcc, L(L38) + stx %g3, [%i0+8] +L(L73): + sllx %g4, 3, %l0 + ldx [%i0], %g5 + srax %o0, %g2, %g4 + sub %g0, %g2, %g3 + xor %g5, %g4, %g4 + xnor %g0, %g2, %g2 + mov 2, %g1 + sllx %g1, %g2, %g1 + add %g1, -1, %g1 + and %g1, %g4, %g1 + ldx [%i0+8], %o7 + xor %g5, %g1, %g5 + sub %g0, %l0, %l0 + sllx %o0, %g3, %g3 + mov -1, %g1 + xor %o7, %g3, %g3 + sllx %g1, %l0, %g1 + stx %g5, [%i0] + and %g1, %g3, %g1 + xor %o7, %g1, %o7 + ba,pt %xcc, L(L38) + stx %o7, [%i0+8] +L(L77): + srax %o1, %l2, %g5 + mov 64, %g1 + sub %g1, %l2, %g1 + sllx %o1, %g1, %g2 + sllx %o0, %g1, %g1 + or %g1, %g5, %g1 + sllx %g4, 3, %g3 + stx %g1, [%i0+8] + ldx [%i0+16], %g4 + sub %g0, %g3, %g3 + xor %g4, %g2, %g2 + mov -1, %g1 + sllx %g1, %g3, %g1 + and %g1, %g2, %g1 + xor %g4, %g1, %g4 + ba,pt %xcc, L(L38) + stx %g4, [%i0+16] +L(L75): + bgu,pt %xcc, L(L79) + sll %g5, 3, %l4 + sll %g5, 3, %l2 + xnor %g0, %l2, %g2 + ldx [%i0], %g3 + mov 2, %g1 + cmp %g4, 24 + sllx %g1, %g2, %g1 + srax %o0, %l2, %g2 + add %g1, -1, %g1 + xor %g3, %g2, %g2 + and %g1, %g2, %g1 + xor %g3, %g1, %g3 + bgu,pt %xcc, L(L81) + stx %g3, [%i0] + sllx %g5, 2, %g2 + mov 32, %g1 + sub %g1, %g2, %g1 + ldx [%i0+16], %o7 + sllx %g4, 3, %g5 + sllx %o0, %g1, %g3 + sllx %o1, %g1, %g2 + sllx %g3, %g1, %g3 + sllx %g2, %g1, %g2 + srax %o2, %l2, %l0 + sub %g0, %g5, %g5 + or %g2, %l0, %g2 + srax %o1, %l2, %g4 + xor %o7, %g2, %g2 + or %g3, %g4, %g3 + mov -1, %g1 + stx %g3, [%i0+8] + sllx %g1, %g5, %g1 + and %g1, %g2, %g1 + xor %o7, %g1, %o7 + ba,pt %xcc, L(L38) + stx %o7, [%i0+16] +L(L79): + xnor %g0, %l4, %g2 + ldx [%i0], %g3 + mov 2, %g1 + cmp %g4, 32 + sllx %g1, %g2, %g1 + srax %o0, %l4, %g2 + add %g1, -1, %g1 + xor %g3, %g2, %g2 + and %g1, %g2, %g1 + xor %g3, %g1, %g3 + bgu,pt %xcc, L(L83) + stx %g3, [%i0] + sllx %g5, 2, %g2 + mov 32, %g1 + sub %g1, %g2, %g1 + ldx [%i0+24], %l0 + sllx %g4, 3, %l1 + sllx %o0, %g1, %g3 + sllx %o1, %g1, %g4 + sllx %g3, %g1, %g3 + sllx %g4, %g1, %g4 + sllx %o2, %g1, %g2 + srax %o3, %l4, %l2 + sllx %g2, %g1, %g2 + sub %g0, %l1, %l1 + or %g2, %l2, %g2 + srax %o1, %l4, %g5 + xor %l0, %g2, %g2 + or %g3, %g5, %g3 + srax %o2, %l4, %o7 + mov -1, %g1 + or %g4, %o7, %g4 + sllx %g1, %l1, %g1 + stx %g3, [%i0+8] + and %g1, %g2, %g1 + stx %g4, [%i0+16] + xor %l0, %g1, %l0 + ba,pt %xcc, L(L38) + stx %l0, [%i0+24] +L(L81): + sllx %g4, 3, %g5 + srax %o2, %l2, %l0 + mov 64, %g1 + sub %g1, %l2, %g1 + sllx %o2, %g1, %g4 + sllx %o0, %g1, %g2 + sllx %o1, %g1, %g1 + or %g1, %l0, %g1 + ldx [%i0+24], %o7 + sub %g0, %g5, %g5 + xor %o7, %g4, %g4 + stx %g1, [%i0+16] + srax %o1, %l2, %g3 + mov -1, %g1 + or %g2, %g3, %g2 + sllx %g1, %g5, %g1 + stx %g2, [%i0+8] + and %g1, %g4, %g1 + xor %o7, %g1, %o7 + ba,pt %xcc, L(L38) + stx %o7, [%i0+24] +L(L83): + srax %o3, %l4, %l2 + mov 64, %g1 + sub %g1, %l4, %g1 + sllx %o3, %g1, %o7 + sllx %o0, %g1, %g2 + sllx %o1, %g1, %g3 + sllx %o2, %g1, %g1 + or %g1, %l2, %g1 + ldx [%i0+32], %l0 + sllx %g4, 3, %l1 + xor %l0, %o7, %o7 + sub %g0, %l1, %l1 + stx %g1, [%i0+24] + srax %o1, %l4, %g4 + srax %o2, %l4, %g5 + or %g2, %g4, %g2 + or %g3, %g5, %g3 + mov -1, %g1 + stx %g2, [%i0+8] + sllx %g1, %l1, %g1 + stx %g3, [%i0+16] + and %g1, %o7, %g1 + xor %l0, %g1, %l0 + ba,pt %xcc, L(L38) + stx %l0, [%i0+32] + FUNEND(avcall_call) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-sparc64.c b/avcall/avcall-sparc64.c new file mode 100644 index 0000000..91fb0fa --- /dev/null +++ b/avcall/avcall-sparc64.c @@ -0,0 +1,518 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + !!! THIS ROUTINE MUST BE COMPILED gcc -O !!! + + Foreign function interface for a Sparc v9 in 64-bit mode with gcc. + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + Sparc 64-bit Argument Passing Conventions + + The argument registers are laid out as an array of 16 elements + and arguments are added sequentially. The first 6 int args and up to the + first 16 fp args (depending on size) are passed in regs. + + Slot Stack Integral Float Float in structure Double Long Double + ---- ----- -------- ----- ------------------ ------ ----------- + 15 [SP+248] %f31 %f30,%f31 %d30 + 14 [SP+240] %f29 %f28,%f29 %d28 %q28 + 13 [SP+232] %f27 %f26,%f27 %d26 + 12 [SP+224] %f25 %f24,%f25 %d24 %q24 + 11 [SP+216] %f23 %f22,%f23 %d22 + 10 [SP+208] %f21 %f20,%f21 %d20 %q20 + 9 [SP+200] %f19 %f18,%f19 %d18 + 8 [SP+192] %f17 %f16,%f17 %d16 %q16 + 7 [SP+184] %f15 %f14,%f15 %d14 + 6 [SP+176] %f13 %f12,%f13 %d12 %q12 + 5 [SP+168] %o5 %f11 %f10,%f11 %d10 + 4 [SP+160] %o4 %f9 %f8,%f9 %d8 %q8 + 3 [SP+152] %o3 %f7 %f6,%f7 %d6 + 2 [SP+144] %o2 %f5 %f4,%f5 %d4 %q4 + 1 [SP+136] %o1 %f3 %f2,%f3 %d2 + 0 [SP+128] %o0 %f1 %f0,%f1 %d0 %q0 + + Here SP = %sp if -mno-stack-bias or %sp+stack_bias otherwise. + + Integral arguments are always passed as 64 bit quantities appropriately + extended. + + Passing of floating point values is handled as follows. + If a prototype is in scope: + If the value is in a named argument (i.e. not a stdarg function or a + value not part of the ‘...’) then the value is passed in the appropriate + fp reg. + If the value is part of the ‘...’ and is passed in one of the first 6 + slots then the value is passed in the appropriate int reg. + If the value is part of the ‘...’ and is not passed in one of the first 6 + slots then the value is passed in memory. + If a prototype is not in scope: + If the value is one of the first 6 arguments the value is passed in the + appropriate integer reg and the appropriate fp reg. + If the value is not one of the first 6 arguments the value is passed in + the appropriate fp reg and in memory. + + Remaining arguments are pushed onto the stack starting at a fixed offset + Space is left on the stack frame for temporary storage of the register + arguments as well. + + Integers shorter than ‘long’ are always promoted to word-length + (zero-extended or sign-extended, according to their type). Structures + <= 16 bytes are passed embedded in the argument sequence; bigger structures + are passed by reference. + + Integers and pointers are returned in o0, floats in f0, doubles in + f0/f1. If the function returns a structure a pointer to space + allocated by the caller is pushed onto the stack immediately + before the function arguments. Structures <= 32 bytes are returned in + registers (integer/float/double registers, as appropriate). + + Long doubles are 16-byte aligned, but we don't deal with this here, so + we assume 8-byte alignment for everything. + + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) +#define OFFSETOF(struct,member) ((int)&(((struct*)0)->member)) + +register __avrword o0 __asm__("%o0"); +register __avrword o1 __asm__("%o1"); +register __avrword o2 __asm__("%o2"); +register __avrword o3 __asm__("%o3"); +register __avrword o4 __asm__("%o4"); +register __avrword o5 __asm__("%o5"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("%sp"); /* C names for registers */ + register float fret __asm__("%f0"); /* %f0 */ + register double dret __asm__("%f0"); /* %f0,%f1 */ + + __av_alist* l = &AV_LIST_INNER(list); + + __avword trampoline[6]; /* room for a trampoline */ + int arglen = l->aptr - l->args; + __avrword iret; + + if (l->darg_mask) { + /* push leading float/double args */ + __avword* a = l->args; + if (l->darg_mask & (1<<0)) + __asm__("ldd [%0+%1],%%f0" : : "p" (a), "i" (0 * sizeof (__avword))); + if (l->darg_mask & (1<<1)) + __asm__("ldd [%0+%1],%%f2" : : "p" (a), "i" (1 * sizeof (__avword))); + if (l->darg_mask & (1<<2)) + __asm__("ldd [%0+%1],%%f4" : : "p" (a), "i" (2 * sizeof (__avword))); + if (l->darg_mask & (1<<3)) + __asm__("ldd [%0+%1],%%f6" : : "p" (a), "i" (3 * sizeof (__avword))); + if (l->darg_mask & (1<<4)) + __asm__("ldd [%0+%1],%%f8" : : "p" (a), "i" (4 * sizeof (__avword))); + if (l->darg_mask & (1<<5)) + __asm__("ldd [%0+%1],%%f10" : : "p" (a), "i" (5 * sizeof (__avword))); + if (l->darg_mask & (1<<6)) + __asm__("ldd [%0+%1],%%f12" : : "p" (a), "i" (6 * sizeof (__avword))); + if (l->darg_mask & (1<<7)) + __asm__("ldd [%0+%1],%%f14" : : "p" (a), "i" (7 * sizeof (__avword))); + if (l->darg_mask & (1<<8)) + __asm__("ldd [%0+%1],%%f16" : : "p" (a), "i" (8 * sizeof (__avword))); + if (l->darg_mask & (1<<9)) + __asm__("ldd [%0+%1],%%f18" : : "p" (a), "i" (9 * sizeof (__avword))); + if (l->darg_mask & (1<<10)) + __asm__("ldd [%0+%1],%%f20" : : "p" (a), "i" (10 * sizeof (__avword))); + if (l->darg_mask & (1<<11)) + __asm__("ldd [%0+%1],%%f22" : : "p" (a), "i" (11 * sizeof (__avword))); + if (l->darg_mask & (1<<12)) + __asm__("ldd [%0+%1],%%f24" : : "p" (a), "i" (12 * sizeof (__avword))); + if (l->darg_mask & (1<<13)) + __asm__("ldd [%0+%1],%%f26" : : "p" (a), "i" (13 * sizeof (__avword))); + if (l->darg_mask & (1<<14)) + __asm__("ldd [%0+%1],%%f28" : : "p" (a), "i" (14 * sizeof (__avword))); + if (l->darg_mask & (1<<15)) + __asm__("ldd [%0+%1],%%f30" : : "p" (a), "i" (15 * sizeof (__avword))); + } + + if (arglen > 6) { + /* alloca space is separated from the extra outgoing args area by + * the area for compiler temps (addressable with postive offsets from sp) + * but they shouldn't be needed for this function, so, effectively, + * space returned by alloca is safe to use as the area for extra args. + */ + void *extra_args_area = __builtin_alloca(sizeof(__avword) * (arglen - 6)); + __avword *argframe = (__avword *)extra_args_area - 6; +#if 0 + /* "by construction" */ + assert(argframe == (void *)((unsigned long)(sp + 16)+2047)); +#endif + + int i; + for (i = 6; i < arglen; i++) /* push excess function args */ + argframe[i] = l->args[i]; + } + + /* call function with 1st 6 args */ + iret = ({ register __avrword iretreg __asm__ ("%o0"); + iretreg = (*l->func)(l->args[0], l->args[1], l->args[2], + l->args[3], l->args[4], l->args[5]); + asm __volatile__("nop"); /* struct returning functions skip this instruction */ + iretreg; + }); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, iret); + } else + if (l->rtype == __AVlonglong) { + RETURN(long long, iret); + } else + if (l->rtype == __AVulonglong) { + RETURN(unsigned long long, iret); + } else + if (l->rtype == __AVfloat) { + RETURN(float, fret); + } else + if (l->rtype == __AVdouble) { + RETURN(double, dret); + } else + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + /* Return structs of size <= 32 in registers. */ + #define iret2 o1 + #define iret3 o2 + #define iret4 o3 + if (l->rsize > 0 && l->rsize <= 32) { + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize == 1) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + } else + if (l->rsize == 2) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + } else + if (l->rsize == 3) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + } else + if (l->rsize == 4) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + } else + if (l->rsize == 5) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + } else + if (l->rsize == 6) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + } else + if (l->rsize == 7) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>8); + } else + if (l->rsize >= 8 && l->rsize <= 32) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret>>56); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[7] = (unsigned char)(iret); + if (l->rsize == 8) { + } else + if (l->rsize == 9) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + } else + if (l->rsize == 10) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + } else + if (l->rsize == 11) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + } else + if (l->rsize == 12) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + } else + if (l->rsize == 13) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + } else + if (l->rsize == 14) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + } else + if (l->rsize == 15) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>8); + } else + if (l->rsize >= 16 && l->rsize <= 32) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2>>56); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+7] = (unsigned char)(iret2); + if (l->rsize == 16) { + } else + if (l->rsize == 17) { + ((unsigned char *)raddr)[16+0] = (unsigned char)(iret3>>56); + } else + if (l->rsize == 18) { + ((unsigned char *)raddr)[16+0] = (unsigned char)(iret3>>56); + ((unsigned char *)raddr)[16+1] = (unsigned char)(iret3>>48); + } else + if (l->rsize == 19) { + ((unsigned char *)raddr)[16+0] = (unsigned char)(iret3>>56); + ((unsigned char *)raddr)[16+1] = (unsigned char)(iret3>>48); + ((unsigned char *)raddr)[16+2] = (unsigned char)(iret3>>40); + } else + if (l->rsize == 20) { + ((unsigned char *)raddr)[16+0] = (unsigned char)(iret3>>56); + ((unsigned char *)raddr)[16+1] = (unsigned char)(iret3>>48); + ((unsigned char *)raddr)[16+2] = (unsigned char)(iret3>>40); + ((unsigned char *)raddr)[16+3] = (unsigned char)(iret3>>32); + } else + if (l->rsize == 21) { + ((unsigned char *)raddr)[16+0] = (unsigned char)(iret3>>56); + ((unsigned char *)raddr)[16+1] = (unsigned char)(iret3>>48); + ((unsigned char *)raddr)[16+2] = (unsigned char)(iret3>>40); + ((unsigned char *)raddr)[16+3] = (unsigned char)(iret3>>32); + ((unsigned char *)raddr)[16+4] = (unsigned char)(iret3>>24); + } else + if (l->rsize == 22) { + ((unsigned char *)raddr)[16+0] = (unsigned char)(iret3>>56); + ((unsigned char *)raddr)[16+1] = (unsigned char)(iret3>>48); + ((unsigned char *)raddr)[16+2] = (unsigned char)(iret3>>40); + ((unsigned char *)raddr)[16+3] = (unsigned char)(iret3>>32); + ((unsigned char *)raddr)[16+4] = (unsigned char)(iret3>>24); + ((unsigned char *)raddr)[16+5] = (unsigned char)(iret3>>16); + } else + if (l->rsize == 23) { + ((unsigned char *)raddr)[16+0] = (unsigned char)(iret3>>56); + ((unsigned char *)raddr)[16+1] = (unsigned char)(iret3>>48); + ((unsigned char *)raddr)[16+2] = (unsigned char)(iret3>>40); + ((unsigned char *)raddr)[16+3] = (unsigned char)(iret3>>32); + ((unsigned char *)raddr)[16+4] = (unsigned char)(iret3>>24); + ((unsigned char *)raddr)[16+5] = (unsigned char)(iret3>>16); + ((unsigned char *)raddr)[16+6] = (unsigned char)(iret3>>8); + } else + if (l->rsize >= 24 && l->rsize <= 32) { + ((unsigned char *)raddr)[16+0] = (unsigned char)(iret3>>56); + ((unsigned char *)raddr)[16+1] = (unsigned char)(iret3>>48); + ((unsigned char *)raddr)[16+2] = (unsigned char)(iret3>>40); + ((unsigned char *)raddr)[16+3] = (unsigned char)(iret3>>32); + ((unsigned char *)raddr)[16+4] = (unsigned char)(iret3>>24); + ((unsigned char *)raddr)[16+5] = (unsigned char)(iret3>>16); + ((unsigned char *)raddr)[16+6] = (unsigned char)(iret3>>8); + ((unsigned char *)raddr)[16+7] = (unsigned char)(iret3); + if (l->rsize == 24) { + } else + if (l->rsize == 25) { + ((unsigned char *)raddr)[24+0] = (unsigned char)(iret4>>56); + } else + if (l->rsize == 26) { + ((unsigned char *)raddr)[24+0] = (unsigned char)(iret4>>56); + ((unsigned char *)raddr)[24+1] = (unsigned char)(iret4>>48); + } else + if (l->rsize == 27) { + ((unsigned char *)raddr)[24+0] = (unsigned char)(iret4>>56); + ((unsigned char *)raddr)[24+1] = (unsigned char)(iret4>>48); + ((unsigned char *)raddr)[24+2] = (unsigned char)(iret4>>40); + } else + if (l->rsize == 28) { + ((unsigned char *)raddr)[24+0] = (unsigned char)(iret4>>56); + ((unsigned char *)raddr)[24+1] = (unsigned char)(iret4>>48); + ((unsigned char *)raddr)[24+2] = (unsigned char)(iret4>>40); + ((unsigned char *)raddr)[24+3] = (unsigned char)(iret4>>32); + } else + if (l->rsize == 29) { + ((unsigned char *)raddr)[24+0] = (unsigned char)(iret4>>56); + ((unsigned char *)raddr)[24+1] = (unsigned char)(iret4>>48); + ((unsigned char *)raddr)[24+2] = (unsigned char)(iret4>>40); + ((unsigned char *)raddr)[24+3] = (unsigned char)(iret4>>32); + ((unsigned char *)raddr)[24+4] = (unsigned char)(iret4>>24); + } else + if (l->rsize == 30) { + ((unsigned char *)raddr)[24+0] = (unsigned char)(iret4>>56); + ((unsigned char *)raddr)[24+1] = (unsigned char)(iret4>>48); + ((unsigned char *)raddr)[24+2] = (unsigned char)(iret4>>40); + ((unsigned char *)raddr)[24+3] = (unsigned char)(iret4>>32); + ((unsigned char *)raddr)[24+4] = (unsigned char)(iret4>>24); + ((unsigned char *)raddr)[24+5] = (unsigned char)(iret4>>16); + } else + if (l->rsize == 31) { + ((unsigned char *)raddr)[24+0] = (unsigned char)(iret4>>56); + ((unsigned char *)raddr)[24+1] = (unsigned char)(iret4>>48); + ((unsigned char *)raddr)[24+2] = (unsigned char)(iret4>>40); + ((unsigned char *)raddr)[24+3] = (unsigned char)(iret4>>32); + ((unsigned char *)raddr)[24+4] = (unsigned char)(iret4>>24); + ((unsigned char *)raddr)[24+5] = (unsigned char)(iret4>>16); + ((unsigned char *)raddr)[24+6] = (unsigned char)(iret4>>8); + } else + if (l->rsize == 32) { + ((unsigned char *)raddr)[24+0] = (unsigned char)(iret4>>56); + ((unsigned char *)raddr)[24+1] = (unsigned char)(iret4>>48); + ((unsigned char *)raddr)[24+2] = (unsigned char)(iret4>>40); + ((unsigned char *)raddr)[24+3] = (unsigned char)(iret4>>32); + ((unsigned char *)raddr)[24+4] = (unsigned char)(iret4>>24); + ((unsigned char *)raddr)[24+5] = (unsigned char)(iret4>>16); + ((unsigned char *)raddr)[24+6] = (unsigned char)(iret4>>8); + ((unsigned char *)raddr)[24+7] = (unsigned char)(iret4); + } + } + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 4*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 5*sizeof(__avrword) */ + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - ((__avrword)1 << (sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + __avrword mask1 = - ((__avrword)1 << (2*sizeof(__avrword)*8-end_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret << (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else if (count <= 2*sizeof(__avrword)) { + /* Use iret, iret2. */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = - ((__avrword)1 << (2*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] ^= (wordaddr[1] ^ ((iret << (sizeof(__avrword)*4-start_offset*4) << (sizeof(__avrword)*4-start_offset*4)) | (iret2 >> (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = - ((__avrword)1 << (3*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] = (iret << (sizeof(__avrword)*8-start_offset*8)) | (iret2 >> (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 << (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } else if (count <= 3*sizeof(__avrword)) { + /* Use iret, iret2, iret3. */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + if (end_offset <= 3*sizeof(__avrword)) { + /* 2*sizeof(__avrword) < end_offset ≤ 3*sizeof(__avrword) */ + __avrword mask2 = - ((__avrword)1 << (3*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] = (iret << (sizeof(__avrword)*4-start_offset*4) << (sizeof(__avrword)*4-start_offset*4)) | (iret2 >> (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ ((iret2 << (sizeof(__avrword)*4-start_offset*4) << (sizeof(__avrword)*4-start_offset*4)) | (iret3 >> (start_offset*8)))) & mask2; + } else { + /* 3*sizeof(__avrword) < end_offset < 4*sizeof(__avrword), start_offset > 0 */ + __avrword mask3 = - ((__avrword)1 << (4*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] = (iret << (sizeof(__avrword)*8-start_offset*8)) | (iret2 >> (start_offset*8)); + wordaddr[2] = (iret2 << (sizeof(__avrword)*8-start_offset*8)) | (iret3 >> (start_offset*8)); + wordaddr[3] ^= (wordaddr[3] ^ (iret3 << (sizeof(__avrword)*8-start_offset*8))) & mask3; + } + } else { + /* Use iret, iret2, iret3, iret4. */ + __avrword mask0 = ((__avrword)2 << (sizeof(__avrword)*8-start_offset*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret >> (start_offset*8))) & mask0; + if (end_offset <= 4*sizeof(__avrword)) { + /* 3*sizeof(__avrword) < end_offset ≤ 4*sizeof(__avrword) */ + __avrword mask3 = - ((__avrword)1 << (4*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] = (iret << (sizeof(__avrword)*4-start_offset*4) << (sizeof(__avrword)*4-start_offset*4)) | (iret2 >> (start_offset*8)); + wordaddr[2] = (iret2 << (sizeof(__avrword)*4-start_offset*4) << (sizeof(__avrword)*4-start_offset*4)) | (iret3 >> (start_offset*8)); + wordaddr[3] ^= (wordaddr[3] ^ ((iret3 << (sizeof(__avrword)*4-start_offset*4) << (sizeof(__avrword)*4-start_offset*4)) | (iret4 >> (start_offset*8)))) & mask3; + } else { + /* 4*sizeof(__avrword) < end_offset < 5*sizeof(__avrword), start_offset > 0 */ + __avrword mask4 = - ((__avrword)1 << (5*sizeof(__avrword)*8-end_offset*8)); + wordaddr[1] = (iret << (sizeof(__avrword)*8-start_offset*8)) | (iret2 >> (start_offset*8)); + wordaddr[2] = (iret2 << (sizeof(__avrword)*8-start_offset*8)) | (iret3 >> (start_offset*8)); + wordaddr[3] = (iret3 << (sizeof(__avrword)*8-start_offset*8)) | (iret4 >> (start_offset*8)); + wordaddr[4] ^= (wordaddr[4] ^ (iret4 << (sizeof(__avrword)*8-start_offset*8))) & mask4; + } + } + #endif + } + } + } + return 0; +} diff --git a/avcall/avcall-structcpy.c b/avcall/avcall-structcpy.c new file mode 100644 index 0000000..4b41bb5 --- /dev/null +++ b/avcall/avcall-structcpy.c @@ -0,0 +1,22 @@ +/* copy structs */ + +/* + * Copyright 2016 Bruno Haible + * + * 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, see . + */ + +#define __structcpy avcall_structcpy + +#include "structcpy.c" diff --git a/avcall/avcall-x86_64-linux.s b/avcall/avcall-x86_64-linux.s new file mode 100644 index 0000000..46b282e --- /dev/null +++ b/avcall/avcall-x86_64-linux.s @@ -0,0 +1,635 @@ + .file "avcall-x86_64.c" + .text + .p2align 4,,15 +.globl avcall_call + .type avcall_call, @function +avcall_call: +.LFB2: + pushq %rbp +.LCFI0: + movq %rsp, %rbp +.LCFI1: + pushq %r13 +.LCFI2: + pushq %r12 +.LCFI3: + pushq %rbx +.LCFI4: + movq %rdi, %rbx + leaq 128(%rbx), %rdx + subq $2072, %rsp +.LCFI5: + movq 40(%rdi), %rax + movq 48(%rdi), %r8 + leaq 15(%rsp), %rsi + subq %r8, %rax + andq $-16, %rsi + movq %rax, %rdi + movq 120(%rbx), %rax + shrq $3, %rdi + subq %rdx, %rax + movq %rax, %r9 + shrq $3, %r9 + testl %edi, %edi + jle .L2 + xorl %ecx, %ecx + xorl %edx, %edx + .p2align 4,,7 +.L4: + movq (%rdx,%r8), %rax + incl %ecx + movq %rax, (%rsi,%rdx) + addq $8, %rdx + cmpl %ecx, %edi + jne .L4 +.L2: + movl 24(%rbx), %eax + cmpl $13, %eax + je .L124 + cmpl $14, %eax + je .L125 + cmpl $7, %r9d + movq 8(%rbx), %r12 + jle .L58 + movlpd 184(%rbx), %xmm10 +.L60: + movq 176(%rbx), %r9 +.L63: + movq 168(%rbx), %r11 +.L66: + movq 160(%rbx), %r10 +.L69: + movlpd 152(%rbx), %xmm8 +.L72: + movq 144(%rbx), %rax +.L75: + movq 136(%rbx), %r8 +.L78: + movlpd 128(%rbx), %xmm9 +.L81: + movq 88(%rbx), %rdx + movq 96(%rbx), %rcx + movsd %xmm10, %xmm7 + movq 80(%rbx), %rsi + movq 72(%rbx), %rdi + movsd %xmm8, %xmm3 + movq %r9, -32(%rbp) + movsd %xmm9, %xmm0 + movlpd -32(%rbp), %xmm6 + movq %r11, -32(%rbp) + movlpd -32(%rbp), %xmm5 + movq %r10, -32(%rbp) + movlpd -32(%rbp), %xmm4 + movq %rax, -32(%rbp) + movl $8, %eax + movlpd -32(%rbp), %xmm2 + movq %r8, -32(%rbp) + movlpd -32(%rbp), %xmm1 + movq 112(%rbx), %r9 + movq 104(%rbx), %r8 + call *%r12 + movq %rax, %r8 + movl 24(%rbx), %eax + movq %rdx, %r9 + cmpl $1, %eax + je .L31 + cmpl $2, %eax + je .L119 + cmpl $3, %eax + je .L119 + cmpl $4, %eax + .p2align 4,,5 + je .L119 + cmpl $5, %eax + .p2align 4,,5 + je .L120 + cmpl $6, %eax + .p2align 4,,5 + je .L120 + cmpl $7, %eax + .p2align 4,,5 + je .L121 + cmpl $8, %eax + .p2align 4,,5 + je .L121 + cmpl $9, %eax + .p2align 4,,5 + je .L122 + cmpl $10, %eax + .p2align 4,,5 + je .L122 + cmpl $11, %eax + .p2align 4,,5 + je .L122 + cmpl $12, %eax + .p2align 4,,5 + je .L122 + cmpl $15, %eax + .p2align 4,,5 + je .L122 + cmpl $16, %eax + .p2align 4,,5 + jne .L31 + testb $2, 1(%rbx) + .p2align 4,,5 + je .L31 + movq 32(%rbx), %rdx + leaq -1(%rdx), %rax + cmpq $15, %rax + ja .L31 + movq 16(%rbx), %rax + movq %rax, %r10 + movq %rax, %rdi + andl $7, %edi + andq $-8, %r10 + cmpq $8, %rdx + leaq (%rdx,%rdi), %r11 + ja .L110 + cmpq $8, %r11 + ja .L112 + leal -1(,%r11,8), %ecx + movq (%r10), %rsi + sall $3, %edi + movl $2, %edx + movl $1, %eax + salq %cl, %rdx + movl %edi, %ecx + salq %cl, %rax + salq %cl, %r8 + xorq %rsi, %r8 + subq %rax, %rdx + andq %r8, %rdx + xorq %rdx, %rsi + movq %rsi, (%r10) + jmp .L31 + .p2align 4,,7 +.L58: + je .L126 + cmpl $5, %r9d + jle .L64 + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movlpd -32(%rbp), %xmm10 + .p2align 4,,3 + jmp .L63 +.L119: + movq 16(%rbx), %rax + movb %r8b, (%rax) +.L31: + leaq -24(%rbp), %rsp + xorl %eax, %eax + popq %rbx + popq %r12 + popq %r13 + leave + ret +.L124: + cmpl $7, %r9d + movq 16(%rbx), %r13 + movq 8(%rbx), %r12 + jle .L7 + movlpd 184(%rbx), %xmm10 +.L9: + movq 176(%rbx), %r9 +.L12: + movq 168(%rbx), %r11 +.L15: + movq 160(%rbx), %r10 +.L18: + movlpd 152(%rbx), %xmm8 +.L21: + movq 144(%rbx), %rax +.L24: + movq 136(%rbx), %r8 +.L27: + movlpd 128(%rbx), %xmm9 +.L30: + movq 96(%rbx), %rcx + movq 88(%rbx), %rdx + movsd %xmm10, %xmm7 + movq 80(%rbx), %rsi + movq 72(%rbx), %rdi + movsd %xmm8, %xmm3 + movq %r9, -32(%rbp) + movsd %xmm9, %xmm0 + movlpd -32(%rbp), %xmm6 + movq %r11, -32(%rbp) + movlpd -32(%rbp), %xmm5 + movq %r10, -32(%rbp) + movlpd -32(%rbp), %xmm4 + movq %rax, -32(%rbp) + movl $8, %eax + movlpd -32(%rbp), %xmm2 + movq %r8, -32(%rbp) + movlpd -32(%rbp), %xmm1 + movq 112(%rbx), %r9 + movq 104(%rbx), %r8 + call *%r12 + movss %xmm0, (%r13) + leaq -24(%rbp), %rsp + xorl %eax, %eax + popq %rbx + popq %r12 + popq %r13 + leave + ret +.L125: + cmpl $7, %r9d + movq 16(%rbx), %r13 + movq 8(%rbx), %r12 + jle .L34 + movlpd 184(%rbx), %xmm10 +.L36: + movq 176(%rbx), %r10 +.L39: + movq 168(%rbx), %r11 +.L42: + movq 160(%rbx), %r9 +.L45: + movlpd 152(%rbx), %xmm8 +.L48: + movq 144(%rbx), %rax +.L51: + movq 136(%rbx), %r8 +.L54: + movlpd 128(%rbx), %xmm9 +.L57: + movq 96(%rbx), %rcx + movq 88(%rbx), %rdx + movsd %xmm10, %xmm7 + movq 80(%rbx), %rsi + movq 72(%rbx), %rdi + movsd %xmm8, %xmm3 + movq %r10, -32(%rbp) + movsd %xmm9, %xmm0 + movlpd -32(%rbp), %xmm6 + movq %r11, -32(%rbp) + movlpd -32(%rbp), %xmm5 + movq %r9, -32(%rbp) + movlpd -32(%rbp), %xmm4 + movq %rax, -32(%rbp) + movl $8, %eax + movlpd -32(%rbp), %xmm2 + movq %r8, -32(%rbp) + movlpd -32(%rbp), %xmm1 + movq 112(%rbx), %r9 + movq 104(%rbx), %r8 + call *%r12 + movsd %xmm0, (%r13) + leaq -24(%rbp), %rsp + xorl %eax, %eax + popq %rbx + popq %r12 + popq %r13 + leave + ret +.L7: + jne .L10 + xorpd %xmm10, %xmm10 + jmp .L9 +.L126: + xorpd %xmm10, %xmm10 + .p2align 4,,7 + jmp .L60 +.L34: + .p2align 4,,7 + jne .L37 + xorpd %xmm10, %xmm10 + .p2align 4,,7 + jmp .L36 +.L120: + movq 16(%rbx), %rax + movw %r8w, (%rax) + .p2align 4,,5 + jmp .L31 +.L10: + cmpl $5, %r9d + .p2align 4,,3 + jg .L127 + .p2align 4,,5 + jne .L16 + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movq %r9, %r11 + movlpd -32(%rbp), %xmm10 + jmp .L15 +.L64: + .p2align 4,,3 + je .L128 + cmpl $3, %r9d + jle .L70 + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movq %r9, %r10 + movq %r9, %r11 + movlpd -32(%rbp), %xmm10 + jmp .L69 +.L37: + cmpl $5, %r9d + jg .L129 + jne .L43 + xorl %r10d, %r10d + movq %r10, -32(%rbp) + movq %r10, %r11 + movlpd -32(%rbp), %xmm10 + jmp .L42 +.L127: + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movlpd -32(%rbp), %xmm10 + jmp .L12 +.L128: + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movq %r9, %r11 + movlpd -32(%rbp), %xmm10 + jmp .L66 +.L129: + xorl %r10d, %r10d + movq %r10, -32(%rbp) + movlpd -32(%rbp), %xmm10 + jmp .L39 +.L121: + movq 16(%rbx), %rax + movl %r8d, (%rax) + jmp .L31 +.L122: + movq 16(%rbx), %rax + movq %r8, (%rax) + jmp .L31 +.L16: + cmpl $3, %r9d + jle .L19 + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movq %r9, %r10 + movq %r9, %r11 + movlpd -32(%rbp), %xmm10 + jmp .L18 +.L70: + jne .L73 + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movq %r9, %r10 + movq %r9, %r11 + movlpd -32(%rbp), %xmm10 + movsd %xmm10, %xmm8 + jmp .L72 +.L43: + cmpl $3, %r9d + jle .L46 + xorl %r10d, %r10d + movq %r10, -32(%rbp) + movq %r10, %r9 + movq %r10, %r11 + movlpd -32(%rbp), %xmm10 + jmp .L45 +.L19: + jne .L22 + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movq %r9, %r10 + movq %r9, %r11 + movlpd -32(%rbp), %xmm10 + movsd %xmm10, %xmm8 + jmp .L21 +.L73: + cmpl $1, %r9d + jle .L76 + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movq %r9, %r10 + movq %r9, %r11 + movlpd -32(%rbp), %xmm10 + movq %r9, %rax + movsd %xmm10, %xmm8 + jmp .L75 +.L46: + jne .L49 + xorl %r10d, %r10d + movq %r10, -32(%rbp) + movq %r10, %r9 + movq %r10, %r11 + movlpd -32(%rbp), %xmm10 + movsd %xmm10, %xmm8 + jmp .L48 +.L22: + cmpl $1, %r9d + jle .L25 + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movq %r9, %r10 + movq %r9, %r11 + movlpd -32(%rbp), %xmm10 + movq %r9, %rax + movsd %xmm10, %xmm8 + jmp .L24 +.L49: + cmpl $1, %r9d + jle .L52 + xorl %r10d, %r10d + movq %r10, -32(%rbp) + movq %r10, %r9 + movq %r10, %r11 + movlpd -32(%rbp), %xmm10 + movq %r10, %rax + movsd %xmm10, %xmm8 + jmp .L51 +.L76: + jne .L130 + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movq %r9, %r10 + movq %r9, %r11 + movlpd -32(%rbp), %xmm10 + movq %r9, %rax + movq %r9, %r8 + movsd %xmm10, %xmm8 + jmp .L78 +.L25: + jne .L131 + xorl %r9d, %r9d + movq %r9, -32(%rbp) + movq %r9, %r10 + movq %r9, %r11 + movlpd -32(%rbp), %xmm10 + movq %r9, %rax + movq %r9, %r8 + movsd %xmm10, %xmm8 + jmp .L27 +.L110: + leaq 0(,%rdi,8), %r12 + movq (%r10), %rsi + movq %r8, %rax + movq $-1, %rdx + movl %r12d, %ecx + salq %cl, %rax + salq %cl, %rdx + xorq %rsi, %rax + andq %rax, %rdx + xorq %rdx, %rsi + cmpq $16, %r11 + movq %rsi, (%r10) + ja .L114 + leaq 0(,%rdi,4), %rax + leal -65(,%r11,8), %edx + movl $32, %edi + movq 8(%r10), %rsi + subl %eax, %edi + movl %edx, %ecx + movl $2, %eax + salq %cl, %rax + movl %edi, %ecx + sarq %cl, %r8 + decq %rax + sarq %cl, %r8 + movl %r12d, %ecx + salq %cl, %r9 + orq %r9, %r8 + xorq %rsi, %r8 + andq %r8, %rax + xorq %rax, %rsi + movq %rsi, 8(%r10) + jmp .L31 +.L112: + leaq 0(,%rdi,8), %rsi + movq (%r10), %rdx + movq %r8, %rbx + movq $-1, %rax + movl %esi, %ecx + salq %cl, %rbx + salq %cl, %rax + movq %rbx, %rcx + xorq %rdx, %rcx + andq %rcx, %rax + leal -65(,%r11,8), %ecx + xorq %rax, %rdx + movl $2, %eax + salq %cl, %rax + movq %rdx, (%r10) + movl $64, %ecx + movq 8(%r10), %rdx + subl %esi, %ecx + decq %rax + sarq %cl, %r8 + xorq %rdx, %r8 + andq %r8, %rax + xorq %rax, %rdx + movq %rdx, 8(%r10) + jmp .L31 +.L52: + jne .L132 + xorl %r10d, %r10d + movq %r10, -32(%rbp) + movq %r10, %r9 + movq %r10, %r11 + movlpd -32(%rbp), %xmm10 + movq %r10, %rax + movq %r10, %r8 + movsd %xmm10, %xmm8 + jmp .L54 +.L130: + xorpd %xmm9, %xmm9 + movsd %xmm9, -32(%rbp) + movq -32(%rbp), %r9 + movsd %xmm9, %xmm10 + movsd %xmm9, %xmm8 + movq %r9, %r11 + movq %r9, %r10 + movq %r9, %rax + movq %r9, %r8 + jmp .L81 +.L114: + movl $64, %esi + movq %r9, %rax + movq 16(%r10), %rdx + subl %r12d, %esi + movl %esi, %ecx + sarq %cl, %r8 + movl %r12d, %ecx + salq %cl, %rax + leal -129(,%r11,8), %ecx + orq %r8, %rax + movq %rax, 8(%r10) + movl $2, %eax + salq %cl, %rax + movl %esi, %ecx + sarq %cl, %r9 + decq %rax + xorq %rdx, %r9 + andq %r9, %rax + xorq %rax, %rdx + movq %rdx, 16(%r10) + jmp .L31 +.L131: + xorpd %xmm9, %xmm9 + movsd %xmm9, -32(%rbp) + movq -32(%rbp), %r9 + movsd %xmm9, %xmm10 + movsd %xmm9, %xmm8 + movq %r9, %r11 + movq %r9, %r10 + movq %r9, %rax + movq %r9, %r8 + jmp .L30 +.L132: + xorpd %xmm9, %xmm9 + movsd %xmm9, -32(%rbp) + movq -32(%rbp), %r10 + movsd %xmm9, %xmm10 + movsd %xmm9, %xmm8 + movq %r10, %r11 + movq %r10, %r9 + movq %r10, %rax + movq %r10, %r8 + jmp .L57 +.LFE2: + .size avcall_call, .-avcall_call + .section .eh_frame,"a",@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 +.LSCIE1: + .long 0x0 + .byte 0x1 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .byte 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + .long .LFB2-. + .long .LFE2-.LFB2 + .uleb128 0x0 + .byte 0x4 + .long .LCFI0-.LFB2 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI4-.LCFI1 + .byte 0x83 + .uleb128 0x5 + .byte 0x8c + .uleb128 0x4 + .byte 0x8d + .uleb128 0x3 + .align 8 +.LEFDE1: + .ident "GCC: (GNU) 4.0.2" + .section .note.GNU-stack,"",@progbits diff --git a/avcall/avcall-x86_64-macro.S b/avcall/avcall-x86_64-macro.S new file mode 100644 index 0000000..a1a79b5 --- /dev/null +++ b/avcall/avcall-x86_64-macro.S @@ -0,0 +1,638 @@ +#include "asm-x86_64.h" + TEXT() + P2ALIGN(4,15) +GLOBL(C(avcall_call)) + DECLARE_FUNCTION(avcall_call) +FUNBEGIN(avcall_call) +L(FB2): + INSN1(push,q ,R(rbp)) +L(CFI0): + INSN2(mov,q ,R(rsp), R(rbp)) +L(CFI1): + INSN1(push,q ,R(r13)) +L(CFI2): + INSN1(push,q ,R(r12)) +L(CFI3): + INSN1(push,q ,R(rbx)) +L(CFI4): + INSN2(mov,q ,R(rdi), R(rbx)) + INSN2(lea,q ,X8 MEM_DISP(rbx,128), R(rdx)) + INSN2(sub,q ,NUM(2072), R(rsp)) +L(CFI5): + INSN2(mov,q ,X8 MEM_DISP(rdi,40), R(rax)) + INSN2(mov,q ,X8 MEM_DISP(rdi,48), R(r8)) + INSN2(lea,q ,X8 MEM_DISP(rsp,15), R(rsi)) + INSN2(sub,q ,R(r8), R(rax)) + INSN2(and,q ,NUM(-16), R(rsi)) + INSN2(mov,q ,R(rax), R(rdi)) + INSN2(mov,q ,X8 MEM_DISP(rbx,120), R(rax)) + INSN2(shr,q ,NUM(3), R(rdi)) + INSN2(sub,q ,R(rdx), R(rax)) + INSN2(mov,q ,R(rax), R(r9)) + INSN2(shr,q ,NUM(3), R(r9)) + INSN2(test,l ,R(edi), R(edi)) + INSN1(jle,_ ,L(2)) + INSN2(xor,l ,R(ecx), R(ecx)) + INSN2(xor,l ,R(edx), R(edx)) + P2ALIGN(4,7) +L(4): + INSN2(mov,q ,X8 MEM_INDEX(rdx,r8), R(rax)) + INSN1(inc,l ,R(ecx)) + INSN2(mov,q ,R(rax),X8 MEM_INDEX(rsi,rdx)) + INSN2(add,q ,NUM(8), R(rdx)) + INSN2(cmp,l ,R(ecx), R(edi)) + INSN1(jne,_ ,L(4)) +L(2): + INSN2(mov,l ,X4 MEM_DISP(rbx,24), R(eax)) + INSN2(cmp,l ,NUM(13), R(eax)) + INSN1(je,_ ,L(124)) + INSN2(cmp,l ,NUM(14), R(eax)) + INSN1(je,_ ,L(125)) + INSN2(cmp,l ,NUM(7), R(r9d)) + INSN2(mov,q ,X8 MEM_DISP(rbx,8), R(r12)) + INSN1(jle,_ ,L(58)) + INSN2(movlp,d ,X8 MEM_DISP(rbx,184), R(xmm10)) +L(60): + INSN2(mov,q ,X8 MEM_DISP(rbx,176), R(r9)) +L(63): + INSN2(mov,q ,X8 MEM_DISP(rbx,168), R(r11)) +L(66): + INSN2(mov,q ,X8 MEM_DISP(rbx,160), R(r10)) +L(69): + INSN2(movlp,d ,X8 MEM_DISP(rbx,152), R(xmm8)) +L(72): + INSN2(mov,q ,X8 MEM_DISP(rbx,144), R(rax)) +L(75): + INSN2(mov,q ,X8 MEM_DISP(rbx,136), R(r8)) +L(78): + INSN2(movlp,d ,X8 MEM_DISP(rbx,128), R(xmm9)) +L(81): + INSN2(mov,q ,X8 MEM_DISP(rbx,88), R(rdx)) + INSN2(mov,q ,X8 MEM_DISP(rbx,96), R(rcx)) + INSN2S(movs,d ,R(xmm10), R(xmm7)) + INSN2(mov,q ,X8 MEM_DISP(rbx,80), R(rsi)) + INSN2(mov,q ,X8 MEM_DISP(rbx,72), R(rdi)) + INSN2S(movs,d ,R(xmm8), R(xmm3)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2S(movs,d ,R(xmm9), R(xmm0)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm6)) + INSN2(mov,q ,R(r11),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm5)) + INSN2(mov,q ,R(r10),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm4)) + INSN2(mov,q ,R(rax),X8 MEM_DISP(rbp,-32)) + INSN2(mov,l ,NUM(8), R(eax)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm2)) + INSN2(mov,q ,R(r8),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm1)) + INSN2(mov,q ,X8 MEM_DISP(rbx,112), R(r9)) + INSN2(mov,q ,X8 MEM_DISP(rbx,104), R(r8)) + INSN1(call,_ ,INDIR(R(r12))) + INSN2(mov,q ,R(rax), R(r8)) + INSN2(mov,l ,X4 MEM_DISP(rbx,24), R(eax)) + INSN2(mov,q ,R(rdx), R(r9)) + INSN2(cmp,l ,NUM(1), R(eax)) + INSN1(je,_ ,L(31)) + INSN2(cmp,l ,NUM(2), R(eax)) + INSN1(je,_ ,L(119)) + INSN2(cmp,l ,NUM(3), R(eax)) + INSN1(je,_ ,L(119)) + INSN2(cmp,l ,NUM(4), R(eax)) + P2ALIGN(4,5) + INSN1(je,_ ,L(119)) + INSN2(cmp,l ,NUM(5), R(eax)) + P2ALIGN(4,5) + INSN1(je,_ ,L(120)) + INSN2(cmp,l ,NUM(6), R(eax)) + P2ALIGN(4,5) + INSN1(je,_ ,L(120)) + INSN2(cmp,l ,NUM(7), R(eax)) + P2ALIGN(4,5) + INSN1(je,_ ,L(121)) + INSN2(cmp,l ,NUM(8), R(eax)) + P2ALIGN(4,5) + INSN1(je,_ ,L(121)) + INSN2(cmp,l ,NUM(9), R(eax)) + P2ALIGN(4,5) + INSN1(je,_ ,L(122)) + INSN2(cmp,l ,NUM(10), R(eax)) + P2ALIGN(4,5) + INSN1(je,_ ,L(122)) + INSN2(cmp,l ,NUM(11), R(eax)) + P2ALIGN(4,5) + INSN1(je,_ ,L(122)) + INSN2(cmp,l ,NUM(12), R(eax)) + P2ALIGN(4,5) + INSN1(je,_ ,L(122)) + INSN2(cmp,l ,NUM(15), R(eax)) + P2ALIGN(4,5) + INSN1(je,_ ,L(122)) + INSN2(cmp,l ,NUM(16), R(eax)) + P2ALIGN(4,5) + INSN1(jne,_ ,L(31)) + INSN2(test,b ,NUM(2),X1 MEM_DISP(rbx,1)) + P2ALIGN(4,5) + INSN1(je,_ ,L(31)) + INSN2(mov,q ,X8 MEM_DISP(rbx,32), R(rdx)) + INSN2(lea,q ,X8 MEM_DISP(rdx,-1), R(rax)) + INSN2(cmp,q ,NUM(15), R(rax)) + INSN1(ja,_ ,L(31)) + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rax)) + INSN2(mov,q ,R(rax), R(r10)) + INSN2(mov,q ,R(rax), R(rdi)) + INSN2(and,l ,NUM(7), R(edi)) + INSN2(and,q ,NUM(-8), R(r10)) + INSN2(cmp,q ,NUM(8), R(rdx)) + INSN2(lea,q ,X8 MEM_INDEX(rdx,rdi), R(r11)) + INSN1(ja,_ ,L(110)) + INSN2(cmp,q ,NUM(8), R(r11)) + INSN1(ja,_ ,L(112)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-1,r11,8), R(ecx)) + INSN2(mov,q ,X8 MEM(r10), R(rsi)) + INSN2(sal,l ,NUM(3), R(edi)) + INSN2(mov,l ,NUM(2), R(edx)) + INSN2(mov,l ,NUM(1), R(eax)) + INSN2(sal,q ,R(cl), R(rdx)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(sal,q ,R(cl), R(rax)) + INSN2(sal,q ,R(cl), R(r8)) + INSN2(xor,q ,R(rsi), R(r8)) + INSN2(sub,q ,R(rax), R(rdx)) + INSN2(and,q ,R(r8), R(rdx)) + INSN2(xor,q ,R(rdx), R(rsi)) + INSN2(mov,q ,R(rsi),X8 MEM(r10)) + INSN1(jmp,_ ,L(31)) + P2ALIGN(4,7) +L(58): + INSN1(je,_ ,L(126)) + INSN2(cmp,l ,NUM(5), R(r9d)) + INSN1(jle,_ ,L(64)) + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + P2ALIGN(4,3) + INSN1(jmp,_ ,L(63)) +L(119): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rax)) + INSN2(mov,b ,R(r8b),X1 MEM(rax)) +L(31): + INSN2(lea,q ,X8 MEM_DISP(rbp,-24), R(rsp)) + INSN2(xor,l ,R(eax), R(eax)) + INSN1(pop,q ,R(rbx)) + INSN1(pop,q ,R(r12)) + INSN1(pop,q ,R(r13)) + leave + ret +L(124): + INSN2(cmp,l ,NUM(7), R(r9d)) + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(r13)) + INSN2(mov,q ,X8 MEM_DISP(rbx,8), R(r12)) + INSN1(jle,_ ,L(7)) + INSN2(movlp,d ,X8 MEM_DISP(rbx,184), R(xmm10)) +L(9): + INSN2(mov,q ,X8 MEM_DISP(rbx,176), R(r9)) +L(12): + INSN2(mov,q ,X8 MEM_DISP(rbx,168), R(r11)) +L(15): + INSN2(mov,q ,X8 MEM_DISP(rbx,160), R(r10)) +L(18): + INSN2(movlp,d ,X8 MEM_DISP(rbx,152), R(xmm8)) +L(21): + INSN2(mov,q ,X8 MEM_DISP(rbx,144), R(rax)) +L(24): + INSN2(mov,q ,X8 MEM_DISP(rbx,136), R(r8)) +L(27): + INSN2(movlp,d ,X8 MEM_DISP(rbx,128), R(xmm9)) +L(30): + INSN2(mov,q ,X8 MEM_DISP(rbx,96), R(rcx)) + INSN2(mov,q ,X8 MEM_DISP(rbx,88), R(rdx)) + INSN2S(movs,d ,R(xmm10), R(xmm7)) + INSN2(mov,q ,X8 MEM_DISP(rbx,80), R(rsi)) + INSN2(mov,q ,X8 MEM_DISP(rbx,72), R(rdi)) + INSN2S(movs,d ,R(xmm8), R(xmm3)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2S(movs,d ,R(xmm9), R(xmm0)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm6)) + INSN2(mov,q ,R(r11),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm5)) + INSN2(mov,q ,R(r10),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm4)) + INSN2(mov,q ,R(rax),X8 MEM_DISP(rbp,-32)) + INSN2(mov,l ,NUM(8), R(eax)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm2)) + INSN2(mov,q ,R(r8),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm1)) + INSN2(mov,q ,X8 MEM_DISP(rbx,112), R(r9)) + INSN2(mov,q ,X8 MEM_DISP(rbx,104), R(r8)) + INSN1(call,_ ,INDIR(R(r12))) + INSN2S(movs,s ,R(xmm0),X4 MEM(r13)) + INSN2(lea,q ,X8 MEM_DISP(rbp,-24), R(rsp)) + INSN2(xor,l ,R(eax), R(eax)) + INSN1(pop,q ,R(rbx)) + INSN1(pop,q ,R(r12)) + INSN1(pop,q ,R(r13)) + leave + ret +L(125): + INSN2(cmp,l ,NUM(7), R(r9d)) + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(r13)) + INSN2(mov,q ,X8 MEM_DISP(rbx,8), R(r12)) + INSN1(jle,_ ,L(34)) + INSN2(movlp,d ,X8 MEM_DISP(rbx,184), R(xmm10)) +L(36): + INSN2(mov,q ,X8 MEM_DISP(rbx,176), R(r10)) +L(39): + INSN2(mov,q ,X8 MEM_DISP(rbx,168), R(r11)) +L(42): + INSN2(mov,q ,X8 MEM_DISP(rbx,160), R(r9)) +L(45): + INSN2(movlp,d ,X8 MEM_DISP(rbx,152), R(xmm8)) +L(48): + INSN2(mov,q ,X8 MEM_DISP(rbx,144), R(rax)) +L(51): + INSN2(mov,q ,X8 MEM_DISP(rbx,136), R(r8)) +L(54): + INSN2(movlp,d ,X8 MEM_DISP(rbx,128), R(xmm9)) +L(57): + INSN2(mov,q ,X8 MEM_DISP(rbx,96), R(rcx)) + INSN2(mov,q ,X8 MEM_DISP(rbx,88), R(rdx)) + INSN2S(movs,d ,R(xmm10), R(xmm7)) + INSN2(mov,q ,X8 MEM_DISP(rbx,80), R(rsi)) + INSN2(mov,q ,X8 MEM_DISP(rbx,72), R(rdi)) + INSN2S(movs,d ,R(xmm8), R(xmm3)) + INSN2(mov,q ,R(r10),X8 MEM_DISP(rbp,-32)) + INSN2S(movs,d ,R(xmm9), R(xmm0)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm6)) + INSN2(mov,q ,R(r11),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm5)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm4)) + INSN2(mov,q ,R(rax),X8 MEM_DISP(rbp,-32)) + INSN2(mov,l ,NUM(8), R(eax)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm2)) + INSN2(mov,q ,R(r8),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm1)) + INSN2(mov,q ,X8 MEM_DISP(rbx,112), R(r9)) + INSN2(mov,q ,X8 MEM_DISP(rbx,104), R(r8)) + INSN1(call,_ ,INDIR(R(r12))) + INSN2S(movs,d ,R(xmm0),X8 MEM(r13)) + INSN2(lea,q ,X8 MEM_DISP(rbp,-24), R(rsp)) + INSN2(xor,l ,R(eax), R(eax)) + INSN1(pop,q ,R(rbx)) + INSN1(pop,q ,R(r12)) + INSN1(pop,q ,R(r13)) + leave + ret +L(7): + INSN1(jne,_ ,L(10)) + INSN2(xorp,d ,R(xmm10), R(xmm10)) + INSN1(jmp,_ ,L(9)) +L(126): + INSN2(xorp,d ,R(xmm10), R(xmm10)) + P2ALIGN(4,7) + INSN1(jmp,_ ,L(60)) +L(34): + P2ALIGN(4,7) + INSN1(jne,_ ,L(37)) + INSN2(xorp,d ,R(xmm10), R(xmm10)) + P2ALIGN(4,7) + INSN1(jmp,_ ,L(36)) +L(120): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rax)) + INSN2(mov,w ,R(r8w),X2 MEM(rax)) + P2ALIGN(4,5) + INSN1(jmp,_ ,L(31)) +L(10): + INSN2(cmp,l ,NUM(5), R(r9d)) + P2ALIGN(4,3) + INSN1(jg,_ ,L(127)) + P2ALIGN(4,5) + INSN1(jne,_ ,L(16)) + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN1(jmp,_ ,L(15)) +L(64): + P2ALIGN(4,3) + INSN1(je,_ ,L(128)) + INSN2(cmp,l ,NUM(3), R(r9d)) + INSN1(jle,_ ,L(70)) + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r9), R(r10)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN1(jmp,_ ,L(69)) +L(37): + INSN2(cmp,l ,NUM(5), R(r9d)) + INSN1(jg,_ ,L(129)) + INSN1(jne,_ ,L(43)) + INSN2(xor,l ,R(r10d), R(r10d)) + INSN2(mov,q ,R(r10),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r10), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN1(jmp,_ ,L(42)) +L(127): + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN1(jmp,_ ,L(12)) +L(128): + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN1(jmp,_ ,L(66)) +L(129): + INSN2(xor,l ,R(r10d), R(r10d)) + INSN2(mov,q ,R(r10),X8 MEM_DISP(rbp,-32)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN1(jmp,_ ,L(39)) +L(121): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rax)) + INSN2(mov,l ,R(r8d),X4 MEM(rax)) + INSN1(jmp,_ ,L(31)) +L(122): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rax)) + INSN2(mov,q ,R(r8),X8 MEM(rax)) + INSN1(jmp,_ ,L(31)) +L(16): + INSN2(cmp,l ,NUM(3), R(r9d)) + INSN1(jle,_ ,L(19)) + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r9), R(r10)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN1(jmp,_ ,L(18)) +L(70): + INSN1(jne,_ ,L(73)) + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r9), R(r10)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN2S(movs,d ,R(xmm10), R(xmm8)) + INSN1(jmp,_ ,L(72)) +L(43): + INSN2(cmp,l ,NUM(3), R(r9d)) + INSN1(jle,_ ,L(46)) + INSN2(xor,l ,R(r10d), R(r10d)) + INSN2(mov,q ,R(r10),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r10), R(r9)) + INSN2(mov,q ,R(r10), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN1(jmp,_ ,L(45)) +L(19): + INSN1(jne,_ ,L(22)) + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r9), R(r10)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN2S(movs,d ,R(xmm10), R(xmm8)) + INSN1(jmp,_ ,L(21)) +L(73): + INSN2(cmp,l ,NUM(1), R(r9d)) + INSN1(jle,_ ,L(76)) + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r9), R(r10)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN2(mov,q ,R(r9), R(rax)) + INSN2S(movs,d ,R(xmm10), R(xmm8)) + INSN1(jmp,_ ,L(75)) +L(46): + INSN1(jne,_ ,L(49)) + INSN2(xor,l ,R(r10d), R(r10d)) + INSN2(mov,q ,R(r10),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r10), R(r9)) + INSN2(mov,q ,R(r10), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN2S(movs,d ,R(xmm10), R(xmm8)) + INSN1(jmp,_ ,L(48)) +L(22): + INSN2(cmp,l ,NUM(1), R(r9d)) + INSN1(jle,_ ,L(25)) + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r9), R(r10)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN2(mov,q ,R(r9), R(rax)) + INSN2S(movs,d ,R(xmm10), R(xmm8)) + INSN1(jmp,_ ,L(24)) +L(49): + INSN2(cmp,l ,NUM(1), R(r9d)) + INSN1(jle,_ ,L(52)) + INSN2(xor,l ,R(r10d), R(r10d)) + INSN2(mov,q ,R(r10),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r10), R(r9)) + INSN2(mov,q ,R(r10), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN2(mov,q ,R(r10), R(rax)) + INSN2S(movs,d ,R(xmm10), R(xmm8)) + INSN1(jmp,_ ,L(51)) +L(76): + INSN1(jne,_ ,L(130)) + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r9), R(r10)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN2(mov,q ,R(r9), R(rax)) + INSN2(mov,q ,R(r9), R(r8)) + INSN2S(movs,d ,R(xmm10), R(xmm8)) + INSN1(jmp,_ ,L(78)) +L(25): + INSN1(jne,_ ,L(131)) + INSN2(xor,l ,R(r9d), R(r9d)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r9), R(r10)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN2(mov,q ,R(r9), R(rax)) + INSN2(mov,q ,R(r9), R(r8)) + INSN2S(movs,d ,R(xmm10), R(xmm8)) + INSN1(jmp,_ ,L(27)) +L(110): + INSN2(lea,q ,X8 MEM_DISP_SHINDEX0(0,rdi,8), R(r12)) + INSN2(mov,q ,X8 MEM(r10), R(rsi)) + INSN2(mov,q ,R(r8), R(rax)) + INSN2(mov,q ,NUM(-1), R(rdx)) + INSN2(mov,l ,R(r12d), R(ecx)) + INSN2(sal,q ,R(cl), R(rax)) + INSN2(sal,q ,R(cl), R(rdx)) + INSN2(xor,q ,R(rsi), R(rax)) + INSN2(and,q ,R(rax), R(rdx)) + INSN2(xor,q ,R(rdx), R(rsi)) + INSN2(cmp,q ,NUM(16), R(r11)) + INSN2(mov,q ,R(rsi),X8 MEM(r10)) + INSN1(ja,_ ,L(114)) + INSN2(lea,q ,X8 MEM_DISP_SHINDEX0(0,rdi,4), R(rax)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,r11,8), R(edx)) + INSN2(mov,l ,NUM(32), R(edi)) + INSN2(mov,q ,X8 MEM_DISP(r10,8), R(rsi)) + INSN2(sub,l ,R(eax), R(edi)) + INSN2(mov,l ,R(edx), R(ecx)) + INSN2(mov,l ,NUM(2), R(eax)) + INSN2(sal,q ,R(cl), R(rax)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(sar,q ,R(cl), R(r8)) + INSN1(dec,q ,R(rax)) + INSN2(sar,q ,R(cl), R(r8)) + INSN2(mov,l ,R(r12d), R(ecx)) + INSN2(sal,q ,R(cl), R(r9)) + INSN2(or,q ,R(r9), R(r8)) + INSN2(xor,q ,R(rsi), R(r8)) + INSN2(and,q ,R(r8), R(rax)) + INSN2(xor,q ,R(rax), R(rsi)) + INSN2(mov,q ,R(rsi),X8 MEM_DISP(r10,8)) + INSN1(jmp,_ ,L(31)) +L(112): + INSN2(lea,q ,X8 MEM_DISP_SHINDEX0(0,rdi,8), R(rsi)) + INSN2(mov,q ,X8 MEM(r10), R(rdx)) + INSN2(mov,q ,R(r8), R(rbx)) + INSN2(mov,q ,NUM(-1), R(rax)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(sal,q ,R(cl), R(rbx)) + INSN2(sal,q ,R(cl), R(rax)) + INSN2(mov,q ,R(rbx), R(rcx)) + INSN2(xor,q ,R(rdx), R(rcx)) + INSN2(and,q ,R(rcx), R(rax)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,r11,8), R(ecx)) + INSN2(xor,q ,R(rax), R(rdx)) + INSN2(mov,l ,NUM(2), R(eax)) + INSN2(sal,q ,R(cl), R(rax)) + INSN2(mov,q ,R(rdx),X8 MEM(r10)) + INSN2(mov,l ,NUM(64), R(ecx)) + INSN2(mov,q ,X8 MEM_DISP(r10,8), R(rdx)) + INSN2(sub,l ,R(esi), R(ecx)) + INSN1(dec,q ,R(rax)) + INSN2(sar,q ,R(cl), R(r8)) + INSN2(xor,q ,R(rdx), R(r8)) + INSN2(and,q ,R(r8), R(rax)) + INSN2(xor,q ,R(rax), R(rdx)) + INSN2(mov,q ,R(rdx),X8 MEM_DISP(r10,8)) + INSN1(jmp,_ ,L(31)) +L(52): + INSN1(jne,_ ,L(132)) + INSN2(xor,l ,R(r10d), R(r10d)) + INSN2(mov,q ,R(r10),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,R(r10), R(r9)) + INSN2(mov,q ,R(r10), R(r11)) + INSN2(movlp,d ,X8 MEM_DISP(rbp,-32), R(xmm10)) + INSN2(mov,q ,R(r10), R(rax)) + INSN2(mov,q ,R(r10), R(r8)) + INSN2S(movs,d ,R(xmm10), R(xmm8)) + INSN1(jmp,_ ,L(54)) +L(130): + INSN2(xorp,d ,R(xmm9), R(xmm9)) + INSN2S(movs,d ,R(xmm9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-32), R(r9)) + INSN2S(movs,d ,R(xmm9), R(xmm10)) + INSN2S(movs,d ,R(xmm9), R(xmm8)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(mov,q ,R(r9), R(r10)) + INSN2(mov,q ,R(r9), R(rax)) + INSN2(mov,q ,R(r9), R(r8)) + INSN1(jmp,_ ,L(81)) +L(114): + INSN2(mov,l ,NUM(64), R(esi)) + INSN2(mov,q ,R(r9), R(rax)) + INSN2(mov,q ,X8 MEM_DISP(r10,16), R(rdx)) + INSN2(sub,l ,R(r12d), R(esi)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(sar,q ,R(cl), R(r8)) + INSN2(mov,l ,R(r12d), R(ecx)) + INSN2(sal,q ,R(cl), R(rax)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-129,r11,8), R(ecx)) + INSN2(or,q ,R(r8), R(rax)) + INSN2(mov,q ,R(rax),X8 MEM_DISP(r10,8)) + INSN2(mov,l ,NUM(2), R(eax)) + INSN2(sal,q ,R(cl), R(rax)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(sar,q ,R(cl), R(r9)) + INSN1(dec,q ,R(rax)) + INSN2(xor,q ,R(rdx), R(r9)) + INSN2(and,q ,R(r9), R(rax)) + INSN2(xor,q ,R(rax), R(rdx)) + INSN2(mov,q ,R(rdx),X8 MEM_DISP(r10,16)) + INSN1(jmp,_ ,L(31)) +L(131): + INSN2(xorp,d ,R(xmm9), R(xmm9)) + INSN2S(movs,d ,R(xmm9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-32), R(r9)) + INSN2S(movs,d ,R(xmm9), R(xmm10)) + INSN2S(movs,d ,R(xmm9), R(xmm8)) + INSN2(mov,q ,R(r9), R(r11)) + INSN2(mov,q ,R(r9), R(r10)) + INSN2(mov,q ,R(r9), R(rax)) + INSN2(mov,q ,R(r9), R(r8)) + INSN1(jmp,_ ,L(30)) +L(132): + INSN2(xorp,d ,R(xmm9), R(xmm9)) + INSN2S(movs,d ,R(xmm9),X8 MEM_DISP(rbp,-32)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-32), R(r10)) + INSN2S(movs,d ,R(xmm9), R(xmm10)) + INSN2S(movs,d ,R(xmm9), R(xmm8)) + INSN2(mov,q ,R(r10), R(r11)) + INSN2(mov,q ,R(r10), R(r9)) + INSN2(mov,q ,R(r10), R(rax)) + INSN2(mov,q ,R(r10), R(r8)) + INSN1(jmp,_ ,L(57)) +L(FE2): + FUNEND(avcall_call, .-avcall_call) +#if !(defined __sun || (defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __CYGWIN__)) + .section EH_FRAME_SECTION +L(frame1): + .long L(ECIE1)-.LSCIE1 +L(SCIE1): + .long 0x0 + .byte 0x1 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .byte 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +L(ECIE1): +L(SFDE1): + .long L(EFDE1)-.LASFDE1 +L(ASFDE1): + .long L(ASFDE1)-.Lframe1 + .long L(FB2)-. + .long L(FE2)-.LFB2 + .uleb128 0x0 + .byte 0x4 + .long L(CFI0)-.LFB2 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long L(CFI1)-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long L(CFI4)-.LCFI1 + .byte 0x83 + .uleb128 0x5 + .byte 0x8c + .uleb128 0x4 + .byte 0x8d + .uleb128 0x3 + .align 8 +L(EFDE1): +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-x86_64-windows-macro.S b/avcall/avcall-x86_64-windows-macro.S new file mode 100644 index 0000000..e5445e3 --- /dev/null +++ b/avcall/avcall-x86_64-windows-macro.S @@ -0,0 +1,370 @@ +#include "asm-x86_64.h" + TEXT() + P2ALIGN(4,15) + GLOBL(C(avcall_call)) + DECLARE_FUNCTION(avcall_call) +FUNBEGIN(avcall_call) +L(FB0): + INSN1(push,q ,R(rbp)) +L(CFI0): + INSN2(mov,q ,R(rsp), R(rbp)) +L(CFI1): + INSN1(push,q ,R(rsi)) + INSN1(push,q ,R(rbx)) +L(CFI2): + INSN2(mov,q ,R(rcx), R(rbx)) + INSN2(sub,q ,NUM(32), R(rsp)) + INSN2(mov,q ,X8 MEM_DISP(rcx,48), R(rcx)) + INSN2(mov,q ,X8 MEM_DISP(rbx,40), R(rax)) + INSN2(sub,q ,NUM(2064), R(rsp)) + INSN2(sub,q ,R(rcx), R(rax)) + INSN2(sar,q ,NUM(3), R(rax)) + INSN2(cmp,l ,NUM(4), R(eax)) + INSN1(jle,_ ,L(6)) + INSN2(lea,l ,X4 MEM_DISP(rax,-5), R(r8d)) + INSN2(lea,q ,X8 MEM_DISP(rsp,32), R(r9)) + INSN2(xor,l ,R(eax), R(eax)) + INSN2(add,q ,NUM(1), R(r8)) + P2ALIGN(4,10) + P2ALIGN(3,7) +L(5): + INSN2(mov,q ,X8 MEM_DISP_SHINDEX(rcx,32,rax,8), R(rdx)) + INSN2(mov,q ,R(rdx),X8 MEM_SHINDEX(r9,rax,8)) + INSN2(add,q ,NUM(1), R(rax)) + INSN2(cmp,q ,R(r8), R(rax)) + INSN1(jne,_ ,L(5)) +L(6): + INSN2(mov,l ,X4 MEM_DISP(rbx,68), R(eax)) + INSN2(test,l ,R(eax), R(eax)) + INSN1(je,_ ,L(7)) + INSN2(test,b ,NUM(1), R(al)) + INSN1(je,_ ,L(8)) + INSN2S(movs,s ,X4 MEM_DISP(rbx,76), R(xmm0)) +L(8): + INSN2(test,b ,NUM(2), R(al)) + INSN1(je,_ ,L(9)) + INSN2S(movs,s ,X4 MEM_DISP(rbx,80), R(xmm1)) +L(9): + INSN2(test,b ,NUM(4), R(al)) + INSN1(je,_ ,L(10)) + INSN2S(movs,s ,X4 MEM_DISP(rbx,84), R(xmm2)) +L(10): + INSN2(test,b ,NUM(8), R(al)) + INSN1(jne,_ ,L(76)) +L(7): + INSN2(mov,l ,X4 MEM_DISP(rbx,72), R(eax)) + INSN2(test,l ,R(eax), R(eax)) + INSN1(je,_ ,L(12)) + INSN2(test,b ,NUM(1), R(al)) + INSN1(je,_ ,L(13)) + INSN2S(movs,d ,X8 MEM_DISP(rbx,96), R(xmm0)) +L(13): + INSN2(test,b ,NUM(2), R(al)) + INSN1(je,_ ,L(14)) + INSN2S(movs,d ,X8 MEM_DISP(rbx,104), R(xmm1)) +L(14): + INSN2(test,b ,NUM(4), R(al)) + INSN1(je,_ ,L(15)) + INSN2S(movs,d ,X8 MEM_DISP(rbx,112), R(xmm2)) +L(15): + INSN2(test,b ,NUM(8), R(al)) + INSN1(jne,_ ,L(77)) +L(12): + INSN2(mov,l ,X4 MEM_DISP(rbx,24), R(eax)) + INSN2(cmp,l ,NUM(13), R(eax)) + INSN1(je,_ ,L(78)) + INSN2(cmp,l ,NUM(14), R(eax)) + INSN1(je,_ ,L(79)) + INSN2(mov,q ,X8 MEM_DISP(rcx,8), R(rdx)) + INSN2(mov,q ,X8 MEM_DISP(rcx,24), R(r9)) + INSN2(mov,q ,X8 MEM_DISP(rcx,16), R(r8)) + INSN2(mov,q ,X8 MEM(rcx), R(rcx)) + INSN1(call,_ ,INDIR(X8 MEM_DISP(rbx,8))) + INSN2(mov,l ,X4 MEM_DISP(rbx,24), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(je,_ ,L(18)) + INSN2(cmp,l ,NUM(2), R(edx)) + INSN1(je,_ ,L(71)) + INSN2(cmp,l ,NUM(3), R(edx)) + INSN1(je,_ ,L(71)) + INSN2(cmp,l ,NUM(4), R(edx)) + INSN1(je,_ ,L(71)) + INSN2(cmp,l ,NUM(5), R(edx)) + INSN1(je,_ ,L(72)) + INSN2(cmp,l ,NUM(6), R(edx)) + INSN1(je,_ ,L(72)) + INSN2(cmp,l ,NUM(7), R(edx)) + INSN1(je,_ ,L(73)) + INSN2(cmp,l ,NUM(8), R(edx)) + INSN1(je,_ ,L(73)) + INSN2(cmp,l ,NUM(9), R(edx)) + INSN1(je,_ ,L(74)) + INSN2(cmp,l ,NUM(10), R(edx)) + INSN1(je,_ ,L(74)) + INSN2(cmp,l ,NUM(11), R(edx)) + INSN1(je,_ ,L(74)) + INSN2(cmp,l ,NUM(12), R(edx)) + INSN1(je,_ ,L(74)) + INSN2(cmp,l ,NUM(15), R(edx)) + INSN1(je,_ ,L(74)) + INSN2(cmp,l ,NUM(16), R(edx)) + INSN1(jne,_ ,L(18)) + INSN2(test,l ,NUM(512),X4 MEM(rbx)) + INSN1(je,_ ,L(18)) + INSN2(mov,q ,X8 MEM_DISP(rbx,32), R(r8)) + INSN2(lea,q ,X8 MEM_DISP(r8,-4), R(rdx)) + INSN2(test,q ,NUM(-5), R(rdx)) + INSN1(je,_ ,L(34)) + INSN2(lea,q ,X8 MEM_DISP(r8,-1), R(rdx)) + INSN2(cmp,q ,NUM(1), R(rdx)) + INSN1(ja,_ ,L(18)) +L(34): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rdx)) + INSN2(mov,q ,R(rdx), R(r9)) + INSN2(and,l ,NUM(7), R(edx)) + INSN2(add,q ,R(rdx), R(r8)) + INSN2(and,q ,NUM(-8), R(r9)) + INSN2(cmp,q ,NUM(8), R(r8)) + INSN1(jbe,_ ,L(80)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,rdx,8), R(ecx)) + INSN2(mov,q ,X8 MEM(r9), R(r10)) + INSN2(mov,q ,R(rax), R(rsi)) + INSN2(mov,q ,NUM(-1), R(r11)) + INSN1(neg,l ,R(edx)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(sal,q ,R(cl), R(r11)) + INSN2(mov,q ,R(rsi), R(rcx)) + INSN2(xor,q ,R(r10), R(rcx)) + INSN2(and,q ,R(r11), R(rcx)) + INSN2(xor,q ,R(r10), R(rcx)) + INSN2(mov,q ,X8 MEM_DISP(r9,8), R(r10)) + INSN2(mov,q ,R(rcx),X8 MEM(r9)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,r8,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(r8d)) + INSN2(sal,q ,R(cl), R(r8)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(64,rdx,8), R(ecx)) + INSN2(sub,q ,NUM(1), R(r8)) + INSN2(sar,q ,R(cl), R(rax)) + INSN2(xor,q ,R(r10), R(rax)) + INSN2(and,q ,R(r8), R(rax)) + INSN2(xor,q ,R(r10), R(rax)) + INSN2(mov,q ,R(rax),X8 MEM_DISP(r9,8)) +L(18): + INSN2(lea,q ,X8 MEM_DISP(rbp,-16), R(rsp)) + INSN2(xor,l ,R(eax), R(eax)) + INSN1(pop,q ,R(rbx)) +L(CFI3): + INSN1(pop,q ,R(rsi)) +L(CFI4): + INSN1(pop,q ,R(rbp)) +L(CFI5): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(77): +L(CFI6): + INSN2S(movs,d ,X8 MEM_DISP(rbx,120), R(xmm3)) + INSN1(jmp,_ ,L(12)) + P2ALIGN(4,10) + P2ALIGN(3,7) +L(76): + INSN2S(movs,s ,X4 MEM_DISP(rbx,88), R(xmm3)) + INSN1(jmp,_ ,L(7)) + P2ALIGN(4,10) + P2ALIGN(3,7) +L(71): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rdx)) + INSN2(mov,b ,R(al),X1 MEM(rdx)) + INSN2(lea,q ,X8 MEM_DISP(rbp,-16), R(rsp)) + INSN2(xor,l ,R(eax), R(eax)) + INSN1(pop,q ,R(rbx)) +L(CFI7): + INSN1(pop,q ,R(rsi)) +L(CFI8): + INSN1(pop,q ,R(rbp)) +L(CFI9): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(72): +L(CFI10): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rdx)) + INSN2(mov,w ,R(ax),X2 MEM(rdx)) + INSN2(lea,q ,X8 MEM_DISP(rbp,-16), R(rsp)) + INSN2(xor,l ,R(eax), R(eax)) + INSN1(pop,q ,R(rbx)) +L(CFI11): + INSN1(pop,q ,R(rsi)) +L(CFI12): + INSN1(pop,q ,R(rbp)) +L(CFI13): + ret +L(74): +L(CFI14): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rdx)) + INSN2(mov,q ,R(rax),X8 MEM(rdx)) + INSN1(jmp,_ ,L(18)) + P2ALIGN(4,10) + P2ALIGN(3,7) +L(79): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rsi)) + INSN2(mov,q ,X8 MEM_DISP(rcx,8), R(rdx)) + INSN2(mov,q ,X8 MEM_DISP(rcx,24), R(r9)) + INSN2(mov,q ,X8 MEM_DISP(rcx,16), R(r8)) + INSN2(mov,q ,X8 MEM(rcx), R(rcx)) + INSN1(call,_ ,INDIR(X8 MEM_DISP(rbx,8))) + INSN2S(movs,d ,R(xmm0),X8 MEM(rsi)) + INSN2(lea,q ,X8 MEM_DISP(rbp,-16), R(rsp)) + INSN2(xor,l ,R(eax), R(eax)) + INSN1(pop,q ,R(rbx)) +L(CFI15): + INSN1(pop,q ,R(rsi)) +L(CFI16): + INSN1(pop,q ,R(rbp)) +L(CFI17): + ret +L(78): +L(CFI18): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rsi)) + INSN2(mov,q ,X8 MEM_DISP(rcx,8), R(rdx)) + INSN2(mov,q ,X8 MEM_DISP(rcx,24), R(r9)) + INSN2(mov,q ,X8 MEM_DISP(rcx,16), R(r8)) + INSN2(mov,q ,X8 MEM(rcx), R(rcx)) + INSN1(call,_ ,INDIR(X8 MEM_DISP(rbx,8))) + INSN2S(movs,s ,R(xmm0),X4 MEM(rsi)) + INSN1(jmp,_ ,L(18)) +L(73): + INSN2(mov,q ,X8 MEM_DISP(rbx,16), R(rdx)) + INSN2(mov,l ,R(eax),X4 MEM(rdx)) + INSN1(jmp,_ ,L(18)) +L(80): + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-1,r8,8), R(ecx)) + INSN2(mov,q ,X8 MEM(r9), R(r10)) + INSN2(sal,l ,NUM(3), R(edx)) + INSN2(mov,l ,NUM(2), R(r8d)) + INSN2(mov,l ,NUM(1), R(r11d)) + INSN2(sal,q ,R(cl), R(r8)) + INSN2(mov,l ,R(edx), R(ecx)) + INSN2(sal,q ,R(cl), R(r11)) + INSN2(sal,q ,R(cl), R(rax)) + INSN2(sub,q ,R(r11), R(r8)) + INSN2(xor,q ,R(r10), R(rax)) + INSN2(and,q ,R(r8), R(rax)) + INSN2(xor,q ,R(r10), R(rax)) + INSN2(mov,q ,R(rax),X8 MEM(r9)) + INSN1(jmp,_ ,L(18)) +L(FE0): + FUNEND(avcall_call, .-avcall_call) +#if !(defined __sun || (defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __CYGWIN__)) + .section EH_FRAME_SECTION +L(frame1): + .long L(ECIE1)-.LSCIE1 +L(SCIE1): + .long 0 + .byte 0x3 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .uleb128 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +L(ECIE1): +L(SFDE1): + .long L(EFDE1)-.LASFDE1 +L(ASFDE1): + .long L(ASFDE1)-.Lframe1 + .long L(FB0)-. + .long L(FE0)-.LFB0 + .uleb128 0 + .byte 0x4 + .long L(CFI0)-.LFB0 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long L(CFI1)-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long L(CFI2)-.LCFI1 + .byte 0x84 + .uleb128 0x3 + .byte 0x83 + .uleb128 0x4 + .byte 0x4 + .long L(CFI3)-.LCFI2 + .byte 0xa + .byte 0xc3 + .byte 0x4 + .long L(CFI4)-.LCFI3 + .byte 0xc4 + .byte 0x4 + .long L(CFI5)-.LCFI4 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI6)-.LCFI5 + .byte 0xb + .byte 0x4 + .long L(CFI7)-.LCFI6 + .byte 0xa + .byte 0xc3 + .byte 0x4 + .long L(CFI8)-.LCFI7 + .byte 0xc4 + .byte 0x4 + .long L(CFI9)-.LCFI8 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI10)-.LCFI9 + .byte 0xb + .byte 0x4 + .long L(CFI11)-.LCFI10 + .byte 0xa + .byte 0xc3 + .byte 0x4 + .long L(CFI12)-.LCFI11 + .byte 0xc4 + .byte 0x4 + .long L(CFI13)-.LCFI12 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI14)-.LCFI13 + .byte 0xb + .byte 0x4 + .long L(CFI15)-.LCFI14 + .byte 0xa + .byte 0xc3 + .byte 0x4 + .long L(CFI16)-.LCFI15 + .byte 0xc4 + .byte 0x4 + .long L(CFI17)-.LCFI16 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI18)-.LCFI17 + .byte 0xb + .align 8 +L(EFDE1): +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/avcall/avcall-x86_64-windows.c b/avcall/avcall-x86_64-windows.c new file mode 100644 index 0000000..f34d136 --- /dev/null +++ b/avcall/avcall-x86_64-windows.c @@ -0,0 +1,225 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + Foreign function interface for an x86_64 (a.k.a. amd64) with gcc + using the Windows ABI ('gcc -mabi=ms'). + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + x86_64 Argument Passing Conventions on Windows: + + Documentation is at https://docs.microsoft.com/en-us/cpp/build/calling-convention + A summary is at https://en.wikipedia.org/wiki/X86_calling_conventions#x86-64_calling_conventions + + * Arguments: + - Up to 4 words are passed in registers: + integer/pointer float/double + 1. %rcx %xmm0 + 2. %rdx %xmm1 + 3. %r8 %xmm2 + 4. %r9 %xmm3 + - Integer or pointer arguments: + The first 4 integer or pointer arguments get passed in integer + registers (%rcx, %rdx, %r8, %r9). + The remaining ones (as an entire word each) on the stack. + - Floating-point arguments: + The float/double arguments among the first 4 words are passed in + SSE registers (%xmm0..%xmm3), as shown above. + The remaining ones (as an entire word each) on the stack. + - Structure arguments: + Structure args of size 1, 2, 4, 8 bytes are passed like integers. + Structure args of other sizes are passed as pointers to caller-allocated + temporary locations. + * Return value: + Types of size 1, 2, 4, 8 bytes are returned in %rax or (for float/double + values) in %xmm0. + To return a structure of another size, the called function copies the + value to space pointed to by its first argument, and all other arguments + are shifted down by one. The function also returns the pointer. + * Call-used registers: rax,rdx,rcx,r8-r11 + + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +/*register __avrword iarg1 __asm__("rcx");*/ +/*register __avrword iarg2 __asm__("rdx");*/ +/*register __avrword iarg3 __asm__("r8");*/ +/*register __avrword iarg4 __asm__("r9");*/ + +register float farg1 __asm__("xmm0"); +register float farg2 __asm__("xmm1"); +register float farg3 __asm__("xmm2"); +register float farg4 __asm__("xmm3"); + +register double darg1 __asm__("xmm0"); +register double darg2 __asm__("xmm1"); +register double darg3 __asm__("xmm2"); +register double darg4 __asm__("xmm3"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("rsp"); /* C names for registers */ + register __avrword iret __asm__("rax"); + register float fret __asm__("xmm0"); + register double dret __asm__("xmm0"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + int i; + + for (i = 4; i < arglen; i++) /* push function args onto stack */ + argframe[i-4] = l->args[i]; + + /* put up to 4 float args into registers */ + if (l->farg_mask) { + if (l->farg_mask & (1<<0)) + farg1 = l->fargs[0]; + if (l->farg_mask & (1<<1)) + farg2 = l->fargs[1]; + if (l->farg_mask & (1<<2)) + farg3 = l->fargs[2]; + if (l->farg_mask & (1<<3)) + farg4 = l->fargs[3]; + } + + /* put up to 4 double args into registers */ + if (l->darg_mask) { + if (l->darg_mask & (1<<0)) + darg1 = l->dargs[0]; + if (l->darg_mask & (1<<1)) + darg2 = l->dargs[1]; + if (l->darg_mask & (1<<2)) + darg3 = l->dargs[2]; + if (l->darg_mask & (1<<3)) + darg4 = l->dargs[3]; + } + + /* Call function. */ + if (l->rtype == __AVfloat) { + *(float*)l->raddr = (*(float(*)())l->func)(l->args[0], l->args[1], l->args[2], l->args[3]); + } else + if (l->rtype == __AVdouble) { + *(double*)l->raddr = (*(double(*)())l->func)(l->args[0], l->args[1], l->args[2], l->args[3]); + } else { + __avrword iret; + iret = (*l->func)(l->args[0], l->args[1], l->args[2], l->args[3]); + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, iret); + } else + if (l->rtype == __AVlonglong) { + RETURN(long long, iret); + } else + if (l->rtype == __AVulonglong) { + RETURN(unsigned long long, iret); + } else + /* see above + if (l->rtype == __AVfloat) { + } else + if (l->rtype == __AVdouble) { + } else + */ + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + /* Return structs of size 1, 2, 4, 8 in registers. */ + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize == 1) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + } else + if (l->rsize == 2) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + } else + if (l->rsize == 4) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + } else + if (l->rsize == 8) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[7] = (unsigned char)(iret>>56); + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; + if (count == 1 || count == 2 || count == 4 || count == 8) { + /* 0 < count ≤ sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 2*sizeof(__avrword) */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (end_offset*8-1)) - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret >> (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } + #endif + } + } + } + return 0; +} diff --git a/avcall/avcall-x86_64-windows.s b/avcall/avcall-x86_64-windows.s new file mode 100644 index 0000000..587ff0a --- /dev/null +++ b/avcall/avcall-x86_64-windows.s @@ -0,0 +1,367 @@ + .file "avcall-x86_64-windows.c" + .text + .p2align 4,,15 + .globl avcall_call + .type avcall_call, @function +avcall_call: +.LFB0: + pushq %rbp +.LCFI0: + movq %rsp, %rbp +.LCFI1: + pushq %rsi + pushq %rbx +.LCFI2: + movq %rcx, %rbx + subq $32, %rsp + movq 48(%rcx), %rcx + movq 40(%rbx), %rax + subq $2064, %rsp + subq %rcx, %rax + sarq $3, %rax + cmpl $4, %eax + jle .L6 + leal -5(%rax), %r8d + leaq 32(%rsp), %r9 + xorl %eax, %eax + addq $1, %r8 + .p2align 4,,10 + .p2align 3 +.L5: + movq 32(%rcx,%rax,8), %rdx + movq %rdx, (%r9,%rax,8) + addq $1, %rax + cmpq %r8, %rax + jne .L5 +.L6: + movl 68(%rbx), %eax + testl %eax, %eax + je .L7 + testb $1, %al + je .L8 + movss 76(%rbx), %xmm0 +.L8: + testb $2, %al + je .L9 + movss 80(%rbx), %xmm1 +.L9: + testb $4, %al + je .L10 + movss 84(%rbx), %xmm2 +.L10: + testb $8, %al + jne .L76 +.L7: + movl 72(%rbx), %eax + testl %eax, %eax + je .L12 + testb $1, %al + je .L13 + movsd 96(%rbx), %xmm0 +.L13: + testb $2, %al + je .L14 + movsd 104(%rbx), %xmm1 +.L14: + testb $4, %al + je .L15 + movsd 112(%rbx), %xmm2 +.L15: + testb $8, %al + jne .L77 +.L12: + movl 24(%rbx), %eax + cmpl $13, %eax + je .L78 + cmpl $14, %eax + je .L79 + movq 8(%rcx), %rdx + movq 24(%rcx), %r9 + movq 16(%rcx), %r8 + movq (%rcx), %rcx + call *8(%rbx) + movl 24(%rbx), %edx + cmpl $1, %edx + je .L18 + cmpl $2, %edx + je .L71 + cmpl $3, %edx + je .L71 + cmpl $4, %edx + je .L71 + cmpl $5, %edx + je .L72 + cmpl $6, %edx + je .L72 + cmpl $7, %edx + je .L73 + cmpl $8, %edx + je .L73 + cmpl $9, %edx + je .L74 + cmpl $10, %edx + je .L74 + cmpl $11, %edx + je .L74 + cmpl $12, %edx + je .L74 + cmpl $15, %edx + je .L74 + cmpl $16, %edx + jne .L18 + testl $512, (%rbx) + je .L18 + movq 32(%rbx), %r8 + leaq -4(%r8), %rdx + testq $-5, %rdx + je .L34 + leaq -1(%r8), %rdx + cmpq $1, %rdx + ja .L18 +.L34: + movq 16(%rbx), %rdx + movq %rdx, %r9 + andl $7, %edx + addq %rdx, %r8 + andq $-8, %r9 + cmpq $8, %r8 + jbe .L80 + leal 0(,%rdx,8), %ecx + movq (%r9), %r10 + movq %rax, %rsi + movq $-1, %r11 + negl %edx + salq %cl, %rsi + salq %cl, %r11 + movq %rsi, %rcx + xorq %r10, %rcx + andq %r11, %rcx + xorq %r10, %rcx + movq 8(%r9), %r10 + movq %rcx, (%r9) + leal -65(,%r8,8), %ecx + movl $2, %r8d + salq %cl, %r8 + leal 64(,%rdx,8), %ecx + subq $1, %r8 + sarq %cl, %rax + xorq %r10, %rax + andq %r8, %rax + xorq %r10, %rax + movq %rax, 8(%r9) +.L18: + leaq -16(%rbp), %rsp + xorl %eax, %eax + popq %rbx +.LCFI3: + popq %rsi +.LCFI4: + popq %rbp +.LCFI5: + ret + .p2align 4,,10 + .p2align 3 +.L77: +.LCFI6: + movsd 120(%rbx), %xmm3 + jmp .L12 + .p2align 4,,10 + .p2align 3 +.L76: + movss 88(%rbx), %xmm3 + jmp .L7 + .p2align 4,,10 + .p2align 3 +.L71: + movq 16(%rbx), %rdx + movb %al, (%rdx) + leaq -16(%rbp), %rsp + xorl %eax, %eax + popq %rbx +.LCFI7: + popq %rsi +.LCFI8: + popq %rbp +.LCFI9: + ret + .p2align 4,,10 + .p2align 3 +.L72: +.LCFI10: + movq 16(%rbx), %rdx + movw %ax, (%rdx) + leaq -16(%rbp), %rsp + xorl %eax, %eax + popq %rbx +.LCFI11: + popq %rsi +.LCFI12: + popq %rbp +.LCFI13: + ret +.L74: +.LCFI14: + movq 16(%rbx), %rdx + movq %rax, (%rdx) + jmp .L18 + .p2align 4,,10 + .p2align 3 +.L79: + movq 16(%rbx), %rsi + movq 8(%rcx), %rdx + movq 24(%rcx), %r9 + movq 16(%rcx), %r8 + movq (%rcx), %rcx + call *8(%rbx) + movsd %xmm0, (%rsi) + leaq -16(%rbp), %rsp + xorl %eax, %eax + popq %rbx +.LCFI15: + popq %rsi +.LCFI16: + popq %rbp +.LCFI17: + ret +.L78: +.LCFI18: + movq 16(%rbx), %rsi + movq 8(%rcx), %rdx + movq 24(%rcx), %r9 + movq 16(%rcx), %r8 + movq (%rcx), %rcx + call *8(%rbx) + movss %xmm0, (%rsi) + jmp .L18 +.L73: + movq 16(%rbx), %rdx + movl %eax, (%rdx) + jmp .L18 +.L80: + leal -1(,%r8,8), %ecx + movq (%r9), %r10 + sall $3, %edx + movl $2, %r8d + movl $1, %r11d + salq %cl, %r8 + movl %edx, %ecx + salq %cl, %r11 + salq %cl, %rax + subq %r11, %r8 + xorq %r10, %rax + andq %r8, %rax + xorq %r10, %rax + movq %rax, (%r9) + jmp .L18 +.LFE0: + .size avcall_call, .-avcall_call + .section .eh_frame,"a",@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 +.LSCIE1: + .long 0 + .byte 0x3 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .uleb128 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + .long .LFB0-. + .long .LFE0-.LFB0 + .uleb128 0 + .byte 0x4 + .long .LCFI0-.LFB0 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI2-.LCFI1 + .byte 0x84 + .uleb128 0x3 + .byte 0x83 + .uleb128 0x4 + .byte 0x4 + .long .LCFI3-.LCFI2 + .byte 0xa + .byte 0xc3 + .byte 0x4 + .long .LCFI4-.LCFI3 + .byte 0xc4 + .byte 0x4 + .long .LCFI5-.LCFI4 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI6-.LCFI5 + .byte 0xb + .byte 0x4 + .long .LCFI7-.LCFI6 + .byte 0xa + .byte 0xc3 + .byte 0x4 + .long .LCFI8-.LCFI7 + .byte 0xc4 + .byte 0x4 + .long .LCFI9-.LCFI8 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI10-.LCFI9 + .byte 0xb + .byte 0x4 + .long .LCFI11-.LCFI10 + .byte 0xa + .byte 0xc3 + .byte 0x4 + .long .LCFI12-.LCFI11 + .byte 0xc4 + .byte 0x4 + .long .LCFI13-.LCFI12 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI14-.LCFI13 + .byte 0xb + .byte 0x4 + .long .LCFI15-.LCFI14 + .byte 0xa + .byte 0xc3 + .byte 0x4 + .long .LCFI16-.LCFI15 + .byte 0xc4 + .byte 0x4 + .long .LCFI17-.LCFI16 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI18-.LCFI17 + .byte 0xb + .align 8 +.LEFDE1: + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/avcall/avcall-x86_64-x32-linux.s b/avcall/avcall-x86_64-x32-linux.s new file mode 100644 index 0000000..00cc199 --- /dev/null +++ b/avcall/avcall-x86_64-x32-linux.s @@ -0,0 +1,612 @@ + .file "avcall-x86_64.c" + .section .text.unlikely,"ax",@progbits +.LCOLDB1: + .text +.LHOTB1: + .p2align 4,,15 + .globl avcall_call + .type avcall_call, @function +avcall_call: +.LFB0: + pushq %rbp +.LCFI0: + movl %esp, %ebp +.LCFI1: + pushq %r12 + pushq %rbx +.LCFI2: + movq %rdi, %rbx + movl 24(%edi), %edi + movl 20(%ebx), %ecx + movl 88(%ebx), %r8d + subl $2064, %esp + leal 96(%rbx), %eax + leal 15(%rsp), %esi + subl %edi, %ecx + subl %eax, %r8d + andl $-16, %esi + sarl $3, %ecx + sarl $3, %r8d + xorl %eax, %eax + testl %ecx, %ecx + jle .L6 + .p2align 4,,10 + .p2align 3 +.L76: + movq (%edi,%eax,8), %rdx + movq %rdx, (%esi,%eax,8) + addl $1, %eax + cmpl %eax, %ecx + jne .L76 +.L6: + movl 12(%ebx), %eax + cmpl $13, %eax + je .L93 + cmpl $14, %eax + je .L94 + cmpl $7, %r8d + movl 4(%ebx), %r10d + jle .L39 + movsd 152(%ebx), %xmm14 +.L40: + movsd 144(%ebx), %xmm13 +.L42: + movsd 136(%ebx), %xmm12 +.L44: + movsd 128(%ebx), %xmm11 +.L46: + movsd 120(%ebx), %xmm10 +.L48: + movsd 112(%ebx), %xmm9 +.L50: + movsd 104(%ebx), %xmm8 +.L52: + movsd 96(%ebx), %xmm15 +.L53: + movq 64(%ebx), %rcx + movq 56(%ebx), %rdx + movl $8, %eax + movq 48(%ebx), %rsi + movq 40(%ebx), %rdi + movapd %xmm14, %xmm7 + movapd %xmm13, %xmm6 + movapd %xmm12, %xmm5 + movq 80(%ebx), %r9 + movapd %xmm11, %xmm4 + movq 72(%ebx), %r8 + movapd %xmm10, %xmm3 + movapd %xmm9, %xmm2 + movapd %xmm8, %xmm1 + movapd %xmm15, %xmm0 + call *%r10 + movl 12(%ebx), %ecx + cmpl $1, %ecx + je .L22 + cmpl $2, %ecx + je .L84 + cmpl $3, %ecx + je .L84 + cmpl $4, %ecx + je .L84 + cmpl $5, %ecx + je .L85 + cmpl $6, %ecx + je .L85 + cmpl $7, %ecx + je .L89 + cmpl $8, %ecx + je .L89 + cmpl $9, %ecx + je .L89 + cmpl $10, %ecx + je .L89 + cmpl $11, %ecx + je .L90 + cmpl $12, %ecx + je .L90 + cmpl $15, %ecx + je .L89 + cmpl $16, %ecx + jne .L22 + testl $512, (%ebx) + je .L22 + movl 16(%ebx), %ecx + leal -1(%rcx), %esi + cmpl $15, %esi + ja .L22 + movl 8(%ebx), %esi + movl %esi, %edi + andl $7, %esi + andl $-8, %edi + cmpl $8, %ecx + leal (%rcx,%rsi), %r8d + ja .L66 + cmpl $8, %r8d + ja .L67 + leal -1(,%r8,8), %ecx + movq (%edi), %r9 + sall $3, %esi + movl $2, %edx + movl $1, %r8d + salq %cl, %rdx + movl %esi, %ecx + salq %cl, %r8 + salq %cl, %rax + subq %r8, %rdx + xorq %r9, %rax + andq %rdx, %rax + xorq %r9, %rax + movq %rax, (%edi) +.L22: + leal -16(%rbp), %esp + xorl %eax, %eax + popq %rbx + popq %r12 + popq %rbp +.LCFI3: + ret + .p2align 4,,10 + .p2align 3 +.L39: +.LCFI4: + je .L95 + cmpl $6, %r8d + je .L96 + cmpl $5, %r8d + je .L97 + cmpl $4, %r8d + je .L98 + cmpl $3, %r8d + je .L99 + cmpl $2, %r8d + je .L100 + pxor %xmm8, %xmm8 + cmpl $1, %r8d + movapd %xmm8, %xmm9 + movapd %xmm8, %xmm10 + movapd %xmm8, %xmm11 + movapd %xmm8, %xmm12 + movapd %xmm8, %xmm13 + movapd %xmm8, %xmm14 + je .L52 + movapd %xmm8, %xmm15 + jmp .L53 + .p2align 4,,10 + .p2align 3 +.L93: + cmpl $7, %r8d + movl 8(%ebx), %r12d + movl 4(%ebx), %r10d + jle .L7 + movsd 152(%ebx), %xmm14 +.L8: + movsd 144(%ebx), %xmm13 +.L10: + movsd 136(%ebx), %xmm12 +.L12: + movsd 128(%ebx), %xmm11 +.L14: + movsd 120(%ebx), %xmm10 +.L16: + movsd 112(%ebx), %xmm9 +.L18: + movsd 104(%ebx), %xmm8 +.L20: + movsd 96(%ebx), %xmm15 + jmp .L21 + .p2align 4,,10 + .p2align 3 +.L84: + movl 8(%ebx), %edx + movb %al, (%edx) + leal -16(%rbp), %esp + xorl %eax, %eax + popq %rbx + popq %r12 + popq %rbp +.LCFI5: + ret + .p2align 4,,10 + .p2align 3 +.L94: +.LCFI6: + cmpl $7, %r8d + movl 8(%ebx), %r12d + movl 4(%ebx), %r10d + jle .L24 + movsd 152(%ebx), %xmm14 +.L25: + movsd 144(%ebx), %xmm13 +.L27: + movsd 136(%ebx), %xmm12 +.L29: + movsd 128(%ebx), %xmm11 +.L31: + movsd 120(%ebx), %xmm10 +.L33: + movsd 112(%ebx), %xmm9 +.L35: + movsd 104(%ebx), %xmm8 +.L37: + movsd 96(%ebx), %xmm15 +.L38: + movq 64(%ebx), %rcx + movq 56(%ebx), %rdx + movl $8, %eax + movq 48(%ebx), %rsi + movq 40(%ebx), %rdi + movq 80(%ebx), %r9 + movq 72(%ebx), %r8 + movapd %xmm14, %xmm7 + movapd %xmm13, %xmm6 + movapd %xmm12, %xmm5 + movapd %xmm11, %xmm4 + movapd %xmm10, %xmm3 + movapd %xmm9, %xmm2 + movapd %xmm8, %xmm1 + movapd %xmm15, %xmm0 + call *%r10 + movsd %xmm0, (%r12d) + leal -16(%rbp), %esp + xorl %eax, %eax + popq %rbx + popq %r12 + popq %rbp +.LCFI7: + ret + .p2align 4,,10 + .p2align 3 +.L7: +.LCFI8: + je .L101 + cmpl $6, %r8d + je .L102 + cmpl $5, %r8d + je .L103 + cmpl $4, %r8d + je .L104 + cmpl $3, %r8d + je .L105 + cmpl $2, %r8d + je .L106 + pxor %xmm8, %xmm8 + cmpl $1, %r8d + movapd %xmm8, %xmm9 + movapd %xmm8, %xmm10 + movapd %xmm8, %xmm11 + movapd %xmm8, %xmm12 + movapd %xmm8, %xmm13 + movapd %xmm8, %xmm14 + movapd %xmm8, %xmm15 + je .L20 +.L21: + movq 64(%ebx), %rcx + movq 56(%ebx), %rdx + movl $8, %eax + movq 48(%ebx), %rsi + movq 40(%ebx), %rdi + movq 80(%ebx), %r9 + movq 72(%ebx), %r8 + movapd %xmm14, %xmm7 + movapd %xmm13, %xmm6 + movapd %xmm12, %xmm5 + movapd %xmm11, %xmm4 + movapd %xmm10, %xmm3 + movapd %xmm9, %xmm2 + movapd %xmm8, %xmm1 + movapd %xmm15, %xmm0 + call *%r10 + movss %xmm0, (%r12d) + leal -16(%rbp), %esp + xorl %eax, %eax + popq %rbx + popq %r12 + popq %rbp +.LCFI9: + ret + .p2align 4,,10 + .p2align 3 +.L100: +.LCFI10: + pxor %xmm9, %xmm9 + movapd %xmm9, %xmm10 + movapd %xmm9, %xmm11 + movapd %xmm9, %xmm12 + movapd %xmm9, %xmm13 + movapd %xmm9, %xmm14 + jmp .L50 +.L24: + je .L107 + cmpl $6, %r8d + je .L108 + cmpl $5, %r8d + je .L109 + cmpl $4, %r8d + je .L110 + cmpl $3, %r8d + je .L111 + cmpl $2, %r8d + je .L112 + pxor %xmm8, %xmm8 + cmpl $1, %r8d + movapd %xmm8, %xmm9 + movapd %xmm8, %xmm10 + movapd %xmm8, %xmm11 + movapd %xmm8, %xmm12 + movapd %xmm8, %xmm13 + movapd %xmm8, %xmm14 + movapd %xmm8, %xmm15 + jne .L38 + jmp .L37 +.L85: + movl 8(%ebx), %edx + movw %ax, (%edx) + jmp .L22 +.L89: + movl 8(%ebx), %edx + movl %eax, (%edx) + jmp .L22 +.L106: + pxor %xmm9, %xmm9 + movapd %xmm9, %xmm10 + movapd %xmm9, %xmm11 + movapd %xmm9, %xmm12 + movapd %xmm9, %xmm13 + movapd %xmm9, %xmm14 + jmp .L18 +.L90: + movl 8(%ebx), %edx + movq %rax, (%edx) + jmp .L22 +.L112: + pxor %xmm9, %xmm9 + movapd %xmm9, %xmm10 + movapd %xmm9, %xmm11 + movapd %xmm9, %xmm12 + movapd %xmm9, %xmm13 + movapd %xmm9, %xmm14 + jmp .L35 +.L66: + leal 0(,%rsi,8), %r10d + movq (%edi), %r9 + movq %rax, %rbx + movq $-1, %r11 + movl %r10d, %ecx + salq %cl, %rbx + salq %cl, %r11 + movq %rbx, %rcx + xorq %r9, %rcx + andq %r11, %rcx + xorq %r9, %rcx + cmpl $16, %r8d + movq %rcx, (%edi) + jbe .L113 + negl %esi + movq 16(%edi), %r9 + leal 64(,%rsi,8), %r11d + movq %rdx, %rsi + movl %r11d, %ecx + sarq %cl, %rax + movl %r10d, %ecx + salq %cl, %rsi + leal -129(,%r8,8), %ecx + orq %rsi, %rax + movq %rax, 8(%edi) + movl $2, %eax + salq %cl, %rax + movl %r11d, %ecx + leaq -1(%rax), %rsi + movq %rdx, %rax + sarq %cl, %rax + xorq %r9, %rax + andq %rsi, %rax + xorq %r9, %rax + movq %rax, 16(%edi) + jmp .L22 +.L67: + leal 0(,%rsi,8), %ecx + movq $-1, %rdx + movq (%edi), %r9 + negl %esi + salq %cl, %rdx + movq %rdx, %r10 + movq %rax, %rdx + salq %cl, %rdx + leal -65(,%r8,8), %ecx + xorq %r9, %rdx + andq %r10, %rdx + xorq %r9, %rdx + movq 8(%edi), %r9 + movq %rdx, (%edi) + movl $2, %edx + salq %cl, %rdx + leal 64(,%rsi,8), %ecx + subq $1, %rdx + sarq %cl, %rax + xorq %r9, %rax + andq %rdx, %rax + xorq %r9, %rax + movq %rax, 8(%edi) + jmp .L22 +.L113: + negl %esi + leal -65(,%r8,8), %ecx + movq 8(%edi), %r9 + leal 32(,%rsi,4), %r11d + movl $2, %esi + salq %cl, %rsi + movl %r11d, %ecx + subq $1, %rsi + sarq %cl, %rax + sarq %cl, %rax + movl %r10d, %ecx + salq %cl, %rdx + orq %rdx, %rax + xorq %r9, %rax + andq %rsi, %rax + xorq %r9, %rax + movq %rax, 8(%edi) + jmp .L22 +.L99: + pxor %xmm10, %xmm10 + movapd %xmm10, %xmm11 + movapd %xmm10, %xmm12 + movapd %xmm10, %xmm13 + movapd %xmm10, %xmm14 + jmp .L48 +.L111: + pxor %xmm10, %xmm10 + movapd %xmm10, %xmm11 + movapd %xmm10, %xmm12 + movapd %xmm10, %xmm13 + movapd %xmm10, %xmm14 + jmp .L33 +.L110: + pxor %xmm11, %xmm11 + movapd %xmm11, %xmm12 + movapd %xmm11, %xmm13 + movapd %xmm11, %xmm14 + jmp .L31 +.L95: + pxor %xmm14, %xmm14 + jmp .L40 +.L96: + pxor %xmm13, %xmm13 + movapd %xmm13, %xmm14 + jmp .L42 +.L97: + pxor %xmm12, %xmm12 + movapd %xmm12, %xmm13 + movapd %xmm12, %xmm14 + jmp .L44 +.L98: + pxor %xmm11, %xmm11 + movapd %xmm11, %xmm12 + movapd %xmm11, %xmm13 + movapd %xmm11, %xmm14 + jmp .L46 +.L109: + pxor %xmm12, %xmm12 + movapd %xmm12, %xmm13 + movapd %xmm12, %xmm14 + jmp .L29 +.L108: + pxor %xmm13, %xmm13 + movapd %xmm13, %xmm14 + jmp .L27 +.L107: + pxor %xmm14, %xmm14 + jmp .L25 +.L105: + pxor %xmm10, %xmm10 + movapd %xmm10, %xmm11 + movapd %xmm10, %xmm12 + movapd %xmm10, %xmm13 + movapd %xmm10, %xmm14 + jmp .L16 +.L104: + pxor %xmm11, %xmm11 + movapd %xmm11, %xmm12 + movapd %xmm11, %xmm13 + movapd %xmm11, %xmm14 + jmp .L14 +.L103: + pxor %xmm12, %xmm12 + movapd %xmm12, %xmm13 + movapd %xmm12, %xmm14 + jmp .L12 +.L102: + pxor %xmm13, %xmm13 + movapd %xmm13, %xmm14 + jmp .L10 +.L101: + pxor %xmm14, %xmm14 + jmp .L8 +.LFE0: + .size avcall_call, .-avcall_call + .section .text.unlikely +.LCOLDE1: + .text +.LHOTE1: + .section .eh_frame,"a",@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 +.LSCIE1: + .long 0 + .byte 0x3 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .uleb128 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 4 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + .long .LFB0-. + .long .LFE0-.LFB0 + .uleb128 0 + .byte 0x4 + .long .LCFI0-.LFB0 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI2-.LCFI1 + .byte 0x8c + .uleb128 0x3 + .byte 0x83 + .uleb128 0x4 + .byte 0x4 + .long .LCFI3-.LCFI2 + .byte 0xa + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI4-.LCFI3 + .byte 0xb + .byte 0x4 + .long .LCFI5-.LCFI4 + .byte 0xa + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI6-.LCFI5 + .byte 0xb + .byte 0x4 + .long .LCFI7-.LCFI6 + .byte 0xa + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI8-.LCFI7 + .byte 0xb + .byte 0x4 + .long .LCFI9-.LCFI8 + .byte 0xa + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI10-.LCFI9 + .byte 0xb + .align 4 +.LEFDE1: + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/avcall/avcall-x86_64.c b/avcall/avcall-x86_64.c new file mode 100644 index 0000000..a1c9c13 --- /dev/null +++ b/avcall/avcall-x86_64.c @@ -0,0 +1,339 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2021 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + Foreign function interface for an x86_64 (a.k.a. amd64) with gcc + using the Unix ABI ('gcc -mabi=sysv'). + + This calls a C function with an argument list built up using macros + defined in avcall.h. + + x86_64 Argument Passing Conventions on Unix: + + Documentation is at https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI + + * Arguments: + - Integer or pointer arguments: + The first 6 integer or pointer arguments get passed in integer + registers (%rdi, %rsi, %rdx, %rcx, %r8, %r9). + The remaining ones (as an entire word each) on the stack. + - Floating-point arguments: + Up to 8 float/double arguments are passed in SSE registers + (%xmm0..%xmm7). + The remaining ones (as an entire word each) on the stack. + - Structure arguments: + Structure args are passed as true structures embedded in the + argument stack. + * Return value: + Integers are returned in %rax, %rdx. Float/double values are returned + in %xmm0, %xmm1. To return a structure larger than 16 bytes, the called + function copies the value to space pointed to by its first argument, + and all other arguments are shifted down by one. + * Call-used registers: rax,rdx,rcx,rsi,rdi,r8-r11 + + ----------------------------------------------------------------------*/ +#include "avcall-internal.h" + +#define RETURN(TYPE,VAL) (*(TYPE*)l->raddr = (TYPE)(VAL)) + +/*register __avrword iarg1 __asm__("rdi");*/ +/*register __avrword iarg2 __asm__("rsi");*/ +/*register __avrword iarg3 __asm__("rdx");*/ +/*register __avrword iarg4 __asm__("rcx");*/ +/*register __avrword iarg5 __asm__("r8");*/ +/*register __avrword iarg6 __asm__("r9");*/ + +register double farg1 __asm__("xmm0"); +register double farg2 __asm__("xmm1"); +register double farg3 __asm__("xmm2"); +register double farg4 __asm__("xmm3"); +register double farg5 __asm__("xmm4"); +register double farg6 __asm__("xmm5"); +register double farg7 __asm__("xmm6"); +register double farg8 __asm__("xmm7"); + +int +avcall_call(av_alist* list) +{ + register __avword* sp __asm__("rsp"); /* C names for registers */ +/*register __avrword iretreg __asm__("rax");*/ + register __avrword iret2reg __asm__("rdx"); + register double dret __asm__("xmm0"); + + __av_alist* l = &AV_LIST_INNER(list); + + __avword* argframe = __builtin_alloca(__AV_ALIST_WORDS * sizeof(__avword)); /* make room for argument list */ + int arglen = l->aptr - l->args; + int farglen = l->faptr - l->fargs; + __avrword iret, iret2; + + { + int i; + for (i = 0; i < arglen; i++) /* push function args onto stack */ + argframe[i] = l->args[i]; + } + + /* Call function. + It's OK to pass 8 values in SSE registers even if the called function takes + less than 8 float/double arguments. Similarly for the integer arguments. */ + if (l->rtype == __AVfloat) { + *(float*)l->raddr = + (*(float(*)())l->func)(l->iargs[0], + l->iargs[1], + l->iargs[2], + l->iargs[3], + l->iargs[4], + l->iargs[5], + farglen > 0 ? l->fargs[0] : 0.0, + farglen > 1 ? l->fargs[1] : 0.0, + farglen > 2 ? l->fargs[2] : 0.0, + farglen > 3 ? l->fargs[3] : 0.0, + farglen > 4 ? l->fargs[4] : 0.0, + farglen > 5 ? l->fargs[5] : 0.0, + farglen > 6 ? l->fargs[6] : 0.0, + farglen > 7 ? l->fargs[7] : 0.0); + } else + if (l->rtype == __AVdouble) { + *(double*)l->raddr = + (*(double(*)())l->func)(l->iargs[0], + l->iargs[1], + l->iargs[2], + l->iargs[3], + l->iargs[4], + l->iargs[5], + farglen > 0 ? l->fargs[0] : 0.0, + farglen > 1 ? l->fargs[1] : 0.0, + farglen > 2 ? l->fargs[2] : 0.0, + farglen > 3 ? l->fargs[3] : 0.0, + farglen > 4 ? l->fargs[4] : 0.0, + farglen > 5 ? l->fargs[5] : 0.0, + farglen > 6 ? l->fargs[6] : 0.0, + farglen > 7 ? l->fargs[7] : 0.0); + } else { + iret = (*l->func)(l->iargs[0], + l->iargs[1], + l->iargs[2], + l->iargs[3], + l->iargs[4], + l->iargs[5], + farglen > 0 ? l->fargs[0] : 0.0, + farglen > 1 ? l->fargs[1] : 0.0, + farglen > 2 ? l->fargs[2] : 0.0, + farglen > 3 ? l->fargs[3] : 0.0, + farglen > 4 ? l->fargs[4] : 0.0, + farglen > 5 ? l->fargs[5] : 0.0, + farglen > 6 ? l->fargs[6] : 0.0, + farglen > 7 ? l->fargs[7] : 0.0); + iret2 = iret2reg; + + /* save return value */ + if (l->rtype == __AVvoid) { + } else + if (l->rtype == __AVchar) { + RETURN(char, iret); + } else + if (l->rtype == __AVschar) { + RETURN(signed char, iret); + } else + if (l->rtype == __AVuchar) { + RETURN(unsigned char, iret); + } else + if (l->rtype == __AVshort) { + RETURN(short, iret); + } else + if (l->rtype == __AVushort) { + RETURN(unsigned short, iret); + } else + if (l->rtype == __AVint) { + RETURN(int, iret); + } else + if (l->rtype == __AVuint) { + RETURN(unsigned int, iret); + } else + if (l->rtype == __AVlong) { + RETURN(long, iret); + } else + if (l->rtype == __AVulong) { + RETURN(unsigned long, iret); + } else + if (l->rtype == __AVlonglong) { + RETURN(long long, iret); + } else + if (l->rtype == __AVulonglong) { + RETURN(unsigned long long, iret); + } else + /* see above + if (l->rtype == __AVfloat) { + } else + if (l->rtype == __AVdouble) { + } else + */ + if (l->rtype == __AVvoidp) { + RETURN(void*, iret); + } else + if (l->rtype == __AVstruct) { + if (l->flags & __AV_REGISTER_STRUCT_RETURN) { + /* Return structs of size <= 16 in registers. */ + if (l->rsize > 0 && l->rsize <= 16) { + void* raddr = l->raddr; + #if 0 /* Unoptimized */ + if (l->rsize == 1) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + } else + if (l->rsize == 2) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + } else + if (l->rsize == 3) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + } else + if (l->rsize == 4) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + } else + if (l->rsize == 5) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + } else + if (l->rsize == 6) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + } else + if (l->rsize == 7) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + } else + if (l->rsize >= 8 && l->rsize <= 16) { + ((unsigned char *)raddr)[0] = (unsigned char)(iret); + ((unsigned char *)raddr)[1] = (unsigned char)(iret>>8); + ((unsigned char *)raddr)[2] = (unsigned char)(iret>>16); + ((unsigned char *)raddr)[3] = (unsigned char)(iret>>24); + ((unsigned char *)raddr)[4] = (unsigned char)(iret>>32); + ((unsigned char *)raddr)[5] = (unsigned char)(iret>>40); + ((unsigned char *)raddr)[6] = (unsigned char)(iret>>48); + ((unsigned char *)raddr)[7] = (unsigned char)(iret>>56); + if (l->rsize == 8) { + } else + if (l->rsize == 9) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + } else + if (l->rsize == 10) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + } else + if (l->rsize == 11) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + } else + if (l->rsize == 12) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + } else + if (l->rsize == 13) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + } else + if (l->rsize == 14) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + } else + if (l->rsize == 15) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + } else + if (l->rsize == 16) { + ((unsigned char *)raddr)[8+0] = (unsigned char)(iret2); + ((unsigned char *)raddr)[8+1] = (unsigned char)(iret2>>8); + ((unsigned char *)raddr)[8+2] = (unsigned char)(iret2>>16); + ((unsigned char *)raddr)[8+3] = (unsigned char)(iret2>>24); + ((unsigned char *)raddr)[8+4] = (unsigned char)(iret2>>32); + ((unsigned char *)raddr)[8+5] = (unsigned char)(iret2>>40); + ((unsigned char *)raddr)[8+6] = (unsigned char)(iret2>>48); + ((unsigned char *)raddr)[8+7] = (unsigned char)(iret2>>56); + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = l->rsize; /* > 0, ≤ 2*sizeof(__avrword) */ + __avrword* wordaddr = (__avrword*)((uintptr_t)raddr & ~(uintptr_t)(sizeof(__avrword)-1)); + uintptr_t start_offset = (uintptr_t)raddr & (uintptr_t)(sizeof(__avrword)-1); /* ≥ 0, < sizeof(__avrword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__avrword) */ + if (count <= sizeof(__avrword)) { + /* Use iret. */ + if (end_offset <= sizeof(__avrword)) { + /* 0 < end_offset ≤ sizeof(__avrword) */ + __avrword mask0 = ((__avrword)2 << (end_offset*8-1)) - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + } else { + /* sizeof(__avrword) < end_offset < 2*sizeof(__avrword), start_offset > 0 */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + wordaddr[1] ^= (wordaddr[1] ^ (iret >> (sizeof(__avrword)*8-start_offset*8))) & mask1; + } + } else { + /* Use iret, iret2. */ + __avrword mask0 = - ((__avrword)1 << (start_offset*8)); + wordaddr[0] ^= (wordaddr[0] ^ (iret << (start_offset*8))) & mask0; + if (end_offset <= 2*sizeof(__avrword)) { + /* sizeof(__avrword) < end_offset ≤ 2*sizeof(__avrword) */ + __avrword mask1 = ((__avrword)2 << (end_offset*8-sizeof(__avrword)*8-1)) - 1; + wordaddr[1] ^= (wordaddr[1] ^ ((iret >> (sizeof(__avrword)*4-start_offset*4) >> (sizeof(__avrword)*4-start_offset*4)) | (iret2 << (start_offset*8)))) & mask1; + } else { + /* 2*sizeof(__avrword) < end_offset < 3*sizeof(__avrword), start_offset > 0 */ + __avrword mask2 = ((__avrword)2 << (end_offset*8-2*sizeof(__avrword)*8-1)) - 1; + wordaddr[1] = (iret >> (sizeof(__avrword)*8-start_offset*8)) | (iret2 << (start_offset*8)); + wordaddr[2] ^= (wordaddr[2] ^ (iret2 >> (sizeof(__avrword)*8-start_offset*8))) & mask2; + } + } + #endif + } + } + } + } + return 0; +} diff --git a/avcall/avcall.3 b/avcall/avcall.3 new file mode 100644 index 0000000..c297248 --- /dev/null +++ b/avcall/avcall.3 @@ -0,0 +1,280 @@ +.\" Copyright (C) 1993 Bill Triggs +.\" Copyright (C) 1995-2017 Bruno Haible +.\" +.\" This manual is covered by the GNU GPL. You can redistribute it and/or +.\" modify it under the terms of the GNU General Public License (GPL), either +.\" version 2 of the License, or (at your option) any later version published +.\" by the Free Software Foundation (FSF). +.\" A copy of the license is at . +.\" +.TH AVCALL 3 "23 July 2017" +.SH NAME +avcall \- build a C argument list incrementally and call a C function on it. +.SH SYNOPSIS +.B #include +.LP +.BI "av_alist " alist ";" +.LP +.BI av_start_ type "(" alist ", " "&func" +.RI "[["\c +.BI ", "\c +.I return_type\c +.RB "]" ", "\c +.I "&return_value"\c +.RB "]" ");" +.LP +.BI av_ type "(" alist ", "\c +.RI "["\c +.IB arg_type ","\c +.RI "] "\c +.IB value ");" +.LP +.BI "av_call(" alist ");" +.IX "av_alist" "" "\fLav_alist\fP \(em avcall argument list declaration" +.IX "av_start_type()" "" "\fLav_start_type()\fP \(em initialize avcall function" +.IX "av_type()" "" "\fLav_type()\fP \(em push next argument in avcall list" +.IX "av_call()" "" "\fLav_call()\fP \(em finish avcall argument list and call function" +.SH DESCRIPTION +.LP +This set of macros builds an argument list for a C function and calls +the function on it. It significantly reduces the amount of `glue' code +required for parsers, debuggers, imbedded interpreters, C extensions to +application programs and other situations where collections of functions +need to be called on lists of externally-supplied arguments. + +Function calling conventions differ considerably on different +machines and +.I avcall +attempts to provide some degree of isolation from such architecture +dependencies. + +The interface is like +.BR stdarg (3) +in reverse. All of the macros return 0 for success, < 0 for failure (e.g., +argument list overflow or type-not-supported). +.RS 0 +.TP +(1) +.B #include +.nf +and declare the argument list structure +.BI "av_alist " alist ; +.fi +.TP +(2) +Set any special flags. This is architecture and compiler dependent. +Compiler options that affect passing conventions may need to be flagged +by +.BR "#define" s +before the +.B "#include " +statement. However, the +.I configure +script should have determined which +.BR "#define" s +are needed and put them +at the top of +.BR avcall.h . +.TP +(3) +Initialize the alist with the function address and return value +pointer (if any). There is a separate macro for each simple return type +([u]char, [u]short, [u]int, [u]long, [u]longlong, float, double, where `u' +indicates `unsigned'). The macros for functions returning structures or +pointers require an explicit type argument. +.LP +E.g., +.LP +.BI "av_start_int (" alist ", " &func ", " &int_return ); +.LP +.BI "av_start_double (" alist ", " &func ", " &double_return ); +.LP +.BI "av_start_void (" alist ", " &func ); +.LP +.nf +.BI "av_start_struct (" alist ", " &func ", " struct_type ", " splittable ", " +.BI " " &struct_return ); +.fi +.LP +.nf +.BI "av_start_ptr (" alist ", " &func ", " pointer_type ", " +.BI " " &pointer_return ); +.fi +.LP +The +.I splittable +flag specifies whether the +.I struct_type +can be returned in registers such that every struct field fits entirely in +a single register. This needs to be specified for structs of size +2*sizeof(long). For structs of size <= sizeof(long), +.I splittable +is ignored and assumed to be 1. For structs of size > 2*sizeof(long), +.I splittable +is ignored and assumed to be 0. There are some handy macros for this: +.nf +.BI "av_word_splittable_1 (" type1 ) +.BI "av_word_splittable_2 (" type1 ", " type2 ) +.BI "av_word_splittable_3 (" type1 ", " type2 ", " type3 ) +.BI "av_word_splittable_4 (" type1 ", " type2 ", " type3 ", " type4 ) +.fi +For a struct with three slots +.nf +.BI "struct { " "type1 id1" "; " "type2 id2" "; " "type3 id3" "; }" +.fi +you can specify +.I splittable +as +.BI "av_word_splittable_3 (" type1 ", " type2 ", " type3 ) +.RB . +.TP +(4) +Push the arguments on to the list in order. Again there is a macro +for each simple built-in type, and the macros for structure and pointer +arguments require an extra type argument: +.LP +.BI "av_int (" alist ", " int_value ); +.LP +.BI "av_double (" alist ", " double_value ); +.LP +.BI "av_struct (" alist ", " struct_or_union_type ", " struct_value ); +.LP +.BI "av_ptr (" alist ", " pointer_type ", " pointer_value ); +.TP +(5) +Call the function, set the return value, and tidy up: +.LP +.BI "av_call (" alist ); +.RE + +.SH NOTES + +(1) Functions whose first declaration is in Kernighan & Ritchie style (i.e., +without a typed argument list) MUST use default K&R C expression promotions +(char and short to int, float to double) whether they are compiled by a K&R +or an ANSI compiler, because the true argument types may not be known at the +call point. Such functions typically back-convert their arguments to the +declared types on function entry. (In fact, the only way to pass a true char, +short or float in K&R C is by an explicit cast: +.B func((char)c,(float)f) +). +Similarly, some K&R compilers (such as Sun cc on the sparc) actually +return a float as a double. + +Hence, for arguments of functions declared in K&R style you should use +.B av_int(\|) +and +.B av_double(\|) +rather than +.B av_char(\|), +.B av_short(\|) +or +.B av_float(\|). +If you use a K&R compiler, the avcall header files may be able to +detect this and define +.B av_float(\|), +etc, appropriately, but with an ANSI compiler there is no way +.I avcall +can know how a function was declared, so you have to correct the +argument types yourself. + +(2) The explicit type arguments of the +.B av_struct(\|) +and +.B av_ptr(\|) +macros are typically used to calculate size, alignment, and passing +conventions. This may not be sufficient for some machines with unusual +structure and pointer handling: in this case additional +.B av_start_\c +.I type\c +.B (\|) +and +.B av_\c +.I type\c +.B (\|) +macros may be defined. + +(3) The macros +.BR av_start_longlong(\|) , +.BR av_start_ulonglong(\|) , +.B av_longlong(\|) +and +.B av_ulonglong(\|) +work only if the C compiler has a working +.B long long +64-bit integer type. + +(4) The struct types used in +.B av_start_struct(\|) +and +.B av_struct(\|) +must only contain (signed or unsigned) int, long, long long or pointer fields. +Struct types containing (signed or unsigned) char, short, float, double or +other structs are not supported. + +.SH SEE ALSO +.BR stdarg (3), +.BR varargs (3). + +.SH BUGS + +The current implementations have been tested on a selection of common +cases but there are probably still many bugs. + +There are typically built-in limits on the size of the argument-list, +which may also include the size of any structure arguments. + +The decision whether a struct is to be returned in registers or in memory +considers only the struct's size and alignment. This is inaccurate: for +example, gcc on m68k-next returns +.B "struct { char a,b,c; }" +in registers and +.B "struct { char a[3]; }" +in memory, although both types have the same size and the same alignment. + +.SH NON-BUGS + +All information is passed in CPU registers and the stack. The +.B avcall +package is therefore multithread-safe. + +.SH PORTING AVCALL + +Ports, bug-fixes, and suggestions are most welcome. The macros required +for argument pushing are pretty grungy, but it does seem to be possible +to port avcall to a range of machines. Ports to non-standard or +non-32-bit machines are especially welcome so we can sort the interface +out before it's too late. + +Knowledge about argument passing conventions can be found in the gcc +source, file +.RI gcc-2.6.3/config/ cpu / cpu .h, +section "Stack layout; function entry, exit and calling." + +Some of the grunge is usually handled by a C or assembly level glue +routine that actually pushes the arguments, calls the function and +unpacks any return value. +This is called avcall_call(\|). A precompiled assembler version for +people without gcc is also made available. The routine should ideally +have flags for the passing conventions of other compilers. + +Many of the current routines waste a lot of stack space and generally do +hairy things to stack frames - a bit more assembly code would probably +help things along quite a bit here. + +.SH AUTHOR + +Bill Triggs . + +.SH ACKNOWLEDGEMENTS + +Some initial ideas were stolen from the C interface to the Zelk +extensions to Oliver Laumann's Elk scheme interpreter by J.P.Lewis, NEC +C&C Research, (for Sun4 & SGI), and Roy +Featherstone's personal C interface library +for Sun[34] & SGI. I also looked at the machine-dependent parts of the +GCC and GDB distributions, and put the gcc asm(\|) extensions to good +use. Thanks guys! + +This work was partly supported by EC-ESPRIT Basic Research Action SECOND. + diff --git a/avcall/avcall.h b/avcall/avcall.h new file mode 100644 index 0000000..3d10db4 --- /dev/null +++ b/avcall/avcall.h @@ -0,0 +1,474 @@ +/* + * Copyright 1993-1995 Bill Triggs + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#ifndef _AVCALL_H +#define _AVCALL_H +/*---------------------------------------------------------------------- + av_call() foreign function interface. + + Varargs-style macros to build a C argument list incrementally + and call a function on it. + ----------------------------------------------------------------------*/ + +#include + +#include "ffcall-version.h" +#include "ffcall-abi.h" + + +/* Max # words in argument-list and temporary structure storage. + * If defined(__hppa__) && !defined(__hppa64__), this must be a multiple of 2. + */ +#ifndef __AV_ALIST_WORDS +#define __AV_ALIST_WORDS 256 +#endif + +/* Determine whether the current ABI is LLP64 + ('long' = 32-bit, 'long long' = 'void*' = 64-bit). */ +#if defined(__x86_64__) && defined(_WIN32) && !defined(__CYGWIN__) +#define __AV_LLP64 1 +#endif + +/* Determine the alignment of a type at compile time. + */ +#if defined(__GNUC__) || defined(__IBM__ALIGNOF__) +#define __AV_alignof __alignof__ +#elif defined(__cplusplus) +template struct __AV_alignof_helper { char __slot1; type __slot2; }; +#define __AV_alignof(type) offsetof (__AV_alignof_helper, __slot2) +#elif defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) /* SGI compiler */ +#define __AV_alignof __builtin_alignof +#else +#define __AV_offsetof(type,ident) ((unsigned long)&(((type*)0)->ident)) +#define __AV_alignof(type) __AV_offsetof(struct { char __slot1; type __slot2; }, __slot2) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* __avword represents a single word that can be pushed on the stack. + * __avrword represents a general-purpose register. + */ +#if defined(__arm64__) && defined(__APPLE__) && defined(__MACH__) +typedef int __avword; +typedef long __avrword; +#elif defined(__mipsn32__) || defined(__x86_64_x32__) || defined(__AV_LLP64) +typedef long long __avword; +typedef long long __avrword; +#else +typedef long __avword; +typedef long __avrword; +#endif + +/* C builtin types. + */ +enum __AVtype +{ + __AVword, /* just a dummy, for binary backward compatibility */ + __AVvoid, + __AVchar, + __AVschar, + __AVuchar, + __AVshort, + __AVushort, + __AVint, + __AVuint, + __AVlong, + __AVulong, + __AVlonglong, + __AVulonglong, + __AVfloat, + __AVdouble, + __AVvoidp, + __AVstruct +}; + +enum __AV_alist_flags +{ + + /* how to return structs */ + /* There are basically 3 ways to return structs: + * a. The called function returns a pointer to static data. Not reentrant. + * Not supported any more. + * b. The caller passes the return structure address in a dedicated register + * or as a first (or last), invisible argument. The called function stores + * its result there. + * c. Like b, and the called function also returns the return structure + * address in the return value register. (This is not very distinguishable + * from b.) + * Independently of this, + * r. small structures (<= 4 or <= 8 bytes) may be returned in the return + * value register(s), or + * m. even small structures are passed in memory. + */ + /* gcc-2.6.3 employs the following strategy: + * - If PCC_STATIC_STRUCT_RETURN is defined in the machine description + * it uses method a, else method c. + * - If flag_pcc_struct_return is set (either by -fpcc-struct-return or if + * DEFAULT_PCC_STRUCT_RETURN is defined to 1 in the machine description) + * it uses method m, else (either by -freg-struct-return or if + * DEFAULT_PCC_STRUCT_RETURN is defined to 0 in the machine description) + * method r. + */ + __AV_SMALL_STRUCT_RETURN = 1<<1, /* r: special case for small structs */ + __AV_GCC_STRUCT_RETURN = 1<<2, /* consider 8 byte structs as small */ +#if defined(__sparc__) && !defined(__sparc64__) + __AV_SUNCC_STRUCT_RETURN = 1<<3, + __AV_SUNPROCC_STRUCT_RETURN = 1<<4, +#endif +#if defined(__i386__) + __AV_MSVC_STRUCT_RETURN = 1<<4, +#endif + /* the default way to return structs */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another struct returning convention, + * just #define __AV_STRUCT_RETURN ... + * before or after #including . + */ +#ifndef __AV_STRUCT_RETURN + __AV_STRUCT_RETURN = +#if defined(__sparc__) && !defined(__sparc64__) && defined(__sun) && (defined(__SUNPRO_C) || defined(__SUNPRO_CC)) /* SUNWspro cc or CC */ + __AV_SUNPROCC_STRUCT_RETURN, +#else +#if (defined(__i386__) && (defined(_WIN32) || defined(__CYGWIN__) || (defined(__MACH__) && defined(__APPLE__)) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__))) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__hppa__) || defined(__hppa64__) || defined(__arm__) || defined(__armhf__) || defined(__arm64__) || defined(__powerpc64_elfv2__) || defined(__ia64__) || defined(__x86_64__) || defined(__riscv32__) || defined(__riscv64__) + __AV_SMALL_STRUCT_RETURN | +#endif +#if defined(__GNUC__) && !((defined(__mipsn32__) || defined(__mips64__)) && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3))) + __AV_GCC_STRUCT_RETURN | +#endif +#if defined(__i386__) && defined(_WIN32) && !defined(__CYGWIN__) /* native Windows */ + __AV_MSVC_STRUCT_RETURN | +#endif + 0, +#endif +#endif + + /* how to return floats */ +#if defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) + __AV_SUNCC_FLOAT_RETURN = 1<<5, +#endif +#if defined(__m68k__) + __AV_FREG_FLOAT_RETURN = 1<<6, +#endif + /* the default way to return floats */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another float returning convention, + * just #define __AV_FLOAT_RETURN ... + * before or after #including . + */ +#ifndef __AV_FLOAT_RETURN +#if (defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__))) && !defined(__GNUC__) && defined(__sun) && !(defined(__SUNPRO_C) || defined(__SUNPRO_CC)) /* Sun cc or CC */ + __AV_FLOAT_RETURN = __AV_SUNCC_FLOAT_RETURN, +#elif defined(__m68k__) + __AV_FLOAT_RETURN = __AV_FREG_FLOAT_RETURN, +#else + __AV_FLOAT_RETURN = 0, +#endif +#endif + + /* how to pass structs */ +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) + __AV_SGICC_STRUCT_ARGS = 1<<7, +#endif +#if defined(__powerpc__) || defined(__powerpc64__) + __AV_AIXCC_STRUCT_ARGS = 1<<7, +#endif +#if defined(__ia64__) + __AV_OLDGCC_STRUCT_ARGS = 1<<7, +#endif + /* the default way to pass structs */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another struct passing convention, + * just #define __AV_STRUCT_ARGS ... + * before or after #including . + */ +#ifndef __AV_STRUCT_ARGS +#if (defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)) && !defined(__GNUC__) /* SGI mips cc */ + __AV_STRUCT_ARGS = __AV_SGICC_STRUCT_ARGS, +#else +#if (defined(__mipsn32__) || defined(__mips64__)) && (!defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3)) /* SGI mips cc or gcc >= 3.4 */ + __AV_STRUCT_ARGS = __AV_SGICC_STRUCT_ARGS, +#else +#if defined(__powerpc__) && !defined(__powerpc64__) && defined(_AIX) && !defined(__GNUC__) /* AIX 32-bit cc, xlc */ + __AV_STRUCT_ARGS = __AV_AIXCC_STRUCT_ARGS, +#else +#if defined(__powerpc64__) && defined(_AIX) /* AIX 64-bit cc, xlc, gcc, xlclang */ + __AV_STRUCT_ARGS = __AV_AIXCC_STRUCT_ARGS, +#else +#if defined(__ia64__) && !(defined(__GNUC__) && (__GNUC__ >= 3)) + __AV_STRUCT_ARGS = __AV_OLDGCC_STRUCT_ARGS, +#else + __AV_STRUCT_ARGS = 0, +#endif +#endif +#endif +#endif +#endif +#endif + + /* how to pass floats */ + /* ANSI C compilers and GNU gcc pass floats as floats. + * K&R C compilers pass floats as doubles. We don't support them any more. + */ +#if defined(__powerpc64__) + __AV_AIXCC_FLOAT_ARGS = 1<<8, /* pass floats in the low 4 bytes of an 8-bytes word */ +#endif + /* the default way to pass floats */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another float passing convention, + * just #define __AV_FLOAT_ARGS ... + * before or after #including . + */ +#ifndef __AV_FLOAT_ARGS +#if defined(__powerpc64__) && defined(_AIX) && (defined(__ibmxl__) || !defined(__GNUC__)) /* AIX 64-bit xlc, xlclang */ + __AV_FLOAT_ARGS = __AV_AIXCC_FLOAT_ARGS, +#else + __AV_FLOAT_ARGS = 0, +#endif +#endif + + /* how to pass and return small integer arguments */ + __AV_ANSI_INTEGERS = 0, /* no promotions */ + __AV_TRADITIONAL_INTEGERS = 0, /* promote [u]char, [u]short to [u]int */ + /* Fortunately these two methods are compatible. Our macros work with both. */ + + /* stack cleanup policy */ + __AV_CDECL_CLEANUP = 0, /* caller pops args after return */ + __AV_STDCALL_CLEANUP = 0, /* callee pops args before return */ + /* currently only supported on __i386__ */ +#ifndef __AV_CLEANUP + __AV_CLEANUP = __AV_CDECL_CLEANUP, +#endif + + /* These are for internal use only */ +#if defined(__i386__) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppa64__) || defined(__arm__) || defined(__armhf__) || defined(__arm64__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || defined(__x86_64__) || (defined(__s390__) && !defined(__s390x__)) || defined(__riscv64__) + __AV_REGISTER_STRUCT_RETURN = 1<<9, +#endif + + __AV_flag_for_broken_compilers_that_dont_like_trailing_commas +}; + +#ifdef _AVCALL_INTERNAL_H +#include "avcall-alist.h" +#endif + +/* An upper bound for sizeof(__av_alist). + The total size of the __av_alist fields, ignoring alignment of fields, + varies from + 40 bytes (for __i386__, __m68k__, __sparc__, __hppa__, __arm__) + to + 232 bytes (for __arm64__). */ +#define __AV_ALIST_SIZE_BOUND 256 + +typedef struct +{ + /* First part: Fixed size __av_alist. */ + union { + char _av_m_room[__AV_ALIST_SIZE_BOUND]; +#ifdef _AVCALL_INTERNAL_H + __av_alist _av_m_alist; +#endif +/* GNU clisp pokes in internals of the alist! + When used by GNU clisp, assume a C compiler that supports anonymous unions + (GCC or an ISO C 11 compiler). */ +#ifdef LISPFUN + int flags; +#endif + /* For alignment. */ + long align1; + double align2; + long long align3; + long double align4; + } +#ifndef LISPFUN + _av_alist_head +#endif + ; + /* Second part: An array whose size depends on __AV_ALIST_WORDS. */ + union { + __avword _av_m_args[__AV_ALIST_WORDS]; + /* For alignment. */ + long align1; + double align2; + long long align3; + long double align4; + } _av_alist_flexarray; +} av_alist; + + +/* Delayed overflow detection */ +extern int avcall_overflown (av_alist* /* LIST */); +#define av_overflown(LIST) avcall_overflown(&(LIST)) + + +/* + * av_start_ macros which specify the return type + */ + +#define __AV_START_FLAGS \ + __AV_STRUCT_RETURN | __AV_FLOAT_RETURN | __AV_STRUCT_ARGS | __AV_FLOAT_ARGS | __AV_CLEANUP + +extern void avcall_start (av_alist* /* LIST */, __avword* /* LIST_ARGS */, __avword* /* LIST_ARGS_END */, __avrword(* /* FUNC */)(), void* /* RADDR */, int /* RETTYPE */, int /* FLAGS */); + +#define av_start_void(LIST,FUNC) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),0, __AVvoid, __AV_START_FLAGS) +#define av_start_char(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVchar, __AV_START_FLAGS) +#define av_start_schar(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVschar, __AV_START_FLAGS) +#define av_start_uchar(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVuchar, __AV_START_FLAGS) +#define av_start_short(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVshort, __AV_START_FLAGS) +#define av_start_ushort(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVushort, __AV_START_FLAGS) +#define av_start_int(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVint, __AV_START_FLAGS) +#define av_start_uint(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVuint, __AV_START_FLAGS) +#define av_start_long(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVlong, __AV_START_FLAGS) +#define av_start_ulong(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVulong, __AV_START_FLAGS) +#define av_start_longlong(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVlonglong, __AV_START_FLAGS) +#define av_start_ulonglong(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVulonglong,__AV_START_FLAGS) +#define av_start_float(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVfloat, __AV_START_FLAGS) +#define av_start_double(LIST,FUNC,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVdouble, __AV_START_FLAGS) +#define av_start_ptr(LIST,FUNC,TYPE,RADDR) \ + avcall_start(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),RADDR,__AVvoidp, __AV_START_FLAGS) + +extern void avcall_start_struct (av_alist* /* LIST */, __avword* /* LIST_ARGS */, __avword* /* LIST_ARGS_END */, __avrword(* /* FUNC */)(), size_t /* TYPE_SIZE */, int /* TYPE_SPLITTABLE */, void* /* RADDR */, int /* FLAGS */); + +#define av_start_struct(LIST,FUNC,TYPE,TYPE_SPLITTABLE,RADDR) \ + _av_start_struct(LIST,FUNC,sizeof(TYPE),TYPE_SPLITTABLE,RADDR) +/* Undocumented, but used by GNU clisp. */ +#define _av_start_struct(LIST,FUNC,TYPE_SIZE,TYPE_SPLITTABLE,RADDR) \ + avcall_start_struct(&(LIST),(LIST)._av_alist_flexarray._av_m_args,&(LIST)._av_alist_flexarray._av_m_args[__AV_ALIST_WORDS],(__avrword(*)())(FUNC),TYPE_SIZE,TYPE_SPLITTABLE,RADDR,__AV_START_FLAGS) + + +/* + * av_ macros which specify the argument and its type + */ + +/* integer argument types */ + +extern int avcall_arg_int (av_alist* /* LIST */, int /* VAL */); +extern int avcall_arg_uint (av_alist* /* LIST */, unsigned int /* VAL */); + +#define av_char(LIST,VAL) avcall_arg_int(&(LIST),(char)(VAL)) +#define av_schar(LIST,VAL) avcall_arg_int(&(LIST),(signed char)(VAL)) +#define av_short(LIST,VAL) avcall_arg_int(&(LIST),(short)(VAL)) +#define av_int(LIST,VAL) avcall_arg_int(&(LIST),(int)(VAL)) +#define av_uchar(LIST,VAL) avcall_arg_uint(&(LIST),(unsigned char)(VAL)) +#define av_ushort(LIST,VAL) avcall_arg_uint(&(LIST),(unsigned short)(VAL)) +#define av_uint(LIST,VAL) avcall_arg_uint(&(LIST),(unsigned int)(VAL)) + +extern int avcall_arg_long (av_alist* /* LIST */, long /* VAL */); +extern int avcall_arg_ulong (av_alist* /* LIST */, unsigned long /* VAL */); + +#define av_long(LIST,VAL) avcall_arg_long(&(LIST),(long)(VAL)) +#define av_ulong(LIST,VAL) avcall_arg_ulong(&(LIST),(unsigned long)(VAL)) + +extern int avcall_arg_ptr (av_alist* /* LIST */, void* /* VAL */); + +#define av_ptr(LIST,TYPE,VAL) avcall_arg_ptr(&(LIST),(TYPE)(VAL)) + +extern int avcall_arg_longlong (av_alist* /* LIST */, long long /* VAL */); +extern int avcall_arg_ulonglong (av_alist* /* LIST */, unsigned long long /* VAL */); + +#define av_longlong(LIST,VAL) avcall_arg_longlong(&(LIST),VAL) +#define av_ulonglong(LIST,VAL) avcall_arg_ulonglong(&(LIST),VAL) + +/* floating-point argument types */ + +extern int avcall_arg_float (av_alist* /* LIST */, float /* VAL */); +#define av_float(LIST,VAL) avcall_arg_float(&(LIST),VAL) + +extern int avcall_arg_double (av_alist* /* LIST */, double /* VAL */); +#define av_double(LIST,VAL) avcall_arg_double(&(LIST),VAL) + +/* + * structure argument types + */ + +extern int avcall_arg_struct (av_alist* /* LIST */, size_t /* TYPE_SIZE */, size_t /* TYPE_ALIGN */, const void* /* VAL_ADDR */); + +#define av_struct(LIST,TYPE,VAL) \ + avcall_arg_struct(&(LIST),sizeof(TYPE),__AV_alignof(TYPE),&(VAL)) +/* _av_struct() is like av_struct(), except that you pass the type's size and alignment + * and the value's address instead of the type and the value themselves. + * Undocumented, but used by GNU clisp. + */ +#define _av_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL_ADDR) \ + avcall_arg_struct(&(LIST),TYPE_SIZE,TYPE_ALIGN,VAL_ADDR) + +/* + * calling the function + */ + +extern int avcall_call (av_alist* /* LIST */); +#define av_call(LIST) avcall_call(&(LIST)) + +/* Determine whether a struct type is word-splittable, i.e. whether each of + * its components fit into a register. + * The entire computation is done at compile time. + */ +#define av_word_splittable_1(slot1) \ + (__av_offset1(slot1)/sizeof(__avword) == (__av_offset1(slot1)+sizeof(slot1)-1)/sizeof(__avword)) +#define av_word_splittable_2(slot1,slot2) \ + ((__av_offset1(slot1)/sizeof(__avword) == (__av_offset1(slot1)+sizeof(slot1)-1)/sizeof(__avword)) \ + && (__av_offset2(slot1,slot2)/sizeof(__avword) == (__av_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__avword)) \ + ) +#define av_word_splittable_3(slot1,slot2,slot3) \ + ((__av_offset1(slot1)/sizeof(__avword) == (__av_offset1(slot1)+sizeof(slot1)-1)/sizeof(__avword)) \ + && (__av_offset2(slot1,slot2)/sizeof(__avword) == (__av_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__avword)) \ + && (__av_offset3(slot1,slot2,slot3)/sizeof(__avword) == (__av_offset3(slot1,slot2,slot3)+sizeof(slot3)-1)/sizeof(__avword)) \ + ) +#define av_word_splittable_4(slot1,slot2,slot3,slot4) \ + ((__av_offset1(slot1)/sizeof(__avword) == (__av_offset1(slot1)+sizeof(slot1)-1)/sizeof(__avword)) \ + && (__av_offset2(slot1,slot2)/sizeof(__avword) == (__av_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__avword)) \ + && (__av_offset3(slot1,slot2,slot3)/sizeof(__avword) == (__av_offset3(slot1,slot2,slot3)+sizeof(slot3)-1)/sizeof(__avword)) \ + && (__av_offset4(slot1,slot2,slot3,slot4)/sizeof(__avword) == (__av_offset4(slot1,slot2,slot3,slot4)+sizeof(slot4)-1)/sizeof(__avword)) \ + ) +#define __av_offset1(slot1) \ + 0 +#define __av_offset2(slot1,slot2) \ + ((__av_offset1(slot1)+sizeof(slot1)+__AV_alignof(slot2)-1) & -(long)__AV_alignof(slot2)) +#define __av_offset3(slot1,slot2,slot3) \ + ((__av_offset2(slot1,slot2)+sizeof(slot2)+__AV_alignof(slot3)-1) & -(long)__AV_alignof(slot3)) +#define __av_offset4(slot1,slot2,slot3,slot4) \ + ((__av_offset3(slot1,slot2,slot3)+sizeof(slot3)+__AV_alignof(slot4)-1) & -(long)__AV_alignof(slot4)) + +#ifdef __cplusplus +} +#endif + +#endif /* _AVCALL_H */ diff --git a/avcall/avcall.html b/avcall/avcall.html new file mode 100644 index 0000000..9fcd138 --- /dev/null +++ b/avcall/avcall.html @@ -0,0 +1,277 @@ + + + + + AVCALL manual page + + +

AVCALL manual page

+ + +

+ +


+ + +

Name

+
+ +avcall - build a C argument list incrementally and call a +C function on it. + + +

Synopsis

+
+ +
+#include <avcall.h>
+av_alist alist;
+av_start_type (alist, &func, [[return_type,] &return_value]);
+av_type (alist, [arg_type,] value);
+av_call(alist);
+
+ + +

Description

+
+ +This set of macros builds an argument list for a C function +and calls the function on it. It significantly +reduces the amount of ‘glue’ code required for parsers, +debuggers, imbedded interpreters, C extensions to application +programs and other situations where collections of +functions need to be called on lists of externally- +supplied arguments. +

+Function calling conventions differ considerably on different +machines and avcall attempts to provide some degree +of isolation from such architecture dependencies. +

+The interface is like stdarg(3) in reverse. All of the +macros return 0 for success, < 0 for failure (e.g., argument +list overflow or type-not-supported). +

+

    +
  1. #include <avcall.h> and declare the argument list +structure av_alist alist; +

    +

  2. Set any special flags. This is architecture and compiler +dependent. +Compiler options that affect passing conventions may need +to be flagged by #defines before the #include <avcall.h> +statement. However, the configure script should have +determined which #defines are needed and put them +at the top of avcall.h. +

    +

  3. Initialize the alist with the function address and +return value pointer (if any). There is a separate macro +for each simple return type ([u]char, [u]short, [u]int, +[u]long, [u]longlong, float, double, where ‘u’ indicates +‘unsigned’). The macros for functions returning structures +or pointers require an explicit type argument. +

    +E.g., +

    +av_start_int (alist, &func, &int_return);
    +av_start_double (alist, &func, &double_return);
    +av_start_void (alist, &func);
    +av_start_struct (alist, &func, struct_type, splittable, &struct_return);
    +av_start_ptr (alist, &func, pointer_type, &pointer_return);
    +
    +The splittable flag specifies whether the struct_type can +be returned in registers such that every struct field fits +entirely in a single register. This needs to be specified +for structs of size 2*sizeof(long). For structs of size +<= sizeof(long), splittable is ignored and assumed to be 1. +For structs of size > 2*sizeof(long), splittable is +ignored and assumed to be 0. There are some handy macros +for this: +
    +av_word_splittable_1 (type1)
    +av_word_splittable_2 (type1, type2)
    +av_word_splittable_3 (type1, type2, type3)
    +av_word_splittable_4 (type1, type2, type3, type4)
    +
    +For a struct with three slots +
    +struct { type1 id1; type2 id2; type3 id3; }
    +
    +you can specify splittable as +av_word_splittable_3 (type1, type2, type3). +

    +

  4. Push the arguments on to the list in order. Again +there is a macro for each simple built-in type, and the +macros for structure and pointer arguments require an +extra type argument: +
    +av_int (alist, int_value);
    +av_double (alist, double_value);
    +av_struct (alist, struct_or_union_type, struct_value);
    +av_ptr (alist, pointer_type, pointer_value);
    +
    +
  5. Call the function, set the return value, and tidy up: +av_call (alist); +
+ + +

Notes

+
+ +
    +
  1. Functions whose first declaration is in Kernighan & +Ritchie style (i.e., without a typed argument list) MUST +use default K&R C expression promotions (char and short to +int, float to double) whether they are compiled by a K&R +or an ANSI compiler, because the true argument types may +not be known at the call point. Such functions typically +back-convert their arguments to the declared types on +function entry. (In fact, the only way to pass a true +char, short or float in K&R C is by an explicit cast: +func((char)c,(float)f) ). Similarly, some K&R compilers +(such as Sun cc on the sparc) actually return a float as a +double. +

    +Hence, for arguments of functions declared in K&R style +you should use av_int() and av_double() rather than +av_char(), av_short() or av_float(). If you use a K&R +compiler, the avcall header files may be able to detect +this and define av_float(), etc, appropriately, but with +an ANSI compiler there is no way avcall can know how a +function was declared, so you have to correct the argument +types yourself. +

    +

  2. The explicit type arguments of the av_struct() and +av_ptr() macros are typically used to calculate size, +alignment, and passing conventions. This may not be sufficient for some machines with unusual structure and +pointer handling: in this case additional av_start_type() +and av_type() macros may be defined. +

    +

  3. The macros av_start_longlong(), +av_start_ulonglong(), av_longlong() and +av_ulonglong() work only if the C compiler has a working +long long 64-bit integer type. +

    +

  4. The struct types used in av_start_struct() and +av_struct() must only contain (signed or unsigned) int, +long, long long or pointer fields. Struct types containing +(signed or unsigned) char, short, float, double or other +structs are not supported. +

    +

+ + +

See also

+
+stdarg(3), varargs(3). + + +

Bugs

+
+ +
    +
  • +The current implementations have been tested on a selection +of common cases but there are probably still many +bugs. +
  • +There are typically built-in limits on the size of the +argument-list, which may also include the size of any +structure arguments. +
  • +The decision whether a struct is to be returned in registers or in memory +considers only the struct's size and alignment. This is inaccurate: for +example, gcc on m68k-next returns +struct { char a,b,c; } +in registers and +struct { char a[3]; } +in memory, although both types have the same size and the same alignment. +
+ + +

Non-Bugs

+
+ +All information is passed in CPU registers and the stack. +The avcall package is therefore multithread-safe. + + +

Porting AVCALL

+
+ +Ports, bug-fixes, and suggestions are most welcome. The +macros required for argument pushing are pretty grungy, +but it does seem to be possible to port avcall to a range +of machines. Ports to non-standard or non-32-bit machines +are especially welcome so we can sort the interface out +before it's too late. +

+Knowledge about argument passing conventions can be found +in the gcc source, file gcc-2.6.3/config/cpu/cpu.h, section +"Stack layout; function entry, exit and calling." +

+Some of the grunge is usually handled by a C or assembly +level glue routine that actually pushes the arguments, +calls the function and unpacks any return value. This is +called avcall_call(). A precompiled assembler version for +people without gcc is also made available. The routine should ideally +have flags for the passing conventions of other compilers. +

+Many of the current routines waste a lot of stack space +and generally do hairy things to stack frames - a bit more +assembly code would probably help things along quite a bit +here. +

+ + +

Author

+ + +Bill Triggs <Bill.Triggs@inrialpes.fr>, <Bill.Triggs@imag.fr>. + + +

Acknowledgements

+
+ +Some initial ideas were stolen from the C interface to the +Zelk extensions to Oliver Laumann's Elk scheme interpreter +by J.P.Lewis, NEC C&C Research, <zilla@ccrl.nj.nec.com> +(for Sun4 & SGI), and Roy Featherstone's +<roy@robots.oxford.ac.uk> personal C interface library for +Sun3, Sun4 & SGI. I also looked at the machine-dependent +parts of the GCC and GDB distributions, and put the gcc +asm() extensions to good use. Thanks guys! +

+This work was partly supported by EC-ESPRIT Basic Research +Action SECOND. +

+ +


+ +
AVCALL manual page
+Bruno Haible <bruno@clisp.org> +
+

+Last modified: 14 January 2001. + + + diff --git a/avcall/avcall.man b/avcall/avcall.man new file mode 100644 index 0000000..20f7c03 --- /dev/null +++ b/avcall/avcall.man @@ -0,0 +1,198 @@ +AVCALL(3) Library Functions Manual AVCALL(3) + + + +NAME + avcall - build a C argument list incrementally and call a C function on + it. + +SYNOPSIS + #include  + + av_alist alist; + + av_start_type(alist, &func [[, return_type], &return_value ]); + + av_type(alist, [arg_type,] value); + + av_call(alist); + +DESCRIPTION + This set of macros builds an argument list for a C function and calls + the function on it. It significantly reduces the amount of `glue' code + required for parsers, debuggers, imbedded interpreters, C extensions to + application programs and other situations where collections of func‐ + tions need to be called on lists of externally-supplied arguments. + + Function calling conventions differ considerably on different machines + and avcall attempts to provide some degree of isolation from such + architecture dependencies. + + The interface is like stdarg(3) in reverse. All of the macros return 0 + for success, < 0 for failure (e.g., argument list overflow or type-not- + supported). + + (1) #include  + and declare the argument list structure + av_alist alist; + + (2) Set any special flags. This is architecture and compiler depen‐ + dent. Compiler options that affect passing conventions may need + to be flagged by #defines before the #include state‐ + ment. However, the configure script should have determined which + #defines are needed and put them at the top of avcall.h. + + (3) Initialize the alist with the function address and return value + pointer (if any). There is a separate macro for each simple + return type ([u]char, [u]short, [u]int, [u]long, [u]longlong, + float, double, where `u' indicates `unsigned'). The macros for + functions returning structures or pointers require an explicit + type argument. + + E.g., + + av_start_int (alist, &func, &int_return); + + av_start_double (alist, &func, &double_return); + + av_start_void (alist, &func); + + av_start_struct (alist, &func, struct_type, splittable, + &struct_return); + + av_start_ptr (alist, &func, pointer_type, + &pointer_return); + + The splittable flag specifies whether the struct_type can be returned + in registers such that every struct field fits entirely in a single + register. This needs to be specified for structs of size + 2*sizeof(long). For structs of size <= sizeof(long), splittable is + ignored and assumed to be 1. For structs of size > 2*sizeof(long), + splittable is ignored and assumed to be 0. There are some handy macros + for this: + av_word_splittable_1 (type1) + av_word_splittable_2 (type1, type2) + av_word_splittable_3 (type1, type2, type3) + av_word_splittable_4 (type1, type2, type3, type4) + For a struct with three slots + struct { type1 id1; type2 id2; type3 id3; } + you can specify splittable as av_word_splittable_3 (type1, type2, + type3) . + + (4) Push the arguments on to the list in order. Again there is a + macro for each simple built-in type, and the macros for struc‐ + ture and pointer arguments require an extra type argument: + + av_int (alist, int_value); + + av_double (alist, double_value); + + av_struct (alist, struct_or_union_type, struct_value); + + av_ptr (alist, pointer_type, pointer_value); + + (5) Call the function, set the return value, and tidy up: + + av_call (alist); + + +NOTES + (1) Functions whose first declaration is in Kernighan & Ritchie style + (i.e., without a typed argument list) MUST use default K&R C expression + promotions (char and short to int, float to double) whether they are + compiled by a K&R or an ANSI compiler, because the true argument types + may not be known at the call point. Such functions typically back-con‐ + vert their arguments to the declared types on function entry. (In fact, + the only way to pass a true char, short or float in K&R C is by an + explicit cast: func((char)c,(float)f) ). Similarly, some K&R compilers + (such as Sun cc on the sparc) actually return a float as a double. + + Hence, for arguments of functions declared in K&R style you should use + av_int() and av_double() rather than av_char(), av_short() or + av_float(). If you use a K&R compiler, the avcall header files may be + able to detect this and define av_float(), etc, appropriately, but with + an ANSI compiler there is no way avcall can know how a function was + declared, so you have to correct the argument types yourself. + + (2) The explicit type arguments of the av_struct() and av_ptr() macros + are typically used to calculate size, alignment, and passing conven‐ + tions. This may not be sufficient for some machines with unusual + structure and pointer handling: in this case additional av_start_type() + and av_type() macros may be defined. + + (3) The macros av_start_longlong(), av_start_ulonglong(), av_longlong() + and av_ulonglong() work only if the C compiler has a working long long + 64-bit integer type. + + (4) The struct types used in av_start_struct() and av_struct() must + only contain (signed or unsigned) int, long, long long or pointer + fields. Struct types containing (signed or unsigned) char, short, + float, double or other structs are not supported. + + +SEE ALSO + stdarg(3), varargs(3). + + +BUGS + The current implementations have been tested on a selection of common + cases but there are probably still many bugs. + + There are typically built-in limits on the size of the argument-list, + which may also include the size of any structure arguments. + + The decision whether a struct is to be returned in registers or in mem‐ + ory considers only the struct's size and alignment. This is inaccurate: + for example, gcc on m68k-next returns struct { char a,b,c; } in regis‐ + ters and struct { char a[3]; } in memory, although both types have the + same size and the same alignment. + + +NON-BUGS + All information is passed in CPU registers and the stack. The avcall + package is therefore multithread-safe. + + +PORTING AVCALL + Ports, bug-fixes, and suggestions are most welcome. The macros required + for argument pushing are pretty grungy, but it does seem to be possible + to port avcall to a range of machines. Ports to non-standard or + non-32-bit machines are especially welcome so we can sort the interface + out before it's too late. + + Knowledge about argument passing conventions can be found in the gcc + source, file gcc-2.6.3/config/cpu/cpu.h, section "Stack layout; func‐ + tion entry, exit and calling." + + Some of the grunge is usually handled by a C or assembly level glue + routine that actually pushes the arguments, calls the function and + unpacks any return value. This is called avcall_call(). A precompiled + assembler version for people without gcc is also made available. The + routine should ideally have flags for the passing conventions of other + compilers. + + Many of the current routines waste a lot of stack space and generally + do hairy things to stack frames - a bit more assembly code would proba‐ + bly help things along quite a bit here. + + +AUTHOR + Bill Triggs . + + +ACKNOWLEDGEMENTS + Some initial ideas were stolen from the C interface to the Zelk exten‐ + sions to Oliver Laumann's Elk scheme interpreter by J.P.Lewis, NEC C&C + Research, (for Sun4 & SGI), and Roy Feather‐ + stone's personal C interface library for + Sun[34] & SGI. I also looked at the machine-dependent parts of the GCC + and GDB distributions, and put the gcc asm() extensions to good use. + Thanks guys! + + This work was partly supported by EC-ESPRIT Basic Research Action SEC‐ + OND. + + + + + 23 July 2017 AVCALL(3) diff --git a/avcall/minitests-c++.cc b/avcall/minitests-c++.cc new file mode 100644 index 0000000..1738e11 --- /dev/null +++ b/avcall/minitests-c++.cc @@ -0,0 +1,18 @@ +/* + * Copyright 2017 Bruno Haible + * + * 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, see . + */ + +#include "minitests.c" diff --git a/avcall/minitests.c b/avcall/minitests.c new file mode 100644 index 0000000..b0f50fe --- /dev/null +++ b/avcall/minitests.c @@ -0,0 +1,19 @@ +/* + * Copyright 1999-2001 Bruno Haible + * + * 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, see . + */ + +#define SKIP_EXTRA_STRUCTS +#include "tests.c" diff --git a/avcall/tests.c b/avcall/tests.c new file mode 100644 index 0000000..427a9e9 --- /dev/null +++ b/avcall/tests.c @@ -0,0 +1,1548 @@ +/** + Copyright 1993 Bill Triggs + Copyright 1995-2019 Bruno Haible + + 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, see . +**/ +/*---------------------------------------------------------------------- + Some test routines for avcall foreign function interface. + The coverage is entirely random, this just contains some of the things + that I think are likely to break. + + We really need to add some more pointer (void* / char* / func*) tests + and some varargs ones, and also try to test structure alignment more + throughly. + ----------------------------------------------------------------------*/ + +#include +#include +#include +#include "avcall.h" + +#include "testcases.c" + +#if defined(__hppa__) && defined(__GNUC__) +#if (__GNUC__ == 2 && __GNUC_MINOR__ < 6) +/* gcc-2.5.2 bugs prevent the T test from working. */ +#define SKIP_T +#endif +#endif +#if defined(__m68k__) && defined(__GNUC__) +/* "gcc-2.6.3 -freg-struct-return" returns T = struct { char c[3]; } (which + * has size 4 !) in memory, in contrast to struct { char a,b,c; } and + * struct { char c[4]; } and struct { char a,b,c,d; } which have the same + * size and the same alignment but are returned in registers. I don't know why. + */ +#define SKIP_T +#endif + + +/* + * The way we run these tests - first call the function directly, then + * through av_call() - there is the danger that arguments or results seem + * to be passed correctly, but what we are seeing are in fact the vestiges + * (traces) or the previous call. This may seriously fake the test. + * Avoid this by clearing the registers between the first and the second call. + */ +long clear_traces_i (long a, long b, long c, long d, long e, long f, long g, long h, + long i, long j, long k, long l, long m, long n, long o, long p) +{ return 0; } +float clear_traces_f (float a, float b, float c, float d, float e, float f, float g, + float h, float i, float j, float k, float l, float m, float n, + float o, float p) +{ return 0.0; } +double clear_traces_d (double a, double b, double c, double d, double e, double f, double g, + double h, double i, double j, double k, double l, double m, double n, + double o, double p) +{ return 0.0; } +J clear_traces_J (void) +{ J j; j.l1 = j.l2 = 0; return j; } +void clear_traces (void) +{ clear_traces_i(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); + clear_traces_f(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0); + clear_traces_d(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0); + clear_traces_J(); +} + +void + void_tests (void) +{ + av_alist a; + v_v(); + clear_traces(); + av_start_void(a,v_v); + av_call(a); + return; +} +void + int_tests (void) +{ + av_alist a; + int ir; + + ir = i_v(); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + av_start_int(a,i_v,&ir); + av_call(a); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i(i1); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + av_start_int(a,i_i,&ir); + av_int(a,i1); + av_call(a); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i2(i1,i2); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + av_start_int(a,i_i2,&ir); + av_int(a,i1); + av_int(a,i2); + av_call(a); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i4(i1,i2,i3,i4); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + av_start_int(a,i_i4,&ir); + av_int(a,i1); + av_int(a,i2); + av_int(a,i3); + av_int(a,i4); + av_call(a); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i8(i1,i2,i3,i4,i5,i6,i7,i8); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + av_start_int(a,i_i8,&ir); + av_int(a,i1); + av_int(a,i2); + av_int(a,i3); + av_int(a,i4); + av_int(a,i5); + av_int(a,i6); + av_int(a,i7); + av_int(a,i8); + av_call(a); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i16(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + av_start_int(a,i_i16,&ir); + av_int(a,i1); + av_int(a,i2); + av_int(a,i3); + av_int(a,i4); + av_int(a,i5); + av_int(a,i6); + av_int(a,i7); + av_int(a,i8); + av_int(a,i9); + av_int(a,i10); + av_int(a,i11); + av_int(a,i12); + av_int(a,i13); + av_int(a,i14); + av_int(a,i15); + av_int(a,i16); + av_call(a); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i32(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17,i18,i19,i20,i21,i22,i23,i24,i25,i26,i27,i28,i29,i30,i31,i32); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + av_start_int(a,i_i32,&ir); + av_int(a,i1); + av_int(a,i2); + av_int(a,i3); + av_int(a,i4); + av_int(a,i5); + av_int(a,i6); + av_int(a,i7); + av_int(a,i8); + av_int(a,i9); + av_int(a,i10); + av_int(a,i11); + av_int(a,i12); + av_int(a,i13); + av_int(a,i14); + av_int(a,i15); + av_int(a,i16); + av_int(a,i17); + av_int(a,i18); + av_int(a,i19); + av_int(a,i20); + av_int(a,i21); + av_int(a,i22); + av_int(a,i23); + av_int(a,i24); + av_int(a,i25); + av_int(a,i26); + av_int(a,i27); + av_int(a,i28); + av_int(a,i29); + av_int(a,i30); + av_int(a,i31); + av_int(a,i32); + av_call(a); + fprintf(out,"->%d\n",ir); + fflush(out); + + return; +} +void + float_tests (void) +{ + av_alist a; + float fr; + + fr = f_f(f1); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f,&fr); + av_float(a,f1); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f2(f1,f2); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f2,&fr); + av_float(a,f1); + av_float(a,f2); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f4(f1,f2,f3,f4); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f4,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_float(a,f4); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f8(f1,f2,f3,f4,f5,f6,f7,f8); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f8,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_float(a,f4); + av_float(a,f5); + av_float(a,f6); + av_float(a,f7); + av_float(a,f8); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f16(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f16,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_float(a,f4); + av_float(a,f5); + av_float(a,f6); + av_float(a,f7); + av_float(a,f8); + av_float(a,f9); + av_float(a,f10); + av_float(a,f11); + av_float(a,f12); + av_float(a,f13); + av_float(a,f14); + av_float(a,f15); + av_float(a,f16); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f24(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,f21,f22,f23,f24); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f24,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_float(a,f4); + av_float(a,f5); + av_float(a,f6); + av_float(a,f7); + av_float(a,f8); + av_float(a,f9); + av_float(a,f10); + av_float(a,f11); + av_float(a,f12); + av_float(a,f13); + av_float(a,f14); + av_float(a,f15); + av_float(a,f16); + av_float(a,f17); + av_float(a,f18); + av_float(a,f19); + av_float(a,f20); + av_float(a,f21); + av_float(a,f22); + av_float(a,f23); + av_float(a,f24); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); +} +void + double_tests (void) +{ + av_alist a; + double dr; + + dr = d_d(d1); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d,&dr); + av_double(a,d1); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d2(d1,d2); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d2,&dr); + av_double(a,d1); + av_double(a,d2); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d4(d1,d2,d3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d4,&dr); + av_double(a,d1); + av_double(a,d2); + av_double(a,d3); + av_double(a,d4); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d8(d1,d2,d3,d4,d5,d6,d7,d8); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d8,&dr); + av_double(a,d1); + av_double(a,d2); + av_double(a,d3); + av_double(a,d4); + av_double(a,d5); + av_double(a,d6); + av_double(a,d7); + av_double(a,d8); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d16(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d16,&dr); + av_double(a,d1); + av_double(a,d2); + av_double(a,d3); + av_double(a,d4); + av_double(a,d5); + av_double(a,d6); + av_double(a,d7); + av_double(a,d8); + av_double(a,d9); + av_double(a,d10); + av_double(a,d11); + av_double(a,d12); + av_double(a,d13); + av_double(a,d14); + av_double(a,d15); + av_double(a,d16); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + return; +} +void + pointer_tests (void) +{ + av_alist a; + void* vpr; + + vpr = vp_vpdpcpsp(&uc1,&d2,str3,&I4); + fprintf(out,"->0x%p\n",vpr); + fflush(out); + vpr = 0; clear_traces(); + av_start_ptr(a,vp_vpdpcpsp,void*,&vpr); + av_ptr(a,void*,&uc1); + av_ptr(a,double*,&d2); + av_ptr(a,char*,str3); + av_ptr(a,Int*,&I4); + av_call(a); + fprintf(out,"->0x%p\n",vpr); + fflush(out); + + return; +} +void + mixed_number_tests (void) +{ + av_alist a; + uchar ucr; + ushort usr; + float fr; + double dr; + long long llr; + + /* Unsigned types. + */ + ucr = uc_ucsil(uc1,us2,ui3,ul4); + fprintf(out,"->%u\n",ucr); + fflush(out); + ucr = 0; clear_traces(); + av_start_uchar(a,uc_ucsil,&ucr); + av_uchar(a,uc1); + av_ushort(a,us2); + av_uint(a,ui3); + av_ulong(a,ul4); + av_call(a); + fprintf(out,"->%u\n",ucr); + fflush(out); + + /* Mixed int & float types. + */ + dr = d_iidd(i1,i2,d3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_iidd,&dr); + av_int(a,i1); + av_int(a,i2); + av_double(a,d3); + av_double(a,d4); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_iiidi(i1,i2,i3,d4,i5); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_iiidi,&dr); + av_int(a,i1); + av_int(a,i2); + av_int(a,i3); + av_double(a,d4); + av_int(a,i5); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_idid(i1,d2,i3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_idid,&dr); + av_int(a,i1); + av_double(a,d2); + av_int(a,i3); + av_double(a,d4); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_fdi(f1,d2,i3); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_fdi,&dr); + av_float(a,f1); + av_double(a,d2); + av_int(a,i3); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + usr = us_cdcd(c1,d2,c3,d4); + fprintf(out,"->%u\n",usr); + fflush(out); + usr = 0; clear_traces(); + av_start_ushort(a,us_cdcd,&usr); + av_char(a,c1); + av_double(a,d2); + av_char(a,c3); + av_double(a,d4); + av_call(a); + fprintf(out,"->%u\n",usr); + fflush(out); + + /* Long long types. + */ + llr = ll_iiilli(i1,i2,i3,ll1,i13); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + av_start_longlong(a,ll_iiilli,&llr); + av_int(a,i1); + av_int(a,i2); + av_int(a,i3); + av_longlong(a,ll1); + av_int(a,i13); + av_call(a); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_flli(f13,ll1,i13); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + av_start_longlong(a,ll_flli,&llr); + av_float(a,f13); + av_longlong(a,ll1); + av_int(a,i13); + av_call(a); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + fr = f_fi(f1,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_fi,&fr); + av_float(a,f1); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f2i(f1,f2,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f2i,&fr); + av_float(a,f1); + av_float(a,f2); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f3i(f1,f2,f3,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f3i,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f4i(f1,f2,f3,f4,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f4i,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_float(a,f4); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f7i(f1,f2,f3,f4,f5,f6,f7,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f7i,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_float(a,f4); + av_float(a,f5); + av_float(a,f6); + av_float(a,f7); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f8i(f1,f2,f3,f4,f5,f6,f7,f8,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f8i,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_float(a,f4); + av_float(a,f5); + av_float(a,f6); + av_float(a,f7); + av_float(a,f8); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f12i(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f12i,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_float(a,f4); + av_float(a,f5); + av_float(a,f6); + av_float(a,f7); + av_float(a,f8); + av_float(a,f9); + av_float(a,f10); + av_float(a,f11); + av_float(a,f12); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f13i(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f13i,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_float(a,f4); + av_float(a,f5); + av_float(a,f6); + av_float(a,f7); + av_float(a,f8); + av_float(a,f9); + av_float(a,f10); + av_float(a,f11); + av_float(a,f12); + av_float(a,f13); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + dr = d_di(d1,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_di,&dr); + av_double(a,d1); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d2i(d1,d2,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d2i,&dr); + av_double(a,d1); + av_double(a,d2); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d3i(d1,d2,d3,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d3i,&dr); + av_double(a,d1); + av_double(a,d2); + av_double(a,d3); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d4i(d1,d2,d3,d4,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d4i,&dr); + av_double(a,d1); + av_double(a,d2); + av_double(a,d3); + av_double(a,d4); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d7i(d1,d2,d3,d4,d5,d6,d7,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d7i,&dr); + av_double(a,d1); + av_double(a,d2); + av_double(a,d3); + av_double(a,d4); + av_double(a,d5); + av_double(a,d6); + av_double(a,d7); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d8i(d1,d2,d3,d4,d5,d6,d7,d8,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d8i,&dr); + av_double(a,d1); + av_double(a,d2); + av_double(a,d3); + av_double(a,d4); + av_double(a,d5); + av_double(a,d6); + av_double(a,d7); + av_double(a,d8); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d12i(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d12i,&dr); + av_double(a,d1); + av_double(a,d2); + av_double(a,d3); + av_double(a,d4); + av_double(a,d5); + av_double(a,d6); + av_double(a,d7); + av_double(a,d8); + av_double(a,d9); + av_double(a,d10); + av_double(a,d11); + av_double(a,d12); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d13i(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d13i,&dr); + av_double(a,d1); + av_double(a,d2); + av_double(a,d3); + av_double(a,d4); + av_double(a,d5); + av_double(a,d6); + av_double(a,d7); + av_double(a,d8); + av_double(a,d9); + av_double(a,d10); + av_double(a,d11); + av_double(a,d12); + av_double(a,d13); + av_int(a,i9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + return; +} +void + small_structure_return_tests (void) +{ + av_alist a; + + { + Size1 r = S1_v(); + fprintf(out,"->{%c}\n",r.x1); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + av_start_struct(a,S1_v,Size1,1,&r); + av_call(a); + fprintf(out,"->{%c}\n",r.x1); + fflush(out); + } + { + Size2 r = S2_v(); + fprintf(out,"->{%c%c}\n",r.x1,r.x2); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + av_start_struct(a,S2_v,Size2,1,&r); + av_call(a); + fprintf(out,"->{%c%c}\n",r.x1,r.x2); + fflush(out); + } + { + Size3 r = S3_v(); + fprintf(out,"->{%c%c%c}\n",r.x1,r.x2,r.x3); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + av_start_struct(a,S3_v,Size3,1,&r); + av_call(a); + fprintf(out,"->{%c%c%c}\n",r.x1,r.x2,r.x3); + fflush(out); + } + { + Size4 r = S4_v(); + fprintf(out,"->{%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + av_start_struct(a,S4_v,Size4,1,&r); + av_call(a); + fprintf(out,"->{%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4); + fflush(out); + } + { + Size7 r = S7_v(); + fprintf(out,"->{%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + av_start_struct(a,S7_v,Size7,1,&r); + av_call(a); + fprintf(out,"->{%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7); + fflush(out); + } + { + Size8 r = S8_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + av_start_struct(a,S8_v,Size8,1,&r); + av_call(a); + fprintf(out,"->{%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8); + fflush(out); + } + { + Size12 r = S12_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + av_start_struct(a,S12_v,Size12,1,&r); + av_call(a); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12); + fflush(out); + } + { + Size15 r = S15_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + av_start_struct(a,S15_v,Size15,1,&r); + av_call(a); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15); + fflush(out); + } + { + Size16 r = S16_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15,r.x16); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + av_start_struct(a,S16_v,Size16,1,&r); + av_call(a); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15,r.x16); + fflush(out); + } +} +void + structure_tests (void) +{ + av_alist a; + Int Ir; + Char Cr; + Float Fr; + Double Dr; + J Jr; + T Tr; + X Xr; + + Ir = I_III(I1,I2,I3); + fprintf(out,"->{%d}\n",Ir.x); + fflush(out); + Ir.x = 0; clear_traces(); + av_start_struct(a,I_III,Int,1,&Ir); + av_struct(a,Int,I1); + av_struct(a,Int,I2); + av_struct(a,Int,I3); + av_call(a); + fprintf(out,"->{%d}\n",Ir.x); + fflush(out); + +#ifndef SKIP_EXTRA_STRUCTS + Cr = C_CdC(C1,d2,C3); + fprintf(out,"->{'%c'}\n",Cr.x); + fflush(out); + Cr.x = '\0'; clear_traces(); + av_start_struct(a,C_CdC,Char,1,&Cr); + av_struct(a,Char,C1); + av_double(a,d2); + av_struct(a,Char,C3); + av_call(a); + fprintf(out,"->{'%c'}\n",Cr.x); + fflush(out); + + Fr = F_Ffd(F1,f2,d3); + fprintf(out,"->{%g}\n",Fr.x); + fflush(out); + Fr.x = 0.0; clear_traces(); + av_start_struct(a,F_Ffd,Float,av_word_splittable_1(float),&Fr); + av_struct(a,Float,F1); + av_float(a,f2); + av_double(a,d3); + av_call(a); + fprintf(out,"->{%g}\n",Fr.x); + fflush(out); + + Dr = D_fDd(f1,D2,d3); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); + Dr.x = 0.0; clear_traces(); + av_start_struct(a,D_fDd,Double,av_word_splittable_1(double),&Dr); + av_float(a,f1); + av_struct(a,Double,D2); + av_double(a,d3); + av_call(a); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); + + Dr = D_Dfd(D1,f2,d3); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); + Dr.x = 0.0; clear_traces(); + av_start_struct(a,D_Dfd,Double,av_word_splittable_1(double),&Dr); + av_struct(a,Double,D1); + av_float(a,f2); + av_double(a,d3); + av_call(a); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); +#endif + + Jr = J_JiJ(J1,i2,J2); + fprintf(out,"->{%ld,%ld}\n",Jr.l1,Jr.l2); + fflush(out); + Jr.l1 = Jr.l2 = 0; clear_traces(); + av_start_struct(a,J_JiJ,J,av_word_splittable_2(long,long),&Jr); + av_struct(a,J,J1); + av_int(a,i2); + av_struct(a,J,J2); + av_call(a); + fprintf(out,"->{%ld,%ld}\n",Jr.l1,Jr.l2); + fflush(out); + +#ifndef SKIP_EXTRA_STRUCTS +#ifndef SKIP_T + Tr = T_TcT(T1,' ',T2); + fprintf(out,"->{\"%c%c%c\"}\n",Tr.c[0],Tr.c[1],Tr.c[2]); + fflush(out); + Tr.c[0] = Tr.c[1] = Tr.c[2] = 0; clear_traces(); + av_start_struct(a,T_TcT,T,1,&Tr); + av_struct(a,T,T1); + av_char(a,' '); + av_struct(a,T,T2); + av_call(a); + fprintf(out,"->{\"%c%c%c\"}\n",Tr.c[0],Tr.c[1],Tr.c[2]); + fflush(out); +#endif + + Xr = X_BcdB(B1,c2,d3,B2); + fprintf(out,"->{\"%s\",'%c'}\n",Xr.c,Xr.c1); + fflush(out); + Xr.c[0]=Xr.c1='\0'; clear_traces(); + av_start_struct(a,X_BcdB,X,0,&Xr); + av_struct(a,B,B1); + av_char(a,c2); + av_double(a,d3); + av_struct(a,B,B2); + av_call(a); + fprintf(out,"->{\"%s\",'%c'}\n",Xr.c,Xr.c1); + fflush(out); +#endif + + return; +} + +void + gpargs_boundary_tests (void) +{ + av_alist a; + long lr; + long long llr; + float fr; + double dr; + + lr = l_l0J(J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l0J,&lr); + av_struct(a,J,J1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l1J(l1,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l1J,&lr); + av_long(a,l1); + av_struct(a,J,J1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l2J(l1,l2,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l2J,&lr); + av_long(a,l1); + av_long(a,l2); + av_struct(a,J,J1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l3J(l1,l2,l3,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l3J,&lr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_struct(a,J,J1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l4J(l1,l2,l3,l4,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l4J,&lr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_struct(a,J,J1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l5J(l1,l2,l3,l4,l5,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l5J,&lr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_struct(a,J,J1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l6J(l1,l2,l3,l4,l5,l6,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l6J,&lr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_long(a,l6); + av_struct(a,J,J1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l7J(l1,l2,l3,l4,l5,l6,l7,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l7J,&lr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_long(a,l6); + av_long(a,l7); + av_struct(a,J,J1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l0K(K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l0K,&lr); + av_struct(a,K,K1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l1K(l1,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l1K,&lr); + av_long(a,l1); + av_struct(a,K,K1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l2K(l1,l2,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l2K,&lr); + av_long(a,l1); + av_long(a,l2); + av_struct(a,K,K1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l3K(l1,l2,l3,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l3K,&lr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_struct(a,K,K1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l4K(l1,l2,l3,l4,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l4K,&lr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_struct(a,K,K1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l5K(l1,l2,l3,l4,l5,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l5K,&lr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_struct(a,K,K1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l6K(l1,l2,l3,l4,l5,l6,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + av_start_long(a,l_l6K,&lr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_long(a,l6); + av_struct(a,K,K1); + av_long(a,l9); + av_call(a); + fprintf(out,"->%ld\n",lr); + fflush(out); + + fr = f_f17l3L(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,l6,l7,l8,L1); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + av_start_float(a,f_f17l3L,&fr); + av_float(a,f1); + av_float(a,f2); + av_float(a,f3); + av_float(a,f4); + av_float(a,f5); + av_float(a,f6); + av_float(a,f7); + av_float(a,f8); + av_float(a,f9); + av_float(a,f10); + av_float(a,f11); + av_float(a,f12); + av_float(a,f13); + av_float(a,f14); + av_float(a,f15); + av_float(a,f16); + av_float(a,f17); + av_long(a,l6); + av_long(a,l7); + av_long(a,l8); + av_struct(a,L,L1); + av_call(a); + fprintf(out,"->%g\n",fr); + fflush(out); + + dr = d_d17l3L(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,l6,l7,l8,L1); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_d17l3L,&dr); + av_double(a,d1); + av_double(a,d2); + av_double(a,d3); + av_double(a,d4); + av_double(a,d5); + av_double(a,d6); + av_double(a,d7); + av_double(a,d8); + av_double(a,d9); + av_double(a,d10); + av_double(a,d11); + av_double(a,d12); + av_double(a,d13); + av_double(a,d14); + av_double(a,d15); + av_double(a,d16); + av_double(a,d17); + av_long(a,l6); + av_long(a,l7); + av_long(a,l8); + av_struct(a,L,L1); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + llr = ll_l2ll(l1,l2,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + av_start_longlong(a,ll_l2ll,&llr); + av_long(a,l1); + av_long(a,l2); + av_longlong(a,ll1); + av_long(a,l9); + av_call(a); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l3ll(l1,l2,l3,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + av_start_longlong(a,ll_l3ll,&llr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_longlong(a,ll1); + av_long(a,l9); + av_call(a); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l4ll(l1,l2,l3,l4,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + av_start_longlong(a,ll_l4ll,&llr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_longlong(a,ll1); + av_long(a,l9); + av_call(a); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l5ll(l1,l2,l3,l4,l5,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + av_start_longlong(a,ll_l5ll,&llr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_longlong(a,ll1); + av_long(a,l9); + av_call(a); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l6ll(l1,l2,l3,l4,l5,l6,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + av_start_longlong(a,ll_l6ll,&llr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_long(a,l6); + av_longlong(a,ll1); + av_long(a,l9); + av_call(a); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l7ll(l1,l2,l3,l4,l5,l6,l7,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + av_start_longlong(a,ll_l7ll,&llr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_long(a,l6); + av_long(a,l7); + av_longlong(a,ll1); + av_long(a,l9); + av_call(a); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + dr = d_l2d(l1,l2,d2,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_l2d,&dr); + av_long(a,l1); + av_long(a,l2); + av_double(a,d2); + av_long(a,l9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l3d(l1,l2,l3,d2,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_l3d,&dr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_double(a,d2); + av_long(a,l9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l4d(l1,l2,l3,l4,d2,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_l4d,&dr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_double(a,d2); + av_long(a,l9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l5d(l1,l2,l3,l4,l5,d2,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_l5d,&dr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_double(a,d2); + av_long(a,l9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l6d(l1,l2,l3,l4,l5,l6,d2,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_l6d,&dr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_long(a,l6); + av_double(a,d2); + av_long(a,l9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l7d(l1,l2,l3,l4,l5,l6,l7,d2,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + av_start_double(a,d_l7d,&dr); + av_long(a,l1); + av_long(a,l2); + av_long(a,l3); + av_long(a,l4); + av_long(a,l5); + av_long(a,l6); + av_long(a,l7); + av_double(a,d2); + av_long(a,l9); + av_call(a); + fprintf(out,"->%g\n",dr); + fflush(out); + + return; +} + +/* Verify that structs larger than 2 words are really + passed by value, not accidentally by reference. */ +void + by_value_tests (void) +{ + av_alist a; + K k; + + k.l1 = l1; + k.l2 = l2; + k.l3 = l3; + k.l4 = l4; + fprintf(out,"by_value:%ld,%ld,%ld,%ld\n",k.l1,k.l2,k.l3,k.l4); + fflush(out); + clear_traces(); + av_start_void(a,v_clobber_K); + av_struct(a,K,k); + av_call(a); + fprintf(out,"by_value:%ld,%ld,%ld,%ld\n",k.l1,k.l2,k.l3,k.l4); + fflush(out); +} + +int + main (void) +{ + out = stdout; + void_tests(); + int_tests(); + float_tests(); + double_tests(); + pointer_tests(); + mixed_number_tests(); + small_structure_return_tests(); + structure_tests(); + gpargs_boundary_tests(); + by_value_tests(); + + exit(0); +} diff --git a/build-aux/ar-lib b/build-aux/ar-lib new file mode 100755 index 0000000..1e9388e --- /dev/null +++ b/build-aux/ar-lib @@ -0,0 +1,271 @@ +#! /bin/sh +# Wrapper for Microsoft lib.exe + +me=ar-lib +scriptversion=2019-07-04.01; # UTC + +# Copyright (C) 2010-2020 Free Software Foundation, Inc. +# Written by Peter Rosin . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# 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. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + + +# func_error message +func_error () +{ + echo "$me: $1" 1>&2 + exit 1 +} + +file_conv= + +# func_file_conv build_file +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN* | MSYS*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv in + mingw) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin | msys) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_at_file at_file operation archive +# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE +# for each of them. +# When interpreting the content of the @FILE, do NOT use func_file_conv, +# since the user would need to supply preconverted file names to +# binutils ar, at least for MinGW. +func_at_file () +{ + operation=$2 + archive=$3 + at_file_contents=`cat "$1"` + eval set x "$at_file_contents" + shift + + for member + do + $AR -NOLOGO $operation:"$member" "$archive" || exit $? + done +} + +case $1 in + '') + func_error "no command. Try '$0 --help' for more information." + ;; + -h | --h*) + cat <. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# 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. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +nl=' +' + +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent tools from complaining about whitespace usage. +IFS=" "" $nl" + +file_conv= + +# func_file_conv build_file lazy +# Convert a $build file to $host form and store it in $file +# Currently only supports Windows hosts. If the determined conversion +# type is listed in (the comma separated) LAZY, no conversion will +# take place. +func_file_conv () +{ + file=$1 + case $file in + / | /[!/]*) # absolute file, and not a UNC file + if test -z "$file_conv"; then + # lazily determine how to convert abs files + case `uname -s` in + MINGW*) + file_conv=mingw + ;; + CYGWIN* | MSYS*) + file_conv=cygwin + ;; + *) + file_conv=wine + ;; + esac + fi + case $file_conv/,$2, in + *,$file_conv,*) + ;; + mingw/*) + file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` + ;; + cygwin/* | msys/*) + file=`cygpath -m "$file" || echo "$file"` + ;; + wine/*) + file=`winepath -w "$file" || echo "$file"` + ;; + esac + ;; + esac +} + +# func_cl_dashL linkdir +# Make cl look for libraries in LINKDIR +func_cl_dashL () +{ + func_file_conv "$1" + if test -z "$lib_path"; then + lib_path=$file + else + lib_path="$lib_path;$file" + fi + linker_opts="$linker_opts -LIBPATH:$file" +} + +# func_cl_dashl library +# Do a library search-path lookup for cl +func_cl_dashl () +{ + lib=$1 + found=no + save_IFS=$IFS + IFS=';' + for dir in $lib_path $LIB + do + IFS=$save_IFS + if $shared && test -f "$dir/$lib.dll.lib"; then + found=yes + lib=$dir/$lib.dll.lib + break + fi + if test -f "$dir/$lib.lib"; then + found=yes + lib=$dir/$lib.lib + break + fi + if test -f "$dir/lib$lib.a"; then + found=yes + lib=$dir/lib$lib.a + break + fi + done + IFS=$save_IFS + + if test "$found" != yes; then + lib=$lib.lib + fi +} + +# func_cl_wrapper cl arg... +# Adjust compile command to suit cl +func_cl_wrapper () +{ + # Assume a capable shell + lib_path= + shared=: + linker_opts= + for arg + do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + eat=1 + case $2 in + *.o | *.[oO][bB][jJ]) + func_file_conv "$2" + set x "$@" -Fo"$file" + shift + ;; + *) + func_file_conv "$2" + set x "$@" -Fe"$file" + shift + ;; + esac + ;; + -I) + eat=1 + func_file_conv "$2" mingw + set x "$@" -I"$file" + shift + ;; + -I*) + func_file_conv "${1#-I}" mingw + set x "$@" -I"$file" + shift + ;; + -l) + eat=1 + func_cl_dashl "$2" + set x "$@" "$lib" + shift + ;; + -l*) + func_cl_dashl "${1#-l}" + set x "$@" "$lib" + shift + ;; + -L) + eat=1 + func_cl_dashL "$2" + ;; + -L*) + func_cl_dashL "${1#-L}" + ;; + -static) + shared=false + ;; + -Wl,*) + arg=${1#-Wl,} + save_ifs="$IFS"; IFS=',' + for flag in $arg; do + IFS="$save_ifs" + linker_opts="$linker_opts $flag" + done + IFS="$save_ifs" + ;; + -Xlinker) + eat=1 + linker_opts="$linker_opts $2" + ;; + -*) + set x "$@" "$1" + shift + ;; + *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) + func_file_conv "$1" + set x "$@" -Tp"$file" + shift + ;; + *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) + func_file_conv "$1" mingw + set x "$@" "$file" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift + done + if test -n "$linker_opts"; then + linker_opts="-link$linker_opts" + fi + exec "$@" $linker_opts + exit 1 +} + +eat= + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand '-c -o'. +Remove '-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file 'INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; + cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ + icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) + func_cl_wrapper "$@" # Doesn't return... + ;; +esac + +ofile= +cfile= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as 'compile cc -o foo foo.c'. + # So we strip '-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no '-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # '.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use '[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/build-aux/config.guess b/build-aux/config.guess new file mode 100755 index 0000000..dc0a6b2 --- /dev/null +++ b/build-aux/config.guess @@ -0,0 +1,1702 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright 1992-2021 Free Software Foundation, Inc. + +timestamp='2021-05-24' + +# 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 3 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, see . +# +# 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. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). +# +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. +# +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.guess +# +# Please send patches to . + + +me=$(echo "$0" | sed -e 's,.*/,,') + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Options: + -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 ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright 1992-2021 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 ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # 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 + +# 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. + +tmp= +# shellcheck disable=SC2172 +trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 + +set_cc_for_build() { + # prevent multiple calls if $tmp is already set + test "$tmp" && return 0 + : "${TMPDIR=/tmp}" + # shellcheck disable=SC2039 + { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } + dummy=$tmp/dummy + case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in + ,,) echo "int x;" > "$dummy.c" + for driver in cc gcc c89 c99 ; do + if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then + CC_FOR_BUILD="$driver" + 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 ; 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 + +case $UNAME_SYSTEM in +Linux|GNU|GNU/*) + LIBC=unknown + + set_cc_for_build + cat <<-EOF > "$dummy.c" + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #elif defined(__GLIBC__) + LIBC=gnu + #else + #include + /* First heuristic to detect musl libc. */ + #ifdef __DEFINED_va_list + LIBC=musl + #endif + #endif + EOF + eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')" + + # Second heuristic to detect musl libc. + if [ "$LIBC" = unknown ] && + command -v ldd >/dev/null && + ldd --version 2>&1 | grep -q ^musl; then + LIBC=musl + fi + + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + if [ "$LIBC" = unknown ]; then + LIBC=gnu + fi + ;; +esac + +# 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 tuples: *-*-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". + UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \ + /sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + /usr/sbin/sysctl -n hw.machine_arch 2>/dev/null || \ + echo unknown)) + case $UNAME_MACHINE_ARCH in + aarch64eb) machine=aarch64_be-unknown ;; + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + earmv*) + arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,') + endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p') + machine="${arch}${endian}"-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) and ABI. + case $UNAME_MACHINE_ARCH in + earm*) + os=netbsdelf + ;; + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + 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 + # Determine ABI tags. + case $UNAME_MACHINE_ARCH in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr") + ;; + 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/[-_].*//' | cut -d. -f1,2) + ;; + 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}${abi-}" + exit ;; + *:Bitrig:*:*) + UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//') + echo "$UNAME_MACHINE_ARCH"-unknown-bitrig"$UNAME_RELEASE" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//') + echo "$UNAME_MACHINE_ARCH"-unknown-openbsd"$UNAME_RELEASE" + exit ;; + *:SecBSD:*:*) + UNAME_MACHINE_ARCH=$(arch | sed 's/SecBSD.//') + echo "$UNAME_MACHINE_ARCH"-unknown-secbsd"$UNAME_RELEASE" + exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//') + echo "$UNAME_MACHINE_ARCH"-unknown-libertybsd"$UNAME_RELEASE" + exit ;; + *:MidnightBSD:*:*) + echo "$UNAME_MACHINE"-unknown-midnightbsd"$UNAME_RELEASE" + exit ;; + *:ekkoBSD:*:*) + echo "$UNAME_MACHINE"-unknown-ekkobsd"$UNAME_RELEASE" + exit ;; + *:SolidBSD:*:*) + echo "$UNAME_MACHINE"-unknown-solidbsd"$UNAME_RELEASE" + exit ;; + *:OS108:*:*) + echo "$UNAME_MACHINE"-unknown-os108_"$UNAME_RELEASE" + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:MirBSD:*:*) + echo "$UNAME_MACHINE"-unknown-mirbsd"$UNAME_RELEASE" + exit ;; + *:Sortix:*:*) + echo "$UNAME_MACHINE"-unknown-sortix + exit ;; + *:Twizzler:*:*) + echo "$UNAME_MACHINE"-unknown-twizzler + exit ;; + *:Redox:*:*) + echo "$UNAME_MACHINE"-unknown-redox + exit ;; + mips:OSF1:*.*) + echo mips-dec-osf1 + exit ;; + alpha:OSF1:*:*) + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + trap '' 0 + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}') + ;; + *5.*) + UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}') + ;; + esac + # 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 Pn.n version is a patched version. + # 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/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)" + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo "$UNAME_MACHINE"-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo "$UNAME_MACHINE"-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix"$UNAME_RELEASE" + exit ;; + arm*:riscos:*:*|arm*:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + 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 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case $(/usr/bin/uname -p) in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux"$UNAME_RELEASE" + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + set_cc_for_build + SUN_ARCH=i386 + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH=x86_64 + fi + fi + echo "$SUN_ARCH"-pc-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + 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 ;; + 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 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos"$UNAME_RELEASE" + exit ;; + 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 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos"$UNAME_RELEASE" + exit ;; + # 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 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint"$UNAME_RELEASE" + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint"$UNAME_RELEASE" + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint"$UNAME_RELEASE" + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint"$UNAME_RELEASE" + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten"$UNAME_RELEASE" + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten"$UNAME_RELEASE" + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix"$UNAME_RELEASE" + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix"$UNAME_RELEASE" + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix"$UNAME_RELEASE" + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" +#ifdef __cplusplus +#include /* 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" && + dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') && + SYSTEM_NAME=$("$dummy" "$dummyarg") && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos"$UNAME_RELEASE" + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=$(/usr/bin/uname -p) + if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 + then + if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ + test "$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 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')" + exit ;; + ????????: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 ;; # Note that: echo "'$(uname -s)'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if test -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 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + 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 ;; + *:AIX:*:[4567]) + 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 test -x /usr/bin/lslpp ; then + IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/) + else + IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" + fi + echo "$IBM_ARCH"-ibm-aix"$IBM_REV" + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 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 test -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 test "$HP_ARCH" = ""; then + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + + #define _HPUX_SOURCE + #include + #include + + 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 test "$HP_ARCH" = hppa2.0w + then + set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH=hppa2.0w + else + HP_ARCH=hppa64 + fi + fi + echo "$HP_ARCH"-hp-hpux"$HPUX_REV" + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') + echo ia64-hp-hpux"$HPUX_REV" + exit ;; + 3050*:HI-UX:*:*) + set_cc_for_build + sed 's/^ //' << EOF > "$dummy.c" + #include + 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" && SYSTEM_NAME=$("$dummy") && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if test -x /usr/sbin/sysversion ; then + echo "$UNAME_MACHINE"-unknown-osf1mk + else + echo "$UNAME_MACHINE"-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + 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 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' + exit ;; + 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 ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') + FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/') + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo "$UNAME_MACHINE"-pc-bsdi"$UNAME_RELEASE" + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi"$UNAME_RELEASE" + exit ;; + *:BSD/OS:*:*) + echo "$UNAME_MACHINE"-unknown-bsdi"$UNAME_RELEASE" + exit ;; + arm:FreeBSD:*:*) + UNAME_PROCESSOR=$(uname -p) + set_cc_for_build + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi + else + echo "${UNAME_PROCESSOR}"-unknown-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf + fi + exit ;; + *:FreeBSD:*:*) + UNAME_PROCESSOR=$(/usr/bin/uname -p) + case $UNAME_PROCESSOR in + amd64) + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; + esac + echo "$UNAME_PROCESSOR"-unknown-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" + exit ;; + i*:CYGWIN*:*) + echo "$UNAME_MACHINE"-pc-cygwin + exit ;; + *:MINGW64*:*) + echo "$UNAME_MACHINE"-pc-mingw64 + exit ;; + *:MINGW*:*) + echo "$UNAME_MACHINE"-pc-mingw32 + exit ;; + *:MSYS*:*) + echo "$UNAME_MACHINE"-pc-msys + exit ;; + i*:PW*:*) + echo "$UNAME_MACHINE"-pc-pw32 + exit ;; + *:Interix*:*) + case $UNAME_MACHINE in + x86) + echo i586-pc-interix"$UNAME_RELEASE" + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix"$UNAME_RELEASE" + exit ;; + IA64) + echo ia64-unknown-interix"$UNAME_RELEASE" + exit ;; + esac ;; + i*:UWIN*:*) + echo "$UNAME_MACHINE"-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-pc-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" + exit ;; + *:GNU:*:*) + # the GNU system + echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-unknown-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')" + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo "$UNAME_MACHINE-unknown-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC" + exit ;; + *:Minix:*:*) + echo "$UNAME_MACHINE"-unknown-minix + exit ;; + aarch64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + aarch64_be:Linux:*:*) + UNAME_MACHINE=aarch64_be + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + alpha:Linux:*:*) + case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) 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 -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arc:Linux:*:* | arceb:Linux:*:* | arc64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + arm*:Linux:*:*) + set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + else + if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_PCS_VFP + then + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabi + else + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"eabihf + fi + fi + exit ;; + avr32*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + cris:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + crisv32:Linux:*:*) + echo "$UNAME_MACHINE"-axis-linux-"$LIBC" + exit ;; + e2k:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + frv:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + hexagon:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + i*86:Linux:*:*) + echo "$UNAME_MACHINE"-pc-linux-"$LIBC" + exit ;; + ia64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + k1om:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + loongarch32:Linux:*:* | loongarch64:Linux:*:* | loongarchx32:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m32r*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + m68*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + set_cc_for_build + IS_GLIBC=0 + test x"${LIBC}" = xgnu && IS_GLIBC=1 + sed 's/^ //' << EOF > "$dummy.c" + #undef CPU + #undef mips + #undef mipsel + #undef mips64 + #undef mips64el + #if ${IS_GLIBC} && defined(_ABI64) + LIBCABI=gnuabi64 + #else + #if ${IS_GLIBC} && defined(_ABIN32) + LIBCABI=gnuabin32 + #else + LIBCABI=${LIBC} + #endif + #endif + + #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa64r6 + #else + #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 + CPU=mipsisa32r6 + #else + #if defined(__mips64) + CPU=mips64 + #else + CPU=mips + #endif + #endif + #endif + + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + MIPS_ENDIAN=el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + MIPS_ENDIAN= + #else + MIPS_ENDIAN= + #endif + #endif +EOF + eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')" + test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; } + ;; + mips64el:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-"$LIBC" + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-"$LIBC" + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-"$LIBC" + exit ;; + 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-"$LIBC" ;; + PA8*) echo hppa2.0-unknown-linux-"$LIBC" ;; + *) echo hppa-unknown-linux-"$LIBC" ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-"$LIBC" + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-"$LIBC" + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-"$LIBC" + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-"$LIBC" + exit ;; + riscv32:Linux:*:* | riscv32be:Linux:*:* | riscv64:Linux:*:* | riscv64be:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" + exit ;; + sh64*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sh*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + tile*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + vax:Linux:*:*) + echo "$UNAME_MACHINE"-dec-linux-"$LIBC" + exit ;; + x86_64:Linux:*:*) + set_cc_for_build + LIBCABI=$LIBC + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_X32 >/dev/null + then + LIBCABI="$LIBC"x32 + fi + fi + echo "$UNAME_MACHINE"-pc-linux-"$LIBCABI" + exit ;; + xtensa*:Linux:*:*) + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; + 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 ;; + 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 ;; + 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 ;; + i*86:XTS-300:*:STOP) + echo "$UNAME_MACHINE"-unknown-stop + exit ;; + i*86:atheos:*:*) + echo "$UNAME_MACHINE"-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo "$UNAME_MACHINE"-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos"$UNAME_RELEASE" + exit ;; + i*86:*DOS:*:*) + echo "$UNAME_MACHINE"-pc-msdosdjgpp + exit ;; + i*86:*: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 ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + 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 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=$(sed -n 's/.*Version //p' /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 ;; + 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 i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configure will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + 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 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 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 | S7501*:*: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; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + 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; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos"$UNAME_RELEASE" + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos"$UNAME_RELEASE" + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos"$UNAME_RELEASE" + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv"$UNAME_RELEASE" + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *: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 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo "$UNAME_MACHINE"-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux"$UNAME_RELEASE" + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if test -d /usr/nec; then + echo mips-nec-sysv"$UNAME_RELEASE" + else + echo mips-unknown-sysv"$UNAME_RELEASE" + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + x86_64:Haiku:*:*) + echo x86_64-unknown-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux"$UNAME_RELEASE" + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux"$UNAME_RELEASE" + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux"$UNAME_RELEASE" + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux"$UNAME_RELEASE" + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux"$UNAME_RELEASE" + exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux"$UNAME_RELEASE" + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody"$UNAME_RELEASE" + exit ;; + *:Rhapsody:*:*) + echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" + exit ;; + arm64:Darwin:*:*) + echo aarch64-apple-darwin"$UNAME_RELEASE" + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=$(uname -p) + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; + esac + if command -v xcode-select > /dev/null 2> /dev/null && \ + ! xcode-select --print-path > /dev/null 2> /dev/null ; then + # Avoid executing cc if there is no toolchain installed as + # cc will be a stub that puts up a graphical alert + # prompting the user to install developer tools. + CC_FOR_BUILD=no_compiler_found + else + set_cc_for_build + fi + if test "$CC_FOR_BUILD" != no_compiler_found; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # uname -m returns i386 or x86_64 + UNAME_PROCESSOR=$UNAME_MACHINE + fi + echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" + exit ;; + *: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 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NEO-*:NONSTOP_KERNEL:*:*) + echo neo-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSE-*:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSR-*:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSV-*:NONSTOP_KERNEL:*:*) + echo nsv-tandem-nsk"$UNAME_RELEASE" + exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk"$UNAME_RELEASE" + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" + exit ;; + *: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 + elif test "x${cputype-}" != x; then + UNAME_MACHINE="$cputype" + fi + echo "$UNAME_MACHINE"-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux"$UNAME_RELEASE" + exit ;; + *:DragonFly:*:*) + echo "$UNAME_MACHINE"-unknown-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=$( (uname -p) 2>/dev/null) + case $UNAME_MACHINE in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo "$UNAME_MACHINE"-pc-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')" + exit ;; + i*86:rdos:*:*) + echo "$UNAME_MACHINE"-pc-rdos + exit ;; + *:AROS:*:*) + echo "$UNAME_MACHINE"-unknown-aros + exit ;; + x86_64:VMkernel:*:*) + echo "$UNAME_MACHINE"-unknown-esx + exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; + *:Unleashed:*:*) + echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE" + exit ;; +esac + +# No uname command or uname output not recognized. +set_cc_for_build +cat > "$dummy.c" < +#include +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#include +#if defined(_SIZE_T_) || defined(SIGLOST) +#include +#endif +#endif +#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 + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#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 +#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 +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname un; + uname (&un); + printf ("vax-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif +#endif +#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) +#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) +#if defined(_SIZE_T_) || defined(SIGLOST) + struct utsname *un; + uname (&un); + printf ("mips-dec-ultrix%s\n", un.release); exit (0); +#else + printf ("mips-dec-ultrix\n"); exit (0); +#endif +#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 && SYSTEM_NAME=$($dummy) && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. +test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } + +echo "$0: unable to guess system type" >&2 + +case $UNAME_MACHINE:$UNAME_SYSTEM in + mips:Linux | mips64:Linux) + # If we got here on MIPS GNU/Linux, output extra information. + cat >&2 <&2 <&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 +fi + +exit 1 + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/build-aux/config.sub b/build-aux/config.sub new file mode 100755 index 0000000..7384e91 --- /dev/null +++ b/build-aux/config.sub @@ -0,0 +1,1864 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright 1992-2021 Free Software Foundation, Inc. + +timestamp='2021-04-30' + +# 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 3 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, see . +# +# 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. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). + + +# Please send patches to . +# +# 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. + +# You can get the latest version of this script from: +# https://git.savannah.gnu.org/cgit/config.git/plain/config.sub + +# 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 or ALIAS + +Canonicalize a configuration name. + +Options: + -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 ." + +version="\ +GNU config.sub ($timestamp) + +Copyright 1992-2021 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 ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo "$1" + exit ;; + + * ) + 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 + +# Split fields of configuration type +# shellcheck disable=SC2162 +IFS="-" read field1 field2 field3 field4 <&2 + exit 1 + ;; + *-*-*-*) + basic_machine=$field1-$field2 + basic_os=$field3-$field4 + ;; + *-*-*) + # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two + # parts + maybe_os=$field2-$field3 + case $maybe_os in + nto-qnx* | linux-* | uclinux-uclibc* \ + | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ + | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ + | storm-chaos* | os2-emx* | rtmk-nova*) + basic_machine=$field1 + basic_os=$maybe_os + ;; + android-linux) + basic_machine=$field1-unknown + basic_os=linux-android + ;; + *) + basic_machine=$field1-$field2 + basic_os=$field3 + ;; + esac + ;; + *-*) + # A lone config we happen to match not fitting any pattern + case $field1-$field2 in + decstation-3100) + basic_machine=mips-dec + basic_os= + ;; + *-*) + # Second component is usually, but not always the OS + case $field2 in + # Prevent following clause from handling this valid os + sun*os*) + basic_machine=$field1 + basic_os=$field2 + ;; + # Manufacturers + dec* | mips* | sequent* | encore* | pc533* | 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 \ + | microblaze* | sim | cisco \ + | oki | wec | wrs | winbond) + basic_machine=$field1-$field2 + basic_os= + ;; + *) + basic_machine=$field1 + basic_os=$field2 + ;; + esac + ;; + esac + ;; + *) + # Convert single-component short-hands not valid as part of + # multi-component configurations. + case $field1 in + 386bsd) + basic_machine=i386-pc + basic_os=bsd + ;; + a29khif) + basic_machine=a29k-amd + basic_os=udi + ;; + adobe68k) + basic_machine=m68010-adobe + basic_os=scout + ;; + alliant) + basic_machine=fx80-alliant + basic_os= + ;; + altos | altos3068) + basic_machine=m68k-altos + basic_os= + ;; + am29k) + basic_machine=a29k-none + basic_os=bsd + ;; + amdahl) + basic_machine=580-amdahl + basic_os=sysv + ;; + amiga) + basic_machine=m68k-unknown + basic_os= + ;; + amigaos | amigados) + basic_machine=m68k-unknown + basic_os=amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + basic_os=sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + basic_os=sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + basic_os=bsd + ;; + aros) + basic_machine=i386-pc + basic_os=aros + ;; + aux) + basic_machine=m68k-apple + basic_os=aux + ;; + balance) + basic_machine=ns32k-sequent + basic_os=dynix + ;; + blackfin) + basic_machine=bfin-unknown + basic_os=linux + ;; + cegcc) + basic_machine=arm-unknown + basic_os=cegcc + ;; + convex-c1) + basic_machine=c1-convex + basic_os=bsd + ;; + convex-c2) + basic_machine=c2-convex + basic_os=bsd + ;; + convex-c32) + basic_machine=c32-convex + basic_os=bsd + ;; + convex-c34) + basic_machine=c34-convex + basic_os=bsd + ;; + convex-c38) + basic_machine=c38-convex + basic_os=bsd + ;; + cray) + basic_machine=j90-cray + basic_os=unicos + ;; + crds | unos) + basic_machine=m68k-crds + basic_os= + ;; + da30) + basic_machine=m68k-da30 + basic_os= + ;; + decstation | pmax | pmin | dec3100 | decstatn) + basic_machine=mips-dec + basic_os= + ;; + delta88) + basic_machine=m88k-motorola + basic_os=sysv3 + ;; + dicos) + basic_machine=i686-pc + basic_os=dicos + ;; + djgpp) + basic_machine=i586-pc + basic_os=msdosdjgpp + ;; + ebmon29k) + basic_machine=a29k-amd + basic_os=ebmon + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + basic_os=ose + ;; + gmicro) + basic_machine=tron-gmicro + basic_os=sysv + ;; + go32) + basic_machine=i386-pc + basic_os=go32 + ;; + h8300hms) + basic_machine=h8300-hitachi + basic_os=hms + ;; + h8300xray) + basic_machine=h8300-hitachi + basic_os=xray + ;; + h8500hms) + basic_machine=h8500-hitachi + basic_os=hms + ;; + harris) + basic_machine=m88k-harris + basic_os=sysv3 + ;; + hp300 | hp300hpux) + basic_machine=m68k-hp + basic_os=hpux + ;; + hp300bsd) + basic_machine=m68k-hp + basic_os=bsd + ;; + hppaosf) + basic_machine=hppa1.1-hp + basic_os=osf + ;; + hppro) + basic_machine=hppa1.1-hp + basic_os=proelf + ;; + i386mach) + basic_machine=i386-mach + basic_os=mach + ;; + isi68 | isi) + basic_machine=m68k-isi + basic_os=sysv + ;; + m68knommu) + basic_machine=m68k-unknown + basic_os=linux + ;; + magnum | m3230) + basic_machine=mips-mips + basic_os=sysv + ;; + merlin) + basic_machine=ns32k-utek + basic_os=sysv + ;; + mingw64) + basic_machine=x86_64-pc + basic_os=mingw64 + ;; + mingw32) + basic_machine=i686-pc + basic_os=mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + basic_os=mingw32ce + ;; + monitor) + basic_machine=m68k-rom68k + basic_os=coff + ;; + morphos) + basic_machine=powerpc-unknown + basic_os=morphos + ;; + moxiebox) + basic_machine=moxie-unknown + basic_os=moxiebox + ;; + msdos) + basic_machine=i386-pc + basic_os=msdos + ;; + msys) + basic_machine=i686-pc + basic_os=msys + ;; + mvs) + basic_machine=i370-ibm + basic_os=mvs + ;; + nacl) + basic_machine=le32-unknown + basic_os=nacl + ;; + ncr3000) + basic_machine=i486-ncr + basic_os=sysv4 + ;; + netbsd386) + basic_machine=i386-pc + basic_os=netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + basic_os=linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + basic_os=newsos + ;; + news1000) + basic_machine=m68030-sony + basic_os=newsos + ;; + necv70) + basic_machine=v70-nec + basic_os=sysv + ;; + nh3000) + basic_machine=m68k-harris + basic_os=cxux + ;; + nh[45]000) + basic_machine=m88k-harris + basic_os=cxux + ;; + nindy960) + basic_machine=i960-intel + basic_os=nindy + ;; + mon960) + basic_machine=i960-intel + basic_os=mon960 + ;; + nonstopux) + basic_machine=mips-compaq + basic_os=nonstopux + ;; + os400) + basic_machine=powerpc-ibm + basic_os=os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + basic_os=ose + ;; + os68k) + basic_machine=m68k-none + basic_os=os68k + ;; + paragon) + basic_machine=i860-intel + basic_os=osf + ;; + parisc) + basic_machine=hppa-unknown + basic_os=linux + ;; + psp) + basic_machine=mipsallegrexel-sony + basic_os=psp + ;; + pw32) + basic_machine=i586-unknown + basic_os=pw32 + ;; + rdos | rdos64) + basic_machine=x86_64-pc + basic_os=rdos + ;; + rdos32) + basic_machine=i386-pc + basic_os=rdos + ;; + rom68k) + basic_machine=m68k-rom68k + basic_os=coff + ;; + sa29200) + basic_machine=a29k-amd + basic_os=udi + ;; + sei) + basic_machine=mips-sei + basic_os=seiux + ;; + sequent) + basic_machine=i386-sequent + basic_os= + ;; + sps7) + basic_machine=m68k-bull + basic_os=sysv2 + ;; + st2000) + basic_machine=m68k-tandem + basic_os= + ;; + stratus) + basic_machine=i860-stratus + basic_os=sysv4 + ;; + sun2) + basic_machine=m68000-sun + basic_os= + ;; + sun2os3) + basic_machine=m68000-sun + basic_os=sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + basic_os=sunos4 + ;; + sun3) + basic_machine=m68k-sun + basic_os= + ;; + sun3os3) + basic_machine=m68k-sun + basic_os=sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + basic_os=sunos4 + ;; + sun4) + basic_machine=sparc-sun + basic_os= + ;; + sun4os3) + basic_machine=sparc-sun + basic_os=sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + basic_os=sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + basic_os=solaris2 + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + basic_os= + ;; + sv1) + basic_machine=sv1-cray + basic_os=unicos + ;; + symmetry) + basic_machine=i386-sequent + basic_os=dynix + ;; + t3e) + basic_machine=alphaev5-cray + basic_os=unicos + ;; + t90) + basic_machine=t90-cray + basic_os=unicos + ;; + toad1) + basic_machine=pdp10-xkl + basic_os=tops20 + ;; + tpf) + basic_machine=s390x-ibm + basic_os=tpf + ;; + udi29k) + basic_machine=a29k-amd + basic_os=udi + ;; + ultra3) + basic_machine=a29k-nyu + basic_os=sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + basic_os=none + ;; + vaxv) + basic_machine=vax-dec + basic_os=sysv + ;; + vms) + basic_machine=vax-dec + basic_os=vms + ;; + vsta) + basic_machine=i386-pc + basic_os=vsta + ;; + vxworks960) + basic_machine=i960-wrs + basic_os=vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + basic_os=vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + basic_os=vxworks + ;; + xbox) + basic_machine=i686-pc + basic_os=mingw32 + ;; + ymp) + basic_machine=ymp-cray + basic_os=unicos + ;; + *) + basic_machine=$1 + basic_os= + ;; + esac + ;; +esac + +# Decode 1-component or ad-hoc basic machines +case $basic_machine in + # 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) + cpu=hppa1.1 + vendor=winbond + ;; + op50n) + cpu=hppa1.1 + vendor=oki + ;; + op60c) + cpu=hppa1.1 + vendor=oki + ;; + ibm*) + cpu=i370 + vendor=ibm + ;; + orion105) + cpu=clipper + vendor=highlevel + ;; + mac | mpw | mac-mpw) + cpu=m68k + vendor=apple + ;; + pmac | pmac-mpw) + cpu=powerpc + vendor=apple + ;; + + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + cpu=m68000 + vendor=att + ;; + 3b*) + cpu=we32k + vendor=att + ;; + bluegene*) + cpu=powerpc + vendor=ibm + basic_os=cnk + ;; + decsystem10* | dec10*) + cpu=pdp10 + vendor=dec + basic_os=tops10 + ;; + decsystem20* | dec20*) + cpu=pdp10 + vendor=dec + basic_os=tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + cpu=m68k + vendor=motorola + ;; + dpx2*) + cpu=m68k + vendor=bull + basic_os=sysv3 + ;; + encore | umax | mmax) + cpu=ns32k + vendor=encore + ;; + elxsi) + cpu=elxsi + vendor=elxsi + basic_os=${basic_os:-bsd} + ;; + fx2800) + cpu=i860 + vendor=alliant + ;; + genix) + cpu=ns32k + vendor=ns + ;; + h3050r* | hiux*) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + cpu=m68000 + vendor=hp + ;; + hp9k3[2-9][0-9]) + cpu=m68k + vendor=hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + cpu=hppa1.1 + vendor=hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + cpu=hppa1.0 + vendor=hp + ;; + i*86v32) + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv32 + ;; + i*86v4*) + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv4 + ;; + i*86v) + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=sysv + ;; + i*86sol2) + cpu=$(echo "$1" | sed -e 's/86.*/86/') + vendor=pc + basic_os=solaris2 + ;; + j90 | j90-cray) + cpu=j90 + vendor=cray + basic_os=${basic_os:-unicos} + ;; + iris | iris4d) + cpu=mips + vendor=sgi + case $basic_os in + irix*) + ;; + *) + basic_os=irix4 + ;; + esac + ;; + miniframe) + cpu=m68000 + vendor=convergent + ;; + *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) + cpu=m68k + vendor=atari + basic_os=mint + ;; + news-3600 | risc-news) + cpu=mips + vendor=sony + basic_os=newsos + ;; + next | m*-next) + cpu=m68k + vendor=next + case $basic_os in + openstep*) + ;; + nextstep*) + ;; + ns2*) + basic_os=nextstep2 + ;; + *) + basic_os=nextstep3 + ;; + esac + ;; + np1) + cpu=np1 + vendor=gould + ;; + op50n-* | op60c-*) + cpu=hppa1.1 + vendor=oki + basic_os=proelf + ;; + pa-hitachi) + cpu=hppa1.1 + vendor=hitachi + basic_os=hiuxwe2 + ;; + pbd) + cpu=sparc + vendor=tti + ;; + pbb) + cpu=m68k + vendor=tti + ;; + pc532) + cpu=ns32k + vendor=pc532 + ;; + pn) + cpu=pn + vendor=gould + ;; + power) + cpu=power + vendor=ibm + ;; + ps2) + cpu=i386 + vendor=ibm + ;; + rm[46]00) + cpu=mips + vendor=siemens + ;; + rtpc | rtpc-*) + cpu=romp + vendor=ibm + ;; + sde) + cpu=mipsisa32 + vendor=sde + basic_os=${basic_os:-elf} + ;; + simso-wrs) + cpu=sparclite + vendor=wrs + basic_os=vxworks + ;; + tower | tower-32) + cpu=m68k + vendor=ncr + ;; + vpp*|vx|vx-*) + cpu=f301 + vendor=fujitsu + ;; + w65) + cpu=w65 + vendor=wdc + ;; + w89k-*) + cpu=hppa1.1 + vendor=winbond + basic_os=proelf + ;; + none) + cpu=none + vendor=none + ;; + leon|leon[3-9]) + cpu=sparc + vendor=$basic_machine + ;; + leon-*|leon[3-9]-*) + cpu=sparc + vendor=$(echo "$basic_machine" | sed 's/-.*//') + ;; + + *-*) + # shellcheck disable=SC2162 + IFS="-" read cpu vendor <&2 + exit 1 + ;; + esac + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $vendor in + digital*) + vendor=dec + ;; + commodore*) + vendor=cbm + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if test x$basic_os != x +then + +# First recognize some ad-hoc caes, or perhaps split kernel-os, or else just +# set os. +case $basic_os in + gnu/linux*) + kernel=linux + os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') + ;; + os2-emx) + kernel=os2 + os=$(echo $basic_os | sed -e 's|os2-emx|emx|') + ;; + nto-qnx*) + kernel=nto + os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') + ;; + *-*) + # shellcheck disable=SC2162 + IFS="-" read kernel os <&2 + exit 1 + ;; +esac + +# As a final step for OS-related things, validate the OS-kernel combination +# (given a valid OS), if there is a kernel. +case $kernel-$os in + linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) + ;; + uclinux-uclibc* ) + ;; + -dietlibc* | -newlib* | -musl* | -uclibc* ) + # These are just libc implementations, not actual OSes, and thus + # require a kernel. + echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 + exit 1 + ;; + kfreebsd*-gnu* | kopensolaris*-gnu*) + ;; + vxworks-simlinux | vxworks-simwindows | vxworks-spe) + ;; + nto-qnx*) + ;; + os2-emx) + ;; + *-eabi* | *-gnueabi*) + ;; + -*) + # Blank kernel with real OS is always fine. + ;; + *-*) + echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 + exit 1 + ;; +esac + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +case $vendor in + unknown) + case $cpu-$os in + *-riscix*) + vendor=acorn + ;; + *-sunos*) + vendor=sun + ;; + *-cnk* | *-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 + ;; + *-clix*) + vendor=intergraph + ;; + *-mvs* | *-opened*) + vendor=ibm + ;; + *-os400*) + vendor=ibm + ;; + s390-* | s390x-*) + 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 + ;; +esac + +echo "$cpu-$vendor-${kernel:+$kernel-}$os" +exit + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/build-aux/depcomp b/build-aux/depcomp new file mode 100755 index 0000000..6b39162 --- /dev/null +++ b/build-aux/depcomp @@ -0,0 +1,791 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1999-2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# 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 Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try '$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by 'PROGRAMS ARGS'. + object Object file output by 'PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputting dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +# Get the directory component of the given path, and save it in the +# global variables '$dir'. Note that this directory component will +# be either empty or ending with a '/' character. This is deliberate. +set_dir_from () +{ + case $1 in + */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; + *) dir=;; + esac +} + +# Get the suffix-stripped basename of the given path, and save it the +# global variable '$base'. +set_base_from () +{ + base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` +} + +# If no dependency file was actually created by the compiler invocation, +# we still have to create a dummy depfile, to avoid errors with the +# Makefile "include basename.Plo" scheme. +make_dummy_depfile () +{ + echo "#dummy" > "$depfile" +} + +# Factor out some common post-processing of the generated depfile. +# Requires the auxiliary global variable '$tmpdepfile' to be set. +aix_post_process_depfile () +{ + # If the compiler actually managed to produce a dependency file, + # post-process it. + if test -f "$tmpdepfile"; then + # Each line is of the form 'foo.o: dependency.h'. + # Do two passes, one to just change these to + # $object: dependency.h + # and one to simply output + # dependency.h: + # which is needed to avoid the deleted-header problem. + { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" + sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" + } > "$depfile" + rm -f "$tmpdepfile" + else + make_dummy_depfile + fi +} + +# A tabulation character. +tab=' ' +# A newline character. +nl=' +' +# Character ranges might be problematic outside the C locale. +# These definitions help. +upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ +lower=abcdefghijklmnopqrstuvwxyz +digits=0123456789 +alpha=${upper}${lower} + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Avoid interferences from the environment. +gccflag= dashmflag= + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvisualcpp +fi + +if test "$depmode" = msvc7msys; then + # This is just like msvc7 but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u='sed s,\\\\,/,g' + depmode=msvc7 +fi + +if test "$depmode" = xlc; then + # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. + gccflag=-qmakedep=gcc,-MF + depmode=gcc +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. +## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. +## (see the conditional assignment to $gccflag above). +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). Also, it might not be +## supported by the other compilers which use the 'gcc' depmode. +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The second -e expression handles DOS-style file names with drive + # letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the "deleted header file" problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. +## Some versions of gcc put a space before the ':'. On the theory +## that the space means something, we add a space to the output as +## well. hp depmode also adds that space, but also prefixes the VPATH +## to the object. Take care to not repeat it in the output. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like '#:fec' to the end of the + # dependency line. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ + | tr "$nl" ' ' >> "$depfile" + echo >> "$depfile" + # The second pass generates a dummy entry for each header file. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" + ;; + +xlc) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts '$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + aix_post_process_depfile + ;; + +tcc) + # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 + # FIXME: That version still under development at the moment of writing. + # Make that this statement remains true also for stable, released + # versions. + # It will wrap lines (doesn't matter whether long or short) with a + # trailing '\', as in: + # + # foo.o : \ + # foo.c \ + # foo.h \ + # + # It will put a trailing '\' even on the last line, and will use leading + # spaces rather than leading tabs (at least since its commit 0394caf7 + # "Emit spaces for -MD"). + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. + # We have to change lines of the first kind to '$object: \'. + sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" + # And for each line of the second kind, we have to emit a 'dep.h:' + # dummy dependency, to avoid the deleted-header problem. + sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" + rm -f "$tmpdepfile" + ;; + +## The order of this option in the case statement is important, since the +## shell code in configure will try each of these formats in the order +## listed in this file. A plain '-MD' option would be understood by many +## compilers, so we must ensure this comes after the gcc and icc options. +pgcc) + # Portland's C compiler understands '-MD'. + # Will always output deps to 'file.d' where file is the root name of the + # source file under compilation, even if file resides in a subdirectory. + # The object file name does not affect the name of the '.d' file. + # pgcc 10.2 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using '\' : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + set_dir_from "$object" + # Use the source, not the object, to determine the base name, since + # that's sadly what pgcc will do too. + set_base_from "$source" + tmpdepfile=$base.d + + # For projects that build the same source file twice into different object + # files, the pgcc approach of using the *source* file root name can cause + # problems in parallel builds. Use a locking strategy to avoid stomping on + # the same $tmpdepfile. + lockdir=$base.d-lock + trap " + echo '$0: caught signal, cleaning up...' >&2 + rmdir '$lockdir' + exit 1 + " 1 2 13 15 + numtries=100 + i=$numtries + while test $i -gt 0; do + # mkdir is a portable test-and-set. + if mkdir "$lockdir" 2>/dev/null; then + # This process acquired the lock. + "$@" -MD + stat=$? + # Release the lock. + rmdir "$lockdir" + break + else + # If the lock is being held by a different process, wait + # until the winning process is done or we timeout. + while test -d "$lockdir" && test $i -gt 0; do + sleep 1 + i=`expr $i - 1` + done + fi + i=`expr $i - 1` + done + trap - 1 2 13 15 + if test $i -le 0; then + echo "$0: failed to acquire lock after $numtries attempts" >&2 + echo "$0: check lockdir '$lockdir'" >&2 + exit 1 + fi + + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + set_dir_from "$object" + set_base_from "$object" + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" + # Add 'dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + make_dummy_depfile + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in 'foo.d' instead, so we check for that too. + # Subdirectories are respected. + set_dir_from "$object" + set_base_from "$object" + + if test "$libtool" = yes; then + # Libtool generates 2 separate objects for the 2 libraries. These + # two compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir$base.o.d # libtool 1.5 + tmpdepfile2=$dir.libs/$base.o.d # Likewise. + tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -ne 0; then + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + # Same post-processing that is required for AIX mode. + aix_post_process_depfile + ;; + +msvc7) + if test "$libtool" = yes; then + showIncludes=-Wc,-showIncludes + else + showIncludes=-showIncludes + fi + "$@" $showIncludes > "$tmpdepfile" + stat=$? + grep -v '^Note: including file: ' "$tmpdepfile" + if test $stat -ne 0; then + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + # The first sed program below extracts the file names and escapes + # backslashes for cygpath. The second sed program outputs the file + # name when reading, but also accumulates all include files in the + # hold buffer in order to output them again at the end. This only + # works with sed implementations that can handle large buffers. + sed < "$tmpdepfile" -n ' +/^Note: including file: *\(.*\)/ { + s//\1/ + s/\\/\\\\/g + p +}' | $cygpath_u | sort -u | sed -n ' +s/ /\\ /g +s/\(.*\)/'"$tab"'\1 \\/p +s/.\(.*\) \\/\1:/ +H +$ { + s/.*/'"$tab"'/ + G + p +}' >> "$depfile" + echo >> "$depfile" # make sure the fragment doesn't end with a backslash + rm -f "$tmpdepfile" + ;; + +msvc7msys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for ':' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. + "$@" $dashmflag | + sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this sed invocation + # correctly. Breaking it into two sed invocations is a workaround. + tr ' ' "$nl" < "$tmpdepfile" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + # makedepend may prepend the VPATH from the source file name to the object. + # No need to regex-escape $object, excess matching of '.' is harmless. + sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process the last invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed '1,2d' "$tmpdepfile" \ + | tr ' ' "$nl" \ + | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ + | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove '-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E \ + | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + | sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" + echo "$tab" >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/build-aux/install-sh b/build-aux/install-sh new file mode 100755 index 0000000..ec298b5 --- /dev/null +++ b/build-aux/install-sh @@ -0,0 +1,541 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2020-11-14.01; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# 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. + +tab=' ' +nl=' +' +IFS=" $tab$nl" + +# Set DOITPROG to "echo" to test this script. + +doit=${DOITPROG-} +doit_exec=${doit:-exec} + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +# Create dirs (including intermediate dirs) using mode 755. +# This is like GNU 'install' as of coreutils 8.32 (2020). +mkdir_umask=22 + +backupsuffix= +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +is_target_a_directory=possibly + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -p pass -p to $cpprog. + -s $stripprog installed files. + -S SUFFIX attempt to back up existing files, with suffix SUFFIX. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG + +By default, rm is invoked with -f; when overridden with RMPROG, +it's up to you to specify -f if you want it. + +If -S is not specified, no backups are attempted. + +Email bug reports to bug-automake@gnu.org. +Automake home page: https://www.gnu.org/software/automake/ +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -p) cpprog="$cpprog -p";; + + -s) stripcmd=$stripprog;; + + -S) backupsuffix="$2" + shift;; + + -t) + is_target_a_directory=always + dst_arg=$2 + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + shift;; + + -T) is_target_a_directory=never;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +# We allow the use of options -d and -T together, by making -d +# take the precedence; this is for compatibility with GNU install. + +if test -n "$dir_arg"; then + if test -n "$dst_arg"; then + echo "$0: target directory not allowed when installing a directory." >&2 + exit 1 + fi +fi + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + # Protect names problematic for 'test' and other utilities. + case $dst_arg in + -* | [=\(\)!]) dst_arg=./$dst_arg;; + esac + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call 'install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + if test $# -gt 1 || test "$is_target_a_directory" = always; then + if test ! -d "$dst_arg"; then + echo "$0: $dst_arg: Is not a directory." >&2 + exit 1 + fi + fi +fi + +if test -z "$dir_arg"; then + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names problematic for 'test' and other utilities. + case $src in + -* | [=\(\)!]) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + # Don't chown directories that already exist. + if test $dstdir_status = 0; then + chowncmd="" + fi + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + dst=$dst_arg + + # If destination is a directory, append the input filename. + if test -d "$dst"; then + if test "$is_target_a_directory" = never; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dstbase=`basename "$src"` + case $dst in + */) dst=$dst$dstbase;; + *) dst=$dst/$dstbase;; + esac + dstdir_status=0 + else + dstdir=`dirname "$dst"` + test -d "$dstdir" + dstdir_status=$? + fi + fi + + case $dstdir in + */) dstdirslash=$dstdir;; + *) dstdirslash=$dstdir/;; + esac + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + # The $RANDOM variable is not portable (e.g., dash). Use it + # here however when possible just to lower collision chance. + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + + trap ' + ret=$? + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null + exit $ret + ' 0 + + # Because "mkdir -p" follows existing symlinks and we likely work + # directly in world-writeable /tmp, make sure that the '$tmpdir' + # directory is successfully created first before we actually test + # 'mkdir -p'. + if (umask $mkdir_umask && + $mkdirprog $mkdir_mode "$tmpdir" && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + test_tmpdir="$tmpdir/a" + ls_ld_tmpdir=`ls -ld "$test_tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null + fi + trap '' 0;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + [-=\(\)!]*) prefix='./';; + *) prefix='';; + esac + + oIFS=$IFS + IFS=/ + set -f + set fnord $dstdir + shift + set +f + IFS=$oIFS + + prefixes= + + for d + do + test X"$d" = X && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=${dstdirslash}_inst.$$_ + rmtmp=${dstdirslash}_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && + { test -z "$stripcmd" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && + + # 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 $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + set +f && + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # If $backupsuffix is set, and the file being installed + # already exists, attempt a backup. Don't worry if it fails, + # e.g., if mv doesn't support -f. + if test -n "$backupsuffix" && test -f "$dst"; then + $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null + fi + + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh new file mode 100644 index 0000000..2c3b672 --- /dev/null +++ b/build-aux/ltmain.sh @@ -0,0 +1,11149 @@ +#! /bin/sh +## DO NOT EDIT - This file generated from ./build-aux/ltmain.in +## by inline-source v2014-01-03.01 + +# libtool (GNU libtool) 2.4.6 +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996-2015 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. + +# GNU Libtool 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. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool 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, see . + + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4.6 +package_revision=2.4.6 + + +## ------ ## +## Usage. ## +## ------ ## + +# Run './libtool --help' for help with using this script from the +# command line. + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# After configure completes, it has a better idea of some of the +# shell tools we need than the defaults used by the functions shared +# with bootstrap, so set those here where they can still be over- +# ridden by the user, but otherwise take precedence. + +: ${AUTOCONF="autoconf"} +: ${AUTOMAKE="automake"} + + +## -------------------------- ## +## Source external libraries. ## +## -------------------------- ## + +# Much of our low-level functionality needs to be sourced from external +# libraries, which are installed to $pkgauxdir. + +# Set a version string for this script. +scriptversion=2015-01-20.17; # UTC + +# General shell script boiler plate, and helper functions. +# Written by Gary V. Vaughan, 2004 + +# Copyright (C) 2004-2015 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. + +# 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 3 of the License, or +# (at your option) any later version. + +# As a special exception to the GNU General Public License, if you distribute +# this file as part of a program or library that is built using GNU Libtool, +# you may include this file under the same distribution terms that you use +# for the rest of that program. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNES 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, see . + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# Evaluate this file near the top of your script to gain access to +# the functions and variables defined here: +# +# . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh +# +# If you need to override any of the default environment variable +# settings, do that before evaluating this file. + + +## -------------------- ## +## Shell normalisation. ## +## -------------------- ## + +# Some shells need a little help to be as Bourne compatible as possible. +# Before doing anything else, make sure all that help has been provided! + +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac +fi + +# NLS nuisances: We save the old values in case they are required later. +_G_user_locale= +_G_safe_locale= +for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test set = \"\${$_G_var+set}\"; then + save_$_G_var=\$$_G_var + $_G_var=C + export $_G_var + _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" + _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" + fi" +done + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +# Make sure IFS has a sensible default +sp=' ' +nl=' +' +IFS="$sp $nl" + +# There are apparently some retarded systems that use ';' as a PATH separator! +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + + +## ------------------------- ## +## Locate command utilities. ## +## ------------------------- ## + + +# func_executable_p FILE +# ---------------------- +# Check that FILE is an executable regular file. +func_executable_p () +{ + test -f "$1" && test -x "$1" +} + + +# func_path_progs PROGS_LIST CHECK_FUNC [PATH] +# -------------------------------------------- +# Search for either a program that responds to --version with output +# containing "GNU", or else returned by CHECK_FUNC otherwise, by +# trying all the directories in PATH with each of the elements of +# PROGS_LIST. +# +# CHECK_FUNC should accept the path to a candidate program, and +# set $func_check_prog_result if it truncates its output less than +# $_G_path_prog_max characters. +func_path_progs () +{ + _G_progs_list=$1 + _G_check_func=$2 + _G_PATH=${3-"$PATH"} + + _G_path_prog_max=0 + _G_path_prog_found=false + _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} + for _G_dir in $_G_PATH; do + IFS=$_G_save_IFS + test -z "$_G_dir" && _G_dir=. + for _G_prog_name in $_G_progs_list; do + for _exeext in '' .EXE; do + _G_path_prog=$_G_dir/$_G_prog_name$_exeext + func_executable_p "$_G_path_prog" || continue + case `"$_G_path_prog" --version 2>&1` in + *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; + *) $_G_check_func $_G_path_prog + func_path_progs_result=$func_check_prog_result + ;; + esac + $_G_path_prog_found && break 3 + done + done + done + IFS=$_G_save_IFS + test -z "$func_path_progs_result" && { + echo "no acceptable sed could be found in \$PATH" >&2 + exit 1 + } +} + + +# We want to be able to use the functions in this file before configure +# has figured out where the best binaries are kept, which means we have +# to search for them ourselves - except when the results are already set +# where we skip the searches. + +# Unless the user overrides by setting SED, search the path for either GNU +# sed, or the sed that truncates its output the least. +test -z "$SED" && { + _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for _G_i in 1 2 3 4 5 6 7; do + _G_sed_script=$_G_sed_script$nl$_G_sed_script + done + echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed + _G_sed_script= + + func_check_prog_sed () + { + _G_path_prog=$1 + + _G_count=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo '' >> conftest.nl + "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin + rm -f conftest.sed + SED=$func_path_progs_result +} + + +# Unless the user overrides by setting GREP, search the path for either GNU +# grep, or the grep that truncates its output the least. +test -z "$GREP" && { + func_check_prog_grep () + { + _G_path_prog=$1 + + _G_count=0 + _G_path_prog_max=0 + printf 0123456789 >conftest.in + while : + do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo 'GREP' >> conftest.nl + "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break + diff conftest.out conftest.nl >/dev/null 2>&1 || break + _G_count=`expr $_G_count + 1` + if test "$_G_count" -gt "$_G_path_prog_max"; then + # Best one so far, save it but keep looking for a better one + func_check_prog_result=$_G_path_prog + _G_path_prog_max=$_G_count + fi + # 10*(2^10) chars as input seems more than enough + test 10 -lt "$_G_count" && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out + } + + func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin + GREP=$func_path_progs_result +} + + +## ------------------------------- ## +## User overridable command paths. ## +## ------------------------------- ## + +# All uppercase variable names are used for environment variables. These +# variables can be overridden by the user before calling a script that +# uses them if a suitable command of that name is not already available +# in the command search PATH. + +: ${CP="cp -f"} +: ${ECHO="printf %s\n"} +: ${EGREP="$GREP -E"} +: ${FGREP="$GREP -F"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} + + +## -------------------- ## +## Useful sed snippets. ## +## -------------------- ## + +sed_dirname='s|/[^/]*$||' +sed_basename='s|^.*/||' + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='s|\([`"$\\]\)|\\\1|g' + +# Same as above, but do not quote variable references. +sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' + +# Sed substitution that converts a w32 file name or path +# that contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-'\' parameter expansions in output of sed_double_quote_subst that +# were '\'-ed in input to the same. If an odd number of '\' preceded a +# '$' in input to sed_double_quote_subst, that '$' was protected from +# expansion. Since each input '\' is now two '\'s, look for any number +# of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. +_G_bs='\\' +_G_bs2='\\\\' +_G_bs4='\\\\\\\\' +_G_dollar='\$' +sed_double_backslash="\ + s/$_G_bs4/&\\ +/g + s/^$_G_bs2$_G_dollar/$_G_bs&/ + s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g + s/\n//g" + + +## ----------------- ## +## Global variables. ## +## ----------------- ## + +# Except for the global variables explicitly listed below, the following +# functions in the '^func_' namespace, and the '^require_' namespace +# variables initialised in the 'Resource management' section, sourcing +# this file will not pollute your global namespace with anything +# else. There's no portable way to scope variables in Bourne shell +# though, so actually running these functions will sometimes place +# results into a variable named after the function, and often use +# temporary variables in the '^_G_' namespace. If you are careful to +# avoid using those namespaces casually in your sourcing script, things +# should continue to work as you expect. And, of course, you can freely +# overwrite any of the functions or variables defined here before +# calling anything to customize them. + +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +# Allow overriding, eg assuming that you follow the convention of +# putting '$debug_cmd' at the start of all your functions, you can get +# bash to show function call trace with: +# +# debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name +debug_cmd=${debug_cmd-":"} +exit_cmd=: + +# By convention, finish your script with: +# +# exit $exit_status +# +# so that you can set exit_status to non-zero if you want to indicate +# something went wrong during execution without actually bailing out at +# the point of failure. +exit_status=$EXIT_SUCCESS + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath=$0 + +# The name of this program. +progname=`$ECHO "$progpath" |$SED "$sed_basename"` + +# Make sure we have an absolute progpath for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` + progdir=`cd "$progdir" && pwd` + progpath=$progdir/$progname + ;; + *) + _G_IFS=$IFS + IFS=${PATH_SEPARATOR-:} + for progdir in $PATH; do + IFS=$_G_IFS + test -x "$progdir/$progname" && break + done + IFS=$_G_IFS + test -n "$progdir" || progdir=`pwd` + progpath=$progdir/$progname + ;; +esac + + +## ----------------- ## +## Standard options. ## +## ----------------- ## + +# The following options affect the operation of the functions defined +# below, and should be set appropriately depending on run-time para- +# meters passed on the command line. + +opt_dry_run=false +opt_quiet=false +opt_verbose=false + +# Categories 'all' and 'none' are always available. Append any others +# you will pass as the first argument to func_warning from your own +# code. +warning_categories= + +# By default, display warnings according to 'opt_warning_types'. Set +# 'warning_func' to ':' to elide all warnings, or func_fatal_error to +# treat the next displayed warning as a fatal error. +warning_func=func_warn_and_continue + +# Set to 'all' to display all warnings, 'none' to suppress all +# warnings, or a space delimited list of some subset of +# 'warning_categories' to display only the listed warnings. +opt_warning_types=all + + +## -------------------- ## +## Resource management. ## +## -------------------- ## + +# This section contains definitions for functions that each ensure a +# particular resource (a file, or a non-empty configuration variable for +# example) is available, and if appropriate to extract default values +# from pertinent package files. Call them using their associated +# 'require_*' variable to ensure that they are executed, at most, once. +# +# It's entirely deliberate that calling these functions can set +# variables that don't obey the namespace limitations obeyed by the rest +# of this file, in order that that they be as useful as possible to +# callers. + + +# require_term_colors +# ------------------- +# Allow display of bold text on terminals that support it. +require_term_colors=func_require_term_colors +func_require_term_colors () +{ + $debug_cmd + + test -t 1 && { + # COLORTERM and USE_ANSI_COLORS environment variables take + # precedence, because most terminfo databases neglect to describe + # whether color sequences are supported. + test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} + + if test 1 = "$USE_ANSI_COLORS"; then + # Standard ANSI escape sequences + tc_reset='' + tc_bold=''; tc_standout='' + tc_red=''; tc_green='' + tc_blue=''; tc_cyan='' + else + # Otherwise trust the terminfo database after all. + test -n "`tput sgr0 2>/dev/null`" && { + tc_reset=`tput sgr0` + test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` + tc_standout=$tc_bold + test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` + test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` + test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` + test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` + test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` + } + fi + } + + require_term_colors=: +} + + +## ----------------- ## +## Function library. ## +## ----------------- ## + +# This section contains a variety of useful functions to call in your +# scripts. Take note of the portable wrappers for features provided by +# some modern shells, which will fall back to slower equivalents on +# less featureful shells. + + +# func_append VAR VALUE +# --------------------- +# Append VALUE onto the existing contents of VAR. + + # We should try to minimise forks, especially on Windows where they are + # unreasonably slow, so skip the feature probes when bash or zsh are + # being used: + if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then + : ${_G_HAVE_ARITH_OP="yes"} + : ${_G_HAVE_XSI_OPS="yes"} + # The += operator was introduced in bash 3.1 + case $BASH_VERSION in + [12].* | 3.0 | 3.0*) ;; + *) + : ${_G_HAVE_PLUSEQ_OP="yes"} + ;; + esac + fi + + # _G_HAVE_PLUSEQ_OP + # Can be empty, in which case the shell is probed, "yes" if += is + # useable or anything else if it does not work. + test -z "$_G_HAVE_PLUSEQ_OP" \ + && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ + && _G_HAVE_PLUSEQ_OP=yes + +if test yes = "$_G_HAVE_PLUSEQ_OP" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_append () + { + $debug_cmd + + eval "$1+=\$2" + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_append () + { + $debug_cmd + + eval "$1=\$$1\$2" + } +fi + + +# func_append_quoted VAR VALUE +# ---------------------------- +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +if test yes = "$_G_HAVE_PLUSEQ_OP"; then + eval 'func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1+=\\ \$func_quote_for_eval_result" + }' +else + func_append_quoted () + { + $debug_cmd + + func_quote_for_eval "$2" + eval "$1=\$$1\\ \$func_quote_for_eval_result" + } +fi + + +# func_append_uniq VAR VALUE +# -------------------------- +# Append unique VALUE onto the existing contents of VAR, assuming +# entries are delimited by the first character of VALUE. For example: +# +# func_append_uniq options " --another-option option-argument" +# +# will only append to $options if " --another-option option-argument " +# is not already present somewhere in $options already (note spaces at +# each end implied by leading space in second argument). +func_append_uniq () +{ + $debug_cmd + + eval _G_current_value='`$ECHO $'$1'`' + _G_delim=`expr "$2" : '\(.\)'` + + case $_G_delim$_G_current_value$_G_delim in + *"$2$_G_delim"*) ;; + *) func_append "$@" ;; + esac +} + + +# func_arith TERM... +# ------------------ +# Set func_arith_result to the result of evaluating TERMs. + test -z "$_G_HAVE_ARITH_OP" \ + && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ + && _G_HAVE_ARITH_OP=yes + +if test yes = "$_G_HAVE_ARITH_OP"; then + eval 'func_arith () + { + $debug_cmd + + func_arith_result=$(( $* )) + }' +else + func_arith () + { + $debug_cmd + + func_arith_result=`expr "$@"` + } +fi + + +# func_basename FILE +# ------------------ +# Set func_basename_result to FILE with everything up to and including +# the last / stripped. +if test yes = "$_G_HAVE_XSI_OPS"; then + # If this shell supports suffix pattern removal, then use it to avoid + # forking. Hide the definitions single quotes in case the shell chokes + # on unsupported syntax... + _b='func_basename_result=${1##*/}' + _d='case $1 in + */*) func_dirname_result=${1%/*}$2 ;; + * ) func_dirname_result=$3 ;; + esac' + +else + # ...otherwise fall back to using sed. + _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' + _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` + if test "X$func_dirname_result" = "X$1"; then + func_dirname_result=$3 + else + func_append func_dirname_result "$2" + fi' +fi + +eval 'func_basename () +{ + $debug_cmd + + '"$_b"' +}' + + +# func_dirname FILE APPEND NONDIR_REPLACEMENT +# ------------------------------------------- +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +eval 'func_dirname () +{ + $debug_cmd + + '"$_d"' +}' + + +# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT +# -------------------------------------------------------- +# Perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# For efficiency, we do not delegate to the functions above but instead +# duplicate the functionality here. +eval 'func_dirname_and_basename () +{ + $debug_cmd + + '"$_b"' + '"$_d"' +}' + + +# func_echo ARG... +# ---------------- +# Echo program name prefixed message. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_echo_all ARG... +# -------------------- +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + + +# func_echo_infix_1 INFIX ARG... +# ------------------------------ +# Echo program name, followed by INFIX on the first line, with any +# additional lines not showing INFIX. +func_echo_infix_1 () +{ + $debug_cmd + + $require_term_colors + + _G_infix=$1; shift + _G_indent=$_G_infix + _G_prefix="$progname: $_G_infix: " + _G_message=$* + + # Strip color escape sequences before counting printable length + for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" + do + test -n "$_G_tc" && { + _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` + _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` + } + done + _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes + + func_echo_infix_1_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_infix_1_IFS + $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 + _G_prefix=$_G_indent + done + IFS=$func_echo_infix_1_IFS +} + + +# func_error ARG... +# ----------------- +# Echo program name prefixed message to standard error. +func_error () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 +} + + +# func_fatal_error ARG... +# ----------------------- +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + $debug_cmd + + func_error "$*" + exit $EXIT_FAILURE +} + + +# func_grep EXPRESSION FILENAME +# ----------------------------- +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $debug_cmd + + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_len STRING +# --------------- +# Set func_len_result to the length of STRING. STRING may not +# start with a hyphen. + test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_len () + { + $debug_cmd + + func_len_result=${#1} + }' +else + func_len () + { + $debug_cmd + + func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` + } +fi + + +# func_mkdir_p DIRECTORY-PATH +# --------------------------- +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + $debug_cmd + + _G_directory_path=$1 + _G_dir_list= + + if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then + + # Protect directory names starting with '-' + case $_G_directory_path in + -*) _G_directory_path=./$_G_directory_path ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$_G_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + _G_dir_list=$_G_directory_path:$_G_dir_list + + # If the last portion added has no slash in it, the list is done + case $_G_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` + done + _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` + + func_mkdir_p_IFS=$IFS; IFS=: + for _G_dir in $_G_dir_list; do + IFS=$func_mkdir_p_IFS + # mkdir can fail with a 'File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$_G_dir" 2>/dev/null || : + done + IFS=$func_mkdir_p_IFS + + # Bail out if we (or some other process) failed to create a directory. + test -d "$_G_directory_path" || \ + func_fatal_error "Failed to create '$1'" + fi +} + + +# func_mktempdir [BASENAME] +# ------------------------- +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, BASENAME is the basename for that directory. +func_mktempdir () +{ + $debug_cmd + + _G_template=${TMPDIR-/tmp}/${1-$progname} + + if test : = "$opt_dry_run"; then + # Return a directory name, but don't create it in dry-run mode + _G_tmpdir=$_G_template-$$ + else + + # If mktemp works, use that first and foremost + _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` + + if test ! -d "$_G_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + _G_tmpdir=$_G_template-${RANDOM-0}$$ + + func_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$_G_tmpdir" + umask $func_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$_G_tmpdir" || \ + func_fatal_error "cannot create temporary directory '$_G_tmpdir'" + fi + + $ECHO "$_G_tmpdir" +} + + +# func_normal_abspath PATH +# ------------------------ +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +func_normal_abspath () +{ + $debug_cmd + + # These SED scripts presuppose an absolute path with a trailing slash. + _G_pathcar='s|^/\([^/]*\).*$|\1|' + _G_pathcdr='s|^/[^/]*||' + _G_removedotparts=':dotsl + s|/\./|/|g + t dotsl + s|/\.$|/|' + _G_collapseslashes='s|/\{1,\}|/|g' + _G_finalslash='s|/*$|/|' + + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` + while :; do + # Processed it all yet? + if test / = "$func_normal_abspath_tpath"; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result"; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$_G_pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + + +# func_notquiet ARG... +# -------------------- +# Echo program name prefixed message only when not in quiet mode. +func_notquiet () +{ + $debug_cmd + + $opt_quiet || func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + + +# func_relative_path SRCDIR DSTDIR +# -------------------------------- +# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. +func_relative_path () +{ + $debug_cmd + + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=$func_dirname_result + if test -z "$func_relative_path_tlibdir"; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test -n "$func_stripname_result"; then + func_append func_relative_path_result "/$func_stripname_result" + fi + + # Normalisation. If bindir is libdir, return '.' else relative path. + if test -n "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + fi + + test -n "$func_relative_path_result" || func_relative_path_result=. + + : +} + + +# func_quote_for_eval ARG... +# -------------------------- +# Aesthetically quote ARGs to be evaled later. +# This function returns two values: +# i) func_quote_for_eval_result +# double-quoted, suitable for a subsequent eval +# ii) func_quote_for_eval_unquoted_result +# has all characters that are still active within double +# quotes backslashified. +func_quote_for_eval () +{ + $debug_cmd + + func_quote_for_eval_unquoted_result= + func_quote_for_eval_result= + while test 0 -lt $#; do + case $1 in + *[\\\`\"\$]*) + _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; + *) + _G_unquoted_arg=$1 ;; + esac + if test -n "$func_quote_for_eval_unquoted_result"; then + func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" + else + func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" + fi + + case $_G_unquoted_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and variable expansion + # for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_quoted_arg=\"$_G_unquoted_arg\" + ;; + *) + _G_quoted_arg=$_G_unquoted_arg + ;; + esac + + if test -n "$func_quote_for_eval_result"; then + func_append func_quote_for_eval_result " $_G_quoted_arg" + else + func_append func_quote_for_eval_result "$_G_quoted_arg" + fi + shift + done +} + + +# func_quote_for_expand ARG +# ------------------------- +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + $debug_cmd + + case $1 in + *[\\\`\"]*) + _G_arg=`$ECHO "$1" | $SED \ + -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; + *) + _G_arg=$1 ;; + esac + + case $_G_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + _G_arg=\"$_G_arg\" + ;; + esac + + func_quote_for_expand_result=$_G_arg +} + + +# func_stripname PREFIX SUFFIX NAME +# --------------------------------- +# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_stripname () + { + $debug_cmd + + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary variable first. + func_stripname_result=$3 + func_stripname_result=${func_stripname_result#"$1"} + func_stripname_result=${func_stripname_result%"$2"} + }' +else + func_stripname () + { + $debug_cmd + + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; + esac + } +fi + + +# func_show_eval CMD [FAIL_EXP] +# ----------------------------- +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + func_quote_for_expand "$_G_cmd" + eval "func_notquiet $func_quote_for_expand_result" + + $opt_dry_run || { + eval "$_G_cmd" + _G_status=$? + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_show_eval_locale CMD [FAIL_EXP] +# ------------------------------------ +# Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + $debug_cmd + + _G_cmd=$1 + _G_fail_exp=${2-':'} + + $opt_quiet || { + func_quote_for_expand "$_G_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + $opt_dry_run || { + eval "$_G_user_locale + $_G_cmd" + _G_status=$? + eval "$_G_safe_locale" + if test 0 -ne "$_G_status"; then + eval "(exit $_G_status); $_G_fail_exp" + fi + } +} + + +# func_tr_sh +# ---------- +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + $debug_cmd + + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_verbose ARG... +# ------------------- +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $debug_cmd + + $opt_verbose && func_echo "$*" + + : +} + + +# func_warn_and_continue ARG... +# ----------------------------- +# Echo program name prefixed warning message to standard error. +func_warn_and_continue () +{ + $debug_cmd + + $require_term_colors + + func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 +} + + +# func_warning CATEGORY ARG... +# ---------------------------- +# Echo program name prefixed warning message to standard error. Warning +# messages can be filtered according to CATEGORY, where this function +# elides messages where CATEGORY is not listed in the global variable +# 'opt_warning_types'. +func_warning () +{ + $debug_cmd + + # CATEGORY must be in the warning_categories list! + case " $warning_categories " in + *" $1 "*) ;; + *) func_internal_error "invalid warning category '$1'" ;; + esac + + _G_category=$1 + shift + + case " $opt_warning_types " in + *" $_G_category "*) $warning_func ${1+"$@"} ;; + esac +} + + +# func_sort_ver VER1 VER2 +# ----------------------- +# 'sort -V' is not generally available. +# Note this deviates from the version comparison in automake +# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a +# but this should suffice as we won't be specifying old +# version formats or redundant trailing .0 in bootstrap.conf. +# If we did want full compatibility then we should probably +# use m4_version_compare from autoconf. +func_sort_ver () +{ + $debug_cmd + + printf '%s\n%s\n' "$1" "$2" \ + | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n +} + +# func_lt_ver PREV CURR +# --------------------- +# Return true if PREV and CURR are in the correct order according to +# func_sort_ver, otherwise false. Use it like this: +# +# func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." +func_lt_ver () +{ + $debug_cmd + + test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: +#! /bin/sh + +# Set a version string for this script. +scriptversion=2014-01-07.03; # UTC + +# A portable, pluggable option parser for Bourne shell. +# Written by Gary V. Vaughan, 2010 + +# Copyright (C) 2010-2015 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. + +# 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 3 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, see . + +# Please report bugs or propose patches to gary@gnu.org. + + +## ------ ## +## Usage. ## +## ------ ## + +# This file is a library for parsing options in your shell scripts along +# with assorted other useful supporting features that you can make use +# of too. +# +# For the simplest scripts you might need only: +# +# #!/bin/sh +# . relative/path/to/funclib.sh +# . relative/path/to/options-parser +# scriptversion=1.0 +# func_options ${1+"$@"} +# eval set dummy "$func_options_result"; shift +# ...rest of your script... +# +# In order for the '--version' option to work, you will need to have a +# suitably formatted comment like the one at the top of this file +# starting with '# Written by ' and ending with '# warranty; '. +# +# For '-h' and '--help' to work, you will also need a one line +# description of your script's purpose in a comment directly above the +# '# Written by ' line, like the one at the top of this file. +# +# The default options also support '--debug', which will turn on shell +# execution tracing (see the comment above debug_cmd below for another +# use), and '--verbose' and the func_verbose function to allow your script +# to display verbose messages only when your user has specified +# '--verbose'. +# +# After sourcing this file, you can plug processing for additional +# options by amending the variables from the 'Configuration' section +# below, and following the instructions in the 'Option parsing' +# section further down. + +## -------------- ## +## Configuration. ## +## -------------- ## + +# You should override these variables in your script after sourcing this +# file so that they reflect the customisations you have added to the +# option parser. + +# The usage line for option parsing errors and the start of '-h' and +# '--help' output messages. You can embed shell variables for delayed +# expansion at the time the message is displayed, but you will need to +# quote other shell meta-characters carefully to prevent them being +# expanded when the contents are evaled. +usage='$progpath [OPTION]...' + +# Short help message in response to '-h' and '--help'. Add to this or +# override it after sourcing this library to reflect the full set of +# options your script accepts. +usage_message="\ + --debug enable verbose shell tracing + -W, --warnings=CATEGORY + report the warnings falling in CATEGORY [all] + -v, --verbose verbosely report processing + --version print version information and exit + -h, --help print short or long help message and exit +" + +# Additional text appended to 'usage_message' in response to '--help'. +long_help_message=" +Warning categories include: + 'all' show all warnings + 'none' turn off all the warnings + 'error' warnings are treated as fatal errors" + +# Help message printed before fatal option parsing errors. +fatal_help="Try '\$progname --help' for more information." + + + +## ------------------------- ## +## Hook function management. ## +## ------------------------- ## + +# This section contains functions for adding, removing, and running hooks +# to the main code. A hook is just a named list of of function, that can +# be run in order later on. + +# func_hookable FUNC_NAME +# ----------------------- +# Declare that FUNC_NAME will run hooks added with +# 'func_add_hook FUNC_NAME ...'. +func_hookable () +{ + $debug_cmd + + func_append hookable_fns " $1" +} + + +# func_add_hook FUNC_NAME HOOK_FUNC +# --------------------------------- +# Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must +# first have been declared "hookable" by a call to 'func_hookable'. +func_add_hook () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not accept hook functions." ;; + esac + + eval func_append ${1}_hooks '" $2"' +} + + +# func_remove_hook FUNC_NAME HOOK_FUNC +# ------------------------------------ +# Remove HOOK_FUNC from the list of functions called by FUNC_NAME. +func_remove_hook () +{ + $debug_cmd + + eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' +} + + +# func_run_hooks FUNC_NAME [ARG]... +# --------------------------------- +# Run all hook functions registered to FUNC_NAME. +# It is assumed that the list of hook functions contains nothing more +# than a whitespace-delimited list of legal shell function names, and +# no effort is wasted trying to catch shell meta-characters or preserve +# whitespace. +func_run_hooks () +{ + $debug_cmd + + case " $hookable_fns " in + *" $1 "*) ;; + *) func_fatal_error "'$1' does not support hook funcions.n" ;; + esac + + eval _G_hook_fns=\$$1_hooks; shift + + for _G_hook in $_G_hook_fns; do + eval $_G_hook '"$@"' + + # store returned options list back into positional + # parameters for next 'cmd' execution. + eval _G_hook_result=\$${_G_hook}_result + eval set dummy "$_G_hook_result"; shift + done + + func_quote_for_eval ${1+"$@"} + func_run_hooks_result=$func_quote_for_eval_result +} + + + +## --------------- ## +## Option parsing. ## +## --------------- ## + +# In order to add your own option parsing hooks, you must accept the +# full positional parameter list in your hook function, remove any +# options that you action, and then pass back the remaining unprocessed +# options in '_result', escaped suitably for +# 'eval'. Like this: +# +# my_options_prep () +# { +# $debug_cmd +# +# # Extend the existing usage message. +# usage_message=$usage_message' +# -s, --silent don'\''t print informational messages +# ' +# +# func_quote_for_eval ${1+"$@"} +# my_options_prep_result=$func_quote_for_eval_result +# } +# func_add_hook func_options_prep my_options_prep +# +# +# my_silent_option () +# { +# $debug_cmd +# +# # Note that for efficiency, we parse as many options as we can +# # recognise in a loop before passing the remainder back to the +# # caller on the first unrecognised argument we encounter. +# while test $# -gt 0; do +# opt=$1; shift +# case $opt in +# --silent|-s) opt_silent=: ;; +# # Separate non-argument short options: +# -s*) func_split_short_opt "$_G_opt" +# set dummy "$func_split_short_opt_name" \ +# "-$func_split_short_opt_arg" ${1+"$@"} +# shift +# ;; +# *) set dummy "$_G_opt" "$*"; shift; break ;; +# esac +# done +# +# func_quote_for_eval ${1+"$@"} +# my_silent_option_result=$func_quote_for_eval_result +# } +# func_add_hook func_parse_options my_silent_option +# +# +# my_option_validation () +# { +# $debug_cmd +# +# $opt_silent && $opt_verbose && func_fatal_help "\ +# '--silent' and '--verbose' options are mutually exclusive." +# +# func_quote_for_eval ${1+"$@"} +# my_option_validation_result=$func_quote_for_eval_result +# } +# func_add_hook func_validate_options my_option_validation +# +# You'll alse need to manually amend $usage_message to reflect the extra +# options you parse. It's preferable to append if you can, so that +# multiple option parsing hooks can be added safely. + + +# func_options [ARG]... +# --------------------- +# All the functions called inside func_options are hookable. See the +# individual implementations for details. +func_hookable func_options +func_options () +{ + $debug_cmd + + func_options_prep ${1+"$@"} + eval func_parse_options \ + ${func_options_prep_result+"$func_options_prep_result"} + eval func_validate_options \ + ${func_parse_options_result+"$func_parse_options_result"} + + eval func_run_hooks func_options \ + ${func_validate_options_result+"$func_validate_options_result"} + + # save modified positional parameters for caller + func_options_result=$func_run_hooks_result +} + + +# func_options_prep [ARG]... +# -------------------------- +# All initialisations required before starting the option parse loop. +# Note that when calling hook functions, we pass through the list of +# positional parameters. If a hook function modifies that list, and +# needs to propogate that back to rest of this script, then the complete +# modified list must be put in 'func_run_hooks_result' before +# returning. +func_hookable func_options_prep +func_options_prep () +{ + $debug_cmd + + # Option defaults: + opt_verbose=false + opt_warning_types= + + func_run_hooks func_options_prep ${1+"$@"} + + # save modified positional parameters for caller + func_options_prep_result=$func_run_hooks_result +} + + +# func_parse_options [ARG]... +# --------------------------- +# The main option parsing loop. +func_hookable func_parse_options +func_parse_options () +{ + $debug_cmd + + func_parse_options_result= + + # this just eases exit handling + while test $# -gt 0; do + # Defer to hook functions for initial option parsing, so they + # get priority in the event of reusing an option name. + func_run_hooks func_parse_options ${1+"$@"} + + # Adjust func_parse_options positional parameters to match + eval set dummy "$func_run_hooks_result"; shift + + # Break out of the loop if we already parsed every option. + test $# -gt 0 || break + + _G_opt=$1 + shift + case $_G_opt in + --debug|-x) debug_cmd='set -x' + func_echo "enabling shell trace mode" + $debug_cmd + ;; + + --no-warnings|--no-warning|--no-warn) + set dummy --warnings none ${1+"$@"} + shift + ;; + + --warnings|--warning|-W) + test $# = 0 && func_missing_arg $_G_opt && break + case " $warning_categories $1" in + *" $1 "*) + # trailing space prevents matching last $1 above + func_append_uniq opt_warning_types " $1" + ;; + *all) + opt_warning_types=$warning_categories + ;; + *none) + opt_warning_types=none + warning_func=: + ;; + *error) + opt_warning_types=$warning_categories + warning_func=func_fatal_error + ;; + *) + func_fatal_error \ + "unsupported warning category: '$1'" + ;; + esac + shift + ;; + + --verbose|-v) opt_verbose=: ;; + --version) func_version ;; + -\?|-h) func_usage ;; + --help) func_help ;; + + # Separate optargs to long options (plugins may need this): + --*=*) func_split_equals "$_G_opt" + set dummy "$func_split_equals_lhs" \ + "$func_split_equals_rhs" ${1+"$@"} + shift + ;; + + # Separate optargs to short options: + -W*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-v*|-x*) + func_split_short_opt "$_G_opt" + set dummy "$func_split_short_opt_name" \ + "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + func_parse_options_result=$func_quote_for_eval_result +} + + +# func_validate_options [ARG]... +# ------------------------------ +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +func_hookable func_validate_options +func_validate_options () +{ + $debug_cmd + + # Display all warnings if -W was not given. + test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" + + func_run_hooks func_validate_options ${1+"$@"} + + # Bail if the options were screwed! + $exit_cmd $EXIT_FAILURE + + # save modified positional parameters for caller + func_validate_options_result=$func_run_hooks_result +} + + + +## ----------------- ## +## Helper functions. ## +## ----------------- ## + +# This section contains the helper functions used by the rest of the +# hookable option parser framework in ascii-betical order. + + +# func_fatal_help ARG... +# ---------------------- +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + eval \$ECHO \""$fatal_help"\" + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + + +# func_help +# --------- +# Echo long help message to standard output and exit. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message" + exit 0 +} + + +# func_missing_arg ARGNAME +# ------------------------ +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $debug_cmd + + func_error "Missing argument for '$1'." + exit_cmd=exit +} + + +# func_split_equals STRING +# ------------------------ +# Set func_split_equals_lhs and func_split_equals_rhs shell variables after +# splitting STRING at the '=' sign. +test -z "$_G_HAVE_XSI_OPS" \ + && (eval 'x=a/b/c; + test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ + && _G_HAVE_XSI_OPS=yes + +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=${1%%=*} + func_split_equals_rhs=${1#*=} + test "x$func_split_equals_lhs" = "x$1" \ + && func_split_equals_rhs= + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_equals () + { + $debug_cmd + + func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` + func_split_equals_rhs= + test "x$func_split_equals_lhs" = "x$1" \ + || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` + } +fi #func_split_equals + + +# func_split_short_opt SHORTOPT +# ----------------------------- +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +if test yes = "$_G_HAVE_XSI_OPS" +then + # This is an XSI compatible shell, allowing a faster implementation... + eval 'func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"} + }' +else + # ...otherwise fall back to using expr, which is often a shell builtin. + func_split_short_opt () + { + $debug_cmd + + func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` + func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` + } +fi #func_split_short_opt + + +# func_usage +# ---------- +# Echo short help message to standard output and exit. +func_usage () +{ + $debug_cmd + + func_usage_message + $ECHO "Run '$progname --help |${PAGER-more}' for full usage" + exit 0 +} + + +# func_usage_message +# ------------------ +# Echo short help message to standard output. +func_usage_message () +{ + $debug_cmd + + eval \$ECHO \""Usage: $usage"\" + echo + $SED -n 's|^# || + /^Written by/{ + x;p;x + } + h + /^Written by/q' < "$progpath" + echo + eval \$ECHO \""$usage_message"\" +} + + +# func_version +# ------------ +# Echo version message to standard output and exit. +func_version () +{ + $debug_cmd + + printf '%s\n' "$progname $scriptversion" + $SED -n ' + /(C)/!b go + :more + /\./!{ + N + s|\n# | | + b more + } + :go + /^# Written by /,/# warranty; / { + s|^# || + s|^# *$|| + s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| + p + } + /^# Written by / { + s|^# || + p + } + /^warranty; /q' < "$progpath" + + exit $? +} + + +# Local variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" +# time-stamp-time-zone: "UTC" +# End: + +# Set a version string. +scriptversion='(GNU libtool) 2.4.6' + + +# func_echo ARG... +# ---------------- +# Libtool also displays the current mode in messages, so override +# funclib.sh func_echo with this custom definition. +func_echo () +{ + $debug_cmd + + _G_message=$* + + func_echo_IFS=$IFS + IFS=$nl + for _G_line in $_G_message; do + IFS=$func_echo_IFS + $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" + done + IFS=$func_echo_IFS +} + + +# func_warning ARG... +# ------------------- +# Libtool warnings are not categorized, so override funclib.sh +# func_warning with this simpler definition. +func_warning () +{ + $debug_cmd + + $warning_func ${1+"$@"} +} + + +## ---------------- ## +## Options parsing. ## +## ---------------- ## + +# Hook in the functions to make sure our own options are parsed during +# the option parsing loop. + +usage='$progpath [OPTION]... [MODE-ARG]...' + +# Short help message in response to '-h'. +usage_message="Options: + --config show all configuration variables + --debug enable verbose shell tracing + -n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --mode=MODE use operation mode MODE + --no-warnings equivalent to '-Wnone' + --preserve-dup-deps don't remove duplicate dependency libraries + --quiet, --silent don't print informational messages + --tag=TAG use configuration variables from tag TAG + -v, --verbose print more informational messages than default + --version print version information + -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] + -h, --help, --help-all print short, long, or detailed help message +" + +# Additional text appended to 'usage_message' in response to '--help'. +func_help () +{ + $debug_cmd + + func_usage_message + $ECHO "$long_help_message + +MODE must be one of the following: + + clean remove files from the build directory + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. When passed as first option, +'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. +Try '$progname --help --mode=MODE' for a more detailed description of MODE. + +When reporting a bug, please describe a test case to reproduce it and +include the following information: + + host-triplet: $host + shell: $SHELL + compiler: $LTCC + compiler flags: $LTCFLAGS + linker: $LD (gnu? $with_gnu_ld) + version: $progname (GNU libtool) 2.4.6 + automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` + autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` + +Report bugs to . +GNU libtool home page: . +General help using GNU software: ." + exit 0 +} + + +# func_lo2o OBJECT-NAME +# --------------------- +# Transform OBJECT-NAME from a '.lo' suffix to the platform specific +# object suffix. + +lo2o=s/\\.lo\$/.$objext/ +o2lo=s/\\.$objext\$/.lo/ + +if test yes = "$_G_HAVE_XSI_OPS"; then + eval 'func_lo2o () + { + case $1 in + *.lo) func_lo2o_result=${1%.lo}.$objext ;; + * ) func_lo2o_result=$1 ;; + esac + }' + + # func_xform LIBOBJ-OR-SOURCE + # --------------------------- + # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) + # suffix to a '.lo' libtool-object suffix. + eval 'func_xform () + { + func_xform_result=${1%.*}.lo + }' +else + # ...otherwise fall back to using sed. + func_lo2o () + { + func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` + } + + func_xform () + { + func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` + } +fi + + +# func_fatal_configuration ARG... +# ------------------------------- +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func__fatal_error ${1+"$@"} \ + "See the $PACKAGE documentation for more information." \ + "Fatal configuration error." +} + + +# func_config +# ----------- +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + + +# func_features +# ------------- +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test yes = "$build_libtool_libs"; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test yes = "$build_old_libs"; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + + +# func_enable_tag TAGNAME +# ----------------------- +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname=$1 + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf=/$re_begincf/,/$re_endcf/p + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + + +# func_check_version_match +# ------------------------ +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# libtool_options_prep [ARG]... +# ----------------------------- +# Preparation for options parsed by libtool. +libtool_options_prep () +{ + $debug_mode + + # Option defaults: + opt_config=false + opt_dlopen= + opt_dry_run=false + opt_help=false + opt_mode= + opt_preserve_dup_deps=false + opt_quiet=false + + nonopt= + preserve_args= + + # Shorthand for --mode=foo, only valid as the first argument + case $1 in + clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; + compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; + execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; + finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; + install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; + link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; + uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; + esac + + # Pass back the list of options. + func_quote_for_eval ${1+"$@"} + libtool_options_prep_result=$func_quote_for_eval_result +} +func_add_hook func_options_prep libtool_options_prep + + +# libtool_parse_options [ARG]... +# --------------------------------- +# Provide handling for libtool specific options. +libtool_parse_options () +{ + $debug_cmd + + # Perform our own loop to consume as many options as possible in + # each iteration. + while test $# -gt 0; do + _G_opt=$1 + shift + case $_G_opt in + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + + --config) func_config ;; + + --dlopen|-dlopen) + opt_dlopen="${opt_dlopen+$opt_dlopen +}$1" + shift + ;; + + --preserve-dup-deps) + opt_preserve_dup_deps=: ;; + + --features) func_features ;; + + --finish) set dummy --mode finish ${1+"$@"}; shift ;; + + --help) opt_help=: ;; + + --help-all) opt_help=': help-all' ;; + + --mode) test $# = 0 && func_missing_arg $_G_opt && break + opt_mode=$1 + case $1 in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $_G_opt" + exit_cmd=exit + break + ;; + esac + shift + ;; + + --no-silent|--no-quiet) + opt_quiet=false + func_append preserve_args " $_G_opt" + ;; + + --no-warnings|--no-warning|--no-warn) + opt_warning=false + func_append preserve_args " $_G_opt" + ;; + + --no-verbose) + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --silent|--quiet) + opt_quiet=: + opt_verbose=false + func_append preserve_args " $_G_opt" + ;; + + --tag) test $# = 0 && func_missing_arg $_G_opt && break + opt_tag=$1 + func_append preserve_args " $_G_opt $1" + func_enable_tag "$1" + shift + ;; + + --verbose|-v) opt_quiet=false + opt_verbose=: + func_append preserve_args " $_G_opt" + ;; + + # An option not handled by this hook function: + *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; + esac + done + + + # save modified positional parameters for caller + func_quote_for_eval ${1+"$@"} + libtool_parse_options_result=$func_quote_for_eval_result +} +func_add_hook func_parse_options libtool_parse_options + + + +# libtool_validate_options [ARG]... +# --------------------------------- +# Perform any sanity checks on option settings and/or unconsumed +# arguments. +libtool_validate_options () +{ + # save first non-option argument + if test 0 -lt $#; then + nonopt=$1 + shift + fi + + # preserve --debug + test : = "$debug_cmd" || func_append preserve_args " --debug" + + case $host in + # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 + # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 + *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + test yes != "$build_libtool_libs" \ + && test yes != "$build_old_libs" \ + && func_fatal_configuration "not configured to build any kind of library" + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test execute != "$opt_mode"; then + func_error "unrecognized option '-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help=$help + help="Try '$progname --help --mode=$opt_mode' for more information." + } + + # Pass back the unparsed argument list + func_quote_for_eval ${1+"$@"} + libtool_validate_options_result=$func_quote_for_eval_result +} +func_add_hook func_validate_options libtool_validate_options + + +# Process options as early as possible so that --help and --version +# can return quickly. +func_options ${1+"$@"} +eval set dummy "$func_options_result"; shift + + + +## ----------- ## +## Main. ## +## ----------- ## + +magic='%%%MAGIC variable%%%' +magic_exe='%%%MAGIC EXE variable%%%' + +# Global variables. +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# func_generated_by_libtool +# True iff stdin has been generated by Libtool. This function is only +# a basic sanity check; it will hardly flush out determined imposters. +func_generated_by_libtool_p () +{ + $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool '.la' library or '.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if 'file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case $lalib_p_line in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test yes = "$lalib_p" +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + test -f "$1" && + $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $debug_cmd + + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# 'FILE.' does not work on cygwin managed mounts. +func_source () +{ + $debug_cmd + + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case $lt_sysroot:$1 in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result='='$func_stripname_result + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $debug_cmd + + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with '--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=$1 + if test yes = "$build_libtool_libs"; then + write_lobj=\'$2\' + else + write_lobj=none + fi + + if test yes = "$build_old_libs"; then + write_oldobj=\'$3\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $debug_cmd + + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result= + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result"; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $debug_cmd + + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $debug_cmd + + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $debug_cmd + + if test -z "$2" && test -n "$1"; then + func_error "Could not determine host file name corresponding to" + func_error " '$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result=$1 + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $debug_cmd + + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " '$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result=$3 + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $debug_cmd + + case $4 in + $1 ) func_to_host_path_result=$3$func_to_host_path_result + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via '$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $debug_cmd + + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $debug_cmd + + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result=$1 +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result=$func_convert_core_msys_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result=$func_convert_core_file_wine_to_w32_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_file_result=$1 + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result=$func_cygpath_result + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via '$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $debug_cmd + + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd=func_convert_path_$func_stripname_result + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $debug_cmd + + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result=$1 +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_msys_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result=$func_convert_core_path_wine_to_w32_result + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $debug_cmd + + func_to_host_path_result=$1 + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result=$func_cygpath_result + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_dll_def_p FILE +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with _LT_DLL_DEF_P in libtool.m4 +func_dll_def_p () +{ + $debug_cmd + + func_dll_def_p_tmp=`$SED -n \ + -e 's/^[ ]*//' \ + -e '/^\(;.*\)*$/d' \ + -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ + -e q \ + "$1"` + test DEF = "$func_dll_def_p_tmp" +} + + +# func_mode_compile arg... +func_mode_compile () +{ + $debug_cmd + + # Get the compilation command and the source file. + base_compile= + srcfile=$nonopt # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg=$arg + arg_mode=normal + ;; + + target ) + libobj=$arg + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify '-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs=$IFS; IFS=, + for arg in $args; do + IFS=$save_ifs + func_append_quoted lastarg "$arg" + done + IFS=$save_ifs + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg=$srcfile + srcfile=$arg + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with '-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj=$func_basename_result + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from '$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test yes = "$build_libtool_libs" \ + || func_fatal_configuration "cannot build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name '$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname=$func_basename_result + xdir=$func_dirname_result + lobj=$xdir$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test yes = "$build_old_libs"; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test no = "$compiler_c_o"; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext + lockfile=$output_obj.lock + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test yes = "$need_locks"; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test warn = "$need_locks"; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test yes = "$build_libtool_libs"; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test no != "$pic_mode"; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test yes = "$suppress_opt"; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test yes = "$build_old_libs"; then + if test yes != "$pic_mode"; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test yes = "$compiler_c_o"; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test warn = "$need_locks" && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support '-c' and '-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test no != "$need_locks"; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test compile = "$opt_mode" && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a '.o' file suitable for static linking + -static only build a '.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a 'standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix '.c' with the +library object suffix, '.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to '-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the '--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the 'install' or 'cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE use a list of object files found in FILE to specify objects + -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static-uninstalled-libs + do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with '-') are ignored. + +Every other argument is treated as a filename. Files ending in '.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in '.la', then a libtool library is created, +only library objects ('.lo' files) may be specified, and '-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created +using 'ar' and 'ranlib', or on Windows using 'lib'. + +If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode '$opt_mode'" + ;; + esac + + echo + $ECHO "Try '$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test : = "$opt_help"; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | $SED -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + $SED '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $debug_cmd + + # The first argument is the command name. + cmd=$nonopt + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "'$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "'$file' was not linked with '-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir=$func_dirname_result + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir=$func_dirname_result + ;; + + *) + func_warning "'-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir=$absdir + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic=$magic + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file=$progdir/$program + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file=$progdir/$program + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if $opt_dry_run; then + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + else + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd=\$cmd$args + fi +} + +test execute = "$opt_mode" && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $debug_cmd + + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "'$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument '$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and '=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_quiet && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the '-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the '$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the '$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the '$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test finish = "$opt_mode" && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $debug_cmd + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac + then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=false + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=: ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test X-m = "X$prev" && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the '$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=: + if $isdir; then + destdir=$dest + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir=$func_dirname_result + destname=$func_basename_result + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "'$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "'$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "'$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir=$func_dirname_result + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking '$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname=$1 + shift + + srcname=$realname + test -n "$relink_command" && srcname=${realname}T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme=$stripme + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme= + ;; + esac + ;; + os2*) + case $realname in + *_dll.a) + tstripme= + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try 'ln -sf' first, because the 'ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib=$destdir/$realname + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name=$func_basename_result + instname=$dir/${name}i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest=$destfile + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to '$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test yes = "$build_old_libs"; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile=$destdir/$destname + else + func_basename "$file" + destfile=$func_basename_result + destfile=$destdir/$destfile + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext= + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=.exe + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script '$wrapper'" + + finalize=: + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "'$lib' has not been installed in '$libdir'" + finalize=false + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test no = "$fast_install" && test -n "$relink_command"; then + $opt_dry_run || { + if $finalize; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file=$func_basename_result + outputname=$tmpdir/$file + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_quiet || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink '$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file=$outputname + else + func_warning "cannot relink '$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name=$func_basename_result + + # Set up the ranlib parameters. + oldlib=$destdir/$name + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $tool_oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run '$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test install = "$opt_mode" && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $debug_cmd + + my_outputname=$1 + my_originator=$2 + my_pic_p=${3-false} + my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms=${my_outputname}S.c + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist=$output_objdir/$my_outputname.nm + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* External symbol declarations for the compiler. */\ +" + + if test yes = "$dlself"; then + func_verbose "generating symbol list for '$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from '$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols=$output_objdir/$outputname.exp + $opt_dry_run || { + $RM $export_symbols + eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from '$dlprefile'" + func_basename "$dlprefile" + name=$func_basename_result + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename= + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname"; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename=$func_basename_result + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename"; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + func_show_eval '$RM "${nlist}I"' + if test -n "$global_symbol_to_import"; then + eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[];\ +" + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ +static void lt_syminit(void) +{ + LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; + for (; symbol->name; ++symbol) + {" + $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" + echo >> "$output_objdir/$my_dlsyms" "\ + } +}" + fi + echo >> "$output_objdir/$my_dlsyms" "\ +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{ {\"$my_originator\", (void *) 0}," + + if test -s "$nlist"I; then + echo >> "$output_objdir/$my_dlsyms" "\ + {\"@INIT@\", (void *) <_syminit}," + fi + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + $my_pic_p && pic_flag_for_symtable=" $pic_flag" + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' + + # Transform the symbol file into the correct name. + symfileobj=$output_objdir/${my_outputname}S.$objext + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for '$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $debug_cmd + + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $debug_cmd + + win32_libid_type=unknown + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + case $nm_interface in + "MS dumpbin") + if func_cygming_ms_implib_p "$1" || + func_cygming_gnu_implib_p "$1" + then + win32_nmres=import + else + win32_nmres= + fi + ;; + *) + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s|.*|import| + p + q + } + }'` + ;; + esac + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $debug_cmd + + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $debug_cmd + + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive that possess that section. Heuristic: eliminate + # all those that have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $debug_cmd + + if func_cygming_gnu_implib_p "$1"; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1"; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result= + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $debug_cmd + + f_ex_an_ar_dir=$1; shift + f_ex_an_ar_oldlib=$1 + if test yes = "$lock_old_archive_extraction"; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test yes = "$lock_old_archive_extraction"; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $debug_cmd + + my_gentop=$1; shift + my_oldlibs=${1+"$@"} + my_oldobjs= + my_xlib= + my_xabs= + my_xdir= + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib=$func_basename_result + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir=$my_gentop/$my_xlib_u + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + func_basename "$darwin_archive" + darwin_base_archive=$func_basename_result + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches; do + func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" + $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" + cd "unfat-$$/$darwin_base_archive-$darwin_arch" + func_extract_an_archive "`pwd`" "$darwin_base_archive" + cd "$darwin_curdir" + $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result=$my_oldobjs +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory where it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# 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+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ that is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options that match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + case \" \$* \" in + *\\ --lt-*) + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done ;; + esac + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test yes = "$fast_install"; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + \$ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +#define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) + +/* declarations of non-ANSI functions */ +#if defined __MINGW32__ +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined __CYGWIN__ +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined other_platform || defined ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined _MSC_VER +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +#elif defined __MINGW32__ +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined __CYGWIN__ +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined other platforms ... */ +#endif + +#if defined PATH_MAX +# define LT_PATHMAX PATH_MAX +#elif defined MAXPATHLEN +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ + defined __OS2__ +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free (stale); stale = 0; } \ +} while (0) + +#if defined LT_DEBUGWRAPPER +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + size_t tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined HAVE_DOS_BASED_FILE_SYSTEM + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined HAVE_DOS_BASED_FILE_SYSTEM + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = (size_t) (q - p); + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (STREQ (str, pat)) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + size_t len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + size_t orig_value_len = strlen (orig_value); + size_t add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + size_t len = strlen (new_value); + while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[--len] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -n -e ' +s/^\(.\{79\}\)\(..*\)/\1\ +\2/ +h +s/\([\\"]\)/\\\1/g +s/$/\\n/ +s/\([^\n]*\).*/ fputs ("\1", f);/p +g +D' + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $debug_cmd + + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_suncc_cstd_abi +# !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! +# Several compiler flags select an ABI that is incompatible with the +# Cstd library. Avoid specifying it if any are in CXXFLAGS. +func_suncc_cstd_abi () +{ + $debug_cmd + + case " $compile_command " in + *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) + suncc_use_cstd_abi=no + ;; + *) + suncc_use_cstd_abi=yes + ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $debug_cmd + + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # what system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll that has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + os2dllname= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=false + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module=$wl-single_module + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test yes != "$build_libtool_libs" \ + && func_fatal_configuration "cannot build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-uninstalled-libs | -static-libtool-libs) + case $arg in + -all-static | -static) + if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static-uninstalled-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg=$1 + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir=$arg + prev= + continue + ;; + dlfiles|dlprefiles) + $preload || { + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=: + } + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test no = "$dlself"; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test dlprefiles = "$prev"; then + dlself=yes + elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test dlfiles = "$prev"; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols=$arg + test -f "$arg" \ + || func_fatal_error "symbol file '$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex=$arg + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir=$arg + prev= + continue + ;; + mllvm) + # Clang does not use LLVM to link, so we can simply discard any + # '-mllvm $arg' options when doing the link step. + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + if test none != "$pic_object"; then + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + fi + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file '$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + os2dllname) + os2dllname=$arg + prev= + continue + ;; + precious_regex) + precious_files_regex=$arg + prev= + continue + ;; + release) + release=-$arg + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test rpath = "$prev"; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds=$arg + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg=$arg + + case $arg in + -all-static | -static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "'-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test X-export-symbols = "X$arg"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between '-L' and '$1'" + else + func_fatal_error "need path for '-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of '$dir'" + dir=$absdir + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test X-lc = "X$arg" || test X-lm = "X$arg"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test X-lc = "X$arg" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + # Do not include libc due to us having libc/libc_r. + test X-lc = "X$arg" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test X-lc = "X$arg" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test X-lc = "X$arg" && continue + ;; + esac + elif test X-lc_r = "X$arg"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig* | *-*-midnightbsd*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -mllvm) + prev=mllvm + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module=$wl-multi_module + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "'-no-install' is ignored for $host" + func_warning "assuming '-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -os2dllname) + prev=os2dllname + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static-uninstalled-libs | -static-libtool-libs) + # The effects of -static-uninstalled-libs are defined in a previous + # loop. We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs=$IFS; IFS=, + for flag in $args; do + IFS=$save_ifs + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS=$save_ifs + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # -fstack-protector* stack protector flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + # -stdlib=* select c++ std lib with clang + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + -Z*) + if test os2 = "`expr $host : '.*\(os2\)'`"; then + # OS/2 uses -Zxxx to specify OS/2-specific options + compiler_flags="$compiler_flags $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case $arg in + -Zlinker | -Zstack) + prev=xcompiler + ;; + esac + continue + else + # Otherwise treat like 'Some other compiler flag' below + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + fi + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test none = "$pic_object" && + test none = "$non_pic_object"; then + func_fatal_error "cannot find name of object for '$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + test none = "$pic_object" || { + # Prepend the subdirectory the object is found in. + pic_object=$xdir$pic_object + + if test dlfiles = "$prev"; then + if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test dlprefiles = "$prev"; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg=$pic_object + } + + # Non-PIC object. + if test none != "$non_pic_object"; then + # Prepend the subdirectory the object is found in. + non_pic_object=$xdir$non_pic_object + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test none = "$pic_object"; then + arg=$non_pic_object + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object=$pic_object + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir=$func_dirname_result + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "'$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test dlfiles = "$prev"; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test dlprefiles = "$prev"; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg=$func_quote_for_eval_result + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the '$prevarg' option requires an argument" + + if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname=$func_basename_result + libobjs_save=$libobjs + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + # Definition is injected by LT_CONFIG during libtool generation. + func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" + + func_dirname "$output" "/" "" + output_objdir=$func_dirname_result$objdir + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test lib = "$linkmode"; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=false + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test lib,link = "$linkmode,$pass"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs=$tmp_deplibs + fi + + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass"; then + libs=$deplibs + deplibs= + fi + if test prog = "$linkmode"; then + case $pass in + dlopen) libs=$dlfiles ;; + dlpreopen) libs=$dlprefiles ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test lib,dlpreopen = "$linkmode,$pass"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs=$dlprefiles + fi + if test dlopen = "$pass"; then + # Collect dlpreopened libraries + save_deplibs=$deplibs + deplibs= + fi + + for deplib in $libs; do + lib= + found=false + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ + |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test lib != "$linkmode" && test prog != "$linkmode"; then + func_warning "'-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test lib = "$linkmode"; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib=$searchdir/lib$name$search_ext + if test -f "$lib"; then + if test .la = "$search_ext"; then + found=: + else + found=false + fi + break 2 + fi + done + done + if $found; then + # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll=$l + done + if test "X$ll" = "X$old_library"; then # only static version available + found=false + func_dirname "$lib" "" "." + ladir=$func_dirname_result + lib=$ladir/$old_library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + else + # deplib doesn't seem to be a libtool library + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + ;; # -l + *.ltframework) + if test prog,link = "$linkmode,$pass"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test lib = "$linkmode"; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test conv = "$pass" && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + if test scan = "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "'-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test link = "$pass"; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=false + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=: + fi + ;; + pass_all) + valid_a_lib=: + ;; + esac + if $valid_a_lib; then + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + else + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + fi + ;; + esac + continue + ;; + prog) + if test link != "$pass"; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test conv = "$pass"; then + deplibs="$deplib $deplibs" + elif test prog = "$linkmode"; then + if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=: + continue + ;; + esac # case $deplib + + $found || test -f "$lib" \ + || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "'$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir=$func_dirname_result + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test lib,link = "$linkmode,$pass" || + test prog,scan = "$linkmode,$pass" || + { test prog != "$linkmode" && test lib != "$linkmode"; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test conv = "$pass"; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test prog != "$linkmode" && test lib != "$linkmode"; then + func_fatal_error "'$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test yes = "$prefer_static_libs" || + test built,no = "$prefer_static_libs,$installed"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib=$l + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for '$lib'" + fi + + # This library was specified with -dlopen. + if test dlopen = "$pass"; then + test -z "$libdir" \ + && func_fatal_error "cannot -dlopen a convenience library: '$lib'" + if test -z "$dlname" || + test yes != "$dlopen_support" || + test no = "$build_libtool_libs" + then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of '$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir=$ladir + fi + ;; + esac + func_basename "$lib" + laname=$func_basename_result + + # Find the relevant object directory and library name. + if test yes = "$installed"; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library '$lib' was moved." + dir=$ladir + absdir=$abs_ladir + libdir=$abs_ladir + else + dir=$lt_sysroot$libdir + absdir=$lt_sysroot$libdir + fi + test yes = "$hardcode_automatic" && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir=$ladir + absdir=$abs_ladir + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir=$ladir/$objdir + absdir=$abs_ladir/$objdir + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test dlpreopen = "$pass"; then + if test -z "$libdir" && test prog = "$linkmode"; then + func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" + fi + case $host in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test lib = "$linkmode"; then + deplibs="$dir/$old_library $deplibs" + elif test prog,link = "$linkmode,$pass"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test prog = "$linkmode" && test link != "$pass"; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=false + if test no != "$link_all_deplibs" || test -z "$library_names" || + test no = "$build_libtool_libs"; then + linkalldeplibs=: + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if $linkalldeplibs; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test prog,link = "$linkmode,$pass"; then + if test -n "$library_names" && + { { test no = "$prefer_static_libs" || + test built,yes = "$prefer_static_libs,$installed"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then + # Make sure the rpath contains only unique directories. + case $temp_rpath: in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if $alldeplibs && + { test pass_all = "$deplibs_check_method" || + { test yes = "$build_libtool_libs" && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test built = "$use_static_libs" && test yes = "$installed"; then + use_static_libs=no + fi + if test -n "$library_names" && + { test no = "$use_static_libs" || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc* | *os2*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test no = "$installed"; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule= + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule=$dlpremoduletest + break + fi + done + if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then + echo + if test prog = "$linkmode"; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test lib = "$linkmode" && + test yes = "$hardcode_into_libs"; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname=$1 + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname=$dlname + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc* | *os2*) + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + esac + eval soname=\"$soname_spec\" + else + soname=$realname + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot=$soname + func_basename "$soroot" + soname=$func_basename_result + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from '$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for '$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test prog = "$linkmode" || test relink != "$opt_mode"; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test no = "$hardcode_direct"; then + add=$dir/$linklib + case $host in + *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; + *-*-sysv4*uw2*) add_dir=-L$dir ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir=-L$dir ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we cannot + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library"; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add=$dir/$old_library + fi + elif test -n "$old_library"; then + add=$dir/$old_library + fi + fi + esac + elif test no = "$hardcode_minus_L"; then + case $host in + *-*-sunos*) add_shlibpath=$dir ;; + esac + add_dir=-L$dir + add=-l$name + elif test no = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + relink) + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$dir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$absdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + add_shlibpath=$dir + add=-l$name + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test yes != "$lib_linked"; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test prog = "$linkmode"; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test yes != "$hardcode_direct" && + test yes != "$hardcode_minus_L" && + test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test prog = "$linkmode" || test relink = "$opt_mode"; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test yes = "$hardcode_direct" && + test no = "$hardcode_direct_absolute"; then + add=$libdir/$linklib + elif test yes = "$hardcode_minus_L"; then + add_dir=-L$libdir + add=-l$name + elif test yes = "$hardcode_shlibpath_var"; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add=-l$name + elif test yes = "$hardcode_automatic"; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib"; then + add=$inst_prefix_dir$libdir/$linklib + else + add=$libdir/$linklib + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir=-L$libdir + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add=-l$name + fi + + if test prog = "$linkmode"; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test prog = "$linkmode"; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test unsupported != "$hardcode_direct"; then + test -n "$old_library" && linklib=$old_library + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test yes = "$build_libtool_libs"; then + # Not a shared library + if test pass_all != "$deplibs_check_method"; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system cannot link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test yes = "$module"; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test lib = "$linkmode"; then + if test -n "$dependency_libs" && + { test yes != "$hardcode_into_libs" || + test yes = "$build_old_libs" || + test yes = "$link_static"; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs=$temp_deplibs + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test no != "$link_all_deplibs"; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path=$deplib ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of '$dir'" + absdir=$dir + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names"; then + for tmp in $deplibrary_names; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl"; then + depdepl=$absdir/$objdir/$depdepl + darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" + func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" + path= + fi + fi + ;; + *) + path=-L$absdir/$objdir + ;; + esac + else + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "'$deplib' seems to be moved" + + path=-L$absdir + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test link = "$pass"; then + if test prog = "$linkmode"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs=$newdependency_libs + if test dlpreopen = "$pass"; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test dlopen != "$pass"; then + test conv = "$pass" || { + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + } + + if test prog,link = "$linkmode,$pass"; then + vars="compile_deplibs finalize_deplibs" + else + vars=deplibs + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + + # Add Sun CC postdeps if required: + test CXX = "$tagname" && { + case $host_os in + linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C++ 5.9 + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + + solaris*) + func_cc_basename "$CC" + case $func_cc_basename_result in + CC* | sunCC*) + func_suncc_cstd_abi + + if test no != "$suncc_use_cstd_abi"; then + func_append postdeps ' -library=Cstd -library=Crun' + fi + ;; + esac + ;; + esac + } + + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i= + ;; + esac + if test -n "$i"; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test prog = "$linkmode"; then + dlfiles=$newdlfiles + fi + if test prog = "$linkmode" || test lib = "$linkmode"; then + dlprefiles=$newdlprefiles + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "'-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "'-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs=$output + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form 'libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test no = "$module" \ + && func_fatal_help "libtool library '$output' must begin with 'lib'" + + if test no != "$need_lib_prefix"; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test pass_all != "$deplibs_check_method"; then + func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test no = "$dlself" \ + || func_warning "'-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test 1 -lt "$#" \ + && func_warning "ignoring multiple '-rpath's for a libtool library" + + install_libdir=$1 + + oldlibs= + if test -z "$rpath"; then + if test yes = "$build_libtool_libs"; then + # Building a libtool convenience library. + # Some compilers have problems with a '.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "'-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "'-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs=$IFS; IFS=: + set dummy $vinfo 0 0 0 + shift + IFS=$save_ifs + + test -n "$7" && \ + func_fatal_help "too many parameters to '-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major=$1 + number_minor=$2 + number_revision=$3 + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # that has an extra 1 added just for fun + # + case $version_type in + # correct linux to gnu/linux during the next big refactor + darwin|freebsd-elf|midnightbsd-elf|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_revision + ;; + freebsd-aout|midnightbsd-aout|qnx|sunos) + current=$number_major + revision=$number_minor + age=0 + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age=$number_minor + revision=$number_minor + lt_irix_increment=no + ;; + esac + ;; + no) + current=$1 + revision=$2 + age=$3 + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT '$current' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION '$revision' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE '$age' must be a nonnegative integer" + func_fatal_error "'$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE '$age' is greater than the current interface number '$current'" + func_fatal_error "'$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + # On Darwin other compilers + case $CC in + nagfor*) + verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" + ;; + *) + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + esac + ;; + + freebsd-aout | midnightbsd-aout) + major=.$current + versuffix=.$current.$revision + ;; + + freebsd-elf | midnightbsd-elf | midnightbsd) + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + irix | nonstopux) + if test no = "$lt_irix_increment"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring=$verstring_prefix$major.$revision + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test 0 -ne "$loop"; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring_prefix$major.$iface:$verstring + done + + # Before this point, $major must not contain '.'. + major=.$major + versuffix=$major.$revision + ;; + + linux) # correct to gnu/linux during the next big refactor + func_arith $current - $age + major=.$func_arith_result + versuffix=$major.$age.$revision + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=.$current.$age.$revision + verstring=$current.$age.$revision + + # Add in all the interfaces that we are compatible with. + loop=$age + while test 0 -ne "$loop"; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring=$verstring:$iface.0 + done + + # Make executables depend on our current version. + func_append verstring ":$current.0" + ;; + + qnx) + major=.$current + versuffix=.$current + ;; + + sco) + major=.$current + versuffix=.$current + ;; + + sunos) + major=.$current + versuffix=.$current.$revision + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 file systems. + func_arith $current - $age + major=$func_arith_result + versuffix=-$major + ;; + + *) + func_fatal_configuration "unknown library version type '$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring=0.0 + ;; + esac + if test no = "$need_version"; then + versuffix= + else + versuffix=.0.0 + fi + fi + + # Remove version info from name if versioning should be avoided + if test yes,no = "$avoid_version,$need_version"; then + major= + versuffix= + verstring= + fi + + # Check to see if the archive will have undefined symbols. + if test yes = "$allow_undefined"; then + if test unsupported = "$allow_undefined_flag"; then + if test yes = "$build_old_libs"; then + func_warning "undefined symbols not allowed in $host shared libraries; building static only" + build_libtool_libs=no + else + func_fatal_error "can't build $host shared library unless -no-undefined is specified" + fi + fi + else + # Don't allow undefined symbols. + allow_undefined_flag=$no_undefined_flag + fi + + fi + + func_generate_dlsyms "$libname" "$libname" : + func_append libobjs " $symfileobj" + test " " = "$libobjs" && libobjs= + + if test relink != "$opt_mode"; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) + if test -n "$precious_files_regex"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles=$dlfiles + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles=$dlprefiles + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test yes = "$build_libtool_libs"; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-midnightbsd*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test yes = "$build_libtool_need_lc"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release= + versuffix= + major= + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib=$potent_lib + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | $SED 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; + *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib= + ;; + esac + fi + if test -n "$a_deplib"; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib=$potent_lib # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib= + break 2 + fi + done + done + fi + if test -n "$a_deplib"; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib"; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs= + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test yes = "$allow_libtool_libs_with_static_runtimes"; then + for i in $predeps $postdeps; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test none = "$deplibs_check_method"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test yes = "$droppeddeps"; then + if test yes = "$module"; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using 'nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** 'nm' from GNU binutils and a full rebuild may help." + fi + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test no = "$allow_undefined"; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test no = "$build_old_libs"; then + oldlibs=$output_objdir/$libname.$libext + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs=$new_libs + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test yes = "$build_libtool_libs"; then + # Remove $wl instances when linking with ld. + # FIXME: should test the right _cmds variable. + case $archive_cmds in + *\$LD\ *) wl= ;; + esac + if test yes = "$hardcode_into_libs"; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath=$finalize_rpath + test relink = "$opt_mode" || rpath=$compile_rpath$rpath + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath=$finalize_shlibpath + test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname=$1 + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname=$realname + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib=$output_objdir/$realname + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols=$output_objdir/$libname.uexp + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + func_dll_def_p "$export_symbols" || { + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols=$export_symbols + export_symbols= + always_export_symbols=yes + } + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs=$IFS; IFS='~' + for cmd1 in $cmds; do + IFS=$save_ifs + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test yes = "$try_normal_branch" \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=$output_objdir/$output_la.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS=$save_ifs + if test -n "$export_symbols_regex" && test : != "$skipped_export"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test : != "$skipped_export" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs=$tmp_deplibs + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test yes = "$compiler_needs_object" && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test : != "$skipped_export" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then + output=$output_objdir/$output_la.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then + output=$output_objdir/$output_la.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test yes = "$compiler_needs_object"; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-$k.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test -z "$objlist" || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test 1 -eq "$k"; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-$k.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-$k.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + ${skipped_export-false} && { + func_verbose "generating symbol list for '$libname.la'" + export_symbols=$output_objdir/$libname.exp + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + } + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs=$IFS; IFS='~' + for cmd in $concat_cmds; do + IFS=$save_ifs + $opt_quiet || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + ${skipped_export-false} && { + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols=$export_symbols + test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for '$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands, which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + } + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test yes = "$module" && test -n "$module_cmds"; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs=$IFS; IFS='~' + for cmd in $cmds; do + IFS=$sp$nl + eval cmd=\"$cmd\" + IFS=$save_ifs + $opt_quiet || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS=$save_ifs + + # Restore the uninstalled library and exit + if test relink = "$opt_mode"; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test yes = "$module" || test yes = "$export_dynamic"; then + # On all known operating systems, these are identical. + dlname=$soname + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then + func_warning "'-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "'-l' and '-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "'-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "'-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "'-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object '$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj=$output + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # if reload_cmds runs $LD directly, get rid of -Wl from + # whole_archive_flag_spec and hope we can get by with turning comma + # into space. + case $reload_cmds in + *\$LD[\ \$]*) wl= ;; + esac + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags + else + gentop=$output_objdir/${obj}x + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test yes = "$build_libtool_libs" || libobjs=$non_pic_objects + + # Create the old-style object. + reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs + + output=$obj + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + test yes = "$build_libtool_libs" || { + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + } + + if test -n "$pic_flag" || test default != "$pic_mode"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output=$libobj + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "'-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "'-release' is ignored for programs" + + $preload \ + && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ + && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test CXX = "$tagname"; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " $wl-bind_at_load" + func_append finalize_command " $wl-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs=$new_libs + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath=$rpath + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs=$libdir + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir=$hardcode_libdirs + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath=$rpath + + if test -n "$libobjs" && test yes = "$build_old_libs"; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" false + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=: + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=false + ;; + *cygwin* | *mingw* ) + test yes = "$build_libtool_libs" || wrappers_required=false + ;; + *) + if test no = "$need_relink" || test yes != "$build_libtool_libs"; then + wrappers_required=false + fi + ;; + esac + $wrappers_required || { + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command=$compile_command$compile_rpath + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.$objext"; then + func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' + fi + + exit $exit_status + } + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test yes = "$no_install"; then + # We don't need to create a wrapper script. + link_command=$compile_var$compile_command$compile_rpath + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + case $hardcode_action,$fast_install in + relink,*) + # Fast installation is not supported + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "'$output' will be relinked during installation" + ;; + *,yes) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + ;; + *,no) + link_command=$compile_var$compile_command$compile_rpath + relink_command=$finalize_var$finalize_command$finalize_rpath + ;; + *,needless) + link_command=$finalize_var$compile_command$finalize_rpath + relink_command= + ;; + esac + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource=$output_path/$objdir/lt-$output_name.c + cwrapper=$output_path/$output_name.exe + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host"; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + case $build_libtool_libs in + convenience) + oldobjs="$libobjs_save $symfileobj" + addlibs=$convenience + build_libtool_libs=no + ;; + module) + oldobjs=$libobjs_save + addlibs=$old_convenience + build_libtool_libs=no + ;; + *) + oldobjs="$old_deplibs $non_pic_objects" + $preload && test -f "$symfileobj" \ + && func_append oldobjs " $symfileobj" + addlibs=$old_convenience + ;; + esac + + if test -n "$addlibs"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop=$output_objdir/${outputname}x + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase=$func_basename_result + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 + tool_oldlib=$func_to_tool_file_result + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj"; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test -z "$oldobjs"; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test yes = "$build_old_libs" && old_library=$libname.$libext + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test yes = "$hardcode_automatic"; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test yes = "$installed"; then + if test -z "$install_libdir"; then + break + fi + output=$output_objdir/${outputname}i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name=$func_basename_result + func_resolve_sysroot "$deplib" + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` + test -z "$libdir" && \ + func_fatal_error "'$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs=$newdependency_libs + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name=$func_basename_result + eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "'$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles=$newdlprefiles + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles=$newdlfiles + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles=$newdlprefiles + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test -n "$bindir"; then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result/$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that cannot go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test no,yes = "$installed,$need_relink"; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +if test link = "$opt_mode" || test relink = "$opt_mode"; then + func_mode_link ${1+"$@"} +fi + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $debug_cmd + + RM=$nonopt + files= + rmforce=false + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic=$magic + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=: ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir=$func_dirname_result + if test . = "$dir"; then + odir=$objdir + else + odir=$dir/$objdir + fi + func_basename "$file" + name=$func_basename_result + test uninstall = "$opt_mode" && odir=$dir + + # Remember odir for removal later, being careful to avoid duplicates + if test clean = "$opt_mode"; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif $rmforce; then + continue + fi + + rmfiles=$file + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case $opt_mode in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && test none != "$pic_object"; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && test none != "$non_pic_object"; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test clean = "$opt_mode"; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.$objext" + if test yes = "$fast_install" && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name"; then + func_append rmfiles " $odir/lt-$noexename.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the $objdir's in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then + func_mode_uninstall ${1+"$@"} +fi + +test -z "$opt_mode" && { + help=$generic_help + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode '$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# where we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/build-aux/missing b/build-aux/missing new file mode 100755 index 0000000..8d0eaad --- /dev/null +++ b/build-aux/missing @@ -0,0 +1,215 @@ +#! /bin/sh +# Common wrapper for a few potentially missing GNU programs. + +scriptversion=2018-03-07.03; # UTC + +# Copyright (C) 1996-2020 Free Software Foundation, Inc. +# Originally written by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# 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. + +if test $# -eq 0; then + echo 1>&2 "Try '$0 --help' for more information" + exit 1 +fi + +case $1 in + + --is-lightweight) + # Used by our autoconf macros to check whether the available missing + # script is modern enough. + exit 0 + ;; + + --run) + # Back-compat with the calling convention used by older automake. + shift + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due +to PROGRAM being missing or too old. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + +Supported PROGRAM values: + aclocal autoconf autoheader autom4te automake makeinfo + bison yacc flex lex help2man + +Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and +'g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: unknown '$1' option" + echo 1>&2 "Try '$0 --help' for more information" + exit 1 + ;; + +esac + +# Run the given program, remember its exit status. +"$@"; st=$? + +# If it succeeded, we are done. +test $st -eq 0 && exit 0 + +# Also exit now if we it failed (or wasn't found), and '--version' was +# passed; such an option is passed most likely to detect whether the +# program is present and works. +case $2 in --version|--help) exit $st;; esac + +# Exit code 63 means version mismatch. This often happens when the user +# tries to use an ancient version of a tool on a file that requires a +# minimum version. +if test $st -eq 63; then + msg="probably too old" +elif test $st -eq 127; then + # Program was missing. + msg="missing on your system" +else + # Program was found and executed, but failed. Give up. + exit $st +fi + +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software + +program_details () +{ + case $1 in + aclocal|automake) + echo "The '$1' program is part of the GNU Automake package:" + echo "<$gnu_software_URL/automake>" + echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/autoconf>" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + autoconf|autom4te|autoheader) + echo "The '$1' program is part of the GNU Autoconf package:" + echo "<$gnu_software_URL/autoconf/>" + echo "It also requires GNU m4 and Perl in order to run:" + echo "<$gnu_software_URL/m4/>" + echo "<$perl_URL>" + ;; + esac +} + +give_advice () +{ + # Normalize program name to check for. + normalized_program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + + printf '%s\n' "'$1' is $msg." + + configure_deps="'configure.ac' or m4 files included by 'configure.ac'" + case $normalized_program in + autoconf*) + echo "You should only need it if you modified 'configure.ac'," + echo "or m4 files included by it." + program_details 'autoconf' + ;; + autoheader*) + echo "You should only need it if you modified 'acconfig.h' or" + echo "$configure_deps." + program_details 'autoheader' + ;; + automake*) + echo "You should only need it if you modified 'Makefile.am' or" + echo "$configure_deps." + program_details 'automake' + ;; + aclocal*) + echo "You should only need it if you modified 'acinclude.m4' or" + echo "$configure_deps." + program_details 'aclocal' + ;; + autom4te*) + echo "You might have modified some maintainer files that require" + echo "the 'autom4te' program to be rebuilt." + program_details 'autom4te' + ;; + bison*|yacc*) + echo "You should only need it if you modified a '.y' file." + echo "You may want to install the GNU Bison package:" + echo "<$gnu_software_URL/bison/>" + ;; + lex*|flex*) + echo "You should only need it if you modified a '.l' file." + echo "You may want to install the Fast Lexical Analyzer package:" + echo "<$flex_URL>" + ;; + help2man*) + echo "You should only need it if you modified a dependency" \ + "of a man page." + echo "You may want to install the GNU Help2man package:" + echo "<$gnu_software_URL/help2man/>" + ;; + makeinfo*) + echo "You should only need it if you modified a '.texi' file, or" + echo "any other file indirectly affecting the aspect of the manual." + echo "You might want to install the Texinfo package:" + echo "<$gnu_software_URL/texinfo/>" + echo "The spurious makeinfo call might also be the consequence of" + echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" + echo "want to install GNU make:" + echo "<$gnu_software_URL/make/>" + ;; + *) + echo "You might have modified some files without having the proper" + echo "tools for further handling them. Check the 'README' file, it" + echo "often tells you about the needed prerequisites for installing" + echo "this package. You may also peek at any GNU archive site, in" + echo "case some other package contains this missing '$1' program." + ;; + esac +} + +give_advice "$1" | sed -e '1s/^/WARNING: /' \ + -e '2,$s/^/ /' >&2 + +# Propagate the correct exit status (expected to be 127 for a program +# not found, 63 for a program that failed due to version mismatch). +exit $st + +# Local variables: +# eval: (add-hook 'before-save-hook 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC0" +# time-stamp-end: "; # UTC" +# End: diff --git a/callback/COPYING b/callback/COPYING new file mode 100644 index 0000000..a3d1815 --- /dev/null +++ b/callback/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 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 + + Appendix: 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. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +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. + + , 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/callback/MIGRATION b/callback/MIGRATION new file mode 100644 index 0000000..6ce7402 --- /dev/null +++ b/callback/MIGRATION @@ -0,0 +1,79 @@ +Migration Guide +=============== + +When switching from vacall+trampoline to callback, you need to make the +following changes to your code: + + vacall+trampoline callback + ----------------- -------- + + -- Include files -- + +#include "vacall/vacall.h" #include "callback/callback.h" +#include "trampoline/trampoline.h" + + -- Variable declarations -- + +static void* trampvar; + + -- Callback declaration -- + +static void static void +mycallback (va_alist args) mycallback (void* data, va_alist args) +{ { + void* data = trampvar; ... + ... + + -- Initialization -- + +vacall_function = &mycallback; + + -- Allocating a callback -- + +void* trampoline = void* trampoline = + alloc_trampoline( alloc_callback(&mycallback,data); + (__TR_function)&vacall, + &trampvar, + data); + + -- Testing for a callback -- + +if if +(is_trampoline(address) (is_callback(address) + && (trampoline_address(address) && (callback_address(address) + == (__TR_function)&vacall) == &mycallback) + && (trampoline_variable(address) ) + == &trampvar) +) + +void* data = trampoline_data(address); void* data = callback_data(address); + + -- Deallocating a callback -- + +free_trampoline(address); free_callback(address); + + -- Libraries -- + +libvacall.a libtrampoline.a libcallback.a + + +================================================================================ +Copyright (C) 1995-1998 Bruno Haible + +This manual is free documentation. It is dually licensed under the +GNU FDL and the GNU GPL. This means that you can redistribute this +manual under either of these two licenses, at your choice. + +This manual is covered by the GNU FDL. Permission is granted to copy, +distribute and/or modify this document under the terms of the +GNU Free Documentation License (FDL), either version 1.2 of the +License, or (at your option) any later version published by the +Free Software Foundation (FSF); with no Invariant Sections, with no +Front-Cover Text, and with no Back-Cover Texts. +A copy of the license is at . + +This manual is covered by the GNU GPL. You can redistribute it and/or +modify it under the terms of the GNU General Public License (GPL), either +version 2 of the License, or (at your option) any later version published +by the Free Software Foundation (FSF). +A copy of the license is at . diff --git a/callback/Makefile.in b/callback/Makefile.in new file mode 100644 index 0000000..00535b2 --- /dev/null +++ b/callback/Makefile.in @@ -0,0 +1,236 @@ +# Makefile for callback + +#### Start of system configuration section. #### + +HOST = @host@ +CPU = @HOST_CPU_C_ABI@ + +# Directories used by "make": +srcdir = @srcdir@ + +# Directories used by "make install": +prefix = @prefix@ +local_prefix = /usr/local +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +mandir = @mandir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +htmldir = $(datadir)/html + +# Programs used by "make": +# C compiler +CC = @CC@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +# C++ compiler +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +# Both C and C++ compiler +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I. -I$(srcdir) -I.. -I$(srcdir)/.. -I$(srcdir)/vacall_r +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile +LIBTOOL_LINK = $(LIBTOOL) --mode=link +LIBTOOL_INSTALL = $(LIBTOOL) --mode=install +LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall +AR = @AR@ +AR_FLAGS = rc +RANLIB = @RANLIB@ +RM = rm -f +@SET_MAKE@ + +# Programs used by "make install": +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +# Libtool options for linking with the thread library. +LTLIBTHREAD = @LTLIBTHREAD@ + +#### End of system configuration section. #### + +SHELL = /bin/sh + +# Needed by $(LIBTOOL). +top_builddir = .. + +# Limit the set of exported symbols, on those platforms where libtool supports it. +# Currently this excludes the symbols from gnulib modules. +LIBCALLBACK_EXPORTED_SYMBOLS_REGEX = '^callback_|_callback$$|^trampoline_r_data0$$' + +# Before making a release, change this according to the libtool documentation, +# section "Library interface versions". +LIBCALLBACK_VERSION_INFO = 1:4:0 + +all : all-subdirs libcallback.la $(srcdir)/callback.3 $(srcdir)/callback.html + +all-subdirs : force + cd @callback_subdir@ && $(MAKE) all + +callback-libapi.lo : $(srcdir)/callback-libapi.c $(srcdir)/callback.h $(srcdir)/trampoline_r/trampoline_r.h ../config.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) -I$(srcdir)/trampoline_r $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/callback-libapi.c + +callback-compat.lo : $(srcdir)/callback-compat.c ../config.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/callback-compat.c + +libcallback.la : vacall_r/libvacall.la trampoline_r/libtrampoline.la callback-libapi.lo callback-compat.lo + $(LIBTOOL_LINK) $(CC) -o libcallback.la -rpath $(libdir) -no-undefined -export-symbols-regex $(LIBCALLBACK_EXPORTED_SYMBOLS_REGEX) -version-info $(LIBCALLBACK_VERSION_INFO) vacall_r/vacall.lo vacall_r/vacall-libapi.lo vacall_r/vacall-structcpy.lo trampoline_r/*.lo callback-libapi.lo callback-compat.lo ../gnulib-lib/libgnu.la $(LDFLAGS) $(LTLIBTHREAD) + +# Installs the library and include files only. Typically called with only +# $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here. +install-lib : all force + cd vacall_r && $(MAKE) install-lib libdir='$(libdir)' includedir='$(includedir)' + mkdir -p $(libdir) + $(LIBTOOL_INSTALL) $(INSTALL_DATA) libcallback.la $(libdir)/libcallback.la + mkdir -p $(includedir) + $(INSTALL_DATA) $(srcdir)/callback.h $(includedir)/callback.h + +install : force + cd vacall_r && $(MAKE) install + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(exec_prefix) + mkdir -p $(DESTDIR)$(libdir) + $(LIBTOOL_INSTALL) $(INSTALL_DATA) libcallback.la $(DESTDIR)$(libdir)/libcallback.la + mkdir -p $(DESTDIR)$(includedir) + $(INSTALL_DATA) $(srcdir)/callback.h $(DESTDIR)$(includedir)/callback.h + mkdir -p $(DESTDIR)$(mandir) + mkdir -p $(DESTDIR)$(mandir)/man3 + $(INSTALL_DATA) $(srcdir)/callback.3 $(DESTDIR)$(mandir)/man3/callback.3 + mkdir -p $(DESTDIR)$(datadir) + mkdir -p $(DESTDIR)$(htmldir) + $(INSTALL_DATA) $(srcdir)/callback.html $(DESTDIR)$(htmldir)/callback.html + +installdirs : force + cd vacall_r && $(MAKE) installdirs + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(exec_prefix) + mkdir -p $(DESTDIR)$(libdir) + mkdir -p $(DESTDIR)$(includedir) + mkdir -p $(DESTDIR)$(mandir) + mkdir -p $(DESTDIR)$(mandir)/man3 + mkdir -p $(DESTDIR)$(datadir) + mkdir -p $(DESTDIR)$(htmldir) + +uninstall : force + cd vacall_r && $(MAKE) uninstall + $(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libcallback.la + $(RM) $(DESTDIR)$(includedir)/callback.h + $(RM) $(DESTDIR)$(mandir)/man3/callback.3 + $(RM) $(DESTDIR)$(htmldir)/callback.html + +test1.@OBJEXT@ : $(srcdir)/test1.c $(srcdir)/callback.h $(srcdir)/vacall_r/vacall_r.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/test1.c + +test1 : test1.@OBJEXT@ libcallback.la + $(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ test1.@OBJEXT@ libcallback.la $(LDFLAGS) -o test1 + +minitests.@OBJEXT@ : $(srcdir)/minitests.c $(srcdir)/tests.c $(srcdir)/callback.h $(srcdir)/vacall_r/vacall_r.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/minitests.c + +minitests.s : $(srcdir)/minitests.c $(srcdir)/tests.c $(srcdir)/callback.h $(srcdir)/vacall_r/vacall_r.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -S $(srcdir)/minitests.c + +minitests : minitests.@OBJEXT@ libcallback.la + $(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ minitests.@OBJEXT@ libcallback.la $(LDFLAGS) -o minitests + +minitests-c++.@OBJEXT@ : $(srcdir)/minitests-c++.cc $(srcdir)/minitests.c $(srcdir)/tests.c $(srcdir)/callback.h $(srcdir)/vacall_r/vacall_r.h + $(CXX) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) -c $(srcdir)/minitests-c++.cc + +minitests-c++ : minitests-c++.@OBJEXT@ libcallback.la + $(LIBTOOL_LINK) $(CXX) $(CXXFLAGS) @GCC_X_NONE@ minitests-c++.@OBJEXT@ libcallback.la $(LDFLAGS) -o minitests-c++ + +check-subdirs : force + cd @callback_subdir@ && $(MAKE) check + +check : all check-subdirs test1 minitests + ./test1 + ./minitests > minitests.out + LC_ALL=C uniq -u < minitests.out > minitests.output.$(HOST) + test '!' -s minitests.output.$(HOST) +@IF_CXX@ ./minitests-c++ > minitests-c++.out +@IF_CXX@ LC_ALL=C uniq -u < minitests-c++.out > minitests-c++.output.$(HOST) +@IF_CXX@ test '!' -s minitests-c++.output.$(HOST) +@IF_CXX@check : minitests-c++ + +tests.@OBJEXT@ : $(srcdir)/tests.c $(srcdir)/callback.h $(srcdir)/vacall_r/vacall_r.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/tests.c + +tests.s : $(srcdir)/tests.c $(srcdir)/callback.h $(srcdir)/vacall_r/vacall_r.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -S $(srcdir)/tests.c + +tests : tests.@OBJEXT@ libcallback.la + $(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ tests.@OBJEXT@ libcallback.la $(LDFLAGS) -o tests + +extracheck-subdirs : force + cd @callback_subdir@ && $(MAKE) extracheck + +extracheck : all extracheck-subdirs tests + ./tests > tests.out + LC_ALL=C uniq -u < tests.out > tests.output.$(HOST) + test '!' -s tests.output.$(HOST) + +MOSTLYCLEANDIRS = .libs _libs +MOSTLYCLEANFILES = \ + *.@OBJEXT@ *.lo core \ + libcallback.* \ + test1.@OBJEXT@ test1 \ + minitests.@OBJEXT@ minitests.s minitests minitests.out \ + minitests-c++.@OBJEXT@ minitests-c++ minitests-c++.out \ + tests.@OBJEXT@ tests.s tests tests.out + +mostlyclean : force + cd @callback_subdir@ && $(MAKE) mostlyclean + $(RM) -r $(MOSTLYCLEANDIRS) + $(RM) $(MOSTLYCLEANFILES) + +clean : force + cd @callback_subdir@ && $(MAKE) clean + $(RM) -r $(MOSTLYCLEANDIRS) + $(RM) $(MOSTLYCLEANFILES) + +DISTCLEANFILES = \ + Makefile \ + minitests.output.* minitests-c++.output.* tests.output.* + +distclean : force + cd @callback_subdir@ && if test -f Makefile; then $(MAKE) distclean; fi + $(RM) -r $(MOSTLYCLEANDIRS) + $(RM) $(MOSTLYCLEANFILES) + $(RM) $(DISTCLEANFILES) + +maintainer-clean : force + cd @callback_subdir@ && if test -f Makefile; then $(MAKE) maintainer-clean; fi + $(RM) -r $(MOSTLYCLEANDIRS) + $(RM) $(MOSTLYCLEANFILES) + $(RM) $(DISTCLEANFILES) + + +# List of source files (committed in version control). +SOURCE_FILES = \ + COPYING MIGRATION PLATFORMS README callback.3 callback.html elf-hack.txt \ + Makefile.maint \ + Makefile.in \ + callback.h \ + callback-libapi.c \ + callback-compat.c \ + test1.c \ + minitests.c minitests-c++.cc \ + tests.c +# List of distributed files generated by Makefile.maint. +GENERATED_FILES = \ + callback.man +# List of distributed files. +DISTFILES = $(SOURCE_FILES) $(GENERATED_FILES) + +distdir : $(DISTFILES) + for file in $(DISTFILES); do \ + if test -f $$file; then dir='.'; else dir='$(srcdir)'; fi; \ + cp -p "$$dir/$$file" '$(distdir)'/$$file || exit 1; \ + done + test -d '$(distdir)'/@callback_subdir@ || mkdir '$(distdir)'/@callback_subdir@; cd @callback_subdir@ && $(MAKE) distdir distdir='$(distdir)'/@callback_subdir@ + + +force : diff --git a/callback/Makefile.maint b/callback/Makefile.maint new file mode 100644 index 0000000..c60fbae --- /dev/null +++ b/callback/Makefile.maint @@ -0,0 +1,29 @@ +# maintainer -*-Makefile-*- + +SHELL = /bin/sh +MAKE = make + +# ==================== Easily regeneratable files ==================== + +ROFF_MAN = groff -Tutf8 -mandoc + +all : callback.man \ + vacall_r/vacall-i386-msvc.c \ + trampoline_r/trampoline_r.man + +callback.man : callback.3 + $(ROFF_MAN) callback.3 > callback.man + +vacall_r/vacall-i386-msvc.c : vacall_r/vacall-i386-macro.S + cd vacall_r && $(MAKE) -f Makefile.maint vacall-i386-msvc.c + +trampoline_r/trampoline_r.man : trampoline_r/trampoline_r.3 + cd trampoline_r && $(MAKE) -f Makefile.maint trampoline_r.man + +totally-clean : force + $(RM) callback.man + cd vacall_r && $(MAKE) -f Makefile.maint totally-clean + cd trampoline_r && $(MAKE) -f Makefile.maint totally-clean + + +force : diff --git a/callback/PLATFORMS b/callback/PLATFORMS new file mode 100644 index 0000000..df4c6e2 --- /dev/null +++ b/callback/PLATFORMS @@ -0,0 +1,43 @@ +Supported CPUs: (Put the GNU config.guess values here.) + i386 i486-pc-linux (gcc), i686-unknown-gnu0.9 (gcc), + i386-pc-solaris2.6 (gcc), i386-pc-solaris2.10 (gcc, cc), + i386-w64-mingw32 (gcc, MSVC 14), + i586-unknown-freebsd11.0 (cc), i386-unknown-dragonfly3.8 (gcc), + i386-unknown-netbsdelf7.0 (gcc), i386-unknown-openbsd6.0 (gcc), + i586-pc-haiku (gcc-x86), i386-pc-minix (clang) + m68k m68k-unknown-linux (gcc) + mips mips-sgi-irix5.3 (gcc), mips-sgi-irix6.4 (cc -32, -n32, -64), + mips-sgi-irix6.5 (cc -32, -n32, gcc -mabi=n32), + mips-unknown-linux (gcc -mabi=32), + mips64-unknown-linux (gcc -mabi=n32, gcc -mabi=64) + sparc sparc-sun-sunos4.1.3_U1 (gcc), sparc-sun-solaris2.4 (gcc), + sparc-sun-solaris2.10 (gcc, cc), + sparc64-sun-solaris2.10 (gcc -m64, cc -xarch=generic64), + sparc-unknown-linux (gcc), sparc64-unknown-linux (gcc), + sparc-unknown-netbsdelf7.1 (gcc), + sparc64-unknown-netbsd8.0 (gcc) + alpha alpha-dec-osf3.2 (gcc), alpha-dec-osf4.0 (gcc, cc), + alphaev67-unknown-linux (gcc) + hppa hppa1.1-hp-hpux9.05 (cc), hppa1.1-hp-hpux10.01 (cc), + hppa2.0-hp-hpux10.20 (cc +DA1.1), hppa2.0w-hp-hpux11.31 (cc), + hppa-unknown-linux (gcc) + hppa64 hppa64-hp-hpux11.31 (cc +DD64) + arm armv5tejl-unknown-linux (gcc), armv6l-unknown-linux (gcc), + armv7l-unknown-linux (gcc) + arm64 aarch64-unknown-linux (gcc), aarch64-apple-darwin20.4.0 (cc) + powerpc powerpc-ibm-aix7.1.3.0 (xlc, gcc), powerpc-unknown-linux (gcc), + powerpc-apple-darwin6.8 (gcc), powerpc-apple-darwin9.8.0 (gcc) + powerpc64 powerpc-ibm-aix7.1.3.0 (gcc -maix64, xlc -q64; AR="ar -X 64"), + powerpc64-unknown-linux (gcc -m64), + powerpc64le-unknown-linux (gcc) + ia64 ia64-unknown-linux (gcc) + x86_64 x86_64-suse-linux (gcc), x86_64-unknown-linux (gcc -mx32), + x86_64-pc-solaris2.10 (gcc -m64, cc -xarch=generic64), + x86_64-pc-cygwin (gcc), x86_64-w64-mingw32 (gcc, MSVC 14), + x86_64-unknown-freebsd11.0 (cc), x86_64-unknown-netbsd7.0 (gcc), + x86_64-unknown-openbsd6.0 (gcc) + s390 s390x-ibm-linux (gcc -m31) + s390x s390x-ibm-linux (gcc) + riscv32 riscv32-unknown-linux (gcc -mabi=ilp32d) + riscv64 riscv64-unknown-linux (gcc -mabi=lp64d) + diff --git a/callback/README b/callback/README new file mode 100644 index 0000000..3b655d9 --- /dev/null +++ b/callback/README @@ -0,0 +1,66 @@ +callback - closures with variable arguments as first-class C functions + +This library implements closures with variable arguments and variable return +values as first-class C functions. A closure consists of a regular C function +and a piece of data which gets passed to the C function when the closure is +called. + +This library is especially suited to the implementation of call-back functions +in embedded interpreters. + + +Installation instructions: + + Configure the parent directory. Then: + cd callback + make + make check + make install + + +Files in this package: + + Documentation: + + README this text + COPYING free software license + PLATFORMS list of supported platforms + MIGRATION migration guide from vacall+trampoline + callback.3 manual page in Unix man format + callback.man manual page + callback.html manual page in HTML format + + Source: + + callback.h include file + tests.c test program + vacall_r/* a reentrant version of the vacall package + trampoline_r/* a reentrant version of the trampoline package + + Building: + + Makefile.in Makefile master + + Porting: + + Makefile.devel developer's Makefile + call-used-registers.txt table of call-used registers on different CPUs + + +Copyright notice: + +Copyright 1995-2017 Bruno Haible + +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, see . + diff --git a/callback/callback-compat.c b/callback/callback-compat.c new file mode 100644 index 0000000..fd3fc64 --- /dev/null +++ b/callback/callback-compat.c @@ -0,0 +1,24 @@ +/* + * Copyright 2017 Bruno Haible + * + * 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, see . + */ + +#include "config.h" + +#include + +/* A dummy symbol, so that GNU clisp's autoconfiguration recognizes this + library. */ +void trampoline_r_data0 (void) { abort(); } diff --git a/callback/callback-libapi.c b/callback/callback-libapi.c new file mode 100644 index 0000000..f1384c5 --- /dev/null +++ b/callback/callback-libapi.c @@ -0,0 +1,53 @@ +/* + * Copyright 2017 Bruno Haible + * + * 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, see . + */ + +#include "config.h" + +#define __TR_function obsolete__TR_function +#include "callback.h" +#undef __TR_function +#include "trampoline_r.h" + +/* This is the implementation of the library API. + The symbols that the linker sees are all prefixed with 'callback_', + to avoid potential collisions with other libraries. */ + +callback_t alloc_callback (callback_function_t address, void* data) +{ + return alloc_trampoline_r((__TR_function)callback_get_receiver(),(void*)address,data); +} + +void free_callback (callback_t callback) +{ + free_trampoline_r (callback); +} + +int is_callback (void* callback) +{ + return is_trampoline_r(callback) + && trampoline_r_address((__TR_function)callback) == (__TR_function)callback_get_receiver(); +} + +callback_function_t callback_address (callback_t callback) +{ + return (callback_function_t)trampoline_r_data0(callback); +} + +void* callback_data (callback_t callback) +{ + return trampoline_r_data1(callback); +} diff --git a/callback/callback.3 b/callback/callback.3 new file mode 100644 index 0000000..5214077 --- /dev/null +++ b/callback/callback.3 @@ -0,0 +1,273 @@ +.\" Copyright (C) 1995-2017 Bruno Haible +.\" +.\" This manual is free documentation. It is dually licensed under the +.\" GNU FDL and the GNU GPL. This means that you can redistribute this +.\" manual under either of these two licenses, at your choice. +.\" +.\" This manual is covered by the GNU FDL. Permission is granted to copy, +.\" distribute and/or modify this document under the terms of the +.\" GNU Free Documentation License (FDL), either version 1.2 of the +.\" License, or (at your option) any later version published by the +.\" Free Software Foundation (FSF); with no Invariant Sections, with no +.\" Front-Cover Text, and with no Back-Cover Texts. +.\" A copy of the license is at . +.\" +.\" This manual is covered by the GNU GPL. You can redistribute it and/or +.\" modify it under the terms of the GNU General Public License (GPL), either +.\" version 2 of the License, or (at your option) any later version published +.\" by the Free Software Foundation (FSF). +.\" A copy of the license is at . +.\" +.TH CALLBACK 3 "1 January 2017" +.SH NAME +callback \- closures with variable arguments as first-class C functions +.SH SYNOPSIS +.B #include +.LP +.nf +.BI "void " function " (void* " data ", va_alist " alist ")" +.BI "{" +.BI " va_start_" type "(" alist "[, " return_type "]);" +.BI " " arg " = va_arg_" type "(" alist "[, " arg_type "]);" +.BI " va_return_" type "(" alist "[[, " return_type "], " return_value "]);" +.BI "}" +.fi +.LP +.IB callback " = alloc_callback(" "&function" ", " data ");" +.LP +.BI "free_callback(" callback ");" +.LP +.nf +.BI "is_callback(" callback ")" +.BI "callback_address(" callback ")" +.BI "callback_data(" callback ")" +.fi +.SH DESCRIPTION +.LP +These functions implement +.I closures +with variable arguments as first-class C functions. + +Closures as +.I first-class C functions +means that they fit into a function pointer and can be called exactly +like any other C function. Moreover, they can be called with variable +arguments and can return variable return values. + +.IB callback " = alloc_callback(" "&function" ", " data ")" +allocates a callback. When +.I callback +gets called, it arranges to call +.IR function "," +passing +.I data +as first argument and, as second argument, the entire sequence of arguments +passed to +.IR callback . + +Function calling conventions differ considerably on different machines, +therefore the arguments are accessed and the result value is stored +through the same macros as used by the +.I vacall +package, see below. + +The callbacks are functions with indefinite extent: +.I callback +is only deallocated when +.BI free_callback( callback ) +is called. + +.BI "is_callback(" callback ")" +checks whether the C function +.I callback +was produced by a call to +.IR alloc_callback . +If this returns true, the arguments given to +.I alloc_callback +can be retrieved: +.RS 4 +.LP +.BI "callback_address(" callback ")" +returns +.IR "&function" , +.LP +.BI "callback_data(" callback ")" +returns +.IR data . +.RE + +.SH VACALL MACROS + +Within +.IR function , +the following macros can be used to walk through the argument list and +specify a return value: +.RS 0 +.TP +.BI "va_start_" type "(" alist "[, " return_type "]);" +starts the walk through the argument list and specifies the return type. +.TP +.IB arg " = va_arg_" type "(" alist "[, " arg_type "]);" +fetches the next argument from the argument list. +.TP +.BI "va_return_" type "(" alist "[[, " return_type "], " return_value "]);" +ends the walk through the argument list and specifies the return value. +.RE + +The +.I type +in +.BI va_start_ type +and +.BI va_return_ type +shall be one of +.BR void ", " int ", " uint ", " long ", " ulong ", " longlong ", " ulonglong ", " double ", " struct ", " ptr +or (for ANSI C calling conventions only) +.BR char ", " schar ", " uchar ", " short ", " ushort ", " float , +depending on the class of +.IR return_type . + +The +.I type +specifiers in +.BI va_start_ type +and +.BI va_return_ type +must be the same. +The +.I return_type +specifiers passed to +.BI va_start_ type +and +.BI va_return_ type +must be the same. + +The +.I type +in +.BI va_arg_ type +shall be one of +.BR int ", " uint ", " long ", " ulong ", " longlong ", " ulonglong ", " double ", " struct ", " ptr +or (for ANSI C calling conventions only) +.BR char ", " schar ", " uchar ", " short ", " ushort ", " float , +depending on the class of +.IR arg_type . + +In +.BI "va_start_struct(" alist ", " return_type ", " splittable ); +the +.I splittable +flag specifies whether the struct +.I return_type +can be returned in registers such that every struct field fits entirely in +a single register. This needs to be specified for structs of size +2*sizeof(long). For structs of size <= sizeof(long), +.I splittable +is ignored and assumed to be 1. For structs of size > 2*sizeof(long), +.I splittable +is ignored and assumed to be 0. There are some handy macros for this: +.nf +.BI "va_word_splittable_1 (" type1 ) +.BI "va_word_splittable_2 (" type1 ", " type2 ) +.BI "va_word_splittable_3 (" type1 ", " type2 ", " type3 ) +.BI "va_word_splittable_4 (" type1 ", " type2 ", " type3 ", " type4 ) +.fi +For a struct with three slots +.nf +.BI "struct { " "type1 id1" "; " "type2 id2" "; " "type3 id3" "; }" +.fi +you can specify +.I splittable +as +.BI "va_word_splittable_3 (" type1 ", " type2 ", " type3 ) +.RB . + +.SH NOTES + +Functions which want to emulate Kernighan & Ritchie style functions (i.e., +in ANSI C, functions without a typed argument list) cannot use the +.I type +values +.BR char ", " schar ", " uchar ", " short ", " ushort ", " float . +As prescribed by the default K&R C expression promotions, they have +to use +.B int +instead of +.BR char ", " schar ", " uchar ", " short ", " ushort +and +.B double +instead of +.BR float . + +The macros +.BR va_start_longlong(\|) , +.BR va_start_ulonglong(\|) , +.BR va_return_longlong(\|) , +.BR va_return_ulonglong(\|) , +.B va_arg_longlong(\|) +and +.B va_arg_ulonglong(\|) +work only if the C compiler has a working +.B long long +64-bit integer type. + +The struct types used in +.B va_start_struct(\|) +and +.B va_struct(\|) +must only contain (signed or unsigned) int, long, long long or pointer fields. +Struct types containing (signed or unsigned) char, short, float, double or +other structs are not supported. + +.SH SEE ALSO +.BR vacall (3), +.BR trampoline (3). + +.SH BUGS + +The current implementations have been tested on a selection of common +cases but there are probably still many bugs. + +There are typically built-in limits on the size of the argument-list, +which may also include the size of any structure arguments. + +The decision whether a struct is to be returned in registers or in memory +considers only the struct's size and alignment. This is inaccurate: for +example, gcc on m68k-next returns +.B "struct { char a,b,c; }" +in registers and +.B "struct { char a[3]; }" +in memory, although both types have the same size and the same alignment. + +The argument list can only be walked once. + +.SH NON-BUGS + +All information is passed in CPU registers and the stack. The +.B callback +package is therefore multithread-safe. + +.SH PORTING + +Porting +.B callback +consists in first porting the +.B vacall +and +.B trampoline +packages, then choosing a CPU register for passing the closure from +.B trampoline +to +.BR vacall . +This register is normally the register designated by STATIC_CHAIN_REGNUM +in the gcc source, file +.RI gcc-2.7.2/config/ cpu / cpu .h. + +.SH AUTHOR + +Bruno Haible + +.SH ACKNOWLEDGEMENTS + +Many ideas were cribbed from the gcc source. + diff --git a/callback/callback.h b/callback/callback.h new file mode 100644 index 0000000..667b067 --- /dev/null +++ b/callback/callback.h @@ -0,0 +1,90 @@ +/* + * Copyright 1997-2017 Bruno Haible + * + * 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, see . + */ + +#ifndef _CALLBACK_H +#define _CALLBACK_H + +#include "ffcall-version.h" + +/* Defines the type 'va_alist' and the va_* macros. */ +#include "vacall_r.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* This type denotes an opaque function pointer. + You need to cast it to an actual function pointer type (with correct return + type) before you can actually invoke it. */ +#ifdef __cplusplus +typedef int (*callback_t) (...); +#else +typedef int (*callback_t) (); +#endif +/* A deprecated alias of this type. */ +typedef callback_t __TR_function; + +/* This type denotes a callback implementation. + DATA is the pointer that was passed to alloc_callback(). + ALIST allows to iterate over the argument list. */ +typedef void (*callback_function_t) (void* /* DATA */, va_alist /* ALIST */); + + +/* Allocates a callback. + It returns a function pointer whose signature depends on the behaviour + of ADDRESS. + When invoked, it passes DATA as first argument to ADDRESS and the actual + arguments as a va_alist to ADDRESS. It returns the value passed to a + va_return_* macro by ADDRESS. + The callback has indefinite extent. It can be accessed until a call to + free_callback(). + */ +extern callback_t alloc_callback (callback_function_t /* ADDRESS */, void* /* DATA */); + +/* Frees the memory used by a callback. + CALLBACK must be the result of an alloc_callback() invocation. + After this call, CALLBACK must not be used any more - neither invoked, + not used as an argument to other functions. + */ +extern void free_callback (callback_t /* CALLBACK */); + + +/* Tests whether a given pointer is a function pointer returned by + alloc_callback(). Returns 1 for yes, 0 for no. + If yes, it can be cast to callback_t. + */ +extern int is_callback (void* /* CALLBACK */); + +/* Returns the ADDRESS argument passed to the alloc_callback() invocation. + CALLBACK must be the result of an alloc_callback() invocation. + */ +extern callback_function_t callback_address (callback_t /* CALLBACK */); + +/* Returns the DATA argument passed to the alloc_callback() invocation. + CALLBACK must be the result of an alloc_callback() invocation. + */ +extern void* callback_data (callback_t /* CALLBACK */); + + +#ifdef __cplusplus +} +#endif + + +#endif /* _CALLBACK_H */ diff --git a/callback/callback.html b/callback/callback.html new file mode 100644 index 0000000..bc0c675 --- /dev/null +++ b/callback/callback.html @@ -0,0 +1,290 @@ + + + + CALLBACK manual page + + +

CALLBACK manual page

+ + +

+ +


+ + +

Name

+
+ +callback - closures with variable arguments as first-class +C functions + + +

Synopsis

+
+ +
+#include <callback.h>
+
+

+

+void function (void* data, va_alist alist)
+{
+  va_start_type(alist[, return_type]);
+  arg = va_arg_type(alist[, arg_type]);
+  va_return_type(alist[[, return_type], return_value]);
+}
+
+

+

+callback = alloc_callback(&function, data);
+
+

+

+free_callback(callback);
+
+

+

+is_callback(callback)
+callback_address(callback)
+callback_data(callback)
+
+ + +

Description

+
+ +These functions implement closures with variable arguments +as first-class C functions. +

+Closures as first-class C functions means that they fit +into a function pointer and can be called exactly like any +other C function. Moreover, they can be called with variable +arguments and can return variable return values. +

+callback = alloc_callback(&function, data) +allocates a +callback. When callback gets called, it arranges to call +function, passing data as first argument and, as second +argument, the entire sequence of arguments passed to callback. +

+Function calling conventions differ considerably on different +machines, therefore the arguments are accessed and +the result value is stored through the same macros as used +by the vacall package, see below. +

+The callbacks are functions with indefinite extent: callback +is only deallocated when free_callback(callback) is +called. +

+is_callback(callback) +checks whether the C function callback +was produced by a call to alloc_callback. If this +returns true, the arguments given to alloc_callback can be +retrieved: +

    +
  • callback_address(callback) returns &function, +
  • callback_data(callback) returns data. +
+ + +

VACALL macros

+
+ +Within function, the following macros can be used to walk +through the argument list and specify a return value: +

+

+va_start_type(alist[, return_type]);
+
+starts the walk through the argument list and specifies the return type. +

+

+arg = va_arg_type(alist[, arg_type]);
+
+fetches the next argument from the argument list. +

+

+va_return_type(alist[[, return_type], return_value]);
+
+ends the walk through the argument list and specifies the return value. +

+The type in va_start_type + and va_return_type shall be one +of void, int, uint, long, +ulong, longlong, ulonglong, +double, struct, ptr +or +(for ANSI C calling conventions only) +char, schar, uchar, +short, ushort, float, +depending on the class of return_type. +

+The type specifiers in +va_start_type and va_return_type + must be the same. +The return_type specifiers passed to +va_start_type and va_return_type + must be the same. +

+The type in va_arg_type +shall be one of int, uint, long, +ulong, longlong, ulonglong, +double, struct, ptr +or (for ANSI C calling conventions only) +char, schar, uchar, +short, ushort, float, +depending on the class of arg_type. +

+In va_start_struct(alist, return_type, splittable); the +splittable flag specifies whether the struct return_type can +be returned in registers such that every struct field fits +entirely in a single register. This needs to be specified +for structs of size 2*sizeof(long). For structs of size +<= sizeof(long), splittable is ignored and assumed to be 1. +For structs of size > 2*sizeof(long), splittable is +ignored and assumed to be 0. There are some handy macros +for this: +

+va_word_splittable_1 (type1)
+va_word_splittable_2 (type1, type2)
+va_word_splittable_3 (type1, type2, type3)
+va_word_splittable_4 (type1, type2, type3, type4)
+
+For a struct with three slots +
+struct { type1 id1; type2 id2; type3 id3; }
+
+you can specify splittable as +va_word_splittable_3 (type1, type2, type3). + + +

Notes

+
+ +
    +
  1. Functions which want to emulate Kernighan & Ritchie style +functions (i.e., in ANSI C, functions without a typed +argument list) cannot use the type values +char, schar, uchar, +short, ushort, float. +As prescribed by the default +K&R C expression promotions, they have to use int instead +of char, schar, uchar, +short, ushort and double instead of +float. +

    +

  2. The macros va_start_longlong(), +va_start_ulonglong(), va_return_longlong(), +va_return_ulonglong(), va_arg_longlong() and +va_arg_ulonglong() work only if the C compiler has a working +long long 64-bit integer type. +

    +

  3. The struct types used in va_start_struct() and +va_struct() must only contain (signed or unsigned) int, +long, long long or pointer fields. Struct types containing +(signed or unsigned) char, short, float, double or other +structs are not supported. +

    +

+ + +

See also

+
+ +vacall(3), trampoline(3). + + +

Bugs

+
+ +The current implementations have been tested on a selection +of common cases but there are probably still many +bugs. +

+There are typically built-in limits on the size of the +argument-list, which may also include the size of any +structure arguments. +

+The decision whether a struct is to be returned in registers or in memory +considers only the struct's size and alignment. This is inaccurate: for +example, gcc on m68k-next returns +struct { char a,b,c; } +in registers and +struct { char a[3]; } +in memory, although both types have the same size and the same alignment. +

+The argument list can only be walked once. + + +

Non-Bugs

+ + +All information is passed in CPU registers and the stack. +The callback package is therefore multithread-safe. + + +

Porting

+
+ +Porting callback consists in first porting the vacall and +trampoline packages, then choosing a CPU register for +passing the closure from trampoline to vacall. This +register is normally the register designated by +STATIC_CHAIN_REGNUM in the gcc source, file +gcc-2.7.2/config/cpu/cpu.h. + + +

Author

+
+ +Bruno Haible <bruno@clisp.org> + + +

Acknowledgements

+
+ +Many ideas were cribbed from the gcc source. +

+ +


+ +
CALLBACK manual page
+Bruno Haible <bruno@clisp.org> +
+

+Last modified: 1 January 2017. + + + diff --git a/callback/callback.man b/callback/callback.man new file mode 100644 index 0000000..8f3a81d --- /dev/null +++ b/callback/callback.man @@ -0,0 +1,164 @@ +CALLBACK(3) Library Functions Manual CALLBACK(3) + + + +NAME + callback - closures with variable arguments as first-class C functions + +SYNOPSIS + #include  + + void function (void* data, va_alist alist) + { + va_start_type(alist[, return_type]); + arg = va_arg_type(alist[, arg_type]); + va_return_type(alist[[, return_type], return_value]); + } + + callback = alloc_callback(&function, data); + + free_callback(callback); + + is_callback(callback) + callback_address(callback) + callback_data(callback) + +DESCRIPTION + These functions implement closures with variable arguments as first- + class C functions. + + Closures as first-class C functions means that they fit into a function + pointer and can be called exactly like any other C function. Moreover, + they can be called with variable arguments and can return variable + return values. + + callback = alloc_callback(&function, data) allocates a callback. When + callback gets called, it arranges to call function, passing data as + first argument and, as second argument, the entire sequence of argu‐ + ments passed to callback. + + Function calling conventions differ considerably on different machines, + therefore the arguments are accessed and the result value is stored + through the same macros as used by the vacall package, see below. + + The callbacks are functions with indefinite extent: callback is only + deallocated when free_callback(callback) is called. + + is_callback(callback) checks whether the C function callback was pro‐ + duced by a call to alloc_callback. If this returns true, the arguments + given to alloc_callback can be retrieved: + + callback_address(callback) returns &function, + + callback_data(callback) returns data. + + +VACALL MACROS + Within function, the following macros can be used to walk through the + argument list and specify a return value: + + va_start_type(alist[, return_type]); + starts the walk through the argument list and specifies the + return type. + + arg = va_arg_type(alist[, arg_type]); + fetches the next argument from the argument list. + + va_return_type(alist[[, return_type], return_value]); + ends the walk through the argument list and specifies the return + value. + + The type in va_start_type and va_return_type shall be one of void, int, + uint, long, ulong, longlong, ulonglong, double, struct, ptr or (for + ANSI C calling conventions only) char, schar, uchar, short, ushort, + float, depending on the class of return_type. + + The type specifiers in va_start_type and va_return_type must be the + same. The return_type specifiers passed to va_start_type and + va_return_type must be the same. + + The type in va_arg_type shall be one of int, uint, long, ulong, long‐ + long, ulonglong, double, struct, ptr or (for ANSI C calling conventions + only) char, schar, uchar, short, ushort, float, depending on the class + of arg_type. + + In va_start_struct(alist, return_type, splittable); the splittable flag + specifies whether the struct return_type can be returned in registers + such that every struct field fits entirely in a single register. This + needs to be specified for structs of size 2*sizeof(long). For structs + of size <= sizeof(long), splittable is ignored and assumed to be 1. For + structs of size > 2*sizeof(long), splittable is ignored and assumed to + be 0. There are some handy macros for this: + va_word_splittable_1 (type1) + va_word_splittable_2 (type1, type2) + va_word_splittable_3 (type1, type2, type3) + va_word_splittable_4 (type1, type2, type3, type4) + For a struct with three slots + struct { type1 id1; type2 id2; type3 id3; } + you can specify splittable as va_word_splittable_3 (type1, type2, + type3) . + + +NOTES + Functions which want to emulate Kernighan & Ritchie style functions + (i.e., in ANSI C, functions without a typed argument list) cannot use + the type values char, schar, uchar, short, ushort, float. As pre‐ + scribed by the default K&R C expression promotions, they have to use + int instead of char, schar, uchar, short, ushort and double instead of + float. + + The macros va_start_longlong(), va_start_ulonglong(), va_return_long‐ + long(), va_return_ulonglong(), va_arg_longlong() and va_arg_ulonglong() + work only if the C compiler has a working long long 64-bit integer + type. + + The struct types used in va_start_struct() and va_struct() must only + contain (signed or unsigned) int, long, long long or pointer fields. + Struct types containing (signed or unsigned) char, short, float, double + or other structs are not supported. + + +SEE ALSO + vacall(3), trampoline(3). + + +BUGS + The current implementations have been tested on a selection of common + cases but there are probably still many bugs. + + There are typically built-in limits on the size of the argument-list, + which may also include the size of any structure arguments. + + The decision whether a struct is to be returned in registers or in mem‐ + ory considers only the struct's size and alignment. This is inaccurate: + for example, gcc on m68k-next returns struct { char a,b,c; } in regis‐ + ters and struct { char a[3]; } in memory, although both types have the + same size and the same alignment. + + The argument list can only be walked once. + + +NON-BUGS + All information is passed in CPU registers and the stack. The callback + package is therefore multithread-safe. + + +PORTING + Porting callback consists in first porting the vacall and trampoline + packages, then choosing a CPU register for passing the closure from + trampoline to vacall. This register is normally the register desig‐ + nated by STATIC_CHAIN_REGNUM in the gcc source, file gcc-2.7.2/con‐ + fig/cpu/cpu.h. + + +AUTHOR + Bruno Haible + + +ACKNOWLEDGEMENTS + Many ideas were cribbed from the gcc source. + + + + + 1 January 2017 CALLBACK(3) diff --git a/callback/elf-hack.txt b/callback/elf-hack.txt new file mode 100644 index 0000000..9b5eee4 --- /dev/null +++ b/callback/elf-hack.txt @@ -0,0 +1,53 @@ +Workaround against the ELF symbol resolving routine +=================================================== + +On Solaris 2.6 / i386, when the function being jumped to is an external symbol +of a shared library, the jump actually points to an ELF indirect jump: + jmp *PTR +where PTR initially contains the address of some resolving routine which +will replace the PTR contents with the actual code address of the function +and then jump to the function. +Unfortunately, this resolving routine clobbers all three registers: +%eax, %edx, %ecx. But %ecx is the register in which we pass the env_t +(that points to function and data) to callback_receiver. + +The same effect is also seen on Linux / x86_64, where r10 is clobbered by the +resolving routine (called '_dl_runtime_resolve' in glibc). +See https://savannah.gnu.org/bugs/?32466 . + +The same thing can happen on all platforms that support ELF, since the +lexical closure register is always a call-used register (see file +call-used-registers.txt). + +On i386 (and m68k), it would be possible to solve this by passing the env_t +as an extra argument on the stack and restore it to the lexical closure +register at the beginning of callback_receiver. But this approach becomes too +complex for the other CPUs. + +It is not possible to make a first call to callback_receiver to "straighten +things out", because during this first call the lexical closure register gets +clobbered and callback_receiver then invokes undefined behaviour. + +It may be possible to fix this, on some platforms, + - by use of "ld -r" to combine object files, so that the code in + trampoline_r.o can access callback_receiver directly, or + - by use of symbol visibility control, so that callback_receiver is + not an external symbol of the shared library any more, or + - by an appropriate use of dlsym(). +But this is highly platform dependent (linker, compiler, libc) and there may +be some platforms for which none of these approaches works. + +A workaround that was implemented in January 2017 was to + 1) modify trampoline_r so that it produces a trampoline that pushes the + env_t on the stack (preserving correct stack alignment) instead of + putting it in the lexical closure register, + 2) insert a couple of instructions at the beginning of callback_receiver + that pops this value off the stack and puts in in the lexical closure + register. + +An even simpler workaround is to make callback_receiver a static function, +so that the ELF linker does not even see it. Instead introduce a function +callback_get_receiver that returns &callback_receiver. This function is global, +but since it has a normal calling convention, the ELF symbol resolving routine +does not cause trouble the first time callback_get_receiver() is invoked. + diff --git a/callback/minitests-c++.cc b/callback/minitests-c++.cc new file mode 100644 index 0000000..1738e11 --- /dev/null +++ b/callback/minitests-c++.cc @@ -0,0 +1,18 @@ +/* + * Copyright 2017 Bruno Haible + * + * 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, see . + */ + +#include "minitests.c" diff --git a/callback/minitests.c b/callback/minitests.c new file mode 100644 index 0000000..b0f50fe --- /dev/null +++ b/callback/minitests.c @@ -0,0 +1,19 @@ +/* + * Copyright 1999-2001 Bruno Haible + * + * 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, see . + */ + +#define SKIP_EXTRA_STRUCTS +#include "tests.c" diff --git a/callback/test1.c b/callback/test1.c new file mode 100644 index 0000000..16625f2 --- /dev/null +++ b/callback/test1.c @@ -0,0 +1,52 @@ +/* Trampoline test */ + +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +#include "config.h" /* Define __${host_cpu}__ */ + +#include +#include + +#include "callback.h" + +#define MAGIC1 0x9db9af42 +#define MAGIC2 0xa2f9d045 +#define MAGIC3 0x7aff3cb4 + +int f (int x) +{ + return x + MAGIC3; +} + +void vf (void* data, va_alist alist) +{ + if (data != (void*)MAGIC1) { printf("wrong data\n"); exit(1); } + va_start_int(alist); + {int a = va_arg_int(alist); + int r = f(a); + va_return_int(alist, r); +}} + +int main () +{ + callback_t cf = alloc_callback(&vf, (void*)MAGIC1); + if ((*cf)(MAGIC2) == MAGIC2+MAGIC3) + { free_callback(cf); printf("Works, test1 passed.\n"); exit(0); } + else + { printf("Doesn't work!\n"); exit(1); } +} diff --git a/callback/tests.c b/callback/tests.c new file mode 100644 index 0000000..f431efe --- /dev/null +++ b/callback/tests.c @@ -0,0 +1,2386 @@ +/* Some random tests for vacall. */ + +/* + * Copyright 1993 Bill Triggs + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include +#include +#include +#include "callback.h" + +#include "testcases.c" + +#if defined(__m68k__) && defined(__GNUC__) +/* "gcc-2.6.3 -freg-struct-return" returns T = struct { char c[3]; } (which + * has size 4 !) in memory, in contrast to struct { char a,b,c; } and + * struct { char c[4]; } and struct { char a,b,c,d; } which have the same + * size and the same alignment but are returned in registers. I don't know why. + */ +#define SKIP_T +#endif +#if defined(__sparc__) && defined(__sun) && defined(__SUNPRO_C) /* SUNWspro cc */ +/* SunPRO cc miscompiles the simulator function for X_BcdB: d.i[1] is + * temporarily stored in %l2 and put onto the stack from %l2, but in between + * the copy of X has used %l2 as a counter without saving and restoring its + * value. + */ +#define SKIP_X +#endif +#if defined(__mipsn32__) && !defined(__GNUC__) +/* The X test crashes for an unknown reason. */ +#define SKIP_X +#endif + + +/* These functions simulate the behaviour of the functions defined in testcases.c. */ + +/* void tests */ +void v_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&v_v) { fprintf(out,"wrong data for v_v\n"); exit(1); } + va_start_void(alist); + fprintf(out,"void f(void):\n"); + fflush(out); + va_return_void(alist); +} + +/* int tests */ +void i_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&i_v) { fprintf(out,"wrong data for i_v\n"); exit(1); } + va_start_int(alist); + {int r=99; + fprintf(out,"int f(void):"); + fflush(out); + va_return_int(alist, r); +}} +void i_i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&i_i) { fprintf(out,"wrong data for i_i\n"); exit(1); } + va_start_int(alist); + {int a = va_arg_int(alist); + int r=a+1; + fprintf(out,"int f(int):(%d)",a); + fflush(out); + va_return_int(alist, r); +}} +void i_i2_simulator (void* data, va_alist alist) +{ + if (data != (void*)&i_i2) { fprintf(out,"wrong data for i_i2\n"); exit(1); } + va_start_int(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int r=a+b; + fprintf(out,"int f(2*int):(%d,%d)",a,b); + fflush(out); + va_return_int(alist, r); +}} +void i_i4_simulator (void* data, va_alist alist) +{ + if (data != (void*)&i_i4) { fprintf(out,"wrong data for i_i4\n"); exit(1); } + va_start_int(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + int d = va_arg_int(alist); + int r=a+b+c+d; + fprintf(out,"int f(4*int):(%d,%d,%d,%d)",a,b,c,d); + fflush(out); + va_return_int(alist, r); +}} +void i_i8_simulator (void* data, va_alist alist) +{ + if (data != (void*)&i_i8) { fprintf(out,"wrong data for i_i8\n"); exit(1); } + va_start_int(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + int d = va_arg_int(alist); + int e = va_arg_int(alist); + int f = va_arg_int(alist); + int g = va_arg_int(alist); + int h = va_arg_int(alist); + int r=a+b+c+d+e+f+g+h; + fprintf(out,"int f(8*int):(%d,%d,%d,%d,%d,%d,%d,%d)",a,b,c,d,e,f,g,h); + fflush(out); + va_return_int(alist, r); +}} +void i_i16_simulator (void* data, va_alist alist) +{ + if (data != (void*)&i_i16) { fprintf(out,"wrong data for i_i16\n"); exit(1); } + va_start_int(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + int d = va_arg_int(alist); + int e = va_arg_int(alist); + int f = va_arg_int(alist); + int g = va_arg_int(alist); + int h = va_arg_int(alist); + int i = va_arg_int(alist); + int j = va_arg_int(alist); + int k = va_arg_int(alist); + int l = va_arg_int(alist); + int m = va_arg_int(alist); + int n = va_arg_int(alist); + int o = va_arg_int(alist); + int p = va_arg_int(alist); + int r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p; + fprintf(out,"int f(16*int):(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)", + a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); + fflush(out); + va_return_int(alist, r); +}} +void i_i32_simulator (void* data, va_alist alist) +{ + if (data != (void*)&i_i32) { fprintf(out,"wrong data for i_i32\n"); exit(1); } + va_start_int(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + int d = va_arg_int(alist); + int e = va_arg_int(alist); + int f = va_arg_int(alist); + int g = va_arg_int(alist); + int h = va_arg_int(alist); + int i = va_arg_int(alist); + int j = va_arg_int(alist); + int k = va_arg_int(alist); + int l = va_arg_int(alist); + int m = va_arg_int(alist); + int n = va_arg_int(alist); + int o = va_arg_int(alist); + int p = va_arg_int(alist); + int aa = va_arg_int(alist); + int ab = va_arg_int(alist); + int ac = va_arg_int(alist); + int ad = va_arg_int(alist); + int ae = va_arg_int(alist); + int af = va_arg_int(alist); + int ag = va_arg_int(alist); + int ah = va_arg_int(alist); + int ai = va_arg_int(alist); + int aj = va_arg_int(alist); + int ak = va_arg_int(alist); + int al = va_arg_int(alist); + int am = va_arg_int(alist); + int an = va_arg_int(alist); + int ao = va_arg_int(alist); + int ap = va_arg_int(alist); + int r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+aa+ab+ac+ad+ae+af+ag+ah+ai+aj+ak+al+am+an+ao+ap; + fprintf(out,"int f(32*int):(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)", + a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap); + fflush(out); + va_return_int(alist, r); +}} + +/* float tests */ +void f_f_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f) { fprintf(out,"wrong data for f_f\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float r=a+1.0; + fprintf(out,"float f(float):(%g)",a); + fflush(out); + va_return_float(alist, r); +}} +void f_f2_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f2) { fprintf(out,"wrong data for f_f2\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float r=a+b; + fprintf(out,"float f(2*float):(%g,%g)",a,b); + fflush(out); + va_return_float(alist, r); +}} +void f_f4_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f4) { fprintf(out,"wrong data for f_f4\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float r=a+b+c+d; + fprintf(out,"float f(4*float):(%g,%g,%g,%g)",a,b,c,d); + fflush(out); + va_return_float(alist, r); +}} +void f_f8_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f8) { fprintf(out,"wrong data for f_f8\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float r=a+b+c+d+e+f+g+h; + fprintf(out,"float f(8*float):(%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h); + fflush(out); + va_return_float(alist, r); +}} +void f_f16_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f16) { fprintf(out,"wrong data for f_f16\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float i = va_arg_float(alist); + float j = va_arg_float(alist); + float k = va_arg_float(alist); + float l = va_arg_float(alist); + float m = va_arg_float(alist); + float n = va_arg_float(alist); + float o = va_arg_float(alist); + float p = va_arg_float(alist); + float r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p; + fprintf(out,"float f(16*float):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); + fflush(out); + va_return_float(alist, r); +}} +void f_f24_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f24) { fprintf(out,"wrong data for f_f24\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float i = va_arg_float(alist); + float j = va_arg_float(alist); + float k = va_arg_float(alist); + float l = va_arg_float(alist); + float m = va_arg_float(alist); + float n = va_arg_float(alist); + float o = va_arg_float(alist); + float p = va_arg_float(alist); + float q = va_arg_float(alist); + float s = va_arg_float(alist); + float t = va_arg_float(alist); + float u = va_arg_float(alist); + float v = va_arg_float(alist); + float w = va_arg_float(alist); + float x = va_arg_float(alist); + float y = va_arg_float(alist); + float r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+v+w+x+y; + fprintf(out,"float f(24*float):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,v,w,x,y); + fflush(out); + va_return_float(alist, r); +}} + +/* double tests */ +void d_d_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d) { fprintf(out,"wrong data for d_d\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double r=a+1.0; + fprintf(out,"double f(double):(%g)",a); + fflush(out); + va_return_double(alist, r); +}} +void d_d2_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d2) { fprintf(out,"wrong data for d_d2\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double r=a+b; + fprintf(out,"double f(2*double):(%g,%g)",a,b); + fflush(out); + va_return_double(alist, r); +}} +void d_d4_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d4) { fprintf(out,"wrong data for d_d4\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double r=a+b+c+d; + fprintf(out,"double f(4*double):(%g,%g,%g,%g)",a,b,c,d); + fflush(out); + va_return_double(alist, r); +}} +void d_d8_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d8) { fprintf(out,"wrong data for d_d8\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + double r=a+b+c+d+e+f+g+h; + fprintf(out,"double f(8*double):(%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h); + fflush(out); + va_return_double(alist, r); +}} +void d_d16_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d16) { fprintf(out,"wrong data for d_d16\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + double i = va_arg_double(alist); + double j = va_arg_double(alist); + double k = va_arg_double(alist); + double l = va_arg_double(alist); + double m = va_arg_double(alist); + double n = va_arg_double(alist); + double o = va_arg_double(alist); + double p = va_arg_double(alist); + double r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p; + fprintf(out,"double f(16*double):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); + fflush(out); + va_return_double(alist, r); +}} + +/* pointer tests */ +void vp_vpdpcpsp_simulator (void* data, va_alist alist) +{ + if (data != (void*)&vp_vpdpcpsp) { fprintf(out,"wrong data for vp_vpdpcpsp\n"); exit(1); } + va_start_ptr(alist, void*); + {void* a = va_arg_ptr(alist, void*); + double* b = va_arg_ptr(alist, double*); + char* c = va_arg_ptr(alist, char*); + Int* d = va_arg_ptr(alist, Int*); + void* ret = (char*)b + 1; + fprintf(out,"void* f(void*,double*,char*,Int*):(0x%p,0x%p,0x%p,0x%p)",a,b,c,d); + fflush(out); + va_return_ptr(alist, void*, ret); +}} + +/* mixed number tests */ +void uc_ucsil_simulator (void* data, va_alist alist) +{ + if (data != (void*)&uc_ucsil) { fprintf(out,"wrong data for uc_ucsil\n"); exit(1); } + va_start_uchar(alist); + {uchar a = va_arg_uchar(alist); + ushort b = va_arg_ushort(alist); + uint c = va_arg_uint(alist); + ulong d = va_arg_ulong(alist); + uchar r = (uchar)-1; + fprintf(out,"uchar f(uchar,ushort,uint,ulong):(%u,%u,%u,%lu)",a,b,c,d); + fflush(out); + va_return_uchar(alist, r); +}} +void d_iidd_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_iidd) { fprintf(out,"wrong data for d_iidd\n"); exit(1); } + va_start_double(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double r=a+b+c+d; + fprintf(out,"double f(int,int,double,double):(%d,%d,%g,%g)",a,b,c,d); + fflush(out); + va_return_double(alist, r); +}} +void d_iiidi_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_iiidi) { fprintf(out,"wrong data for d_iiidi\n"); exit(1); } + va_start_double(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + double d = va_arg_double(alist); + int e = va_arg_int(alist); + double r=a+b+c+d+e; + fprintf(out,"double f(int,int,int,double,int):(%d,%d,%d,%g,%d)",a,b,c,d,e); + fflush(out); + va_return_double(alist, r); +}} +void d_idid_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_idid) { fprintf(out,"wrong data for d_idid\n"); exit(1); } + va_start_double(alist); + {int a = va_arg_int(alist); + double b = va_arg_double(alist); + int c = va_arg_int(alist); + double d = va_arg_double(alist); + double r=a+b+c+d; + fprintf(out,"double f(int,double,int,double):(%d,%g,%d,%g)",a,b,c,d); + fflush(out); + va_return_double(alist, r); +}} +void d_fdi_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_fdi) { fprintf(out,"wrong data for d_fdi\n"); exit(1); } + va_start_double(alist); + {float a = va_arg_float(alist); + double b = va_arg_double(alist); + int c = va_arg_int(alist); + double r=a+b+c; + fprintf(out,"double f(float,double,int):(%g,%g,%d)",a,b,c); + fflush(out); + va_return_double(alist, r); +}} +void us_cdcd_simulator (void* data, va_alist alist) +{ + if (data != (void*)&us_cdcd) { fprintf(out,"wrong data for us_cdcd\n"); exit(1); } + va_start_ushort(alist); + {char a = va_arg_char(alist); + double b = va_arg_double(alist); + char c = va_arg_char(alist); + double d = va_arg_double(alist); + ushort r = (ushort)(int)(a + b + c + d); + fprintf(out,"ushort f(char,double,char,double):('%c',%g,'%c',%g)",a,b,c,d); + fflush(out); + va_return_ushort(alist, r); +}} +void ll_iiilli_simulator (void* data, va_alist alist) +{ + if (data != (void*)&ll_iiilli) { fprintf(out,"wrong data for ll_iiilli\n"); exit(1); } + va_start_longlong(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + long long d = va_arg_longlong(alist); + int e = va_arg_int(alist); + long long r = (long long)(int)a + (long long)(int)b + (long long)(int)c + d + (long long)e; + fprintf(out,"long long f(int,int,int,long long,int):(%d,%d,%d,0x%lx%08lx,%d)",a,b,c,(long)(d>>32),(long)(d&0xffffffff),e); + fflush(out); + va_return_longlong(alist, r); +}} +void ll_flli_simulator (void* data, va_alist alist) +{ + if (data != (void*)&ll_flli) { fprintf(out,"wrong data for ll_flli\n"); exit(1); } + va_start_longlong(alist); + {float a = va_arg_float(alist); + long long b = va_arg_longlong(alist); + int c = va_arg_int(alist); + long long r = (long long)(int)a + b + (long long)c; + fprintf(out,"long long f(float,long long,int):(%g,0x%lx%08lx,0x%lx)",a,(long)(b>>32),(long)(b&0xffffffff),(long)c); + fflush(out); + va_return_longlong(alist, r); +}} +void f_fi_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_fi) { fprintf(out,"wrong data for f_fi\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + int z = va_arg_int(alist); + float r=a+z; + fprintf(out,"float f(float,int):(%g,%d)",a,z); + fflush(out); + va_return_float(alist, r); +}} +void f_f2i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f2i) { fprintf(out,"wrong data for f_f2i\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + int z = va_arg_int(alist); + float r=a+b+z; + fprintf(out,"float f(2*float,int):(%g,%g,%d)",a,b,z); + fflush(out); + va_return_float(alist, r); +}} +void f_f3i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f3i) { fprintf(out,"wrong data for f_f3i\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + int z = va_arg_int(alist); + float r=a+b+c+z; + fprintf(out,"float f(3*float,int):(%g,%g,%g,%d)",a,b,c,z); + fflush(out); + va_return_float(alist, r); +}} +void f_f4i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f4i) { fprintf(out,"wrong data for f_f4i\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + int z = va_arg_int(alist); + float r=a+b+c+d+z; + fprintf(out,"float f(4*float,int):(%g,%g,%g,%g,%d)",a,b,c,d,z); + fflush(out); + va_return_float(alist, r); +}} +void f_f7i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f7i) { fprintf(out,"wrong data for f_f7i\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + int z = va_arg_int(alist); + float r=a+b+c+d+e+f+g+z; + fprintf(out,"float f(7*float,int):(%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,z); + fflush(out); + va_return_float(alist, r); +}} +void f_f8i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f8i) { fprintf(out,"wrong data for f_f8i\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + int z = va_arg_int(alist); + float r=a+b+c+d+e+f+g+h+z; + fprintf(out,"float f(8*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,z); + fflush(out); + va_return_float(alist, r); +}} +void f_f12i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f12i) { fprintf(out,"wrong data for f_f12i\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float i = va_arg_float(alist); + float j = va_arg_float(alist); + float k = va_arg_float(alist); + float l = va_arg_float(alist); + int z = va_arg_int(alist); + float r=a+b+c+d+e+f+g+h+i+j+k+l+z; + fprintf(out,"float f(12*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,z); + fflush(out); + va_return_float(alist, r); +}} +void f_f13i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f13i) { fprintf(out,"wrong data for f_f13i\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float i = va_arg_float(alist); + float j = va_arg_float(alist); + float k = va_arg_float(alist); + float l = va_arg_float(alist); + float m = va_arg_float(alist); + int z = va_arg_int(alist); + float r=a+b+c+d+e+f+g+h+i+j+k+l+m+z; + fprintf(out,"float f(13*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,m,z); + fflush(out); + va_return_float(alist, r); +}} +void d_di_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_di) { fprintf(out,"wrong data for d_di\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + int z = va_arg_int(alist); + double r=a+z; + fprintf(out,"double f(double,int):(%g,%d)",a,z); + fflush(out); + va_return_double(alist, r); +}} +void d_d2i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d2i) { fprintf(out,"wrong data for d_d2i\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + int z = va_arg_int(alist); + double r=a+b+z; + fprintf(out,"double f(2*double,int):(%g,%g,%d)",a,b,z); + fflush(out); + va_return_double(alist, r); +}} +void d_d3i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d3i) { fprintf(out,"wrong data for d_d3i\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + int z = va_arg_int(alist); + double r=a+b+c+z; + fprintf(out,"double f(3*double,int):(%g,%g,%g,%d)",a,b,c,z); + fflush(out); + va_return_double(alist, r); +}} +void d_d4i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d4i) { fprintf(out,"wrong data for d_d4i\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + int z = va_arg_int(alist); + double r=a+b+c+d+z; + fprintf(out,"double f(4*double,int):(%g,%g,%g,%g,%d)",a,b,c,d,z); + fflush(out); + va_return_double(alist, r); +}} +void d_d7i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d7i) { fprintf(out,"wrong data for d_d7i\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + int z = va_arg_int(alist); + double r=a+b+c+d+e+f+g+z; + fprintf(out,"double f(7*double,int):(%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,z); + fflush(out); + va_return_double(alist, r); +}} +void d_d8i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d8i) { fprintf(out,"wrong data for d_d8i\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + int z = va_arg_int(alist); + double r=a+b+c+d+e+f+g+h+z; + fprintf(out,"double f(8*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,z); + fflush(out); + va_return_double(alist, r); +}} +void d_d12i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d12i) { fprintf(out,"wrong data for d_d12i\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + double i = va_arg_double(alist); + double j = va_arg_double(alist); + double k = va_arg_double(alist); + double l = va_arg_double(alist); + int z = va_arg_int(alist); + double r=a+b+c+d+e+f+g+h+i+j+k+l+z; + fprintf(out,"double f(12*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,z); + fflush(out); + va_return_double(alist, r); +}} +void d_d13i_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d13i) { fprintf(out,"wrong data for d_d13i\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + double i = va_arg_double(alist); + double j = va_arg_double(alist); + double k = va_arg_double(alist); + double l = va_arg_double(alist); + double m = va_arg_double(alist); + int z = va_arg_int(alist); + double r=a+b+c+d+e+f+g+h+i+j+k+l+m+z; + fprintf(out,"double f(13*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,m,z); + fflush(out); + va_return_double(alist, r); +}} + +/* small structure return tests */ +void S1_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&S1_v) { fprintf(out,"wrong data for S1_v\n"); exit(1); } + {Size1 r; + va_start_struct(alist, Size1, 1); + r = Size1_1; + fprintf(out,"Size1 f(void):"); + fflush(out); + va_return_struct(alist, Size1, r); +}} +void S2_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&S2_v) { fprintf(out,"wrong data for S2_v\n"); exit(1); } + {Size2 r; + va_start_struct(alist, Size2, 1); + r = Size2_1; + fprintf(out,"Size2 f(void):"); + fflush(out); + va_return_struct(alist, Size2, r); +}} +void S3_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&S3_v) { fprintf(out,"wrong data for S3_v\n"); exit(1); } + {Size3 r; + va_start_struct(alist, Size3, 1); + r = Size3_1; + fprintf(out,"Size3 f(void):"); + fflush(out); + va_return_struct(alist, Size3, r); +}} +void S4_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&S4_v) { fprintf(out,"wrong data for S4_v\n"); exit(1); } + {Size4 r; + va_start_struct(alist, Size4, 1); + r = Size4_1; + fprintf(out,"Size4 f(void):"); + fflush(out); + va_return_struct(alist, Size4, r); +}} +void S7_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&S7_v) { fprintf(out,"wrong data for S7_v\n"); exit(1); } + {Size7 r; + va_start_struct(alist, Size7, 1); + r = Size7_1; + fprintf(out,"Size7 f(void):"); + fflush(out); + va_return_struct(alist, Size7, r); +}} +void S8_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&S8_v) { fprintf(out,"wrong data for S8_v\n"); exit(1); } + {Size8 r; + va_start_struct(alist, Size8, 1); + r = Size8_1; + fprintf(out,"Size8 f(void):"); + fflush(out); + va_return_struct(alist, Size8, r); +}} +void S12_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&S12_v) { fprintf(out,"wrong data for S12_v\n"); exit(1); } + {Size12 r; + va_start_struct(alist, Size12, 1); + r = Size12_1; + fprintf(out,"Size12 f(void):"); + fflush(out); + va_return_struct(alist, Size12, r); +}} +void S15_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&S15_v) { fprintf(out,"wrong data for S15_v\n"); exit(1); } + {Size15 r; + va_start_struct(alist, Size15, 1); + r = Size15_1; + fprintf(out,"Size15 f(void):"); + fflush(out); + va_return_struct(alist, Size15, r); +}} +void S16_v_simulator (void* data, va_alist alist) +{ + if (data != (void*)&S16_v) { fprintf(out,"wrong data for S16_v\n"); exit(1); } + {Size16 r; + va_start_struct(alist, Size16, 1); + r = Size16_1; + fprintf(out,"Size16 f(void):"); + fflush(out); + va_return_struct(alist, Size16, r); +}} + +/* structure tests */ +void I_III_simulator (void* data, va_alist alist) +{ + if (data != (void*)&I_III) { fprintf(out,"wrong data for I_III\n"); exit(1); } + {Int a; + Int b; + Int c; + Int r; + va_start_struct(alist, Int, 1); + a = va_arg_struct(alist, Int); + b = va_arg_struct(alist, Int); + c = va_arg_struct(alist, Int); + r.x = a.x + b.x + c.x; + fprintf(out,"Int f(Int,Int,Int):({%d},{%d},{%d})",a.x,b.x,c.x); + fflush(out); + va_return_struct(alist, Int, r); +}} +#ifndef SKIP_EXTRA_STRUCTS +void C_CdC_simulator (void* data, va_alist alist) +{ + if (data != (void*)&C_CdC) { fprintf(out,"wrong data for C_CdC\n"); exit(1); } + {Char a; + double b; + Char c; + Char r; + va_start_struct(alist, Char, 1); + a = va_arg_struct(alist, Char); + b = va_arg_double(alist); + c = va_arg_struct(alist, Char); + r.x = (a.x + c.x)/2; + fprintf(out,"Char f(Char,double,Char):({'%c'},%g,{'%c'})",a.x,b,c.x); + fflush(out); + va_return_struct(alist, Char, r); +}} +void F_Ffd_simulator (void* data, va_alist alist) +{ + if (data != (void*)&F_Ffd) { fprintf(out,"wrong data for F_Ffd\n"); exit(1); } + {Float a; + float b; + double c; + Float r; + va_start_struct(alist, Float, va_word_splittable_1(float)); + a = va_arg_struct(alist, Float); + b = va_arg_float(alist); + c = va_arg_double(alist); + r.x = a.x + b + c; + fprintf(out,"Float f(Float,float,double):({%g},%g,%g)",a.x,b,c); + fflush(out); + va_return_struct(alist, Float, r); +}} +void D_fDd_simulator (void* data, va_alist alist) +{ + if (data != (void*)&D_fDd) { fprintf(out,"wrong data for D_fDd\n"); exit(1); } + {float a; + Double b; + double c; + Double r; + va_start_struct(alist, Double, va_word_splittable_1(double)); + a = va_arg_float(alist); + b = va_arg_struct(alist, Double); + c = va_arg_double(alist); + r.x = a + b.x + c; + fprintf(out,"Double f(float,Double,double):(%g,{%g},%g)",a,b.x,c); + fflush(out); + va_return_struct(alist, Double, r); +}} +void D_Dfd_simulator (void* data, va_alist alist) +{ + if (data != (void*)&D_Dfd) { fprintf(out,"wrong data for D_Dfd\n"); exit(1); } + {Double a; + float b; + double c; + Double r; + va_start_struct(alist, Double, va_word_splittable_1(double)); + a = va_arg_struct(alist, Double); + b = va_arg_float(alist); + c = va_arg_double(alist); + r.x = a.x + b + c; + fprintf(out,"Double f(Double,float,double):({%g},%g,%g)",a.x,b,c); + fflush(out); + va_return_struct(alist, Double, r); +}} +#endif +void J_JiJ_simulator (void* data, va_alist alist) +{ + if (data != (void*)&J_JiJ) { fprintf(out,"wrong data for J_JiJ\n"); exit(1); } + {J a; + int b; + J c; + J r; + va_start_struct(alist, J, va_word_splittable_2(long,long)); + a = va_arg_struct(alist, J); + b = va_arg_int(alist); + c = va_arg_struct(alist, J); + r.l1 = a.l1+c.l1; r.l2 = a.l2+b+c.l2; + fprintf(out,"J f(J,int,J):({%ld,%ld},%d,{%ld,%ld})",a.l1,a.l2,b,c.l1,c.l2); + fflush(out); + va_return_struct(alist, J, r); +}} +#ifndef SKIP_EXTRA_STRUCTS +void T_TcT_simulator (void* data, va_alist alist) +{ + if (data != (void*)&T_TcT) { fprintf(out,"wrong data for T_TcT\n"); exit(1); } + {T a; + char b; + T c; + T r; + va_start_struct(alist, T, 1); + a = va_arg_struct(alist, T); + b = va_arg_char(alist); + c = va_arg_struct(alist, T); + r.c[0]='b'; r.c[1]=c.c[1]; r.c[2]=c.c[2]; + fprintf(out,"T f(T,char,T):({\"%c%c%c\"},'%c',{\"%c%c%c\"})",a.c[0],a.c[1],a.c[2],b,c.c[0],c.c[1],c.c[2]); + fflush(out); + va_return_struct(alist, T, r); +}} +void X_BcdB_simulator (void* data, va_alist alist) +{ + if (data != (void*)&X_BcdB) { fprintf(out,"wrong data for X_BcdB\n"); exit(1); } + {B a; + char b; + double c; + B d; + static X xr={"return val",'R'}; + X r; + va_start_struct(alist, X, 0); + a = va_arg_struct(alist, B); + b = va_arg_char(alist); + c = va_arg_double(alist); + d = va_arg_struct(alist, B); + r = xr; + r.c1 = b; + fprintf(out,"X f(B,char,double,B):({%g,{%d,%d,%d}},'%c',%g,{%g,{%d,%d,%d}})", + a.d,a.i[0],a.i[1],a.i[2],b,c,d.d,d.i[0],d.i[1],d.i[2]); + fflush(out); + va_return_struct(alist, X, r); +}} +#endif + +/* gpargs boundary tests */ +void l_l0J_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l0J) { fprintf(out,"wrong data for l_l0J\n"); exit(1); } + va_start_long(alist); + {J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = b.l1 + b.l2 + c; + fprintf(out,"long f(J,long):(%ld,%ld,%ld)",b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l1J_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l1J) { fprintf(out,"wrong data for l_l1J\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + b.l1 + b.l2 + c; + fprintf(out,"long f(long,J,long):(%ld,%ld,%ld,%ld)",a1,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l2J_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l2J) { fprintf(out,"wrong data for l_l2J\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + b.l1 + b.l2 + c; + fprintf(out,"long f(2*long,J,long):(%ld,%ld,%ld,%ld,%ld)",a1,a2,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l3J_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l3J) { fprintf(out,"wrong data for l_l3J\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + b.l1 + b.l2 + c; + fprintf(out,"long f(3*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l4J_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l4J) { fprintf(out,"wrong data for l_l4J\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + b.l1 + b.l2 + c; + fprintf(out,"long f(4*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l5J_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l5J) { fprintf(out,"wrong data for l_l5J\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + a5 + b.l1 + b.l2 + c; + fprintf(out,"long f(5*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l6J_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l6J) { fprintf(out,"wrong data for l_l6J\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + a5 + a6 + b.l1 + b.l2 + c; + fprintf(out,"long f(6*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,a6,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l7J_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l7J) { fprintf(out,"wrong data for l_l7J\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + long a7 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + a5 + a6 + a7 + b.l1 + b.l2 + c; + fprintf(out,"long f(7*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,a6,a7,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l0K_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l0K) { fprintf(out,"wrong data for l_l0K\n"); exit(1); } + va_start_long(alist); + {K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(K,long):(%ld,%ld,%ld,%ld,%ld)",b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l1K_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l1K) { fprintf(out,"wrong data for l_l1K\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld)",a1,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l2K_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l2K) { fprintf(out,"wrong data for l_l2K\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + a2 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(2*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l3K_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l3K) { fprintf(out,"wrong data for l_l3K\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(3*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l4K_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l4K) { fprintf(out,"wrong data for l_l4K\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(4*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l5K_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l5K) { fprintf(out,"wrong data for l_l5K\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + a5 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(5*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); +}} +void l_l6K_simulator (void* data, va_alist alist) +{ + if (data != (void*)&l_l6K) { fprintf(out,"wrong data for l_l6K\n"); exit(1); } + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + a5 + a6 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(6*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,a6,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); +}} +void f_f17l3L_simulator (void* data, va_alist alist) +{ + if (data != (void*)&f_f17l3L) { fprintf(out,"wrong data for f_f17l3L\n"); exit(1); } + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float i = va_arg_float(alist); + float j = va_arg_float(alist); + float k = va_arg_float(alist); + float l = va_arg_float(alist); + float m = va_arg_float(alist); + float n = va_arg_float(alist); + float o = va_arg_float(alist); + float p = va_arg_float(alist); + float q = va_arg_float(alist); + long s = va_arg_long(alist); + long t = va_arg_long(alist); + long u = va_arg_long(alist); + L z = va_arg_struct(alist, L); + float r = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+z.l1+z.l2+z.l3+z.l4+z.l5+z.l6; + fprintf(out,"float f(17*float,3*int,L):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,z.l1,z.l2,z.l3,z.l4,z.l5,z.l6); + fflush(out); + va_return_float(alist, r); +}} +void d_d17l3L_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_d17l3L) { fprintf(out,"wrong data for d_d17l3L\n"); exit(1); } + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + double i = va_arg_double(alist); + double j = va_arg_double(alist); + double k = va_arg_double(alist); + double l = va_arg_double(alist); + double m = va_arg_double(alist); + double n = va_arg_double(alist); + double o = va_arg_double(alist); + double p = va_arg_double(alist); + double q = va_arg_double(alist); + long s = va_arg_long(alist); + long t = va_arg_long(alist); + long u = va_arg_long(alist); + L z = va_arg_struct(alist, L); + double r = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+z.l1+z.l2+z.l3+z.l4+z.l5+z.l6; + fprintf(out,"double f(17*double,3*int,L):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,z.l1,z.l2,z.l3,z.l4,z.l5,z.l6); + fflush(out); + va_return_double(alist, r); +}} +void ll_l2ll_simulator (void* data, va_alist alist) +{ + if (data != (void*)&ll_l2ll) { fprintf(out,"wrong data for ll_l2ll\n"); exit(1); } + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2) + b + c; + fprintf(out,"long long f(2*long,long long,long):(%ld,%ld,0x%lx%08lx,%ld)",a1,a2,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); +}} +void ll_l3ll_simulator (void* data, va_alist alist) +{ + if (data != (void*)&ll_l3ll) { fprintf(out,"wrong data for ll_l3ll\n"); exit(1); } + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2 + a3) + b + c; + fprintf(out,"long long f(3*long,long long,long):(%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); +}} +void ll_l4ll_simulator (void* data, va_alist alist) +{ + if (data != (void*)&ll_l4ll) { fprintf(out,"wrong data for ll_l4ll\n"); exit(1); } + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2 + a3 + a4) + b + c; + fprintf(out,"long long f(4*long,long long,long):(%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); +}} +void ll_l5ll_simulator (void* data, va_alist alist) +{ + if (data != (void*)&ll_l5ll) { fprintf(out,"wrong data for ll_l5ll\n"); exit(1); } + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2 + a3 + a4 + a5) + b + c; + fprintf(out,"long long f(5*long,long long,long):(%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); +}} +void ll_l6ll_simulator (void* data, va_alist alist) +{ + if (data != (void*)&ll_l6ll) { fprintf(out,"wrong data for ll_l6ll\n"); exit(1); } + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2 + a3 + a4 + a5 + a6) + b + c; + fprintf(out,"long long f(6*long,long long,long):(%ld,%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,a6,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); +}} +void ll_l7ll_simulator (void* data, va_alist alist) +{ + if (data != (void*)&ll_l7ll) { fprintf(out,"wrong data for ll_l7ll\n"); exit(1); } + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + long a7 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2 + a3 + a4 + a5 + a6 + a7) + b + c; + fprintf(out,"long long f(7*long,long long,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,a6,a7,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); +}} +void d_l2d_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_l2d) { fprintf(out,"wrong data for d_l2d\n"); exit(1); } + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2) + b + c; + fprintf(out,"double f(2*long,double,long):(%ld,%ld,%g,%ld)",a1,a2,b,c); + fflush(out); + va_return_double(alist, r); +}} +void d_l3d_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_l3d) { fprintf(out,"wrong data for d_l3d\n"); exit(1); } + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2 + a3) + b + c; + fprintf(out,"double f(3*long,double,long):(%ld,%ld,%ld,%g,%ld)",a1,a2,a3,b,c); + fflush(out); + va_return_double(alist, r); +}} +void d_l4d_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_l4d) { fprintf(out,"wrong data for d_l4d\n"); exit(1); } + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2 + a3 + a4) + b + c; + fprintf(out,"double f(4*long,double,long):(%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,b,c); + fflush(out); + va_return_double(alist, r); +}} +void d_l5d_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_l5d) { fprintf(out,"wrong data for d_l5d\n"); exit(1); } + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2 + a3 + a4 + a5) + b + c; + fprintf(out,"double f(5*long,double,long):(%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,b,c); + fflush(out); + va_return_double(alist, r); +}} +void d_l6d_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_l6d) { fprintf(out,"wrong data for d_l6d\n"); exit(1); } + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2 + a3 + a4 + a5 + a6) + b + c; + fprintf(out,"double f(6*long,double,long):(%ld,%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,a6,b,c); + fflush(out); + va_return_double(alist, r); +}} +void d_l7d_simulator (void* data, va_alist alist) +{ + if (data != (void*)&d_l7d) { fprintf(out,"wrong data for d_l7d\n"); exit(1); } + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + long a7 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2 + a3 + a4 + a5 + a6 + a7) + b + c; + fprintf(out,"double f(7*long,double,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,a6,a7,b,c); + fflush(out); + va_return_double(alist, r); +}} +void v_clobber_K_simulator (void* data, va_alist alist) +{ + if (data != (void*)&v_clobber_K) { fprintf(out,"wrong data for v_clobber_K\n"); exit(1); } + va_start_void(alist); + {K k = va_arg_struct(alist, K); + k.l1 += 1; + k.l2 += 10; + k.l3 += 100; + k.l4 += 1000; + va_return_void(alist); +}} + + +/* + * The way we run these tests - first call the function directly, then + * through vacall() - there is the danger that arguments or results seem + * to be passed correctly, but what we are seeing are in fact the vestiges + * (traces) or the previous call. This may seriously fake the test. + * Avoid this by clearing the registers between the first and the second call. + */ +long clear_traces_i (long a, long b, long c, long d, long e, long f, long g, long h, + long i, long j, long k, long l, long m, long n, long o, long p) +{ return 0; } +float clear_traces_f (float a, float b, float c, float d, float e, float f, float g, + float h, float i, float j, float k, float l, float m, float n, + float o, float p) +{ return 0.0; } +double clear_traces_d (double a, double b, double c, double d, double e, double f, double g, + double h, double i, double j, double k, double l, double m, double n, + double o, double p) +{ return 0.0; } +J clear_traces_J (void) +{ J j; j.l1 = j.l2 = 0; return j; } +void clear_traces (void) +{ clear_traces_i(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); + clear_traces_f(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0); + clear_traces_d(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0); + clear_traces_J(); +} + +int main (void) +{ + callback_t callback; + + out = stdout; + + /* void tests */ + v_v(); + clear_traces(); + callback = alloc_callback(&v_v_simulator,(void*)&v_v); + ((void (*) (void)) callback) (); + + /* int tests */ + { int ir; + + ir = i_v(); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + callback = alloc_callback(&i_v_simulator,(void*)&i_v); + ir = ((int (*) (void)) callback) (); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i(i1); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + callback = alloc_callback(&i_i_simulator,(void*)&i_i); + ir = ((int (*) (int)) callback) (i1); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i2(i1,i2); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + callback = alloc_callback(&i_i2_simulator,(void*)&i_i2); + ir = ((int (*) (int,int)) callback) (i1,i2); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i4(i1,i2,i3,i4); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + callback = alloc_callback(&i_i4_simulator,(void*)&i_i4); + ir = ((int (*) (int,int,int,int)) callback) (i1,i2,i3,i4); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i8(i1,i2,i3,i4,i5,i6,i7,i8); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + callback = alloc_callback(&i_i8_simulator,(void*)&i_i8); + ir = ((int (*) (int,int,int,int,int,int,int,int)) callback) (i1,i2,i3,i4,i5,i6,i7,i8); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i16(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + callback = alloc_callback(&i_i16_simulator,(void*)&i_i16); + ir = ((int (*) (int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int)) callback) (i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i32(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17,i18,i19,i20,i21,i22,i23,i24,i25,i26,i27,i28,i29,i30,i31,i32); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + callback = alloc_callback(&i_i32_simulator,(void*)&i_i32); + ir = ((int (*) (int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int)) callback) (i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17,i18,i19,i20,i21,i22,i23,i24,i25,i26,i27,i28,i29,i30,i31,i32); + fprintf(out,"->%d\n",ir); + fflush(out); + } + + /* float tests */ + { float fr; + + fr = f_f(f1); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f_simulator,(void*)&f_f); + fr = ((float (*) (float)) callback) (f1); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f2(f1,f2); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f2_simulator,(void*)&f_f2); + fr = ((float (*) (float,float)) callback) (f1,f2); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f4(f1,f2,f3,f4); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f4_simulator,(void*)&f_f4); + fr = ((float (*) (float,float,float,float)) callback) (f1,f2,f3,f4); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f8(f1,f2,f3,f4,f5,f6,f7,f8); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f8_simulator,(void*)&f_f8); + fr = ((float (*) (float,float,float,float,float,float,float,float)) callback) (f1,f2,f3,f4,f5,f6,f7,f8); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f16(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f16_simulator,(void*)&f_f16); + fr = ((float (*) (float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float)) callback) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f24(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,f21,f22,f23,f24); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f24_simulator,(void*)&f_f24); + fr = ((float (*) (float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float)) callback) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,f21,f22,f23,f24); + fprintf(out,"->%g\n",fr); + fflush(out); + } + + /* double tests */ + { double dr; + + dr = d_d(d1); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d_simulator,(void*)&d_d); + dr = ((double (*) (double)) callback) (d1); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d2(d1,d2); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d2_simulator,(void*)&d_d2); + dr = ((double (*) (double,double)) callback) (d1,d2); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d4(d1,d2,d3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d4_simulator,(void*)&d_d4); + dr = ((double (*) (double,double,double,double)) callback) (d1,d2,d3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d8(d1,d2,d3,d4,d5,d6,d7,d8); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d8_simulator,(void*)&d_d8); + dr = ((double (*) (double,double,double,double,double,double,double,double)) callback) (d1,d2,d3,d4,d5,d6,d7,d8); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d16(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d16_simulator,(void*)&d_d16); + dr = ((double (*) (double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double)) callback) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16); + fprintf(out,"->%g\n",dr); + fflush(out); + } + + /* pointer tests */ + { void* vpr; + + vpr = vp_vpdpcpsp(&uc1,&d2,str3,&I4); + fprintf(out,"->0x%p\n",vpr); + fflush(out); + vpr = 0; clear_traces(); + callback = alloc_callback(&vp_vpdpcpsp_simulator,(void*)&vp_vpdpcpsp); + vpr = ((void* (*) (void*,double*,char*,Int*)) callback) (&uc1,&d2,str3,&I4); + fprintf(out,"->0x%p\n",vpr); + fflush(out); + } + + /* mixed number tests */ + { uchar ucr; + ushort usr; + float fr; + double dr; + long long llr; + + ucr = uc_ucsil(uc1,us2,ui3,ul4); + fprintf(out,"->%u\n",ucr); + fflush(out); + ucr = 0; clear_traces(); + callback = alloc_callback(&uc_ucsil_simulator,(void*)&uc_ucsil); + ucr = ((uchar (*) (uchar,ushort,uint,ulong)) callback) (uc1,us2,ui3,ul4); + fprintf(out,"->%u\n",ucr); + fflush(out); + + dr = d_iidd(i1,i2,d3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_iidd_simulator,(void*)&d_iidd); + dr = ((double (*) (int,int,double,double)) callback) (i1,i2,d3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_iiidi(i1,i2,i3,d4,i5); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_iiidi_simulator,(void*)&d_iiidi); + dr = ((double (*) (int,int,int,double,int)) callback) (i1,i2,i3,d4,i5); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_idid(i1,d2,i3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_idid_simulator,(void*)&d_idid); + dr = ((double (*) (int,double,int,double)) callback) (i1,d2,i3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_fdi(f1,d2,i3); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_fdi_simulator,(void*)&d_fdi); + dr = ((double (*) (float,double,int)) callback) (f1,d2,i3); + fprintf(out,"->%g\n",dr); + fflush(out); + + usr = us_cdcd(c1,d2,c3,d4); + fprintf(out,"->%u\n",usr); + fflush(out); + usr = 0; clear_traces(); + callback = alloc_callback(&us_cdcd_simulator,(void*)&us_cdcd); + usr = ((ushort (*) (char,double,char,double)) callback) (c1,d2,c3,d4); + fprintf(out,"->%u\n",usr); + fflush(out); + + llr = ll_iiilli(i1,i2,i3,ll1,i13); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + callback = alloc_callback(&ll_iiilli_simulator,(void*)&ll_iiilli); + llr = ((long long (*) (int,int,int,long long,int)) callback) (i1,i2,i3,ll1,i13); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_flli(f13,ll1,i13); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + callback = alloc_callback(&ll_flli_simulator,(void*)&ll_flli); + llr = ((long long (*) (float,long long,int)) callback) (f13,ll1,i13); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + fr = f_fi(f1,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_fi_simulator,(void*)&f_fi); + fr = ((float (*) (float,int)) callback) (f1,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f2i(f1,f2,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f2i_simulator,(void*)&f_f2i); + fr = ((float (*) (float,float,int)) callback) (f1,f2,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f3i(f1,f2,f3,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f3i_simulator,(void*)&f_f3i); + fr = ((float (*) (float,float,float,int)) callback) (f1,f2,f3,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f4i(f1,f2,f3,f4,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f4i_simulator,(void*)&f_f4i); + fr = ((float (*) (float,float,float,float,int)) callback) (f1,f2,f3,f4,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f7i(f1,f2,f3,f4,f5,f6,f7,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f7i_simulator,(void*)&f_f7i); + fr = ((float (*) (float,float,float,float,float,float,float,int)) callback) (f1,f2,f3,f4,f5,f6,f7,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f8i(f1,f2,f3,f4,f5,f6,f7,f8,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f8i_simulator,(void*)&f_f8i); + fr = ((float (*) (float,float,float,float,float,float,float,float,int)) callback) (f1,f2,f3,f4,f5,f6,f7,f8,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f12i(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f12i_simulator,(void*)&f_f12i); + fr = ((float (*) (float,float,float,float,float,float,float,float,float,float,float,float,int)) callback) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f13i(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f13i_simulator,(void*)&f_f13i); + fr = ((float (*) (float,float,float,float,float,float,float,float,float,float,float,float,float,int)) callback) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + dr = d_di(d1,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_di_simulator,(void*)&d_di); + dr = ((double (*) (double,int)) callback) (d1,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d2i(d1,d2,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d2i_simulator,(void*)&d_d2i); + dr = ((double (*) (double,double,int)) callback) (d1,d2,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d3i(d1,d2,d3,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d3i_simulator,(void*)&d_d3i); + dr = ((double (*) (double,double,double,int)) callback) (d1,d2,d3,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d4i(d1,d2,d3,d4,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d4i_simulator,(void*)&d_d4i); + dr = ((double (*) (double,double,double,double,int)) callback) (d1,d2,d3,d4,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d7i(d1,d2,d3,d4,d5,d6,d7,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d7i_simulator,(void*)&d_d7i); + dr = ((double (*) (double,double,double,double,double,double,double,int)) callback) (d1,d2,d3,d4,d5,d6,d7,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d8i(d1,d2,d3,d4,d5,d6,d7,d8,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d8i_simulator,(void*)&d_d8i); + dr = ((double (*) (double,double,double,double,double,double,double,double,int)) callback) (d1,d2,d3,d4,d5,d6,d7,d8,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d12i(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d12i_simulator,(void*)&d_d12i); + dr = ((double (*) (double,double,double,double,double,double,double,double,double,double,double,double,int)) callback) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d13i(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d13i_simulator,(void*)&d_d13i); + dr = ((double (*) (double,double,double,double,double,double,double,double,double,double,double,double,double,int)) callback) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + } + + /* small structure return tests */ + { + Size1 r = S1_v(); + fprintf(out,"->{%c}\n",r.x1); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + callback = alloc_callback(&S1_v_simulator,(void*)&S1_v); + r = ((Size1 (*) (void)) callback) (); + fprintf(out,"->{%c}\n",r.x1); + fflush(out); + } + { + Size2 r = S2_v(); + fprintf(out,"->{%c%c}\n",r.x1,r.x2); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + callback = alloc_callback(&S2_v_simulator,(void*)&S2_v); + r = ((Size2 (*) (void)) callback) (); + fprintf(out,"->{%c%c}\n",r.x1,r.x2); + fflush(out); + } + { + Size3 r = S3_v(); + fprintf(out,"->{%c%c%c}\n",r.x1,r.x2,r.x3); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + callback = alloc_callback(&S3_v_simulator,(void*)&S3_v); + r = ((Size3 (*) (void)) callback) (); + fprintf(out,"->{%c%c%c}\n",r.x1,r.x2,r.x3); + fflush(out); + } + { + Size4 r = S4_v(); + fprintf(out,"->{%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + callback = alloc_callback(&S4_v_simulator,(void*)&S4_v); + r = ((Size4 (*) (void)) callback) (); + fprintf(out,"->{%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4); + fflush(out); + } + { + Size7 r = S7_v(); + fprintf(out,"->{%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + callback = alloc_callback(&S7_v_simulator,(void*)&S7_v); + r = ((Size7 (*) (void)) callback) (); + fprintf(out,"->{%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7); + fflush(out); + } + { + Size8 r = S8_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + callback = alloc_callback(&S8_v_simulator,(void*)&S8_v); + r = ((Size8 (*) (void)) callback) (); + fprintf(out,"->{%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8); + fflush(out); + } + { + Size12 r = S12_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + callback = alloc_callback(&S12_v_simulator,(void*)&S12_v); + r = ((Size12 (*) (void)) callback) (); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12); + fflush(out); + } + { + Size15 r = S15_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + callback = alloc_callback(&S15_v_simulator,(void*)&S15_v); + r = ((Size15 (*) (void)) callback) (); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15); + fflush(out); + } + { + Size16 r = S16_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15,r.x16); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + callback = alloc_callback(&S16_v_simulator,(void*)&S16_v); + r = ((Size16 (*) (void)) callback) (); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15,r.x16); + fflush(out); + } + + /* structure tests */ + { Int Ir; + Char Cr; + Float Fr; + Double Dr; + J Jr; + T Tr; + X Xr; + + Ir = I_III(I1,I2,I3); + fprintf(out,"->{%d}\n",Ir.x); + fflush(out); + Ir.x = 0; clear_traces(); + callback = alloc_callback(&I_III_simulator,(void*)&I_III); + Ir = ((Int (*) (Int,Int,Int)) callback) (I1,I2,I3); + fprintf(out,"->{%d}\n",Ir.x); + fflush(out); + +#ifndef SKIP_EXTRA_STRUCTS + Cr = C_CdC(C1,d2,C3); + fprintf(out,"->{'%c'}\n",Cr.x); + fflush(out); + Cr.x = '\0'; clear_traces(); + callback = alloc_callback(&C_CdC_simulator,(void*)&C_CdC); + Cr = ((Char (*) (Char,double,Char)) callback) (C1,d2,C3); + fprintf(out,"->{'%c'}\n",Cr.x); + fflush(out); + + Fr = F_Ffd(F1,f2,d3); + fprintf(out,"->{%g}\n",Fr.x); + fflush(out); + Fr.x = 0.0; clear_traces(); + callback = alloc_callback(&F_Ffd_simulator,(void*)&F_Ffd); + Fr = ((Float (*) (Float,float,double)) callback) (F1,f2,d3); + fprintf(out,"->{%g}\n",Fr.x); + fflush(out); + + Dr = D_fDd(f1,D2,d3); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); + Dr.x = 0.0; clear_traces(); + callback = alloc_callback(&D_fDd_simulator,(void*)&D_fDd); + Dr = ((Double (*) (float,Double,double)) callback) (f1,D2,d3); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); + + Dr = D_Dfd(D1,f2,d3); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); + Dr.x = 0.0; clear_traces(); + callback = alloc_callback(&D_Dfd_simulator,(void*)&D_Dfd); + Dr = ((Double (*) (Double,float,double)) callback) (D1,f2,d3); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); +#endif + + Jr = J_JiJ(J1,i2,J2); + fprintf(out,"->{%ld,%ld}\n",Jr.l1,Jr.l2); + fflush(out); + Jr.l1 = Jr.l2 = 0; clear_traces(); + callback = alloc_callback(&J_JiJ_simulator,(void*)&J_JiJ); + Jr = ((J (*) (J,int,J)) callback) (J1,i2,J2); + fprintf(out,"->{%ld,%ld}\n",Jr.l1,Jr.l2); + fflush(out); + +#ifndef SKIP_EXTRA_STRUCTS +#ifndef SKIP_T + Tr = T_TcT(T1,' ',T2); + fprintf(out,"->{\"%c%c%c\"}\n",Tr.c[0],Tr.c[1],Tr.c[2]); + fflush(out); + Tr.c[0] = Tr.c[1] = Tr.c[2] = 0; clear_traces(); + callback = alloc_callback(&T_TcT_simulator,(void*)&T_TcT); + Tr = ((T (*) (T,char,T)) callback) (T1,' ',T2); + fprintf(out,"->{\"%c%c%c\"}\n",Tr.c[0],Tr.c[1],Tr.c[2]); + fflush(out); +#endif + +#ifndef SKIP_X + Xr = X_BcdB(B1,c2,d3,B2); + fprintf(out,"->{\"%s\",'%c'}\n",Xr.c,Xr.c1); + fflush(out); + Xr.c[0]=Xr.c1='\0'; clear_traces(); + callback = alloc_callback(&X_BcdB_simulator,(void*)&X_BcdB); + Xr = ((X (*) (B,char,double,B)) callback) (B1,c2,d3,B2); + fprintf(out,"->{\"%s\",'%c'}\n",Xr.c,Xr.c1); + fflush(out); +#endif +#endif + } + + /* gpargs boundary tests */ + { long lr; + long long llr; + float fr; + double dr; + + lr = l_l0J(J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l0J_simulator,(void*)l_l0J); + lr = ((long (*) (J,long)) callback) (J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l1J(l1,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l1J_simulator,(void*)l_l1J); + lr = ((long (*) (long,J,long)) callback) (l1,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l2J(l1,l2,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l2J_simulator,(void*)l_l2J); + lr = ((long (*) (long,long,J,long)) callback) (l1,l2,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l3J(l1,l2,l3,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l3J_simulator,(void*)l_l3J); + lr = ((long (*) (long,long,long,J,long)) callback) (l1,l2,l3,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l4J(l1,l2,l3,l4,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l4J_simulator,(void*)l_l4J); + lr = ((long (*) (long,long,long,long,J,long)) callback) (l1,l2,l3,l4,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l5J(l1,l2,l3,l4,l5,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l5J_simulator,(void*)l_l5J); + lr = ((long (*) (long,long,long,long,long,J,long)) callback) (l1,l2,l3,l4,l5,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l6J(l1,l2,l3,l4,l5,l6,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l6J_simulator,(void*)l_l6J); + lr = ((long (*) (long,long,long,long,long,long,J,long)) callback) (l1,l2,l3,l4,l5,l6,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l7J(l1,l2,l3,l4,l5,l6,l7,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l7J_simulator,(void*)l_l7J); + lr = ((long (*) (long,long,long,long,long,long,long,J,long)) callback) (l1,l2,l3,l4,l5,l6,l7,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l0K(K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l0K_simulator,(void*)l_l0K); + lr = ((long (*) (K,long)) callback) (K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l1K(l1,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l1K_simulator,(void*)l_l1K); + lr = ((long (*) (long,K,long)) callback) (l1,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l2K(l1,l2,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l2K_simulator,(void*)l_l2K); + lr = ((long (*) (long,long,K,long)) callback) (l1,l2,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l3K(l1,l2,l3,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l3K_simulator,(void*)l_l3K); + lr = ((long (*) (long,long,long,K,long)) callback) (l1,l2,l3,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l4K(l1,l2,l3,l4,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l4K_simulator,(void*)l_l4K); + lr = ((long (*) (long,long,long,long,K,long)) callback) (l1,l2,l3,l4,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l5K(l1,l2,l3,l4,l5,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l5K_simulator,(void*)l_l5K); + lr = ((long (*) (long,long,long,long,long,K,long)) callback) (l1,l2,l3,l4,l5,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l6K(l1,l2,l3,l4,l5,l6,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + callback = alloc_callback(&l_l6K_simulator,(void*)l_l6K); + lr = ((long (*) (long,long,long,long,long,long,K,long)) callback) (l1,l2,l3,l4,l5,l6,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + fr = f_f17l3L(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,l6,l7,l8,L1); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + callback = alloc_callback(&f_f17l3L_simulator,(void*)&f_f17l3L); + fr = ((float (*) (float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,long,long,long,L)) callback) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,l6,l7,l8,L1); + fprintf(out,"->%g\n",fr); + fflush(out); + + dr = d_d17l3L(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,l6,l7,l8,L1); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_d17l3L_simulator,(void*)&d_d17l3L); + dr = ((double (*) (double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,long,long,long,L)) callback) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,l6,l7,l8,L1); + fprintf(out,"->%g\n",dr); + fflush(out); + + llr = ll_l2ll(l1,l2,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + callback = alloc_callback(&ll_l2ll_simulator,(void*)ll_l2ll); + llr = ((long long (*) (long,long,long long,long)) callback) (l1,l2,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l3ll(l1,l2,l3,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + callback = alloc_callback(&ll_l3ll_simulator,(void*)ll_l3ll); + llr = ((long long (*) (long,long,long,long long,long)) callback) (l1,l2,l3,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l4ll(l1,l2,l3,l4,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + callback = alloc_callback(&ll_l4ll_simulator,(void*)ll_l4ll); + llr = ((long long (*) (long,long,long,long,long long,long)) callback) (l1,l2,l3,l4,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l5ll(l1,l2,l3,l4,l5,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + callback = alloc_callback(&ll_l5ll_simulator,(void*)ll_l5ll); + llr = ((long long (*) (long,long,long,long,long,long long,long)) callback) (l1,l2,l3,l4,l5,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l6ll(l1,l2,l3,l4,l5,l6,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + callback = alloc_callback(&ll_l6ll_simulator,(void*)ll_l6ll); + llr = ((long long (*) (long,long,long,long,long,long,long long,long)) callback) (l1,l2,l3,l4,l5,l6,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l7ll(l1,l2,l3,l4,l5,l6,l7,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + callback = alloc_callback(&ll_l7ll_simulator,(void*)ll_l7ll); + llr = ((long long (*) (long,long,long,long,long,long,long,long long,long)) callback) (l1,l2,l3,l4,l5,l6,l7,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + dr = d_l2d(l1,l2,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_l2d_simulator,(void*)d_l2d); + dr = ((double (*) (long,long,double,long)) callback) (l1,l2,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l3d(l1,l2,l3,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_l3d_simulator,(void*)d_l3d); + dr = ((double (*) (long,long,long,double,long)) callback) (l1,l2,l3,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l4d(l1,l2,l3,l4,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_l4d_simulator,(void*)d_l4d); + dr = ((double (*) (long,long,long,long,double,long)) callback) (l1,l2,l3,l4,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l5d(l1,l2,l3,l4,l5,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_l5d_simulator,(void*)d_l5d); + dr = ((double (*) (long,long,long,long,long,double,long)) callback) (l1,l2,l3,l4,l5,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l6d(l1,l2,l3,l4,l5,l6,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_l6d_simulator,(void*)d_l6d); + dr = ((double (*) (long,long,long,long,long,long,double,long)) callback) (l1,l2,l3,l4,l5,l6,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l7d(l1,l2,l3,l4,l5,l6,l7,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + callback = alloc_callback(&d_l7d_simulator,(void*)d_l7d); + dr = ((double (*) (long,long,long,long,long,long,long,double,long)) callback) (l1,l2,l3,l4,l5,l6,l7,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + } + + /* by-value tests */ + /* This test is trivial, since a copy of k is allocated on the callee's stack. + But anyway... */ + { K k; + + k.l1 = l1; + k.l2 = l2; + k.l3 = l3; + k.l4 = l4; + fprintf(out,"by_value:%ld,%ld,%ld,%ld\n",k.l1,k.l2,k.l3,k.l4); + fflush(out); + clear_traces(); + callback = alloc_callback(&v_clobber_K_simulator,(void*)v_clobber_K); + ((void (*) (K)) callback) (k); + fprintf(out,"by_value:%ld,%ld,%ld,%ld\n",k.l1,k.l2,k.l3,k.l4); + fflush(out); + } + + exit(0); +} diff --git a/callback/trampoline_r/COPYING b/callback/trampoline_r/COPYING new file mode 100644 index 0000000..a3d1815 --- /dev/null +++ b/callback/trampoline_r/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 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 + + Appendix: 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. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +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. + + , 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/callback/trampoline_r/Makefile.devel b/callback/trampoline_r/Makefile.devel new file mode 100644 index 0000000..7abb351 --- /dev/null +++ b/callback/trampoline_r/Makefile.devel @@ -0,0 +1,217 @@ +# This is the developer's -*-Makefile-*-, not the user's makefile. +# Do not use it unless you know exactly what you do! + +THISFILE = Makefile.devel +RM = rm -f + +# ============ Rules that require cross-compilation tools ============ + +GCC = gcc +GCCFLAGS = -O2 -fomit-frame-pointer -fPIC +CPP = $(GCC) -E +CROSS_TOOL = cross + +precompiled : \ + cache-sparc-macro.S cache-sparc64-macro.S \ + cache-alpha-macro.S \ + cache-hppa-macro.S cache-hppa64-macro.S \ + cache-powerpc-linux-macro.S cache-powerpc-macos.s \ + cache-powerpc64-elfv2-macro.S + + +cache-sparc-linux.s : cache-sparc.c $(THISFILE) + $(CROSS_TOOL) sparc-linux gcc -V 3.1 $(GCCFLAGS) -D__sparc__ -S cache-sparc.c -o cache-sparc-linux.s + +cache-sparc-macro.S : cache-sparc-linux.s ../../common/asm-sparc.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-sparc.h"' ; ../../common/asm-sparc.sh < cache-sparc-linux.s ; cat ../../common/noexecstack.h) > cache-sparc-macro.S + +cache-sparc64-linux.s : cache-sparc.c $(THISFILE) + $(CROSS_TOOL) sparc64-linux gcc -V 4.0.2 $(GCCFLAGS) -D__sparc64__ -S cache-sparc.c -o cache-sparc64-linux.s + +cache-sparc64-macro.S : cache-sparc64-linux.s ../../common/asm-sparc.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-sparc.h"' ; ../../common/asm-sparc.sh < cache-sparc64-linux.s ; cat ../../common/noexecstack.h) > cache-sparc64-macro.S + + +cache-alpha-linux.s : cache-alpha.c $(THISFILE) + $(CROSS_TOOL) alpha-linux gcc -V 4.0.2 $(GCCFLAGS) -D__alpha__ -S cache-alpha.c -o cache-alpha-linux.s + +cache-alpha-macro.S : cache-alpha-linux.s ../../common/asm-alpha.sh ../../common/noexecstack.h $(THISFILE) + (../../common/asm-alpha.sh < cache-alpha-linux.s ; cat ../../common/noexecstack.h) > cache-alpha-macro.S + + +cache-hppa-linux.s : cache-hppa.c $(THISFILE) + $(CROSS_TOOL) hppa-linux gcc -V 3.1 $(GCCFLAGS) -D__hppa__ -S cache-hppa.c -o cache-hppa-linux.s + +cache-hppa-macro.S : cache-hppa-linux.s ../../common/asm-hppa.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-hppa.h"' ; ../../common/asm-hppa.sh < cache-hppa-linux.s ; cat ../../common/noexecstack.h) > cache-hppa-macro.S + + +cache-hppa64-linux.s : cache-hppa.c $(THISFILE) + $(CROSS_TOOL) hppa64-linux gcc -V 3.1 $(GCCFLAGS) -D__hppa64__ -S cache-hppa.c -o cache-hppa64-linux.s + +cache-hppa64-macro.S : cache-hppa64-linux.s ../../common/asm-hppa64.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-hppa64.h"' ; ../../common/asm-hppa64.sh < cache-hppa64-linux.s ; cat ../../common/noexecstack.h) > cache-hppa64-macro.S + + +cache-powerpc-linux.s : cache-powerpc.c $(THISFILE) + $(CROSS_TOOL) powerpc-linux gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc $(GCCFLAGS) -D__powerpc__ -S cache-powerpc.c -o cache-powerpc-linux.s + +cache-powerpc-linux-macro.S : cache-powerpc-linux.s ../../common/asm-powerpc.sh ../../common/noexecstack.h $(THISFILE) + (../../common/asm-powerpc.sh < cache-powerpc-linux.s ; cat ../../common/noexecstack.h) > cache-powerpc-linux-macro.S + +cache-powerpc-macos.s : cache-powerpc.c $(THISFILE) + $(CROSS_TOOL) powerpc-darwin gcc -V 3.3.6 $(GCCFLAGS) -D__powerpc__ -S cache-powerpc.c -o cache-powerpc-macos.s + + +cache-powerpc64-elfv2-linux.s : cache-powerpc64.c $(THISFILE) + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv2 -mcpu=power4 -mlittle-endian $(GCCFLAGS) -D__powerpc64__ -S cache-powerpc64.c -o cache-powerpc64-elfv2-linux-le.s + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv2 -mcpu=power4 -mbig-endian $(GCCFLAGS) -D__powerpc64__ -S cache-powerpc64.c -o cache-powerpc64-elfv2-linux-be.s + cmp cache-powerpc64-elfv2-linux-le.s cache-powerpc64-elfv2-linux-be.s > /dev/null + mv cache-powerpc64-elfv2-linux-le.s cache-powerpc64-elfv2-linux.s + $(RM) cache-powerpc64-elfv2-linux-be.s + +cache-powerpc64-elfv2-macro.S : cache-powerpc64-elfv2-linux.s ../../common/asm-powerpc.sh ../../common/noexecstack.h $(THISFILE) + (../../common/asm-powerpc.sh < cache-powerpc64-elfv2-linux.s ; cat ../../common/noexecstack.h) > cache-powerpc64-elfv2-macro.S + + +# --------------- Older rules --------------- + +OLDGCCFLAGS = -O2 -fomit-frame-pointer +ASPREFIX = /usr1/gnu/lib + +proto-precompiled : proto-i386.s proto-m68k.s proto-mips.s proto-mipsn32.s proto-mips64.s proto-sparc.s proto-sparc64.s proto-alpha.s proto-hppa.s proto-hppa64.s proto-arm.s proto-arm64.s proto-powerpc-aix.s proto-powerpc-sysv4.s proto-powerpc-macos.s proto-powerpc64-aix.s proto-powerpc64-elfv2.s proto-ia64.c proto-x86_64.c proto-x86_64-x32.s proto-s390.s proto-s390x.s proto-riscv32.s proto-riscv64.s + +proto-i386.s : proto.c + $(GCC) -V 2.7.2 -b i486-linuxaout $(OLDGCCFLAGS) -D__i386__ -S proto.c -o $@ + +proto-m68k.s : proto.c + $(GCC) -V egcs-2.91.57 -b m68k-sun $(OLDGCCFLAGS) -D__m68k__ -S proto.c -o $@ + +proto-mips.s : proto.c + $(GCC) -V 2.95.2 -b mips-sgi $(OLDGCCFLAGS) -D__mips__ -S proto.c -o $@ -mabicalls + +proto-mipsn32.s : proto.c + $(GCC) -V 2.95.2 -b mips-sgi-irix6 $(OLDGCCFLAGS) -D__mipsn32__ -S proto.c -o $@ -mabicalls + +proto-mips64.s : proto64.c + $(GCC) -V 2.95.2 -b mips-sgi -mips3 -mlong64 $(OLDGCCFLAGS) -D__mips64__ -S proto64.c -o $@ -mabicalls + +proto-sparc.s : proto.c + $(GCC) -V 2.95.2 -b sparc-sun $(OLDGCCFLAGS) -D__sparc__ -S proto.c -o $@ + +proto-sparc64.s : proto64.c + sparc64-linux-gcc -V 2.95.2 -b sparc64-linux $(OLDGCCFLAGS) -D__sparc64__ -S proto64.c -o $@ + +proto-alpha.s : proto64.c + $(GCC) -V 2.7.2 -b alpha-dec-osf $(OLDGCCFLAGS) -D__alpha__ -S proto64.c -o $@ + +proto-hppa.s : proto.c + $(GCC) -V 2.6.3 -b hppa1.0-hpux $(OLDGCCFLAGS) -D__hppa__ -S proto.c -o $@ + +proto-hppa64.s : proto64.c + $(CROSS_TOOL) hppa64-linux gcc -V 3.1 $(OLDGCCFLAGS) -D__hppa64__ -S proto64.c -o $@ + +proto-arm.s : proto.c + $(CROSS_TOOL) arm-linux gcc -V 3.1 $(OLDGCCFLAGS) -fno-omit-frame-pointer -D__arm__ -S proto.c -o $@ + +proto-arm64.s : proto64.c + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 $(OLDGCCFLAGS) -D__arm64__ -S proto64.c -o $@ + +proto-powerpc-aix.s : proto.c + $(GCC) -V 2.95.2 -b rs6000 -mno-power -mno-power2 -mno-powerpc -mnew-mnemonics $(OLDGCCFLAGS) -D__powerpc__ -S proto.c -o $@ + +proto-powerpc-sysv4.s : proto.c + $(GCC) -V 2.95.2 -b ppc-linux -mno-power -mno-power2 -mno-powerpc $(OLDGCCFLAGS) -D__powerpc__ -S proto.c -o $@ + +proto-powerpc-macos.s : proto.c + $(GCC) -V 3.3.2 -b powerpc-darwin $(OLDGCCFLAGS) -D__powerpc__ -S proto.c -o $@ + +proto-powerpc64-aix.s : proto64.c + $(CROSS_TOOL) powerpc64-linux gcc $(OLDGCCFLAGS) -D__powerpc64__ -S proto64.c -o $@ + +proto-powerpc64-elfv2.s : proto64.c + $(CROSS_TOOL) powerpc64le-linux gcc -mabi=elfv2 $(OLDGCCFLAGS) -D__powerpc64__ -S proto64.c -o $@ + +proto-ia64.s : proto64.c + $(GCC) -V 2.9-ia64-000216 -b ia64-hp-linux $(OLDGCCFLAGS) -D__ia64__ -S proto64.c -o $@ + +proto-x86_64.s : proto64.c + $(GCC) -V 3.2.2 -b x86_64-suse-linux $(OLDGCCFLAGS) -D__x86_64__ -S proto64.c -o $@ + +proto-x86_64-x32.s : proto.c + $(CROSS_TOOL) x86_64-linux gcc-5.4.0 -mx32 $(OLDGCCFLAGS) -fno-asynchronous-unwind-tables -D__x86_64__ -D__x86_64_x32__ -S proto.c -o $@ + +proto-s390.s : proto.c + $(CROSS_TOOL) s390-linux gcc -V 3.1 $(OLDGCCFLAGS) -D__s390__ -S proto.c -o $@ + +proto-s390x.s : proto64.c + $(CROSS_TOOL) s390x-linux gcc-5.4.0 $(OLDGCCFLAGS) -D__s390x__ -S proto64.c -o $@ + +proto-riscv32.s : proto.c + $(CROSS_TOOL) riscv32-linux gcc-7.3.0 $(OLDGCCFLAGS) -D__riscv32__ -S proto.c -o $@ + +proto-riscv64.s : proto64.c + $(CROSS_TOOL) riscv64-linux gcc-7.3.0 $(OLDGCCFLAGS) -D__riscv64__ -S proto64.c -o $@ + +tramp-i386.o : tramp-i386.s + $(ASPREFIX)/i486-linux/bin/as tramp-i386.s -o $@ + +tramp-m68k.o : tramp-m68k.s + $(ASPREFIX)/m68k-linux/bin/as tramp-m68k.s -o $@ + +tramp-mips.o : tramp-mips.s + $(ASPREFIX)/mips-linux/bin/as tramp-mips.s -o $@ + +tramp-mips64.o : tramp-mips64.s + $(ASPREFIX)/mips-linux/bin/as -mips64 -mabi=64 tramp-mips64.s -o $@ + +tramp-sparc.o : tramp-sparc.s + $(ASPREFIX)/sparc-sun/bin/as tramp-sparc.s -o $@ + +tramp-sparc64.o : tramp-sparc64.s + $(ASPREFIX)/sparc64-linux/bin/as tramp-sparc64.s -o $@ + +tramp-alpha.o : tramp-alpha.s + $(ASPREFIX)/alpha-linux/bin/as tramp-alpha.s -o $@ + +tramp-hppa.o : tramp-hppa.s + $(ASPREFIX)/hppa1.0-hpux/bin/as tramp-hppa.s -o $@ + +tramp-hppa64.o : tramp-hppa64.s + $(CROSS_TOOL) hppa64-linux as tramp-hppa64.s -o $@ + +tramp-arm.o : tramp-arm.s + $(CROSS_TOOL) arm-linux as tramp-arm.s -o $@ + +tramp-arm64.o : tramp-arm64.s + $(CROSS_TOOL) aarch64-linux as tramp-arm64.s -o $@ + +tramp-powerpc-old.o : tramp-powerpc-old.s + $(ASPREFIX)/rs6000/bin/as tramp-powerpc-old.s -o $@ + +tramp-powerpc-sysv4.o : tramp-powerpc-sysv4.s + $(ASPREFIX)/ppc-linux/bin/as tramp-powerpc-sysv4.s -o $@ + +tramp-powerpc64-elfv2.o : tramp-powerpc64-elfv2.s + $(CROSS_TOOL) powerpc64le-linux as tramp-powerpc64-elfv2.s -o $@ + +tramp-ia64.o : tramp-ia64.s + /nue/usr/ia64-hp-linux/bin/as tramp-ia64.s -o $@ + +tramp-x86_64.o : tramp-x86_64.s + $(ASPREFIX)/x86_64-linux/bin/as tramp-x86_64.s -o $@ + +tramp-x86_64-x32.o : tramp-x86_64-x32.s + $(CROSS_TOOL) x86_64-linux as tramp-x86_64-x32.s -o $@ + +tramp-s390.o : tramp-s390.s + $(CROSS_TOOL) s390-linux as tramp-s390.s -o $@ + +tramp-s390x.o : tramp-s390x.s + $(CROSS_TOOL) s390x-linux as tramp-s390x.s -o $@ + +tramp-riscv32.o : tramp-riscv32.s + $(CROSS_TOOL) riscv32-linux as tramp-riscv32.s -o $@ + +tramp-riscv64.o : tramp-riscv64.s + $(CROSS_TOOL) riscv64-linux as tramp-riscv64.s -o $@ diff --git a/callback/trampoline_r/Makefile.in b/callback/trampoline_r/Makefile.in new file mode 100644 index 0000000..ee88507 --- /dev/null +++ b/callback/trampoline_r/Makefile.in @@ -0,0 +1,257 @@ +# Makefile for trampoline + +#### Start of system configuration section. #### + +HOST = @host@ +CPU = @HOST_CPU_C_ABI@ +OS = @host_os@ + +# Directories used by "make": +srcdir = @srcdir@ + +# Directories used by "make install": +prefix = @prefix@ +local_prefix = /usr/local +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +mandir = @mandir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +htmldir = $(datadir)/html + +# Programs used by "make": +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CPP = @CPP@ +INCLUDES = -I. -I$(srcdir) -I../.. -I$(srcdir)/../.. +INCLUDES_WITH_GNULIB = $(INCLUDES) -I../../gnulib-lib -I$(srcdir)/../../gnulib-lib +ASPFLAGS = `if test @AS_UNDERSCORE@ = true; then echo '-DASM_UNDERSCORE'; fi` +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile +LIBTOOL_LINK = $(LIBTOOL) --mode=link +LIBTOOL_INSTALL = $(LIBTOOL) --mode=install +LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall +AR = @AR@ +AR_FLAGS = rc +RANLIB = @RANLIB@ +RM = rm -f +@SET_MAKE@ + +# Programs used by "make install": +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +# Libtool options for linking with the thread library. +LTLIBTHREAD = @LTLIBTHREAD@ + +#### End of system configuration section. #### + +SHELL = /bin/sh + +# Needed by $(LIBTOOL). +top_builddir = ../.. + +OBJECTS = trampoline.lo @CPU_OBJECTS@ + +all : $(OBJECTS) libtrampoline.la $(srcdir)/trampoline_r.3 $(srcdir)/trampoline_r.html + +trampoline.lo : $(srcdir)/trampoline.c $(srcdir)/trampoline_r.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES_WITH_GNULIB) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/trampoline.c + +tramp-hppa.lo : tramp-hppa.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c tramp-hppa.s + +tramp-hppa.s : $(srcdir)/tramp-hppa-macro.S $(srcdir)/../../common/noexecstack.h + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common $(srcdir)/tramp-hppa-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > tramp-hppa.s + +tramp-hppa64.lo : tramp-hppa64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c tramp-hppa64.s + +tramp-hppa64.s : $(srcdir)/tramp-hppa64-macro.S $(srcdir)/../../common/noexecstack.h + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common $(srcdir)/tramp-hppa64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > tramp-hppa64.s + +tramp-powerpc.lo : tramp-powerpc.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c tramp-powerpc.s + +tramp-powerpc.s : $(srcdir)/tramp-powerpc-aix.S + $(CPP) $(srcdir)/tramp-powerpc-aix.S > tramp-powerpc.s + +tramp-powerpc64.lo : tramp-powerpc64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c tramp-powerpc64.s + +tramp-powerpc64.s : $(srcdir)/tramp-powerpc64-aix.S $(srcdir)/../../common/noexecstack.h + $(CPP) -I$(srcdir)/../../common $(srcdir)/tramp-powerpc64-aix.S > tramp-powerpc64.s + +tramp-ia64.lo : tramp-ia64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c tramp-ia64.s + +tramp-ia64.s : $(srcdir)/tramp-ia64-macro.S $(srcdir)/../../common/noexecstack.h + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common $(srcdir)/tramp-ia64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > tramp-ia64.s + +cache-sparc.lo : cache-sparc.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-sparc.s + +cache-sparc.s : $(srcdir)/cache-sparc-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common - < $(srcdir)/cache-sparc-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//.*$$,,' -e 's,\$$,#,g' -e 's,# ,#,g' > cache-sparc.s + +cache-sparc64.lo : cache-sparc64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-sparc64.s + +cache-sparc64.s : $(srcdir)/cache-sparc64-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common - < $(srcdir)/cache-sparc64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//.*$$,,' -e 's,\$$,#,g' -e 's,# ,#,g' > cache-sparc64.s + +cache-alpha.lo : cache-alpha.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-alpha.s + +cache-alpha.s : $(srcdir)/cache-alpha-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/cache-alpha-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > cache-alpha.s + +cache-hppa.lo : cache-hppa.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-hppa.s + +cache-hppa.s : $(srcdir)/cache-hppa-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common $(srcdir)/cache-hppa-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > cache-hppa.s + +cache-hppa64.lo : cache-hppa64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-hppa64.s + +cache-hppa64.s : $(srcdir)/cache-hppa64-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common $(srcdir)/cache-hppa64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > cache-hppa64.s + +cache-powerpc.lo : cache-powerpc.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-powerpc.s + +cache-powerpc.s : $(srcdir)/cache-powerpc-linux-macro.S $(srcdir)/cache-powerpc-macos.s + case "$(OS)" in \ + macos* | darwin*) syntax=macos;; \ + *) syntax=linux;; \ + esac; \ + case $${syntax} in \ + macos) \ + grep -v '\.machine' $(srcdir)/cache-powerpc-$${syntax}.s > cache-powerpc.s || exit 1 ;; \ + linux) \ + $(CPP) $(ASPFLAGS) $(srcdir)/cache-powerpc-$${syntax}-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > cache-powerpc.s || exit 1 ;; \ + *) \ + cp $(srcdir)/cache-powerpc-$${syntax}.s cache-powerpc.s || exit 1 ;; \ + esac + +cache-powerpc64-elfv2.lo : cache-powerpc64-elfv2.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-powerpc64-elfv2.s + +cache-powerpc64-elfv2.s : $(srcdir)/cache-powerpc64-elfv2-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/cache-powerpc64-elfv2-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > cache-powerpc64-elfv2.s + +libtrampoline.la : $(OBJECTS) ../../gnulib-lib/libgnu.la + $(LIBTOOL_LINK) $(CC) -o libtrampoline.la -rpath $(libdir) -no-undefined $(OBJECTS) ../../gnulib-lib/libgnu.la $(LDFLAGS) $(LTLIBTHREAD) + +# Installs the library and include files only. Typically called with only +# $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here. +install-lib : all force + mkdir -p $(includedir) + $(INSTALL_DATA) $(srcdir)/trampoline_r.h $(includedir)/trampoline_r.h + +install : all force + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(exec_prefix) +# mkdir -p $(DESTDIR)$(libdir) +# $(LIBTOOL_INSTALL) $(INSTALL_DATA) libtrampoline.la $(DESTDIR)$(libdir)/libtrampoline.la + mkdir -p $(DESTDIR)$(includedir) + $(INSTALL_DATA) $(srcdir)/trampoline_r.h $(DESTDIR)$(includedir)/trampoline_r.h + mkdir -p $(DESTDIR)$(mandir) + mkdir -p $(DESTDIR)$(mandir)/man3 + $(INSTALL_DATA) $(srcdir)/trampoline_r.3 $(DESTDIR)$(mandir)/man3/trampoline_r.3 + mkdir -p $(DESTDIR)$(datadir) + mkdir -p $(DESTDIR)$(htmldir) + $(INSTALL_DATA) $(srcdir)/trampoline_r.html $(DESTDIR)$(htmldir)/trampoline_r.html + +installdirs : force + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(exec_prefix) +# mkdir -p $(DESTDIR)$(libdir) + mkdir -p $(DESTDIR)$(includedir) + mkdir -p $(DESTDIR)$(mandir) + mkdir -p $(DESTDIR)$(mandir)/man3 + mkdir -p $(DESTDIR)$(datadir) + mkdir -p $(DESTDIR)$(htmldir) + +uninstall : force +# $(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libtrampoline.la + $(RM) $(DESTDIR)$(includedir)/trampoline_r.h + $(RM) $(DESTDIR)$(mandir)/man3/trampoline_r.3 + $(RM) $(DESTDIR)$(htmldir)/trampoline_r.html + +test1.@OBJEXT@ : $(srcdir)/test1.c $(srcdir)/trampoline_r.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/test1.c + +test1 : test1.@OBJEXT@ libtrampoline.la + $(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ test1.@OBJEXT@ libtrampoline.la $(LDFLAGS) -o test1 + +test2.@OBJEXT@ : $(srcdir)/test2.c $(srcdir)/trampoline_r.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/test2.c + +test2 : test2.@OBJEXT@ libtrampoline.la + $(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ test2.@OBJEXT@ libtrampoline.la $(LDFLAGS) -o test2 + +check1 : all test1 + ./test1 + +check : all test1 test2 + ./test1 + ./test2 + touch tests.passed.$(HOST) + +extracheck : check + +mostlyclean : clean + +clean : force + $(RM) $(OBJECTS) `echo $(OBJECTS) | sed -e 's/\.lo/.@OBJEXT@/g'` tramp-hppa.s tramp-hppa64.s tramp-powerpc.s tramp-powerpc64.s tramp-ia64.s cache-sparc.s cache-sparc64.s cache-alpha.s cache-hppa.s cache-hppa64.s cache-powerpc.s cache-powerpc64-elfv2.s libtrampoline.* core + $(RM) -r .libs _libs + $(RM) test1.@OBJEXT@ test1 test2.@OBJEXT@ test2 + +distclean : clean + $(RM) Makefile tests.passed.* + +maintainer-clean : distclean + + +# List of source files (committed in version control or generated by Makefile.devel). +SOURCE_FILES = \ + COPYING \ + PORTING README trampoline_r.3 trampoline_r.html \ + Makefile.devel \ + Makefile.maint \ + Makefile.in \ + trampoline_r.h \ + trampoline.c \ + tramp-hppa-macro.S \ + tramp-hppa64-macro.S \ + tramp-powerpc-aix.S \ + tramp-powerpc64-aix.S \ + tramp-ia64-macro.S \ + cache.c \ + cache-alpha.c cache-alpha-linux.s cache-alpha-macro.S \ + cache-hppa.c cache-hppa-linux.s cache-hppa-macro.S cache-hppa64-linux.s cache-hppa64-macro.S \ + cache-powerpc.c cache-powerpc-linux.s cache-powerpc-linux-macro.S cache-powerpc-macos.s \ + cache-powerpc64.c cache-powerpc64-elfv2-linux.s cache-powerpc64-elfv2-macro.S \ + cache-sparc.c cache-sparc-linux.s cache-sparc-macro.S cache-sparc64-linux.s cache-sparc64-macro.S \ + test1.c \ + test2.c +# List of distributed files generated by Makefile.maint. +GENERATED_FILES = \ + trampoline_r.man +# List of distributed files. +DISTFILES = $(SOURCE_FILES) $(GENERATED_FILES) + +distdir : $(DISTFILES) + for file in $(DISTFILES); do \ + if test -f $$file; then dir='.'; else dir='$(srcdir)'; fi; \ + cp -p "$$dir/$$file" '$(distdir)'/$$file || exit 1; \ + done + + +force : diff --git a/callback/trampoline_r/Makefile.maint b/callback/trampoline_r/Makefile.maint new file mode 100644 index 0000000..bc9c542 --- /dev/null +++ b/callback/trampoline_r/Makefile.maint @@ -0,0 +1,30 @@ +# maintainer -*-Makefile-*- + +RM = rm -f + +# ==================== Easily regeneratable files ==================== + +ROFF_MAN = groff -Tutf8 -mandoc + +all : trampoline_r.man + +trampoline_r.man : trampoline_r.3 + $(ROFF_MAN) trampoline_r.3 > trampoline_r.man + +totally-clean : force + $(RM) trampoline_r.man + + +# Files copied from other directories + +COPIED_FILES = \ + PORTING \ + cache.c \ + cache-alpha.c \ + cache-hppa.c +copied-files : $(COPIED_FILES) +$(COPIED_FILES) : % : ../../trampoline/% + cp $< $@ + + +force : diff --git a/callback/trampoline_r/PORTING b/callback/trampoline_r/PORTING new file mode 100644 index 0000000..46b6042 --- /dev/null +++ b/callback/trampoline_r/PORTING @@ -0,0 +1,95 @@ +The list of CPUs and platforms TRAMPOLINE has been ported to can be found +at the top of file trampoline.c. + +To port TRAMPOLINE to a new platform, three issues may have to be resolved: +A. a new CPU - how to build the trampoline? +B. a new OS - how to make code in malloc'ed memory executable? +C. a new CPU or OS - how to flush the instruction cache? + + +A. a new CPU - how to build the trampoline? + + The trampoline is a short sequence of machine instructions which puts + the constant into , then jumps to

. The only + registers that are allowed to be modified are call-used registers. No + stack manipulations are allowed since the trampoline has to pass its + arguments along to the function at
. + + 1. To find out which instructions are available for "move"/"store" and + "jump", compile proto.c for your CPU: + + make -f Makefile.devel proto-${CPU}.s + or + gcc -O2 -fomit-frame-pointer -S proto.c -o proto-${CPU}.s + + 2. Write down the instructions for the trampoline in a file tramp-${CPU}.s, + using constants for , ,
. Assemble it: + + gcc -c tramp-${CPU}.s + + Verify that the jump actually goes to
. (Beware: Some CPUs have + program-counter relative jumps.) + + gdb tramp-${CPU}.o + disassemble tramp + + 3. Take a hex dump of tramp-${CPU}.o + + hexdump -e '"%06.6_ax " 16/1 " %02X" "\n"' < tramp-${CPU}.o + or + od -tx1 -Ax < tramp-${CPU}.o + or + od -x +x < tramp-${CPU}.o + + Look out for the magic numbers you used for , and +
. + + 4. Write the code which builds up a trampoline in memory, in trampoline.c. + + 5. Try it: + + make + make check1 + + 6. Write the is_tramp() macro and the tramp_xxx() accessor macros + in trampoline.c. + + 7. Try it: + + make + make check + + +B. a new OS - how to make code in malloc'ed memory executable? + + ‘configure’ will find out whether code stored in malloc'ed memory is + executable, or whether virtual memory protections have to be set in order + to allow this. (The test is pretty simple: it copies a small function + to malloc'ed memory and tries to executed it. The test could also fail + because the compiler produced non-position-independent code or because + of alignment issues.) + + To set virtual memory protections on a page of memory, your system should + provide the mprotect() and getpagesize() functions. If it does not, find + a substitute. + + +C. a new CPU or OS - how to flush the instruction cache? + + CPUs which have separate data and instruction caches need to flush + (part of) the instruction cache when alloc_trampoline() is called. + (There may have been an old trampoline at the same location, and the + instruction cache is not updated when the new trampoline is built. + The effect can be that when the new trampoline is called, the old one + will still be executed.) + + To flush the instruction cache, some CPUs have special instruction which + can be put into gcc "asm" statements. On some CPUs these instructions are + privileged, you therefore need to call some system or library function. + On other CPUs, the only way to flush the instruction cache is to execute + a long sequence of "nop" or "jump" instructions. This is hairy. + + +When you are done with porting to a new platform, or even if TRAMPOLINE +passes the "make check" out of the box without modifications, please report +your results to the author of TRAMPOLINE, for inclusion in the next release. diff --git a/callback/trampoline_r/README b/callback/trampoline_r/README new file mode 100644 index 0000000..486839e --- /dev/null +++ b/callback/trampoline_r/README @@ -0,0 +1,12 @@ +This directory contains a reentrant version of the trampoline package. + +Instead of clobbering a global variable, a pointer to data0,data1,... +is passed to the called function in a special CPU register. + +The number of supported data words (data0,data1) is arbitrary; 3 or 4 +or more would work as well if trampoline.c was modified appropriately. +Two words are needed, however, for passing closures through vacall_r +without an additional malloc() call per closure. + +The include file is renamed to . + diff --git a/callback/trampoline_r/cache-alpha-linux.s b/callback/trampoline_r/cache-alpha-linux.s new file mode 100644 index 0000000..6754a16 --- /dev/null +++ b/callback/trampoline_r/cache-alpha-linux.s @@ -0,0 +1,20 @@ + .set noreorder + .set volatile + .set noat + .set nomacro + .text + .align 2 + .align 4 + .globl __TR_clear_cache + .ent __TR_clear_cache +$__TR_clear_cache..ng: +__TR_clear_cache: + .frame $30,0,$26,0 + .prologue 0 + .set macro + call_pal 0x86 + .set nomacro + ret $31,($26),1 + .end __TR_clear_cache + .ident "GCC: (GNU) 4.0.2" + .section .note.GNU-stack,"",@progbits diff --git a/callback/trampoline_r/cache-alpha-macro.S b/callback/trampoline_r/cache-alpha-macro.S new file mode 100644 index 0000000..e350f4c --- /dev/null +++ b/callback/trampoline_r/cache-alpha-macro.S @@ -0,0 +1,21 @@ + .set noreorder + .set volatile + .set noat + .set nomacro + .text + .align 2 + .align 4 + .globl __TR_clear_cache + .ent __TR_clear_cache +$__TR_clear_cache..ng: +__TR_clear_cache: + .frame $30,0,$26,0 + .prologue 0 + .set macro + call_pal 0x86 + .set nomacro + ret $31,($26),1 + .end __TR_clear_cache +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/trampoline_r/cache-alpha.c b/callback/trampoline_r/cache-alpha.c new file mode 100644 index 0000000..ad20947 --- /dev/null +++ b/callback/trampoline_r/cache-alpha.c @@ -0,0 +1,24 @@ +/* Instruction cache flushing for alpha */ + +/* + * Copyright 1997 Bruno Haible + * + * 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, see . + */ + +void __TR_clear_cache (void) +{ + /* Taken from gforth-0.3.0. */ + asm volatile ("call_pal 0x86"); /* imb (instruction-memory barrier) */ +} diff --git a/callback/trampoline_r/cache-hppa-linux.s b/callback/trampoline_r/cache-hppa-linux.s new file mode 100644 index 0000000..b9c9a6d --- /dev/null +++ b/callback/trampoline_r/cache-hppa-linux.s @@ -0,0 +1,33 @@ + .LEVEL 1.1 + .text + .align 4 +.globl __TR_clear_cache + .type __TR_clear_cache,@function +__TR_clear_cache: + .PROC + .CALLINFO FRAME=0,NO_CALLS + .ENTRY +#APP + fdc 0(0,%r26) + fdc 0(0,%r25) + sync + mfsp %sr0,%r20 + ldsid (0,%r26),%r26 + mtsp %r26,%sr0 + fic 0(%sr0,%r26) + fic 0(%sr0,%r25) + sync + mtsp %r20,%sr0 + nop + nop + nop + nop + nop + nop +#NO_APP + bv,n %r0(%r2) + .EXIT + .PROCEND +.Lfe1: + .size __TR_clear_cache,.Lfe1-__TR_clear_cache + .ident "GCC: (GNU) 3.1" diff --git a/callback/trampoline_r/cache-hppa-macro.S b/callback/trampoline_r/cache-hppa-macro.S new file mode 100644 index 0000000..7c39646 --- /dev/null +++ b/callback/trampoline_r/cache-hppa-macro.S @@ -0,0 +1,36 @@ +#include "asm-hppa.h" + .LEVEL 1.1 + IMPORT_MILLICODE($$dyncall) + TEXT1() + TEXT2() + .align 4 +GLOBL(__TR_clear_cache) + DECLARE_FUNCTION(__TR_clear_cache) +DEF(__TR_clear_cache) + .PROC + .CALLINFO FRAME=0,NO_CALLS + .ENTRY + fdc 0(0,%r26) + fdc 0(0,%r25) + sync + mfsp %sr0,%r20 + ldsid (0,%r26),%r26 + mtsp %r26,%sr0 + fic 0(%sr0,%r26) + fic 0(%sr0,%r25) + sync + mtsp %r20,%sr0 + nop + nop + nop + nop + nop + nop + bv,n %r0(%r2) + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(__TR_clear_cache) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/trampoline_r/cache-hppa.c b/callback/trampoline_r/cache-hppa.c new file mode 100644 index 0000000..2174716 --- /dev/null +++ b/callback/trampoline_r/cache-hppa.c @@ -0,0 +1,65 @@ +/* Instruction cache flushing for hppa */ + +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +#ifdef __hppa64__ +/* Tell GCC not to clobber the registers that are call-saved in the HP C + calling convention. */ +register long arg0 __asm__("r26"); +register long arg1 __asm__("r25"); +register long arg2 __asm__("r24"); +register long arg3 __asm__("r23"); +register long arg4 __asm__("r22"); +register long arg5 __asm__("r21"); +register long arg6 __asm__("r20"); +register long arg7 __asm__("r19"); +#endif + +/* + * This assumes that the range [first_addr..last_addr] lies in at most two + * cache lines. + */ +void __TR_clear_cache (char* first_addr, char* last_addr) +{ + register int tmp1; + register int tmp2; + /* Flush the relevant data cache lines. (Yes, this is needed. I tried it.) */ + asm volatile ("fdc 0(0,%0)" + "\n\t" "fdc 0(0,%1)" + "\n\t" "sync" + : + : "r" (first_addr), "r" (last_addr) + ); + /* Flush the relevant instruction cache lines. */ + asm volatile ("mfsp %%sr0,%1" + "\n\t" "ldsid (0,%4),%0" + "\n\t" "mtsp %0,%%sr0" + "\n\t" "fic 0(%%sr0,%2)" + "\n\t" "fic 0(%%sr0,%3)" + "\n\t" "sync" + "\n\t" "mtsp %1,%%sr0" + "\n\t" "nop" + "\n\t" "nop" + "\n\t" "nop" + "\n\t" "nop" + "\n\t" "nop" + "\n\t" "nop" + : "=r" (tmp1), "=r" (tmp2) + : "r" (first_addr), "r" (last_addr), "r" (first_addr) + ); +} diff --git a/callback/trampoline_r/cache-hppa64-linux.s b/callback/trampoline_r/cache-hppa64-linux.s new file mode 100644 index 0000000..928f35f --- /dev/null +++ b/callback/trampoline_r/cache-hppa64-linux.s @@ -0,0 +1,35 @@ + .LEVEL 2.0w + .text + .align 8 +.globl __TR_clear_cache + .type __TR_clear_cache,@function +__TR_clear_cache: + .PROC + .CALLINFO FRAME=128,NO_CALLS + .ENTRY + ldo 128(%r30),%r30 +#APP + fdc 0(0,%r26) + fdc 0(0,%r25) + sync + mfsp %sr0,%r31 + ldsid (0,%r26),%r28 + mtsp %r28,%sr0 + fic 0(%sr0,%r26) + fic 0(%sr0,%r25) + sync + mtsp %r31,%sr0 + nop + nop + nop + nop + nop + nop +#NO_APP + bve (%r2) + ldo -128(%r30),%r30 + .EXIT + .PROCEND +.Lfe1: + .size __TR_clear_cache,.Lfe1-__TR_clear_cache + .ident "GCC: (GNU) 3.1" diff --git a/callback/trampoline_r/cache-hppa64-macro.S b/callback/trampoline_r/cache-hppa64-macro.S new file mode 100644 index 0000000..e5344ae --- /dev/null +++ b/callback/trampoline_r/cache-hppa64-macro.S @@ -0,0 +1,37 @@ +#include "asm-hppa64.h" + .LEVEL 2.0w + TEXT1() + TEXT2() + .align 8 +GLOBL(__TR_clear_cache) + DECLARE_FUNCTION(__TR_clear_cache) +DEF(__TR_clear_cache) + .PROC + .CALLINFO FRAME=128,NO_CALLS + .ENTRY + ldo 128(%r30),%r30 + fdc 0(0,%r26) + fdc 0(0,%r25) + sync + mfsp %sr0,%r31 + ldsid (0,%r26),%r28 + mtsp %r28,%sr0 + fic 0(%sr0,%r26) + fic 0(%sr0,%r25) + sync + mtsp %r31,%sr0 + nop + nop + nop + nop + nop + nop + bve (%r2) + ldo -128(%r30),%r30 + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(__TR_clear_cache) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/trampoline_r/cache-powerpc-linux-macro.S b/callback/trampoline_r/cache-powerpc-linux-macro.S new file mode 100644 index 0000000..9fb39b2 --- /dev/null +++ b/callback/trampoline_r/cache-powerpc-linux-macro.S @@ -0,0 +1,31 @@ + .file "cache-powerpc.c" + .section ".text" + .align 2 + .globl __TR_clear_cache + .type __TR_clear_cache, @function +__TR_clear_cache: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-32(1) + icbi 0,3; dcbf 0,3 + addi 0,3,4 + icbi 0,0; dcbf 0,0 + addi 9,3,8 + icbi 0,9; dcbf 0,9 + addi 0,3,12 + icbi 0,0; dcbf 0,0 + addi 9,3,16 + icbi 0,9; dcbf 0,9 + addi 3,3,20 + icbi 0,3; dcbf 0,3 + sync; isync + addi 1,1,32 + blr + .size __TR_clear_cache, .-__TR_clear_cache +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/trampoline_r/cache-powerpc-linux.s b/callback/trampoline_r/cache-powerpc-linux.s new file mode 100644 index 0000000..11788b3 --- /dev/null +++ b/callback/trampoline_r/cache-powerpc-linux.s @@ -0,0 +1,42 @@ + .file "cache-powerpc.c" + .section ".text" + .align 2 + .globl __TR_clear_cache + .type __TR_clear_cache, @function +__TR_clear_cache: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-32(1) +#APP + icbi 0,3; dcbf 0,3 +#NO_APP + addi 0,3,4 +#APP + icbi 0,0; dcbf 0,0 +#NO_APP + addi 9,3,8 +#APP + icbi 0,9; dcbf 0,9 +#NO_APP + addi 0,3,12 +#APP + icbi 0,0; dcbf 0,0 +#NO_APP + addi 9,3,16 +#APP + icbi 0,9; dcbf 0,9 +#NO_APP + addi 3,3,20 +#APP + icbi 0,3; dcbf 0,3 + sync; isync +#NO_APP + addi 1,1,32 + blr + .size __TR_clear_cache, .-__TR_clear_cache + .section .note.GNU-stack,"",@progbits + .ident "GCC: (GNU) 3.3.6" diff --git a/callback/trampoline_r/cache-powerpc-macos.s b/callback/trampoline_r/cache-powerpc-macos.s new file mode 100644 index 0000000..c468cf3 --- /dev/null +++ b/callback/trampoline_r/cache-powerpc-macos.s @@ -0,0 +1,17 @@ +.text + .align 2 + .globl ___TR_clear_cache +___TR_clear_cache: + icbi 0,r3; dcbf 0,r3 + addi r0,r3,4 + icbi 0,r0; dcbf 0,r0 + addi r9,r3,8 + icbi 0,r9; dcbf 0,r9 + addi r0,r3,12 + icbi 0,r0; dcbf 0,r0 + addi r9,r3,16 + icbi 0,r9; dcbf 0,r9 + addi r3,r3,20 + icbi 0,r3; dcbf 0,r3 + sync; isync + blr diff --git a/callback/trampoline_r/cache-powerpc.c b/callback/trampoline_r/cache-powerpc.c new file mode 100644 index 0000000..88dbb0b --- /dev/null +++ b/callback/trampoline_r/cache-powerpc.c @@ -0,0 +1,32 @@ +/* Instruction cache flushing for powerpc, not on AIX */ + +/* + * Copyright 1997-2017 Bruno Haible + * + * 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, see . + */ + +void __TR_clear_cache (char* first_addr) +{ + /* Taken from egcs-1.1.2/gcc/config/rs6000/tramp.asm. */ + /* The number of asm statements here depends on the value of TRAMP_LENGTH + for __powerpcsysv4__. */ + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+4)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+8)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+12)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+16)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+20)); + asm volatile ("sync; isync"); +} diff --git a/callback/trampoline_r/cache-powerpc64-elfv2-linux.s b/callback/trampoline_r/cache-powerpc64-elfv2-linux.s new file mode 100644 index 0000000..e51aef5 --- /dev/null +++ b/callback/trampoline_r/cache-powerpc64-elfv2-linux.s @@ -0,0 +1,42 @@ + .file "cache-powerpc64.c" + .machine power4 + .abiversion 2 + .section ".toc","aw" + .section ".text" + .align 2 + .p2align 4,,15 + .globl __TR_clear_cache + .type __TR_clear_cache, @function +__TR_clear_cache: +#APP + # 25 "cache-powerpc64.c" 1 + icbi 0,3; dcbf 0,3 + # 0 "" 2 +#NO_APP + addi 9,3,4 +#APP + # 26 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 +#NO_APP + addi 9,3,8 +#APP + # 27 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 +#NO_APP + addi 3,3,12 +#APP + # 28 "cache-powerpc64.c" 1 + icbi 0,3; dcbf 0,3 + # 0 "" 2 + # 29 "cache-powerpc64.c" 1 + sync; isync + # 0 "" 2 +#NO_APP + blr + .long 0 + .byte 0,0,0,0,0,0,0,0 + .size __TR_clear_cache,.-__TR_clear_cache + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/callback/trampoline_r/cache-powerpc64-elfv2-macro.S b/callback/trampoline_r/cache-powerpc64-elfv2-macro.S new file mode 100644 index 0000000..81c43d0 --- /dev/null +++ b/callback/trampoline_r/cache-powerpc64-elfv2-macro.S @@ -0,0 +1,35 @@ + .file "cache-powerpc64.c" + .machine power4 + .abiversion 2 + .section ".toc","aw" + .section ".text" + .align 2 + .p2align 4,,15 + .globl __TR_clear_cache + .type __TR_clear_cache, @function +__TR_clear_cache: + # 25 "cache-powerpc64.c" 1 + icbi 0,3; dcbf 0,3 + # 0 "" 2 + addi 9,3,4 + # 26 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 + addi 9,3,8 + # 27 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 + addi 3,3,12 + # 28 "cache-powerpc64.c" 1 + icbi 0,3; dcbf 0,3 + # 0 "" 2 + # 29 "cache-powerpc64.c" 1 + sync; isync + # 0 "" 2 + blr + .long 0 + .byte 0,0,0,0,0,0,0,0 + .size __TR_clear_cache,.-__TR_clear_cache +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/trampoline_r/cache-powerpc64.c b/callback/trampoline_r/cache-powerpc64.c new file mode 100644 index 0000000..76a2b72 --- /dev/null +++ b/callback/trampoline_r/cache-powerpc64.c @@ -0,0 +1,30 @@ +/* Instruction cache flushing for powerpc64, not the AIX ABI */ + +/* + * Copyright 1997-2017 Bruno Haible + * + * 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, see . + */ + +void __TR_clear_cache (char* first_addr) +{ + /* Taken from egcs-1.1.2/gcc/config/rs6000/tramp.asm. */ + /* The number of asm statements here depends on the value of TRAMP_LENGTH-2*8 + for __powerpc64_elfv2__. */ + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+4)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+8)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+12)); + asm volatile ("sync; isync"); +} diff --git a/callback/trampoline_r/cache-sparc-linux.s b/callback/trampoline_r/cache-sparc-linux.s new file mode 100644 index 0000000..2fa77f5 --- /dev/null +++ b/callback/trampoline_r/cache-sparc-linux.s @@ -0,0 +1,15 @@ + .file "cache-sparc.c" + .section ".text" + .align 4 + .global __TR_clear_cache_2 + .type __TR_clear_cache_2,#function + .proc 020 +__TR_clear_cache_2: + !#PROLOGUE# 0 + iflush %o0+0;iflush %o0+8 + nop + retl + nop +.LLfe1: + .size __TR_clear_cache_2,.LLfe1-__TR_clear_cache_2 + .ident "GCC: (GNU) 3.1" diff --git a/callback/trampoline_r/cache-sparc-macro.S b/callback/trampoline_r/cache-sparc-macro.S new file mode 100644 index 0000000..b633dc5 --- /dev/null +++ b/callback/trampoline_r/cache-sparc-macro.S @@ -0,0 +1,17 @@ +#include "asm-sparc.h" + .section ".text" + .align 4 + .global C(__TR_clear_cache_2) + DECLARE_FUNCTION(__TR_clear_cache_2) + .proc 020 +FUNBEGIN(__TR_clear_cache_2) + !$PROLOGUE$ 0 + iflush %o0+0;iflush %o0+8 + nop + retl + nop +L(Lfe1): + FUNEND(__TR_clear_cache_2) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/trampoline_r/cache-sparc.c b/callback/trampoline_r/cache-sparc.c new file mode 100644 index 0000000..81bc434 --- /dev/null +++ b/callback/trampoline_r/cache-sparc.c @@ -0,0 +1,29 @@ +/* Instruction cache flushing for sparc */ + +/* + * Copyright 1996-1999 Bruno Haible + * + * 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, see . + */ + +/* + * This assumes that the range [first_addr..last_addr] lies in at most two + * cache lines. + */ +void __TR_clear_cache_2 (char* first_addr, char* last_addr) +{ + asm volatile ("iflush %0+0;" /* the +0 is needed by gas, says gforth-0.3.0 */ + "iflush %0+8" + : : "r" (first_addr)); +} diff --git a/callback/trampoline_r/cache-sparc64-linux.s b/callback/trampoline_r/cache-sparc64-linux.s new file mode 100644 index 0000000..eb13421 --- /dev/null +++ b/callback/trampoline_r/cache-sparc64-linux.s @@ -0,0 +1,13 @@ + .file "cache-sparc.c" + .section ".text" + .align 4 + .global __TR_clear_cache_2 + .type __TR_clear_cache_2, #function + .proc 020 +__TR_clear_cache_2: + iflush %o0+0;iflush %o0+8 + jmp %o7+8 + nop + .size __TR_clear_cache_2, .-__TR_clear_cache_2 + .ident "GCC: (GNU) 4.0.2" + .section ".note.GNU-stack" diff --git a/callback/trampoline_r/cache-sparc64-macro.S b/callback/trampoline_r/cache-sparc64-macro.S new file mode 100644 index 0000000..039fd8e --- /dev/null +++ b/callback/trampoline_r/cache-sparc64-macro.S @@ -0,0 +1,14 @@ +#include "asm-sparc.h" + .section ".text" + .align 4 + .global C(__TR_clear_cache_2) + DECLARE_FUNCTION(__TR_clear_cache_2) + .proc 020 +FUNBEGIN(__TR_clear_cache_2) + iflush %o0+0;iflush %o0+8 + jmp %o7+8 + nop + FUNEND(__TR_clear_cache_2) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/trampoline_r/cache.c b/callback/trampoline_r/cache.c new file mode 100644 index 0000000..7d34af9 --- /dev/null +++ b/callback/trampoline_r/cache.c @@ -0,0 +1,143 @@ +/* This file is derived from gcc-2.6.3/libgcc2.c, section L_clear_cache */ + +/* Copyright (C) 1989-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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, see . */ + + +/* Clear part of an instruction cache. */ + +/* Our emphasis here is _not_ to clear as few cache lines as possible + * or with as few machine instructions as possible, but to do it _right_. + */ + + + +/* This code is apparently untested!! */ + +/* This is from Andreas Stolcke . */ +#if defined(__mips__) || defined(__mips64__) +#include +#define CLEAR_INSN_CACHE(BEG, END) \ + cacheflush (BEG, END - BEG, BCACHE) +#endif + +void +__TR_clear_cache (beg, end) + char *beg, *end; +{ +#ifdef CLEAR_INSN_CACHE + CLEAR_INSN_CACHE (beg, end); +#else +#ifdef INSN_CACHE_SIZE /* This is actually dead code!! */ +#define INSN_CACHE_PLANE_SIZE (INSN_CACHE_SIZE / INSN_CACHE_DEPTH) + static char array[INSN_CACHE_SIZE + INSN_CACHE_PLANE_SIZE + INSN_CACHE_LINE_WIDTH]; + static int initialized = 0; + int offset; + void *start_addr; + void *end_addr; + typedef (*function_ptr) (); + +#if (INSN_CACHE_SIZE / INSN_CACHE_LINE_WIDTH) < 16 + /* It's cheaper to clear the whole cache. + Put in a series of jump instructions so that calling the beginning + of the cache will clear the whole thing. */ + + if (! initialized) + { + int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1) + & -INSN_CACHE_LINE_WIDTH); + int end_ptr = ptr + INSN_CACHE_SIZE; + + while (ptr < end_ptr) + { + *(INSTRUCTION_TYPE *)ptr + = JUMP_AHEAD_INSTRUCTION + INSN_CACHE_LINE_WIDTH; + ptr += INSN_CACHE_LINE_WIDTH; + } + *(INSTRUCTION_TYPE *)(ptr - INSN_CACHE_LINE_WIDTH) = RETURN_INSTRUCTION; + + initialized = 1; + } + + /* Call the beginning of the sequence. */ + (((function_ptr) (((int) array + INSN_CACHE_LINE_WIDTH - 1) + & -INSN_CACHE_LINE_WIDTH)) + ()); + +#else /* Cache is large. */ + + if (! initialized) + { + int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1) + & -INSN_CACHE_LINE_WIDTH); + + while (ptr < (int) array + sizeof array) + { + *(INSTRUCTION_TYPE *)ptr = RETURN_INSTRUCTION; + ptr += INSN_CACHE_LINE_WIDTH; + } + + initialized = 1; + } + + /* Find the location in array that occupies the same cache line as BEG. */ + + offset = ((int) beg & -INSN_CACHE_LINE_WIDTH) & (INSN_CACHE_PLANE_SIZE - 1); + start_addr = (((int) (array + INSN_CACHE_PLANE_SIZE - 1) + & -INSN_CACHE_PLANE_SIZE) + + offset); + + /* Compute the cache alignment of the place to stop clearing. */ +#if 0 /* This is not needed for gcc's purposes. */ + /* If the block to clear is bigger than a cache plane, + we clear the entire cache, and OFFSET is already correct. */ + if (end < beg + INSN_CACHE_PLANE_SIZE) +#endif + offset = (((int) (end + INSN_CACHE_LINE_WIDTH - 1) + & -INSN_CACHE_LINE_WIDTH) + & (INSN_CACHE_PLANE_SIZE - 1)); + +#if INSN_CACHE_DEPTH > 1 + end_addr = (start_addr & -INSN_CACHE_PLANE_SIZE) + offset; + if (end_addr <= start_addr) + end_addr += INSN_CACHE_PLANE_SIZE; + + for (plane = 0; plane < INSN_CACHE_DEPTH; plane++) + { + int addr = start_addr + plane * INSN_CACHE_PLANE_SIZE; + int stop = end_addr + plane * INSN_CACHE_PLANE_SIZE; + + while (addr != stop) + { + /* Call the return instruction at ADDR. */ + ((function_ptr) addr) (); + + addr += INSN_CACHE_LINE_WIDTH; + } + } +#else /* just one plane */ + do + { + /* Call the return instruction at START_ADDR. */ + ((function_ptr) start_addr) (); + + start_addr += INSN_CACHE_LINE_WIDTH; + } + while ((start_addr % INSN_CACHE_SIZE) != offset); +#endif /* just one plane */ +#endif /* Cache is large */ +#endif /* Cache exists */ +#endif /* CLEAR_INSN_CACHE */ +} diff --git a/callback/trampoline_r/test1.c b/callback/trampoline_r/test1.c new file mode 100644 index 0000000..4b2f9f8 --- /dev/null +++ b/callback/trampoline_r/test1.c @@ -0,0 +1,105 @@ +/* Trampoline test */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include +#include + +#include "trampoline_r.h" +#include "ffcall-abi.h" /* Define __${host_cpu}__ */ + +/* Set when we can check that the env register is being passed correctly. */ +#if defined __GNUC__ && !defined __clang__ && !defined(__arm__) +#define CHECK_ENV_REGISTER +#endif + +#define MAGIC1 0x9db9af42 +#define MAGIC2 0x614a13c9 +#define MAGIC3 0x7aff3cb4 +#define MAGIC4 0xa2f9d045 + +#ifdef __cplusplus +typedef int (*function)(...); +#else +typedef int (*function)(); +#endif + +int f (int x) +{ +#ifdef CHECK_ENV_REGISTER +#ifdef __i386__ +register void* env __asm__("%ecx"); +#endif +#ifdef __m68k__ +register void* env __asm__("a0"); +#endif +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) +register void* env __asm__("$2"); +#endif +#if defined(__sparc__) && !defined(__sparc64__) +register void* env __asm__("%g2"); +#endif +#ifdef __sparc64__ +register void* env __asm__("%g5"); +#endif +#ifdef __alpha__ +register void* env __asm__("$1"); +#endif +#if defined(__hppa__) && !defined(__hppa64__) +register void* env __asm__("%r29"); +#endif +#ifdef __hppa64__ +register void* env __asm__("%r31"); +#endif +#ifdef __arm64__ +register void* env __asm__("x18"); +#endif +#ifdef __powerpc__ +register void* env __asm__("r11"); +#endif +#ifdef __ia64__ +register void* env __asm__("r15"); +#endif +#ifdef __x86_64__ +register void* env __asm__("r10"); +#endif +#if defined(__s390__) || defined(__s390x__) +register void* env __asm__("r0"); +#endif +#if defined(__riscv32__) || defined(__riscv64__) +register void* env __asm__("t2"); +#endif + + return x + (int)(long)((void**)env)[1] + (int)(long)((void**)env)[0] + MAGIC3; +#else + return x + MAGIC3; +#endif +} + +int main () +{ + function cf = alloc_trampoline_r((function)&f, (void*)MAGIC1, (void*)MAGIC2); +#ifdef CHECK_ENV_REGISTER + if ((*cf)(MAGIC4) == MAGIC1+MAGIC2+MAGIC3+MAGIC4) +#else + if ((*cf)(MAGIC4) == MAGIC3+MAGIC4) +#endif + { free_trampoline_r(cf); printf("Works, test1 passed.\n"); exit(0); } + else + { printf("Doesn't work!\n"); exit(1); } +} diff --git a/callback/trampoline_r/test2.c b/callback/trampoline_r/test2.c new file mode 100644 index 0000000..cd4bd1f --- /dev/null +++ b/callback/trampoline_r/test2.c @@ -0,0 +1,52 @@ +/* Trampoline accessor test */ + +/* + * Copyright 1995-2005 Bruno Haible + * + * 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, see . + */ + +#include +#include + +#include "trampoline_r.h" + +#ifdef __cplusplus +typedef int (*function)(...); +#else +typedef int (*function)(); +#endif + +int f (int x) +{ return x; } + +#define MAGIC1 0x9db9af42 +#define MAGIC2 0x614a13c9 + +int main () +{ + function cf = alloc_trampoline_r((function)&f, (void*)MAGIC1, (void*)MAGIC2); + if (is_trampoline_r((void*)&main)) + { printf("is_trampoline_r(&main) returns true!\n"); exit(1); } + if (!is_trampoline_r((void*)cf)) + { printf("is_trampoline_r() returns false!\n"); exit(1); } + if (trampoline_r_address(cf) != (function)&f) + { printf("trampoline_r_address() doesn't work!\n"); exit(1); } + if (trampoline_r_data0(cf) != (void*)MAGIC1) + { printf("trampoline_r_data0() doesn't work!\n"); exit(1); } + if (trampoline_r_data1(cf) != (void*)MAGIC2) + { printf("trampoline_r_data1() doesn't work!\n"); exit(1); } + printf("test2 passed.\n"); + exit(0); +} diff --git a/callback/trampoline_r/tramp-hppa-macro.S b/callback/trampoline_r/tramp-hppa-macro.S new file mode 100644 index 0000000..f223283 --- /dev/null +++ b/callback/trampoline_r/tramp-hppa-macro.S @@ -0,0 +1,49 @@ +; Trampoline for hppa CPU + +; Copyright 1997-2017 Bruno Haible +; +; 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, see . + +; Available registers: %r1, %r19, %r20, %r21, %r22, %r29, %r31. + + .code + .IMPORT $global$,DATA + .IMPORT $$dyncall,MILLICODE + .code + + .align 4 + .EXPORT tramp_r,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR + .label tramp_r + .PROC + .CALLINFO FRAME=0,NO_CALLS + .ENTRY +; The closure pointer is already in register %r19. +; Move into register %r29 + ldw 0(0,%r19),%r29 +; Move
into register %r21. + ldw 4(0,%r19),%r21 +; Jump to it. + bb,>=,n %r21,30,tramp_r_2 + depi 0,31,2,%r21 + ldw 4(0,%r21),%r19 + ldw 0(0,%r21),%r21 + .label tramp_r_2 + ldsid (0,%r21),%r1 + mtsp %r1,%sr0 + be,n 0(%sr0,%r21) + nop + .EXIT + .PROCEND + +#include "noexecstack.h" diff --git a/callback/trampoline_r/tramp-hppa64-macro.S b/callback/trampoline_r/tramp-hppa64-macro.S new file mode 100644 index 0000000..62eb419 --- /dev/null +++ b/callback/trampoline_r/tramp-hppa64-macro.S @@ -0,0 +1,48 @@ +; Trampoline for hppa64 CPU + +; Copyright 2017 Bruno Haible +; +; 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, see . + +; Available registers: %r1, %r27, %r31. +; %r27 has a fixed meaning at function calls: pic_base (a.k.a. gp or dp). +; %r31 has a fixed meaning as millicode return pointer (mrp). + +#include "asm-hppa64.h" + + .LEVEL 2.0w + TEXT1() + TEXT2() + .align 8 + GLOBL(tramp_r) + DECLARE_FUNCTION(tramp_r) +DEF(tramp_r) + .PROC + .CALLINFO FRAME=0,NO_CALLS + .ENTRY +; The closure pointer is already in register %r27. +; Move into register %r31. + ldd 0(%r27),%r31 ; get +; Jump to . + ldd 8(%r27),%r27 ; get + ldd 16(%r27),%r1 + ldd 24(%r27),%r27 + bve (%r1) ; jump to + nop + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(tramp_r) + +#include "noexecstack.h" diff --git a/callback/trampoline_r/tramp-ia64-macro.S b/callback/trampoline_r/tramp-ia64-macro.S new file mode 100644 index 0000000..f2deeec --- /dev/null +++ b/callback/trampoline_r/tramp-ia64-macro.S @@ -0,0 +1,43 @@ +/* Trampoline for ia64 CPU */ + +/* + * Copyright 2001-2017 Bruno Haible + * + * 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, see . + */ + +/* Available registers: r14 ... r31, r9 ... r11, r2 ... r3. */ + + .text + .align 16 + .global tramp_r# + .proc tramp_r# +tramp_r: + /* The closure pointer is already in register r1. */ + ld8 r14 = [r1] /* Move
into register r14. */ + adds r15 = 8, r1 + ;; + ld8 r15 = [r15] /* Move into register r15. */ + /* Jump to r14. */ + ld8 r17 = [r14] + adds r16 = 8, r14 + ;; + ld8 r1 = [r16] + mov b6 = r17 + ;; + br b6 + ;; + .endp tramp_r# + +#include "noexecstack.h" diff --git a/callback/trampoline_r/tramp-powerpc-aix.S b/callback/trampoline_r/tramp-powerpc-aix.S new file mode 100644 index 0000000..2ed1eca --- /dev/null +++ b/callback/trampoline_r/tramp-powerpc-aix.S @@ -0,0 +1,49 @@ +/* Trampoline for powerpc CPU with AIX calling convention */ + +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +/* Available registers: r0, r11, r12. */ +/* However, r0 is special in that it cannot be used as a base register. */ + + .globl tramp_r + .globl .tramp_r +.csect tramp_r[DS] +tramp_r: + .long .tramp_r, 0, 0 +.csect .text[PR] +.tramp_r: +/* Move into register r11 */ + lwz 11,0(2) /* get */ +/* Get */ + lwz 12,4(2) +/* + * gcc-2.6.3 source says: + * A function pointer is a pointer to a data area whose first word contains + * the actual address of the function, whose second word contains a pointer + * to its TOC, and whose third word contains a value to place in the static + * chain register (r11). But we have already placed our information in r11. + */ +/* lwz 11,8(12) pass static chain in r11 */ + lwz 2,4(12) /* pass TOC in r2 */ + lwz 0,0(12) /* actual code address */ + mtctr 0 + bctr + +_section_.text: +.csect .data[RW] + .long _section_.text diff --git a/callback/trampoline_r/tramp-powerpc64-aix.S b/callback/trampoline_r/tramp-powerpc64-aix.S new file mode 100644 index 0000000..2221dda --- /dev/null +++ b/callback/trampoline_r/tramp-powerpc64-aix.S @@ -0,0 +1,55 @@ +/* Trampoline for powerpc64 CPU with AIX calling convention */ + +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +/* Available registers: r0, r11, r12. */ +/* However, r0 is special in that it cannot be used as a base register. */ + + .machine "ppc64" + +#ifdef _AIX + .rename H.4.NO_SYMBOL{PR},"" + .lglobl H.4.NO_SYMBOL{PR} + + .globl .tramp_r + .csect H.4.NO_SYMBOL{PR},7 +#else + .globl tramp_r + .globl .tramp_r +tramp_r: + .quad .tramp_r +#endif +.tramp_r: +/* Move into register r11 */ + ld 11,0(2) /* get */ +/* Get */ + ld 12,8(2) +/* + * gcc-2.6.3 source says: + * A function pointer is a pointer to a data area whose first word contains + * the actual address of the function, whose second word contains a pointer + * to its TOC, and whose third word contains a value to place in the static + * chain register (r11). But we have already placed our information in r11. + */ +/* ld 11,16(12) pass static chain in r11 */ + ld 2,8(12) /* pass TOC in r2 */ + ld 0,0(12) /* actual code address */ + mtctr 0 + bctr + +#include "noexecstack.h" diff --git a/callback/trampoline_r/trampoline.c b/callback/trampoline_r/trampoline.c new file mode 100644 index 0000000..5d4f8c2 --- /dev/null +++ b/callback/trampoline_r/trampoline.c @@ -0,0 +1,1490 @@ +/* Trampoline construction */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + + +#include "config.h" +#include "trampoline_r.h" + +#if defined(__hppa__) && !defined(__hppa64__) +#if 0 +#define __hppaold__ /* Old trampoline, real machine code. */ +#else +#define __hppanew__ /* New trampoline, just a closure. */ +#endif +#endif +#if defined(__hppa64__) +#if 0 +#define __hppa64old__ /* Old trampoline, real machine code. */ +#else +#define __hppa64new__ /* New trampoline, just a closure. */ +#endif +#endif +#if defined(__powerpc__) && !defined(__powerpc64__) +#if !defined(_AIX) +#define __powerpcsysv4__ /* SysV.4 ABI, real machine code. */ +#else +#define __powerpcaix__ /* AIX ABI, just a closure. */ +#endif +#endif +#if defined(__powerpc64__) && !defined(__powerpc64_elfv2__) +#define __powerpc64aix__ /* AIX ABI, just a closure. */ +#endif +#if defined(__hppanew__) || defined(__hppa64new__) +/* + * A function pointer is a biased pointer to a data area whose first word + * (hppa) or third word (hppa64) contains the actual address of the function. + */ +extern void tramp_r (); /* trampoline prototype */ +/* We don't need to take any special measures to make the code executable + * since the actual instructions are in the text segment. + */ +#ifndef CODE_EXECUTABLE +#define CODE_EXECUTABLE +#endif +#endif +#if defined(__powerpcaix__) || defined(__powerpc64aix__) || defined(__ia64__) +/* + * A function pointer is a pointer to a data area whose first word contains + * the actual address of the function. + */ +extern void (*tramp_r) (); /* trampoline prototype */ +/* We don't need to take any special measures to make the code executable + * since the actual instructions are in the text segment. + */ +#ifndef CODE_EXECUTABLE +#define CODE_EXECUTABLE +#endif +#endif + +#ifndef CODE_EXECUTABLE /* Linux, Hurd, macOS, *BSD, IRIX, Solaris, Cygwin, native Windows */ + /* How do we make the trampoline's code executable? */ + #if HAVE_WORKING_MPROTECT /* Linux, Hurd, macOS, *BSD, IRIX, Solaris, Cygwin */ + #if HAVE_MPROTECT_AFTER_MALLOC_CAN_EXEC > 0 /* Hurd, macOS, *BSD except HardenedBSD, IRIX, Solaris, Cygwin */ + /* mprotect() [or equivalent] the malloc'ed area. */ + #define EXECUTABLE_VIA_MALLOC_THEN_MPROTECT + #elif HAVE_MPROTECT_AFTER_MMAP_CAN_EXEC > 0 + /* mprotect() [or equivalent] the mmap'ed area. */ + #define EXECUTABLE_VIA_MMAP_THEN_MPROTECT + #elif HAVE_MMAP_SHARED_CAN_EXEC /* Linux, HardenedBSD */ + #define EXECUTABLE_VIA_MMAP_FILE_SHARED + #else + #error "Don't know how to make memory pages executable." + #endif + #else /* native Windows, very old Linux */ + #if HAVE_MMAP_ANONYMOUS /* very old Linux */ + /* Use an mmap'ed page. */ + #define EXECUTABLE_VIA_MMAP + #else + #if defined(_WIN32) && ! defined(__CYGWIN__) /* native Windows */ + #define EXECUTABLE_VIA_VIRTUALALLOC + #else + ?? + #endif + #endif + #endif +#endif + +#include /* declares fprintf() */ + +#include +#include /* declares abort(), malloc(), free() */ +#ifdef HAVE_UNISTD_H +#include /* declares getpagesize() */ +#endif + +/* Define intptr_t, uintptr_t. */ +#include + +/* Declare getpagesize(). */ +/* On HP-UX, getpagesize exists, but it is not declared in even if + the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ +#ifdef __hpux +extern +#ifdef __cplusplus + "C" +#endif + int getpagesize (void); +#endif + +/* Declare mprotect(). */ +#if defined(EXECUTABLE_VIA_MALLOC_THEN_MPROTECT) || defined(EXECUTABLE_VIA_MMAP_THEN_MPROTECT) +#include +#include +#endif + +/* Declare mmap(). */ +#if defined(EXECUTABLE_VIA_MMAP) || defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) +#include +#include +#endif + +/* Declare open(). */ +#if defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) +#include +#include +#include +#endif + +/* Declare VirtualAlloc(), GetSystemInfo. */ +#ifdef EXECUTABLE_VIA_VIRTUALALLOC +#define WIN32_LEAN_AND_MEAN +#define WIN32_EXTRA_LEAN +#include +#endif + +/* Some old mmap() implementations require the flag MAP_VARIABLE whenever you + pass an addr == NULL. */ +#ifndef MAP_VARIABLE +#define MAP_VARIABLE 0 +#endif + +/* Support for instruction cache flush. */ +#if defined _WIN32 && !defined __CYGWIN__ +# define WIN32_LEAN_AND_MEAN +# define WIN32_EXTRA_LEAN +# include +#elif defined __APPLE__ && defined __MACH__ +# include +#elif defined _AIX +# include +#elif defined __sgi +# include +#else +#ifdef __i386__ +#if defined(_WIN32) && ! defined(__CYGWIN__) /* native Windows */ +#define WIN32_LEAN_AND_MEAN +#define WIN32_EXTRA_LEAN +#include +#endif +#endif +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__riscv32__) || defined(__riscv64__) +#ifdef HAVE_SYS_CACHECTL_H /* IRIX, Linux */ +#include +#else +#ifdef __OpenBSD__ +#include +#endif +#endif +#endif +/* Inline assembly function for instruction cache flush. */ +#if defined(__sparc__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppaold__) || defined(__hppa64old__) || defined(__powerpcsysv4__) || defined(__powerpc64_elfv2__) +#if defined(__sparc__) || defined(__sparc64__) +extern void __TR_clear_cache_2(); +#else +extern void __TR_clear_cache(); +#endif +#endif +#endif + +/* Support for multithread-safe coding. */ +#include "glthread/lock.h" + +#if defined(__APPLE__) && defined(__MACH__) /* only needed on macOS */ +#define KEEP_TEMP_FILE_VISIBLE +/* Support for temporary files that are cleaned up automatically. */ +#include "clean-temp-simple.h" +#endif + +#if !defined(CODE_EXECUTABLE) && defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) +/* Opens a file descriptor and attempts to make it non-inheritable. */ +static int open_noinherit (const char *filename, int flags, int mode) +{ +# if O_CLOEXEC + return open (filename, flags | O_CLOEXEC, mode); +# else + int fd = open (filename, flags, mode); +# ifdef F_SETFD + if (fd >= 0) + { + int flags = fcntl (fd, F_GETFD, 0); + if (flags >= 0) + fcntl (fd, F_SETFD, flags | FD_CLOEXEC); + } +# endif + return fd; +# endif +} +#endif + +/* Length and alignment of trampoline */ +#ifdef __i386__ +#define TRAMP_LENGTH 12 +#define TRAMP_ALIGN 16 /* 4 for a i386, 16 for a i486 */ +#endif +#ifdef __m68k__ +#define TRAMP_LENGTH 14 +#define TRAMP_ALIGN 16 +#endif +#if (defined(__mips__) || defined(__mipsn32__)) && !defined(__mips64__) +#define TRAMP_LENGTH 24 +#define TRAMP_ALIGN 4 +#endif +#ifdef __mips64old__ +#define TRAMP_LENGTH 56 +#define TRAMP_ALIGN 4 +#endif +#ifdef __mips64__ +#define TRAMP_LENGTH 32 +#define TRAMP_ALIGN 8 +#endif +#if defined(__sparc__) && !defined(__sparc64__) +#define TRAMP_LENGTH 16 +#define TRAMP_ALIGN 16 +#endif +#ifdef __sparc64__ +#define TRAMP_LENGTH 32 +#define TRAMP_ALIGN 16 +#endif +#ifdef __alpha__ +#define TRAMP_LENGTH 32 +#define TRAMP_ALIGN 8 +#endif +#ifdef __hppaold__ +#define TRAMP_LENGTH 48 +#define TRAMP_ALIGN 16 +#endif +#ifdef __hppanew__ +#define TRAMP_LENGTH 16 +#define TRAMP_ALIGN 16 +#define TRAMP_BIAS 2 +#endif +#ifdef __hppa64old__ +#define TRAMP_LENGTH 80 +#define TRAMP_ALIGN 8 +#define TRAMP_BIAS 48 +#endif +#ifdef __hppa64new__ +#define TRAMP_LENGTH 48 +#define TRAMP_ALIGN 8 +#endif +#if defined(__arm__) || defined(__armhf__) +#define TRAMP_LENGTH 48 +#define TRAMP_ALIGN 4 +#endif +#ifdef __arm64__ +#define TRAMP_LENGTH 32 +#define TRAMP_ALIGN 8 +#endif +#ifdef __powerpcsysv4__ +#define TRAMP_LENGTH 24 +#define TRAMP_ALIGN 4 +#endif +#ifdef __powerpcaix__ +#define TRAMP_LENGTH 20 +#define TRAMP_ALIGN 4 +#endif +#ifdef __powerpc64_elfv2__ +#define TRAMP_LENGTH 32 +#define TRAMP_ALIGN 8 +#endif +#ifdef __powerpc64aix__ +#define TRAMP_LENGTH 40 +#define TRAMP_ALIGN 8 +#endif +#ifdef __ia64__ +#define TRAMP_LENGTH 32 +#define TRAMP_ALIGN 16 +#endif +#ifdef __x86_64__ +#ifdef __x86_64_x32__ +#define TRAMP_LENGTH 13 +#define TRAMP_ALIGN 4 +#else +#define TRAMP_LENGTH 22 +#define TRAMP_ALIGN 16 +#endif +#endif +#if defined(__s390__) && !defined(__s390x__) +#define TRAMP_LENGTH 20 +#define TRAMP_ALIGN 4 +#endif +#ifdef __s390x__ +#define TRAMP_LENGTH 32 +#define TRAMP_ALIGN 8 +#endif +#ifdef __riscv32__ +#define TRAMP_LENGTH 24 +#define TRAMP_ALIGN 4 +#endif +#ifdef __riscv64__ +#define TRAMP_LENGTH 32 +#define TRAMP_ALIGN 8 +#endif + +#ifndef TRAMP_BIAS +#define TRAMP_BIAS 0 +#endif + +#define TRAMP_TOTAL_LENGTH (TRAMP_LENGTH + 2*sizeof(void*)) + +#if !defined(CODE_EXECUTABLE) +static long pagesize = 0; +#endif + +#if !defined(CODE_EXECUTABLE) && defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) + +/* Variables needed for obtaining memory pages via mmap(). */ +static int file_fd; +static long file_length; + +/* Initialization of these variables. */ +static void for_mmap_init (void) +{ + { + char filename[100]; + sprintf(filename, "%s/trampdata-%d-%ld", "/tmp", getpid (), random ()); +#if defined(KEEP_TEMP_FILE_VISIBLE) + if (register_temporary_file(filename) < 0) + { fprintf(stderr,"trampoline: Out of virtual memory!\n"); abort(); } +#endif + file_fd = open_noinherit (filename, O_CREAT | O_RDWR | O_TRUNC, 0700); + if (file_fd < 0) + { +#if defined(KEEP_TEMP_FILE_VISIBLE) + unregister_temporary_file(filename); +#endif + fprintf(stderr,"trampoline: Cannot open %s!\n",filename); + abort(); + } +#if !defined(KEEP_TEMP_FILE_VISIBLE) + /* Remove the file from the file system as soon as possible, to make + sure there is no leftover after this process terminates or crashes. + On macOS 11.2, this does not work: It would make the mmap call below, + with arguments PROT_READ|PROT_EXEC and MAP_SHARED, fail. */ + unlink(filename); +#endif + } + file_length = 0; +} + +/* Once-only initializer for these variables. */ +gl_once_define(static, for_mmap_once) + +#endif + +#if !defined(CODE_EXECUTABLE) && !defined(EXECUTABLE_VIA_MALLOC_THEN_MPROTECT) +/* AIX doesn't support mprotect() in malloc'ed memory. Must get pages of + * memory with execute permission via mmap(). Then keep a free list of + * free trampolines. + */ +static char* freelist = NULL; +/* Lock that protects the freelist from simultaneous access from multiple + threads. */ +gl_lock_define_initialized(static, freelist_lock) +#endif + +__TR_function alloc_trampoline_r (__TR_function address, void* data0, void* data1) +{ + char* function; + char* function_x; + char* data; + +#if !defined(CODE_EXECUTABLE) + /* First, get the page size once and for all. */ + if (!pagesize) + { +#if defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) + /* Use a once-only initializer here, since simultaneous execution of + for_mmap_init() in multiple threads must be avoided. */ + gl_once (for_mmap_once, for_mmap_init); +#endif + /* Simultaneous execution of this initialization in multiple threads + is OK. */ +#if defined(EXECUTABLE_VIA_VIRTUALALLOC) + /* GetSystemInfo + + */ + SYSTEM_INFO info; + GetSystemInfo(&info); + pagesize = info.dwPageSize; +#else + pagesize = getpagesize(); +#endif + } +#endif + + /* 1. Allocate room */ + +#if !defined(CODE_EXECUTABLE) && !defined(EXECUTABLE_VIA_MALLOC_THEN_MPROTECT) + gl_lock_lock(freelist_lock); + if (freelist == NULL) + { /* Get a new page. */ + char* page; + char* page_end; +#ifdef EXECUTABLE_VIA_VIRTUALALLOC + /* VirtualAlloc + + */ + page = VirtualAlloc(NULL,pagesize,MEM_COMMIT,PAGE_EXECUTE_READWRITE); + if (page == NULL) + { fprintf(stderr,"trampoline: Out of virtual memory!\n"); abort(); } + page_end = page + pagesize; +#else +#ifdef EXECUTABLE_VIA_MMAP_FILE_SHARED + char* page_x; + /* Extend the file by one page. */ + long new_file_length = file_length + pagesize; + if (ftruncate(file_fd,new_file_length) < 0) + { fprintf(stderr,"trampoline: Cannot extend backing file!\n"); abort(); } + /* Create separate mappings for writing and for executing. */ + page = (char*)mmap(NULL,pagesize,PROT_READ|PROT_WRITE,MAP_SHARED,file_fd,file_length); + page_x = (char*)mmap(NULL,pagesize,PROT_READ|PROT_EXEC,MAP_SHARED,file_fd,file_length); + if (page == (char*)(-1) || page_x == (char*)(-1)) + { fprintf(stderr,"trampoline: Out of virtual memory!\n"); abort(); } + file_length = new_file_length; + page_end = page + pagesize; + /* Link the two pages together. */ + ((intptr_t*)page)[0] = page_x - page; + page = (char*)(((uintptr_t)page + sizeof(intptr_t) + TRAMP_ALIGN-1) & -TRAMP_ALIGN); +#else +#ifdef EXECUTABLE_VIA_MMAP_THEN_MPROTECT + /* Use mmap with the MAP_ANONYMOUS or MAP_ANON flag. */ + page = mmap(NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_VARIABLE, -1, 0); +#endif +#ifdef EXECUTABLE_VIA_MMAP + /* Use mmap with the MAP_ANONYMOUS or MAP_ANON flag. */ + page = mmap(NULL, pagesize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | MAP_VARIABLE, -1, 0); +#endif + if (page == (char*)(-1)) + { fprintf(stderr,"trampoline: Out of virtual memory!\n"); abort(); } + page_end = page + pagesize; +#endif +#endif + /* Fill it with free trampolines. */ + { char** last = &freelist; + while (page+TRAMP_TOTAL_LENGTH <= page_end) + { *last = page; last = (char**)page; + page = (char*)(((uintptr_t)page + TRAMP_TOTAL_LENGTH + TRAMP_ALIGN-1) & -TRAMP_ALIGN); + } + *last = NULL; + } } + function = freelist; freelist = *(char**)freelist; + gl_lock_unlock(freelist_lock); +#else + { char* room = (char*) malloc(sizeof(void*) + TRAMP_TOTAL_LENGTH + TRAMP_ALIGN-1); + if (!room) + { fprintf(stderr,"trampoline: Out of virtual memory!\n"); abort(); } + function = (char*)(((uintptr_t)room + sizeof(void*) + TRAMP_ALIGN-1) & -TRAMP_ALIGN); + ((char**)function)[-1] = room; /* backpointer for free_trampoline() */ + } +#endif + +#if !defined(CODE_EXECUTABLE) && defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) + /* Find the executable address corresponding to the writable address. */ + { uintptr_t page = (uintptr_t) function & -(intptr_t)pagesize; + function_x = function + ((intptr_t*)page)[0]; + } +#else + function_x = function; +#endif + + /* 2. Fill out the trampoline */ + data = function + TRAMP_LENGTH; + /* Knowing that data = function + TRAMP_LENGTH, we could certainly optimize + * the trampolines a little bit more, using PC relative addressing modes. + * But I doubt it's really worth it. + */ +#ifdef __i386__ + /* function: + * movl $,%ecx B9 + * jmp
E9
- + * here: + * nop 90 + * nop 90 + */ + *(char *) (function + 0) = 0xB9; + *(long *) (function + 1) = (long) data; + *(char *) (function + 5) = 0xE9; + *(long *) (function + 6) = (long) address - (long) (function_x + 10); + *(short *) (function +10) = 0x9090; /* nop nop, for alignment */ +#define is_tramp(function) \ + *(unsigned char *) (function + 0) == 0xB9 && \ + *(unsigned char *) (function + 5) == 0xE9 +#define tramp_address(function) \ + *(long *) (function + 6) + (long) (function + 10) +#define tramp_data(function) \ + *(long *) (function + 1) +#endif +#ifdef __m68k__ + /* function: + * movel #,a0 20 7C + * jmp
4E F9
+ * nop 4E 71 + */ + *(short *) (function + 0) = 0x207C; + *(long *) (function + 2) = (long) data; + *(short *) (function + 6) = 0x4EF9; + *(long *) (function + 8) = (long) address; + *(short *) (function +12) = 0x4E71; +#define is_tramp(function) \ + *(unsigned short *) (function + 0) == 0x207C && \ + *(unsigned short *) (function + 6) == 0x4EF9 && \ + *(unsigned short *) (function +12) == 0x4E71 +#define tramp_address(function) \ + *(long *) (function + 8) +#define tramp_data(function) \ + *(long *) (function + 2) +#endif +#if (defined(__mips__) || defined(__mipsn32__)) && !defined(__mips64__) + /* function: + * lw $2,16($25) 8F 22 00 10 + * lw $25,20($25) 8F 39 00 14 + * jal $0,$25 03 20 00 09 was: j $25 03 20 00 08 + * nop 00 00 00 00 + * .word + * .word
+ */ + *(unsigned int *) (function + 0) = 0x8F220010; + *(unsigned int *) (function + 4) = 0x8F390014; + *(unsigned int *) (function + 8) = 0x03200009; + *(unsigned int *) (function +12) = 0x00000000; + *(unsigned int *) (function +16) = (unsigned int) data; + *(unsigned int *) (function +20) = (unsigned int) address; +#define TRAMP_CODE_LENGTH 16 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0x8F220010 && \ + *(unsigned int *) (function + 4) == 0x8F390014 && \ + *(unsigned int *) (function + 8) == 0x03200009 && \ + *(unsigned int *) (function +12) == 0x00000000 +#define tramp_address(function) \ + *(unsigned int *) (function +20) +#define tramp_data(function) \ + *(unsigned int *) (function +16) +#endif +#ifdef __mips64old__ + /* function: + * dli $2, 3C 02 hi16(hi32()) + * 34 42 lo16(hi32()) + * 00 02 14 38 + * 34 42 hi16(lo32()) + * 00 02 14 38 + * 34 42 lo16(lo32()) + * dli $25,
3C 19 hi16(hi32(
)) + * 37 39 lo16(hi32(
)) + * 00 19 CC 38 + * 37 39 hi16(lo32(
)) + * 00 19 CC 38 + * 37 39 lo16(lo32(
)) + * jal $0,$25 03 20 00 09 was: j $25 03 20 00 08 + * nop 00 00 00 00 + */ + /* What about big endian / little endian ?? */ + *(short *) (function + 0) = 0x3C02; + *(short *) (function + 2) = (unsigned long) data >> 48; + *(short *) (function + 4) = 0x3442; + *(short *) (function + 6) = ((unsigned long) data >> 32) & 0xffff; + *(int *) (function + 8) = 0x00021438; + *(short *) (function +12) = 0x3442; + *(short *) (function +14) = ((unsigned long) data >> 16) & 0xffff; + *(int *) (function +16) = 0x00021438; + *(short *) (function +20) = 0x3442; + *(short *) (function +22) = (unsigned long) data & 0xffff; + *(short *) (function +24) = 0x3C19; + *(short *) (function +26) = (unsigned long) address >> 48; + *(short *) (function +28) = 0x3739; + *(short *) (function +30) = ((unsigned long) address >> 32) & 0xffff; + *(int *) (function +32) = 0x0019CC38; + *(short *) (function +36) = 0x3739; + *(short *) (function +38) = ((unsigned long) address >> 16) & 0xffff; + *(int *) (function +40) = 0x0019CC38; + *(short *) (function +44) = 0x3739; + *(short *) (function +46) = (unsigned long) address & 0xffff; + *(int *) (function +48) = 0x03200009; + *(int *) (function +52) = 0x00000000; +#define is_tramp(function) \ + *(unsigned short *) (function + 0) == 0x3C02 && \ + *(unsigned short *) (function + 4) == 0x3442 && \ + *(unsigned int *) (function + 8) == 0x00021438 && \ + *(unsigned short *) (function +12) == 0x3442 && \ + *(unsigned int *) (function +16) == 0x00021438 && \ + *(unsigned short *) (function +20) == 0x3442 && \ + *(unsigned short *) (function +24) == 0x3C19 && \ + *(unsigned short *) (function +28) == 0x3739 && \ + *(unsigned int *) (function +32) == 0x0019CC38 && \ + *(unsigned short *) (function +36) == 0x3739 && \ + *(unsigned int *) (function +40) == 0x0019CC38 && \ + *(unsigned short *) (function +44) == 0x3739 && \ + *(unsigned int *) (function +48) == 0x03200009 && \ + *(unsigned int *) (function +52) == 0x00000000 +#define hilo(word3,word2,word1,word0) \ + (((unsigned long) (word3) << 48) | ((unsigned long) (word2) << 32) | \ + ((unsigned long) (word1) << 16) | (unsigned long) (word0)) +#define tramp_address(function) \ + hilo(*(unsigned short *) (function +26), \ + *(unsigned short *) (function +30), \ + *(unsigned short *) (function +38), \ + *(unsigned short *) (function +46)) +#define tramp_data(function) \ + hilo(*(unsigned short *) (function + 2), \ + *(unsigned short *) (function + 6), \ + *(unsigned short *) (function +14), \ + *(unsigned short *) (function +22)) +#endif +#ifdef __mips64__ + /* function: + * ld $2,16($25) DF 22 00 10 + * ld $25,24($25) DF 39 00 18 + * jal $0,$25 03 20 00 09 was: j $25 03 20 00 08 + * nop 00 00 00 00 + * .dword + * .dword
+ */ + *(unsigned int *) (function + 0) = 0xDF220010; + *(unsigned int *) (function + 4) = 0xDF390018; + *(unsigned int *) (function + 8) = 0x03200009; + *(unsigned int *) (function +12) = 0x00000000; + *(unsigned long *) (function +16) = (unsigned long) data; + *(unsigned long *) (function +24) = (unsigned long) address; +#define TRAMP_CODE_LENGTH 16 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0xDF220010 && \ + *(unsigned int *) (function + 4) == 0xDF390018 && \ + *(unsigned int *) (function + 8) == 0x03200009 && \ + *(unsigned int *) (function +12) == 0x00000000 +#define tramp_address(function) \ + *(unsigned long *) (function +24) +#define tramp_data(function) \ + *(unsigned long *) (function +16) +#endif +#if defined(__sparc__) && !defined(__sparc64__) + /* function: + * sethi %hi(),%g2 05000000 | ( >> 10) + * sethi %hi(
),%g1 03000000 | (
>> 10) + * jmp %g1+%lo(
) 81C06000 | (
& 0x3ff) + * or %g2,%lo(),%g2 8410A000 | ( & 0x3ff) + */ +#define hi(word) ((unsigned long) (word) >> 10) +#define lo(word) ((unsigned long) (word) & 0x3ff) + *(long *) (function + 0) = 0x05000000 | hi(data); + *(long *) (function + 4) = 0x03000000 | hi(address); + *(long *) (function + 8) = 0x81C06000 | lo(address); + *(long *) (function +12) = 0x8410A000 | lo(data); +#define is_tramp(function) \ + (*(long *) (function + 0) & 0xffc00000) == 0x05000000 && \ + (*(long *) (function + 4) & 0xffc00000) == 0x03000000 && \ + (*(long *) (function + 8) & 0xfffffc00) == 0x81C06000 && \ + (*(long *) (function +12) & 0xfffffc00) == 0x8410A000 +#define hilo(hiword,loword) (((hiword) << 10) | ((loword) & 0x3ff)) +#define tramp_address(function) \ + hilo(*(long *) (function + 4), *(long *) (function + 8)) +#define tramp_data(function) \ + hilo(*(long *) (function + 0), *(long *) (function +12)) +#endif +#ifdef __sparc64__ + /* function: + * rd %pc,%g1 83414000 + * ldx [%g1+24],%g2 C4586018 + * jmp %g2 81C08000 + * ldx [%g1+16],%g5 CA586010 + * .long high32() >> 32 + * .long low32() & 0xffffffff + * .long high32(
)
>> 32 + * .long low32(
)
& 0xffffffff + */ + *(int *) (function + 0) = 0x83414000; + *(int *) (function + 4) = 0xC4586018; + *(int *) (function + 8) = 0x81C08000; + *(int *) (function +12) = 0xCA586010; + *(long *) (function +16) = (long) data; + *(long *) (function +24) = (long) address; +#define TRAMP_CODE_LENGTH 16 +#define is_tramp(function) \ + *(int *) (function + 0) == 0x83414000 && \ + *(int *) (function + 4) == 0xC4586018 && \ + *(int *) (function + 8) == 0x81C08000 && \ + *(int *) (function +12) == 0xCA586010 +#define tramp_address(function) \ + *(long *) (function +24) +#define tramp_data(function) \ + *(long *) (function +16) +#endif +#ifdef __alpha__ + /* function: + * br $1,function..ng 00 00 20 C0 + * function..ng: + * ldq $27,20($1) 14 00 61 A7 + * ldq $1,12($1) 0C 00 21 A4 + * jmp $31,($27),0 00 00 FB 6B + * .quad + * .quad
+ */ + { static int code [4] = + { 0xC0200000, 0xA7610014, 0xA421000C, 0x6BFB0000 }; + int i; + for (i=0; i<4; i++) { ((int *) function)[i] = code[i]; } + ((long *) function)[2] = (long) data; + ((long *) function)[3] = (long) address; + } +#define TRAMP_CODE_LENGTH 16 +#define is_tramp(function) \ + ((int *) function)[0] == 0xC0200000 && \ + ((int *) function)[1] == 0xA7610014 && \ + ((int *) function)[2] == 0xA421000C && \ + ((int *) function)[3] == 0x6BFB0000 +#define tramp_address(function) \ + ((long *) function)[3] +#define tramp_data(function) \ + ((long *) function)[2] +#endif +#ifdef __hppaold__ + /* function: + * ldil L',%r29 23A00000 | hi() + * ldil L'
,%r21 22A00000 | hi(
) + * ldo R'(%r29),%r29 37BD0000 | lo() + * ldo R'
(%r21),%r21 36B50000 | lo(
) + * bb,>=,n %r21,30,function2 C7D5C012 + * depi 0,31,2,%r21 D6A01C1E + * ldw 4(0,%r21),%r19 4AB30008 + * ldw 0(0,%r21),%r21 4AB50000 + * function2: + * ldsid (0,%r21),%r1 02A010A1 + * mtsp %r1,%sr0 00011820 + * be,n 0(%sr0,%r21) E2A00002 + * nop 08000240 + */ + /* When decoding a 21-bit argument in an instruction, the hppa performs + * the following bit manipulation: + * assemble21: x[20]...x[0] + * --> x[0] x[11]...x[1] x[15]..x[14] x[20]...x[16] x[13]..x[12] + * When encoding a 21-bit argument into an instruction, we need the + * to perform the reverse permutation: + * permute21: y[20]...y[0] + * --> y[6]...y[2] y[8]..y[7] y[1]..y[0] y[19]...y[9] y[20] + */ +#define assemble21(x) \ + ((((x) & 0x1) << 20) | (((x) & 0xFFE) << 8) | \ + (((x) & 0xC000) >> 7) | (((x) & 0x1F0000) >> 14) | (((x) & 0x3000) >> 12)) +#define permute21(y) \ + ((((y) & 0x7C) << 14) | (((y) & 0x180) << 7) | (((y) & 0x3) << 12) | \ + (((y) & 0xFFE00) >> 8) | (((y) & 0x100000) >> 20)) +#define hi(word) permute21((unsigned long) (word) >> 11) +#define lo(word) (((unsigned long) (word) & 0x7FF) << 1) + *(long *) (function + 0) = 0x23A00000 | hi(data); + *(long *) (function + 4) = 0x22A00000 | hi(address); + *(long *) (function + 8) = 0x37BD0000 | lo(data); + *(long *) (function +12) = 0x36B50000 | lo(address); + *(long *) (function +16) = 0xC7D5C012; + *(long *) (function +20) = 0xD6A01C1E; + *(long *) (function +24) = 0x4AB30008; + *(long *) (function +28) = 0x4AB50000; + *(long *) (function +32) = 0x02A010A1; + *(long *) (function +36) = 0x00011820; + *(long *) (function +40) = 0xE2A00002; + *(long *) (function +44) = 0x08000240; +#define is_tramp(function) \ + ((long) function & 3) == 0 && \ + (*(long *) (function + 0) & 0xffe00000) == 0x23A00000 && \ + (*(long *) (function + 4) & 0xffe00000) == 0x22A00000 && \ + (*(long *) (function + 8) & 0xfffff000) == 0x37BD0000 && \ + (*(long *) (function +12) & 0xfffff000) == 0x36B50000 && \ + *(long *) (function +16) == 0xC7D5C012 && \ + *(long *) (function +20) == 0xD6A01C1E && \ + *(long *) (function +24) == 0x4AB30008 && \ + *(long *) (function +28) == 0x4AB50000 && \ + *(long *) (function +32) == 0x02A010A1 && \ + *(long *) (function +36) == 0x00011820 && \ + *(long *) (function +40) == 0xE2A00002 && \ + *(long *) (function +44) == 0x08000240 +#define hilo(hiword,loword) \ + ((assemble21((unsigned long) (hiword)) << 11) | \ + (((unsigned long) (loword) & 0xFFE) >> 1) \ + ) +#define tramp_address(function) \ + hilo(*(long *) (function + 4), *(long *) (function +12)) +#define tramp_data(function) \ + hilo(*(long *) (function + 0), *(long *) (function + 8)) +#endif +#ifdef __hppanew__ + /* function: + * .long tramp_r + * .long closure + * closure: + * .long + * .long
+ */ + { /* work around a bug in gcc 3.* */ + void* tramp_r_address = &tramp_r; + *(long *) (function + 0) = ((long *) ((char*)tramp_r_address-2))[0]; + *(long *) (function + 4) = (long) (function + 8); + *(long *) (function + 8) = (long) data; + *(long *) (function +12) = (long) address; + } +#define TRAMP_CODE_LENGTH 0 +#define is_tramp(function) \ + ((long *) function)[0] == ((long *) ((char*)tramp_r_address-2))[0] +#define tramp_address(function) \ + ((long *) function)[3] +#define tramp_data(function) \ + ((long *) function)[2] +#endif +#ifdef __hppa64old__ + /* function: + * mfia %r27 000014BB + * ldd 32(%r27),%r31 537F0040 + * ldd 40(%r27),%r27 537B0050 + * ldd 16(%r27),%r1 53610020 + * ldd 24(%r27),%r27 537B0030 + * bve (%r1) E820D000 + * nop 08000240 + * .align 8 + * .dword + * .dword
+ * function_pointer: + * .dword 0 + * .dword 0 + * .dword function + * .dword 0 + */ + *(int *) (function + 0) = 0x000014BB; + *(int *) (function + 4) = 0x537F0040; + *(int *) (function + 8) = 0x537B0050; + *(int *) (function +12) = 0x53610020; + *(int *) (function +16) = 0x537B0030; + *(int *) (function +20) = 0xE820D000; + *(int *) (function +24) = 0x08000240; + *(long *) (function +32) = (long)data; + *(long *) (function +40) = (long)address; + *(long *) (function +48) = (long)0; + *(long *) (function +56) = (long)0; + *(long *) (function +64) = (long)function; + *(long *) (function +72) = (long)0; +#define TRAMP_CODE_LENGTH 28 +#define is_tramp(function) \ + *(int *) (function + 0) == 0x000014BB && \ + *(int *) (function + 4) == 0x537F0040 && \ + *(int *) (function + 8) == 0x537B0050 && \ + *(int *) (function +12) == 0x53610020 && \ + *(int *) (function +16) == 0x537B0030 && \ + *(int *) (function +20) == 0xE820D000 && \ + *(int *) (function +24) == 0x08000240 +#define tramp_address(function) \ + (*(unsigned long *) (function +40)) +#define tramp_data(function) \ + (*(unsigned long *) (function +32)) +#endif +#ifdef __hppa64new__ + /* function: + * .dword 0 + * .dword 0 + * .dword tramp + * .dword closure + * closure: + * .dword + * .dword
+ */ + *(long *) (function + 0) = 0; + *(long *) (function + 8) = 0; + *(long *) (function +16) = ((long *) (void*) &tramp_r)[2]; + *(long *) (function +24) = (long) (function + 32); + *(long *) (function +32) = (long) data; + *(long *) (function +40) = (long) address; +#define TRAMP_CODE_LENGTH 0 +#define is_tramp(function) \ + ((long *) function)[2] == ((long *) (void*) &tramp_r)[2] && \ + ((long *) function)[3] == (long) (function + 32) +#define tramp_address(function) \ + ((long *) function)[5] +#define tramp_data(function) \ + ((long *) function)[4] +#endif +#if defined(__arm__) || defined(__armhf__) + /* function: + * mov ip,sp E1A0C00D + * stmdb sp!,{r0,r1,r2,r3} E92D000F + * stmfd sp!,{fp,ip,lr,pc} E92DD800 + * sub fp,ip,#20 E24CB014 + * sub sp,sp,#8 E24DD008 + * ldr ip,[pc,#12] E59FC00C @ Get + * str ip,[sp,#0] E58DC000 @ Put on stack + * mov lr,pc E1A0E00F @ Prepare call (put return address in lr) + * ldr pc,[pc,#4] E59FF004 @ Call
with the same args in registers + * ldmea fp,{fp,sp,pc} E91BA800 @ Restore fp and sp, and return to return address. + * _data: + * .word + * _address: + * .word
+ */ + { + ((long *) function)[0] = 0xE1A0C00D; + ((long *) function)[1] = 0xE92D000F; + ((long *) function)[2] = 0xE92DD800; + ((long *) function)[3] = 0xE24CB014; + ((long *) function)[4] = 0xE24DD008; + ((long *) function)[5] = 0xE59FC00C; + ((long *) function)[6] = 0xE58DC000; + ((long *) function)[7] = 0xE1A0E00F; + ((long *) function)[8] = 0xE59FF004; + ((long *) function)[9] = 0xE91BA800; + ((long *) function)[10] = (long) data; + ((long *) function)[11] = (long) address; + } +#define TRAMP_CODE_LENGTH 40 +#define is_tramp(function) \ + ((long *) function)[0] == 0xE1A0C00D && \ + ((long *) function)[1] == 0xE92D000F && \ + ((long *) function)[2] == 0xE92DD800 && \ + ((long *) function)[3] == 0xE24CB014 && \ + ((long *) function)[4] == 0xE24DD008 && \ + ((long *) function)[5] == 0xE59FC00C && \ + ((long *) function)[6] == 0xE58DC000 && \ + ((long *) function)[7] == 0xE1A0E00F && \ + ((long *) function)[8] == 0xE59FF004 && \ + ((long *) function)[9] == 0xE91BA800 +#define tramp_address(function) \ + ((long *) function)[11] +#define tramp_data(function) \ + ((long *) function)[10] +#endif +#ifdef __arm64__ + /* function: + * ldr x17,.+24 580000D1 + * ldr x18,.+12 58000072 + * br x17 D61F0220 + * nop D503201F + * .xword + * .xword
+ */ + *(int *) (function + 0) = 0x580000D1; + *(int *) (function + 4) = 0x58000072; + *(int *) (function + 8) = 0xD61F0220; + *(int *) (function +12) = 0xD503201F; + *(long *) (function +16) = (unsigned long) data; + *(long *) (function +24) = (unsigned long) address; +#define TRAMP_CODE_LENGTH 16 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0x580000D1 && \ + *(unsigned int *) (function + 4) == 0x58000072 && \ + *(unsigned int *) (function + 8) == 0xD61F0220 && \ + *(unsigned int *) (function +12) == 0xD503201F +#define tramp_address(function) \ + (*(unsigned long *) (function +24)) +#define tramp_data(function) \ + (*(unsigned long *) (function +16)) +#endif +#ifdef __powerpcsysv4__ + /* function: + * {liu|lis} 11,hi16() 3D 60 hi16() + * {oril|ori} 11,11,lo16() 61 6B lo16() + * {liu|lis} 0,hi16(
) 3C 00 hi16(
) + * {oril|ori} 0,0,lo16(
) 60 00 lo16(
) + * mtctr 0 7C 09 03 A6 + * bctr 4E 80 04 20 + */ + *(short *) (function + 0) = 0x3D60; + *(short *) (function + 2) = (unsigned long) data >> 16; + *(short *) (function + 4) = 0x616B; + *(short *) (function + 6) = (unsigned long) data & 0xffff; + *(short *) (function + 8) = 0x3C00; + *(short *) (function +10) = (unsigned long) address >> 16; + *(short *) (function +12) = 0x6000; + *(short *) (function +14) = (unsigned long) address & 0xffff; + *(long *) (function +16) = 0x7C0903A6; + *(long *) (function +20) = 0x4E800420; +#define is_tramp(function) \ + *(unsigned short *) (function + 0) == 0x3D60 && \ + *(unsigned short *) (function + 4) == 0x616B && \ + *(unsigned short *) (function + 8) == 0x3C00 && \ + *(unsigned short *) (function +12) == 0x6000 && \ + *(unsigned long *) (function +16) == 0x7C0903A6 && \ + *(unsigned long *) (function +20) == 0x4E800420 +#define hilo(hiword,loword) \ + (((unsigned long) (hiword) << 16) | (unsigned long) (loword)) +#define tramp_address(function) \ + hilo(*(unsigned short *) (function +10), *(unsigned short *) (function +14)) +#define tramp_data(function) \ + hilo(*(unsigned short *) (function + 2), *(unsigned short *) (function + 6)) +#endif +#ifdef __powerpcaix__ + /* function: + * .long .tramp_r + * .long .mytoc + * .long 0 + * .mytoc: + * .long + * .long
+ */ + *(long *) (function + 0) = ((long *) &tramp_r)[0]; + *(long *) (function + 4) = (long) (function + 12); + *(long *) (function + 8) = 0; + *(long *) (function +12) = (long) data; + *(long *) (function +16) = (long) address; +#define TRAMP_CODE_LENGTH 0 +#define is_tramp(function) \ + ((long *) function)[0] == ((long *) &tramp_r)[0] +#define tramp_address(function) \ + ((long *) function)[4] +#define tramp_data(function) \ + ((long *) function)[3] +#endif +#ifdef __powerpc64_elfv2__ + /* function: + * ld 11,16(12) 10 00 6C E9 + * ld 12,24(12) 18 00 8C E9 + * mtctr 12 A6 03 89 7D + * bctr 20 04 80 4E + * .quad + * .quad
+ */ + *(int *) (function + 0) = 0xE96C0010; + *(int *) (function + 4) = 0xE98C0018; + *(int *) (function + 8) = 0x7D8903A6; + *(int *) (function +12) = 0x4E800420; + *(long *) (function +16) = (unsigned long) data; + *(long *) (function +24) = (unsigned long) address; +#define TRAMP_CODE_LENGTH 16 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0xE96C0010 && \ + *(unsigned int *) (function + 4) == 0xE98C0018 && \ + *(unsigned int *) (function + 8) == 0x7D8903A6 && \ + *(unsigned int *) (function +12) == 0x4E800420 +#define tramp_address(function) \ + (*(unsigned long *) (function +24)) +#define tramp_data(function) \ + (*(unsigned long *) (function +16)) +#endif +#ifdef __powerpc64aix__ + /* function: + * .quad .tramp_r + * .quad .mytoc + * .quad 0 + * .mytoc: + * .quad + * .quad
+ */ + *(long *) (function + 0) = ((long *) &tramp_r)[0]; + *(long *) (function + 8) = (long) (function + 24); + *(long *) (function +16) = 0; + *(long *) (function +24) = (long) data; + *(long *) (function +32) = (long) address; +#define TRAMP_CODE_LENGTH 0 +#define is_tramp(function) \ + ((long *) function)[0] == ((long *) &tramp_r)[0] +#define tramp_address(function) \ + ((long *) function)[4] +#define tramp_data(function) \ + ((long *) function)[3] +#endif +#ifdef __ia64__ + /* function: + * data8 tramp_r + * data8 closure + * closure: + * data8
+ * data8 + */ + *(long *) (function + 0) = (long) &tramp_r; + *(long *) (function + 8) = (long) (function + 16); + *(long *) (function +16) = (long) address; + *(long *) (function +24) = (long) data; +#define TRAMP_CODE_LENGTH 0 +#define is_tramp(function) \ + ((long *) function)[0] == (long) &tramp_r && \ + ((long *) function)[1] == (long) (function + 16) +#define tramp_address(function) \ + ((long *) function)[2] +#define tramp_data(function) \ + ((long *) function)[3] +#endif +#ifdef __x86_64__ +#ifdef __x86_64_x32__ + /* function: + * movl $,%r10d 41 BA + * movl $
,%rax B8
+ * jmp *%rax FF E0 + */ + *(int *) (function + 0) = ((unsigned long) data << 16) | 0xBA41; + *(int *) (function + 4) = ((unsigned long) address << 24) | 0xB80000 | ((unsigned long) data >> 16); + *(int *) (function + 8) = 0xFF000000 | ((unsigned long) address >> 8); + *(int *) (function +12) = 0xE0; +#define is_tramp(function) \ + (*(unsigned long *) (function + 0) & 0x0000FFFF) == 0xBA41 && \ + (*(unsigned long *) (function + 4) & 0x00FF0000) == 0xB80000 && \ + (*(unsigned long *) (function + 8) & 0xFF000000) == 0xFF000000 && \ + *(unsigned char *) (function +12) == 0xE0 +#define tramp_address(function) \ + ((*(unsigned long *) (function + 4) >> 24) | \ + (*(unsigned long *) (function + 8) << 8)) +#define tramp_data(function) \ + ((*(unsigned long *) (function + 0) >> 16) | \ + (*(unsigned long *) (function + 4) << 16)) +#else + /* function: + * movabsq $,%r10 49 BA + * movabsq $
,%rax 48 B8
+ * jmp *%rax FF E0 + */ + *(short *) (function + 0) = 0xBA49; + *(short *) (function + 2) = (unsigned long long) data & 0xffff; + *(int *) (function + 4) = ((unsigned long long) data >> 16) & 0xffffffff; + *(short *) (function + 8) = ((unsigned long long) data >> 48) & 0xffff; + *(short *) (function +10) = 0xB848; + *(int *) (function +12) = (unsigned long long) address & 0xffffffff; + *(int *) (function +16) = ((unsigned long long) address >> 32) & 0xffffffff; + *(short *) (function +20) = 0xE0FF; +#define is_tramp(function) \ + *(unsigned short *) (function + 0) == 0xBA49 && \ + *(unsigned short *) (function +10) == 0xB848 && \ + *(unsigned short *) (function +20) == 0xE0FF +#define hilo(hiword,loword) \ + (((unsigned long long) (hiword) << 32) | (unsigned long long) (loword)) +#define himidlo(hishort,midword,loshort) \ + (((unsigned long long) (hishort) << 48) | (unsigned long long) (midword) << 16 \ + | (unsigned long long) (loshort)) +#define tramp_address(function) \ + hilo(*(unsigned int *) (function +16), *(unsigned int *) (function +12)) +#define tramp_data(function) \ + himidlo(*(unsigned short *) (function + 8), \ + *(unsigned int *) (function + 4), \ + *(unsigned short *) (function + 2)) +#endif +#endif +#if defined(__s390__) && !defined(__s390x__) + /* function: + * bras %r1,.L1 A7150002 + * .L1: + * lm %r0,%r1,data-.L1(%r1) 98011008 + * br %r1 07F1 + * nop 0707 + * data: .long + * address: .long
+ */ + *(int *) (function + 0) = 0xA7150002; + *(int *) (function + 4) = 0x98011008; + *(int *) (function + 8) = 0x07F10707; + *(int *) (function +12) = (unsigned int) data; + *(int *) (function +16) = (unsigned int) address; +#define TRAMP_CODE_LENGTH 12 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0xA7150002 && \ + *(unsigned int *) (function + 4) == 0x98011008 && \ + *(unsigned int *) (function + 8) == 0x07F10707 +#define tramp_address(function) \ + *(unsigned int *) (function +16) +#define tramp_data(function) \ + *(unsigned int *) (function +12) +#endif +#ifdef __s390x__ + /* function: + * larl %r1,.L1 C01000000003 + * .L1: + * lmg %r0,%r1,data-.L1(%r1) EB01100A0004 + * br %r1 07F1 + * nop 0707 + * data: .quad + * address: .quad
+ */ + *(int *) (function + 0) = 0xC0100000; + *(int *) (function + 4) = 0x0003EB01; + *(int *) (function + 8) = 0x100A0004; + *(int *) (function +12) = 0x07F10707; + *(long *) (function +16) = (unsigned long) data; + *(long *) (function +24) = (unsigned long) address; +#define TRAMP_CODE_LENGTH 16 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0xC0100000 && \ + *(unsigned int *) (function + 4) == 0x0003EB01 && \ + *(unsigned int *) (function + 8) == 0x100A0004 && \ + *(unsigned int *) (function +12) == 0x07F10707 +#define tramp_address(function) \ + (*(unsigned long *) (function +24)) +#define tramp_data(function) \ + (*(unsigned long *) (function +16)) +#endif +#ifdef __riscv32__ + /* function: + * auipc t0,0 00000297 + * lw t1,20(t0) 0142A303 + * lw t2,16(t0) 0102A383 + * jr t1 00030067 + * data: .quad + * address: .quad
+ */ + *(int *) (function + 0) = 0x00000297; + *(int *) (function + 4) = 0x0142A303; + *(int *) (function + 8) = 0x0102A383; + *(int *) (function +12) = 0x00030067; + *(int *) (function +16) = (unsigned int) data; + *(int *) (function +24) = (unsigned int) address; +#define TRAMP_CODE_LENGTH 16 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0x00000297 && \ + *(unsigned int *) (function + 4) == 0x0142A303 && \ + *(unsigned int *) (function + 8) == 0x0102A383 && \ + *(unsigned int *) (function +12) == 0x00030067 +#define tramp_address(function) \ + (*(unsigned int *) (function +20)) +#define tramp_data(function) \ + (*(unsigned int *) (function +16)) +#endif +#ifdef __riscv64__ + /* function: + * auipc t0,0 00000297 + * ld t1,24(t0) 0182B303 + * ld t2,16(t0) 0102B383 + * jr t1 00030067 + * data: .quad + * address: .quad
+ */ + *(int *) (function + 0) = 0x00000297; + *(int *) (function + 4) = 0x0182B303; + *(int *) (function + 8) = 0x0102B383; + *(int *) (function +12) = 0x00030067; + *(long *) (function +16) = (unsigned long) data; + *(long *) (function +24) = (unsigned long) address; +#define TRAMP_CODE_LENGTH 16 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0x00000297 && \ + *(unsigned int *) (function + 4) == 0x0182B303 && \ + *(unsigned int *) (function + 8) == 0x0102B383 && \ + *(unsigned int *) (function +12) == 0x00030067 +#define tramp_address(function) \ + (*(unsigned long *) (function +24)) +#define tramp_data(function) \ + (*(unsigned long *) (function +16)) +#endif + /* + * data: + * + * + */ + *(void* *) (data + 0*sizeof(void*)) = data0; + *(void* *) (data + 1*sizeof(void*)) = data1; + + /* 3. Set memory protection to "executable" */ + +#if !defined(CODE_EXECUTABLE) +#if defined(EXECUTABLE_VIA_MALLOC_THEN_MPROTECT) || defined(EXECUTABLE_VIA_MMAP_THEN_MPROTECT) + /* Call mprotect on the pages that contain the range. */ + { uintptr_t start_addr = (uintptr_t) function; + uintptr_t end_addr = (uintptr_t) (function + TRAMP_LENGTH); + start_addr = start_addr & -pagesize; + end_addr = (end_addr + pagesize-1) & -pagesize; + {uintptr_t len = end_addr - start_addr; + if (mprotect((void*)start_addr, len, PROT_READ|PROT_WRITE|PROT_EXEC) < 0) + { fprintf(stderr,"trampoline: cannot make memory executable\n"); abort(); } + }} +#endif +#endif + + /* 4. Flush instruction cache */ + /* We need this because some CPUs have separate data cache and instruction + * cache. The freshly built trampoline is visible to the data cache, but not + * maybe not to the instruction cache. This is hairy. + */ + /* TRAMP_CODE_LENGTH = length of the machine instructions. */ +#ifndef TRAMP_CODE_LENGTH +#define TRAMP_CODE_LENGTH TRAMP_LENGTH +#endif +#if !(defined(__hppanew__) || defined(__hppa64new__) || defined(__powerpcaix__) || defined(__powerpc64aix__) || defined(__ia64__)) + /* Only needed if we really set up machine instructions. */ + /* Use the operating system provided function, when available. */ +#if defined _WIN32 && !defined __CYGWIN__ + /* Native Windows. + FlushInstructionCache + */ + HANDLE process = GetCurrentProcess (); + while (!FlushInstructionCache (process, function_x, TRAMP_CODE_LENGTH)) + ; +#elif defined __APPLE__ && defined __MACH__ + /* macOS */ + sys_icache_invalidate (function_x, TRAMP_CODE_LENGTH); +#elif defined _AIX + /* AIX. */ + _sync_cache_range (function_x, TRAMP_CODE_LENGTH); +#elif defined __sgi + /* IRIX. */ + cacheflush (function_x, TRAMP_CODE_LENGTH, ICACHE); +#elif defined __sun + /* Solaris. */ + extern void sync_instruction_memory (char *, size_t); + sync_instruction_memory (function_x, TRAMP_CODE_LENGTH); +#else + /* No operating system provided function. Dispatch according to the CPU. */ +#ifdef __i386__ +#if defined(_WIN32) + while (!FlushInstructionCache(GetCurrentProcess(),function_x,TRAMP_CODE_LENGTH)) + continue; +#endif +#endif +#ifdef __m68k__ +#if defined(__NetBSD__) && defined(__GNUC__) + { register uintptr_t _beg __asm__ ("%a1") = (uintptr_t) function_x; + register uintptr_t _len __asm__ ("%d1") = TRAMP_CODE_LENGTH; + __asm__ __volatile__ ( + "move%.l %#0x80000004,%/d0\n\t" /* CC_EXTPURGE | C_IPURGE */ + "trap #12" /* kernel call ‘cachectl’ */ + : + : "a" (_beg), "d" (_len) + : "%a0", "%a1", "%d0", "%d1" /* call-used registers */ + ); + } +#endif +#if defined(__linux__) && defined(__GNUC__) + { register uintptr_t _beg __asm__ ("%d1") = (uintptr_t) function_x; + register uintptr_t _len __asm__ ("%d4") = TRAMP_CODE_LENGTH + 32; + __asm__ __volatile__ ( + "move%.l %#123,%/d0\n\t" + "move%.l %#1,%/d2\n\t" + "move%.l %#3,%/d3\n\t" + "trap %#0" + : + : "d" (_beg), "d" (_len) + : "%d0", "%d2", "%d3" + ); + } +#endif +#if defined(AUX) && defined(__GNUC__) + /* sysm68k(105, addr, scope, cache, len) */ + __asm__ __volatile__ ( + "move%.l %1,%/sp@-\n\t" + "move%.l %#3,%/sp@-\n\t" + "move%.l %#1,%/sp@-\n\t" + "move%.l %0,%/sp@-\n\t" + "move%.l %#105,%/sp@-\n\t" + "move%.l %#0,%/sp@-\n\t" + "move%.l %#38,%/sp@-\n\t" + "trap %#0\n\t" + "add%.l %#24,%/sp" + : + : "r" (function_x), "g" ((int)TRAMP_CODE_LENGTH) + : "%d0" + ); +#endif +#endif +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) + cacheflush(function_x,TRAMP_CODE_LENGTH,ICACHE); + /* gforth-0.3.0 uses BCACHE instead of ICACHE. Why?? */ +#endif +#if defined(__sparc__) || defined(__sparc64__) + /* This assumes that the trampoline fits in at most two cache lines. */ + __TR_clear_cache_2(function_x,function_x+TRAMP_CODE_LENGTH-1); +#endif +#ifdef __alpha__ + __TR_clear_cache(); +#endif +#if defined(__hppa__) || defined(__hppa64__) + /* This assumes that the trampoline fits in at most two cache lines. */ + __TR_clear_cache(function_x,function_x+TRAMP_CODE_LENGTH-1); +#endif +#if defined(__arm__) || defined(__armhf__) || defined(__arm64__) + /* On ARM, cache flushing can only be done through a system call. + GCC implements it for Linux with EABI, through an "swi 0" with code + 0xf0002. For other systems, it may be an "swi 0x9f0002", + an "swi 0xf00000", or similar. */ + /* On ARM64, cache flushing is done through special instructions, + and the length of the cache lines must be determined at runtime. + See gcc/libgcc/config/aarch64/sync-cache.c. */ +#if defined(__GNUC__) + /* Use the GCC built-in. */ + __clear_cache((void*)function_x,(void*)(function_x+TRAMP_CODE_LENGTH)); +#else + #error "Don't know how to implement clear_cache on this platform." +#endif +#endif +#if defined(__powerpc__) || defined(__powerpc64__) + __TR_clear_cache(function_x); +#endif +#if defined(__riscv32__) || defined(__riscv64__) +#if defined(__linux__) + /* Use the libc function. */ + __riscv_flush_icache((void*)function_x,(void*)(function_x+TRAMP_CODE_LENGTH),0); +#elif defined(__GNUC__) + __asm__ __volatile__ ("fence.i"); +#endif +#endif +#endif +#endif + + /* 5. Return. */ + return (__TR_function) (function_x + TRAMP_BIAS); +} + +void free_trampoline_r (__TR_function function) +{ +#if TRAMP_BIAS + function = (__TR_function)((char*)function - TRAMP_BIAS); +#endif +#if !defined(CODE_EXECUTABLE) && !defined(EXECUTABLE_VIA_MALLOC_THEN_MPROTECT) +#ifdef EXECUTABLE_VIA_MMAP_FILE_SHARED + /* Find the writable address corresponding to the executable address. */ + { uintptr_t page_x = (uintptr_t) function & -(intptr_t)pagesize; + function -= ((intptr_t*)page_x)[0]; + } +#endif + gl_lock_lock(freelist_lock); + *(char**)function = freelist; freelist = (char*)function; + gl_lock_unlock(freelist_lock); + /* It is probably not worth calling munmap() for entirely freed pages. */ +#else + free(((char**)function)[-1]); +#endif +} + +int is_trampoline_r (void* function) +{ +#if defined(is_tramp) && defined(tramp_data) +#ifdef __hppanew__ + void* tramp_r_address = &tramp_r; + if (!(((uintptr_t)function & 3) == (TRAMP_BIAS & 3))) return 0; +#endif + if (is_tramp(((char*)function - TRAMP_BIAS))) + { + char* function_w; +#ifdef EXECUTABLE_VIA_MMAP_FILE_SHARED + /* Find the writable address corresponding to the executable address. */ + { uintptr_t page_x = (uintptr_t) function & -(intptr_t)pagesize; + function_w = function - ((intptr_t*)page_x)[0]; + } +#else + function_w = function; +#endif + return (tramp_data(((char*)function - TRAMP_BIAS))) == (uintptr_t)((char*)function_w - TRAMP_BIAS + TRAMP_LENGTH); + } + return 0; +#else + abort(); +#endif +} + +__TR_function trampoline_r_address (__TR_function function) +{ +#ifdef tramp_address + return (__TR_function)(tramp_address(((char*)function - TRAMP_BIAS))); +#else + abort(); +#endif +} + +void* trampoline_r_data0 (__TR_function function) +{ +#ifdef tramp_data + return ((void**)((char*)function-TRAMP_BIAS+TRAMP_LENGTH))[0]; +#else + abort(); +#endif +} + +void* trampoline_r_data1 (__TR_function function) +{ +#ifdef tramp_data + return ((void**)((char*)function-TRAMP_BIAS+TRAMP_LENGTH))[1]; +#else + abort(); +#endif +} diff --git a/callback/trampoline_r/trampoline_r.3 b/callback/trampoline_r/trampoline_r.3 new file mode 100644 index 0000000..f58cfe6 --- /dev/null +++ b/callback/trampoline_r/trampoline_r.3 @@ -0,0 +1,120 @@ +.\" Copyright (C) 1995-2017 Bruno Haible +.\" +.\" This manual is free documentation. It is dually licensed under the +.\" GNU FDL and the GNU GPL. This means that you can redistribute this +.\" manual under either of these two licenses, at your choice. +.\" +.\" This manual is covered by the GNU FDL. Permission is granted to copy, +.\" distribute and/or modify this document under the terms of the +.\" GNU Free Documentation License (FDL), either version 1.2 of the +.\" License, or (at your option) any later version published by the +.\" Free Software Foundation (FSF); with no Invariant Sections, with no +.\" Front-Cover Text, and with no Back-Cover Texts. +.\" A copy of the license is at . +.\" +.\" This manual is covered by the GNU GPL. You can redistribute it and/or +.\" modify it under the terms of the GNU General Public License (GPL), either +.\" version 2 of the License, or (at your option) any later version published +.\" by the Free Software Foundation (FSF). +.\" A copy of the license is at . +.\" +.TH TRAMPOLINE 3 "1 January 2017" +.SH NAME +trampoline \- closures as first-class C functions +.SH SYNOPSIS +.B #include +.LP +.B function = alloc_trampoline_r(address, data0, data1); +.LP +.B free_trampoline_r(function); +.LP +.nf +.B is_trampoline_r(function) +.B trampoline_r_address(function) +.B trampoline_r_data0(function) +.B trampoline_r_data1(function) +.fi +.SH DESCRIPTION +.LP +These functions implement +.I closures +as first-class C functions. +A closure consists of a regular C function and a piece of data +which gets passed to the C function when the closure is called. + +Closures as +.I first-class C functions +means that they fit into a function +pointer and can be called exactly like any other C function. +.IB function " = alloc_trampoline_r(" address ", " data0 ", " data1 ")" +allocates a closure. When +.I function +gets called, it stores in a special "lexical chain register" a pointer to a +storage area containing +.I data0 +in its first word and +.I data1 +in its second word and calls the C function at +.IR address . +The function at +.I address +is responsible for fetching +.I data0 +and +.I data1 +off the pointer. Note that the "lexical chain register" is a call-used +register, i.e. is clobbered by function calls. + +This is much like +.BR gcc "'s" +local functions, except that the GNU C local functions have dynamic extent +(i.e. are deallocated when the creating function returns), while +.I trampoline +provides functions with indefinite extent: +.I function +is only deallocated when +.BI free_trampoline_r( function ) +is called. + +.BI "is_trampoline_r(" function ")" +checks whether the C function +.I function +was produced by a call to +.IR alloc_trampoline_r . +If this returns true, the arguments given to +.I alloc_trampoline_r +can be retrieved: +.RS 4 +.LP +.BI "trampoline_r_address(" function ")" +returns +.IR address , +.LP +.BI "trampoline_r_data0(" function ")" +returns +.IR data0 , +.LP +.BI "trampoline_r_data1(" function ")" +returns +.IR data1 . +.RE + +.SH SEE ALSO +.BR trampoline (3), +.BR gcc (1), +.BR stdarg (3) + +.SH PORTING +The way +.B gcc +builds local functions is described in the gcc source, file +.RI gcc-2.6.3/config/ cpu / cpu .h. + +.SH AUTHOR + +Bruno Haible + +.SH ACKNOWLEDGEMENTS + +Many ideas were cribbed from the gcc source. + diff --git a/callback/trampoline_r/trampoline_r.h b/callback/trampoline_r/trampoline_r.h new file mode 100644 index 0000000..42bb221 --- /dev/null +++ b/callback/trampoline_r/trampoline_r.h @@ -0,0 +1,41 @@ +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +#ifndef _TRAMPOLINE_R_H +#define _TRAMPOLINE_R_H + +/* Use a consistent prefix for all symbols in libcallback. */ +#define alloc_trampoline_r callback_trampoline_alloc +#define free_trampoline_r callback_trampoline_free +#define is_trampoline_r callback_trampoline_is +#define trampoline_r_address callback_trampoline_address +#define trampoline_r_data0 callback_trampoline_data0 +#define trampoline_r_data1 callback_trampoline_data1 + +#ifdef __cplusplus +typedef int (*__TR_function) (...); +#else +typedef int (*__TR_function) (); +#endif +extern __TR_function alloc_trampoline_r (__TR_function, void*, void*); +extern void free_trampoline_r (__TR_function); +extern int is_trampoline_r (void*); +extern __TR_function trampoline_r_address (__TR_function); +extern void* trampoline_r_data0 (__TR_function); +extern void* trampoline_r_data1 (__TR_function); + +#endif /* _TRAMPOLINE_R_H */ diff --git a/callback/trampoline_r/trampoline_r.html b/callback/trampoline_r/trampoline_r.html new file mode 100644 index 0000000..e7fb770 --- /dev/null +++ b/callback/trampoline_r/trampoline_r.html @@ -0,0 +1,135 @@ + + + + TRAMPOLINE_R manual page + + +

TRAMPOLINE_R manual page

+ + +

+ +


+ + +

Name

+
+ +trampoline_r - closures as first-class C functions + + +

Synopsis

+
+ +
+#include <trampoline_r.h>
+function = alloc_trampoline_r(address, data0, data1);
+free_trampoline_r(function);
+is_trampoline_r(function)
+trampoline_r_address(function)
+trampoline_r_data0(function)
+trampoline_r_data1(function)
+
+ + +

Description

+
+ +These functions implement closures as first-class +C functions. A closure consists of a regular C function and a +piece of data which gets passed to the C function when the +closure is called. +

+Closures as first-class C functions means that they fit +into a function pointer and can be called exactly like any +other C function. function = alloc_trampoline_r(address, data0, data1) +allocates a closure. When function gets +called, it stores in a special "lexical chain register" a +pointer to a storage area containing data0 in its first +word and data1 in its second word and calls the C function +at address. The function at address is responsible for +fetching data0 and data1 off the pointer. Note that the +"lexical chain register" is a call-used register, i.e. is +clobbered by function calls. +

+This is much like gcc's local functions, except that the +GNU C local functions have dynamic extent (i.e. are +deallocated when the creating function returns), while trampoline + provides functions with indefinite extent: function +is only deallocated when free_trampoline_r(function) is +called. +

+is_trampoline_r(function) +checks whether the C function function +was produced by a call to alloc_trampoline_r. +If this returns true, the arguments given to alloc_trampoline_r +can be retrieved: +

    +
  • trampoline_r_address(function) returns address, +
  • trampoline_r_data0(function) returns data0, +
  • trampoline_r_data1(function) returns data1. +
+ + +

See also

+
+trampoline(3), gcc(1), stdarg(3) + + +

Porting

+
+ +The way gcc builds local functions is described in the gcc +source, file gcc-2.6.3/config/cpu/cpu.h. + + +

Author

+
+ +Bruno Haible <bruno@clisp.org> + + +

Acknowledgements

+
+ +Many ideas were cribbed from the gcc source. +

+ +


+ +
TRAMPOLINE_R manual page
+Bruno Haible <bruno@clisp.org> +
+

+Last modified: 1 January 2017. + + + diff --git a/callback/trampoline_r/trampoline_r.man b/callback/trampoline_r/trampoline_r.man new file mode 100644 index 0000000..4580171 --- /dev/null +++ b/callback/trampoline_r/trampoline_r.man @@ -0,0 +1,71 @@ +TRAMPOLINE(3) Library Functions Manual TRAMPOLINE(3) + + + +NAME + trampoline - closures as first-class C functions + +SYNOPSIS + #include  + + function = alloc_trampoline_r(address, data0, data1); + + free_trampoline_r(function); + + is_trampoline_r(function) + trampoline_r_address(function) + trampoline_r_data0(function) + trampoline_r_data1(function) + +DESCRIPTION + These functions implement closures as first-class C functions. A clo‐ + sure consists of a regular C function and a piece of data which gets + passed to the C function when the closure is called. + + Closures as first-class C functions means that they fit into a function + pointer and can be called exactly like any other C function. function + = alloc_trampoline_r(address, data0, data1) allocates a closure. When + function gets called, it stores in a special "lexical chain register" a + pointer to a storage area containing data0 in its first word and data1 + in its second word and calls the C function at address. The function + at address is responsible for fetching data0 and data1 off the pointer. + Note that the "lexical chain register" is a call-used register, i.e. is + clobbered by function calls. + + This is much like gcc's local functions, except that the GNU C local + functions have dynamic extent (i.e. are deallocated when the creating + function returns), while trampoline provides functions with indefinite + extent: function is only deallocated when free_trampoline_r(function) + is called. + + is_trampoline_r(function) checks whether the C function function was + produced by a call to alloc_trampoline_r. If this returns true, the + arguments given to alloc_trampoline_r can be retrieved: + + trampoline_r_address(function) returns address, + + trampoline_r_data0(function) returns data0, + + trampoline_r_data1(function) returns data1. + + +SEE ALSO + trampoline(3), gcc(1), stdarg(3) + + +PORTING + The way gcc builds local functions is described in the gcc source, file + gcc-2.6.3/config/cpu/cpu.h. + + +AUTHOR + Bruno Haible + + +ACKNOWLEDGEMENTS + Many ideas were cribbed from the gcc source. + + + + + 1 January 2017 TRAMPOLINE(3) diff --git a/callback/vacall_r/COPYING b/callback/vacall_r/COPYING new file mode 100644 index 0000000..a3d1815 --- /dev/null +++ b/callback/vacall_r/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 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 + + Appendix: 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. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +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. + + , 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/callback/vacall_r/Makefile.devel b/callback/vacall_r/Makefile.devel new file mode 100644 index 0000000..1a2e62e --- /dev/null +++ b/callback/vacall_r/Makefile.devel @@ -0,0 +1,235 @@ +# This is the developer's -*-Makefile-*-, not the user's makefile. +# Do not use it unless you know exactly what you do! + +THISFILE = Makefile.devel +LN = ln -s +RM = rm -f + +# ============ Rules that require cross-compilation tools ============ + +GCC = gcc +GCCFLAGS = -I../.. -I../../dummy -O2 -fno-omit-frame-pointer -fPIC -DREENTRANT +SED = sed +CROSS_TOOL = cross + +precompiled : \ + vacall-i386-macro.S \ + vacall-m68k.mit.S vacall-m68k.motorola.S \ + vacall-mipseb-macro.S vacall-mipsel-macro.S vacall-mipsn32eb-macro.S vacall-mipsn32el-macro.S vacall-mips64eb-macro.S vacall-mips64el-macro.S \ + vacall-sparc-macro.S vacall-sparc64-macro.S \ + vacall-alpha-macro.S \ + vacall-hppa-macro.S vacall-hppa64-macro.S \ + vacall-arm-macro.S vacall-armhf-macro.S \ + vacall-arm64-macro.S vacall-arm64-macos-macro.S \ + vacall-powerpc-aix.s vacall-powerpc-linux-macro.S vacall-powerpc-sysv4-macro.S vacall-powerpc-macos.s vacall-powerpc64-aix.s vacall-powerpc64-linux.S vacall-powerpc64-elfv2-linux.S \ + vacall-ia64-macro.S \ + vacall-x86_64-macro.S vacall-x86_64-x32-linux.s vacall-x86_64-windows-macro.S \ + vacall-s390-macro.S vacall-s390x-macro.S \ + vacall-riscv32-ilp32d-macro.S vacall-riscv64-lp64d-macro.S + + +vacall-i386-linux.s : ../../vacall/vacall-i386.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) i386-linux gcc -V 3.1 $(GCCFLAGS) -D__i386__ -S ../../vacall/vacall-i386.c -I../../vacall -I. -o vacall-i386-linux.s + +vacall-i386-macro.S : vacall-i386-linux.s ../../common/asm-i386.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-i386.h"' ; sed -e '/\.align.*,0x90$$/d' < vacall-i386-linux.s | ../../common/asm-i386.sh ; cat ../../common/noexecstack.h) > vacall-i386-macro.S + + +vacall-m68k-linux.s : ../../vacall/vacall-m68k.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) m68k-linux gcc -V 3.1 $(GCCFLAGS) -D__m68k__ -S ../../vacall/vacall-m68k.c -I../../vacall -I. -o vacall-m68k-linux.s + +vacall-m68k-sun.s : ../../vacall/vacall-m68k.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) m68k-sun gcc -V 3.1 $(GCCFLAGS) -D__m68k__ -S ../../vacall/vacall-m68k.c -I../../vacall -I. -o vacall-m68k-sun.s + +vacall-m68k.mit.S : vacall-m68k-sun.s ../../common/asm-m68k.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-m68k.h"' ; ../../common/asm-m68k.sh mit < vacall-m68k-sun.s ; cat ../../common/noexecstack.h) > vacall-m68k.mit.S + +vacall-m68k.motorola.S : vacall-m68k-linux.s ../../common/asm-m68k.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-m68k.h"' ; ../../common/asm-m68k.sh motorola < vacall-m68k-linux.s ; cat ../../common/noexecstack.h) > vacall-m68k.motorola.S + + +vacall-mipseb-linux.s : ../../vacall/vacall-mips.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) +# For references to symbols: -mno-explicit-relocs ensures a syntax that the IRIX assembler understands. + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=32 -mfpxx -march=mips2 -meb -mno-explicit-relocs $(GCCFLAGS) -D__mips__ -S ../../vacall/vacall-mips.c -I../../vacall -I. -o vacall-mipseb-linux.s + +vacall-mipseb-macro.S : vacall-mipseb-linux.s ../../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../../common/asm-mips.sh < vacall-mipseb-linux.s) > vacall-mipseb-macro.S + +vacall-mipsel-linux.s : ../../vacall/vacall-mips.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=32 -mfpxx -march=mips2 -mel -mno-explicit-relocs $(GCCFLAGS) -D__mips__ -S ../../vacall/vacall-mips.c -I../../vacall -I. -o vacall-mipsel-linux.s + +vacall-mipsel-macro.S : vacall-mipsel-linux.s ../../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../../common/asm-mips.sh < vacall-mipsel-linux.s) > vacall-mipsel-macro.S + +vacall-mipsn32eb-linux.s : ../../vacall/vacall-mipsn32.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=n32 -meb $(GCCFLAGS) -D__mipsn32__ -S ../../vacall/vacall-mipsn32.c -I../../vacall -I. -o vacall-mipsn32eb-linux.s + +vacall-mipsn32eb-macro.S : vacall-mipsn32eb-linux.s ../../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../../common/asm-mips.sh < vacall-mipsn32eb-linux.s) > vacall-mipsn32eb-macro.S + +vacall-mipsn32el-linux.s : ../../vacall/vacall-mipsn32.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=n32 -mel $(GCCFLAGS) -D__mipsn32__ -S ../../vacall/vacall-mipsn32.c -I../../vacall -I. -o vacall-mipsn32el-linux.s + +vacall-mipsn32el-macro.S : vacall-mipsn32el-linux.s ../../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../../common/asm-mips.sh < vacall-mipsn32el-linux.s) > vacall-mipsn32el-macro.S + +vacall-mips64eb-linux.s : ../../vacall/vacall-mips64.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=64 -meb $(GCCFLAGS) -D__mips64__ -S ../../vacall/vacall-mips64.c -I../../vacall -I. -o vacall-mips64eb-linux.s + +vacall-mips64eb-macro.S : vacall-mips64eb-linux.s ../../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../../common/asm-mips.sh < vacall-mips64eb-linux.s) > vacall-mips64eb-macro.S + +vacall-mips64el-linux.s : ../../vacall/vacall-mips64.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=64 -mel $(GCCFLAGS) -D__mips64__ -S ../../vacall/vacall-mips64.c -I../../vacall -I. -o vacall-mips64el-linux.s + +vacall-mips64el-macro.S : vacall-mips64el-linux.s ../../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../../common/asm-mips.sh < vacall-mips64el-linux.s) > vacall-mips64el-macro.S + + +vacall-sparc-linux.s : ../../vacall/vacall-sparc.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) sparc-linux gcc -V 3.1 $(GCCFLAGS) -D__sparc__ -S ../../vacall/vacall-sparc.c -I../../vacall -I. -o vacall-sparc-linux.s + +vacall-sparc-macro.S : vacall-sparc-linux.s ../../common/asm-sparc.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-sparc.h"' ; ../../common/asm-sparc.sh < vacall-sparc-linux.s ; cat ../../common/noexecstack.h) > vacall-sparc-macro.S + +vacall-sparc64-linux.s : ../../vacall/vacall-sparc64.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) sparc64-linux gcc -V 4.0.2 $(GCCFLAGS) -D__sparc64__ -S ../../vacall/vacall-sparc64.c -I../../vacall -I. -o vacall-sparc64-linux.s + +vacall-sparc64-macro.S : vacall-sparc64-linux.s ../../common/asm-sparc.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-sparc.h"' ; ../../common/asm-sparc.sh < vacall-sparc64-linux.s ; cat ../../common/noexecstack.h) > vacall-sparc64-macro.S + + +vacall-alpha-linux.s : ../../vacall/vacall-alpha.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) alpha-linux gcc -V 4.0.2 $(GCCFLAGS) -D__alpha__ -S ../../vacall/vacall-alpha.c -I../../vacall -I. -o vacall-alpha-linux.s + +vacall-alpha-macro.S : vacall-alpha-linux.s ../../common/asm-alpha.sh ../../common/noexecstack.h $(THISFILE) + (../../common/asm-alpha.sh < vacall-alpha-linux.s ; cat ../../common/noexecstack.h) > vacall-alpha-macro.S + + +vacall-hppa-linux.s : ../../vacall/vacall-hppa.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) hppa-linux gcc -V 3.1 $(GCCFLAGS) -D__hppa__ -S ../../vacall/vacall-hppa.c -I../../vacall -I. -o vacall-hppa-linux.s + +vacall-hppa-macro.S : vacall-hppa-linux.s ../../common/asm-hppa.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-hppa.h"' ; ../../common/asm-hppa.sh < vacall-hppa-linux.s ; cat ../../common/noexecstack.h) > vacall-hppa-macro.S + +vacall-hppa64-linux.s : ../../vacall/vacall-hppa64.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) hppa64-linux gcc -V 3.1 $(GCCFLAGS) -D__hppa64__ -S ../../vacall/vacall-hppa64.c -I../../vacall -I. -o vacall-hppa64-linux.s + +vacall-hppa64-macro.S : vacall-hppa64-linux.s ../../common/asm-hppa64.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-hppa64.h"' ; ../../common/asm-hppa64.sh < vacall-hppa64-linux.s ; cat ../../common/noexecstack.h) > vacall-hppa64-macro.S + + +vacall-arm-macro.S : ../../vacall/vacall-arm.c ../../vacall/vacall-internal.h vacall_r.h ../../common/asm-arm.sh ../../common/noexecstack-arm.h $(THISFILE) + $(CROSS_TOOL) arm-linux gcc -V 3.1 -mlittle-endian $(GCCFLAGS) -D__arm__ -S ../../vacall/vacall-arm.c -I../../vacall -I. -o vacall-armel.s + $(CROSS_TOOL) arm-linux gcc -V 3.1 -mbig-endian $(GCCFLAGS) -D__arm__ -S ../../vacall/vacall-arm.c -I../../vacall -I. -o vacall-armeb.s + cmp vacall-armel.s vacall-armeb.s > /dev/null + (echo '#include "asm-arm.h"' ; ../../common/asm-arm.sh < vacall-armel.s ; cat ../../common/noexecstack-arm.h) > vacall-arm-macro.S + $(RM) vacall-armel.s vacall-armeb.s + +vacall-armhf-macro.S : ../../vacall/vacall-armhf.c ../../vacall/vacall-internal.h vacall_r.h ../../common/asm-arm.sh ../../common/noexecstack-arm.h $(THISFILE) +# The option -mabi=aapcs ensures an 8-bytes-aligned stack pointer. + $(CROSS_TOOL) armv7l-linux-gnueabihf gcc-6.5.0 -march=armv6 -mabi=aapcs -mfloat-abi=hard -mlittle-endian $(GCCFLAGS) -D__armhf__ -S ../../vacall/vacall-armhf.c -I../../vacall -I. -o vacall-armhfel.s + $(CROSS_TOOL) armv7l-linux-gnueabihf gcc-6.5.0 -march=armv6 -mabi=aapcs -mfloat-abi=hard -mbig-endian $(GCCFLAGS) -D__armhf__ -S ../../vacall/vacall-armhf.c -I../../vacall -I. -o vacall-armhfeb.s + cmp vacall-armhfel.s vacall-armhfeb.s > /dev/null + (echo '#include "asm-arm.h"' ; ../../common/asm-arm.sh < vacall-armhfel.s ; cat ../../common/noexecstack-arm.h) > vacall-armhf-macro.S + $(RM) vacall-armhfel.s vacall-armhfeb.s + + +vacall-arm64-macro.S : ../../vacall/vacall-arm64.c ../../vacall/vacall-internal.h vacall_r.h ../../common/asm-arm64.sh ../../common/noexecstack-arm.h $(THISFILE) + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 -mlittle-endian $(GCCFLAGS) -D__arm64__ -S ../../vacall/vacall-arm64.c -I../../vacall -I. -o vacall-arm64el.s + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 -mbig-endian $(GCCFLAGS) -D__arm64__ -S ../../vacall/vacall-arm64.c -I../../vacall -I. -o vacall-arm64eb.s + cmp vacall-arm64el.s vacall-arm64eb.s > /dev/null + (echo '#include "asm-arm64.h"' ; ../../common/asm-arm64.sh < vacall-arm64el.s ; cat ../../common/noexecstack-arm.h) > vacall-arm64-macro.S + $(RM) vacall-arm64el.s vacall-arm64eb.s + + +vacall-arm64-macos-macro.S : ../../vacall/vacall-arm64.c ../../vacall/vacall-internal.h vacall_r.h ../../common/asm-arm64.sh ../../common/noexecstack-arm.h $(THISFILE) + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 -mlittle-endian $(GCCFLAGS) -D__arm64__ -D__APPLE__ -D__MACH__ -S ../../vacall/vacall-arm64.c -I../../vacall -I. -o vacall-arm64-macos.s + (echo '#include "asm-arm64.h"' ; ../../common/asm-arm64.sh < vacall-arm64-macos.s ; cat ../../common/noexecstack-arm.h) > vacall-arm64-macos-macro.S + $(RM) vacall-arm64-macos.s + + +vacall-powerpc-aix.s : ../../vacall/vacall-powerpc.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) rs6000-aix gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc -mnew-mnemonics $(GCCFLAGS) -D__powerpc__ -S ../../vacall/vacall-powerpc.c -I../../vacall -I. -o vacall-powerpc-aix.s + +vacall-powerpc-linux.s : ../../vacall/vacall-powerpc.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) powerpc-linux gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc $(GCCFLAGS) -D__powerpc__ -S ../../vacall/vacall-powerpc.c -I../../vacall -I. -o vacall-powerpc-linux.s + +vacall-powerpc-linux-macro.S : vacall-powerpc-linux.s ../../common/asm-powerpc.sh ../../common/noexecstack.h $(THISFILE) + (../../common/asm-powerpc.sh < vacall-powerpc-linux.s ; cat ../../common/noexecstack.h) > vacall-powerpc-linux-macro.S + +vacall-powerpc-sysv4-macro.S : ../../vacall/vacall-powerpc.c ../../vacall/vacall-internal.h vacall_r.h ../../common/asm-powerpc.sh ../../common/noexecstack.h $(THISFILE) + $(CROSS_TOOL) powerpc-linux gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc $(GCCFLAGS) -D__powerpc__ -S ../../vacall/vacall-powerpc.c -I../../vacall -I. -o vacall-powerpc-sysv4.s + (../../common/asm-powerpc.sh < vacall-powerpc-sysv4.s ; cat ../../common/noexecstack.h) > vacall-powerpc-sysv4-macro.S + $(RM) vacall-powerpc-sysv4.s + +vacall-powerpc-macos.s : ../../vacall/vacall-powerpc.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) powerpc-darwin gcc -V 3.3.6 $(GCCFLAGS) -D__powerpc__ -S ../../vacall/vacall-powerpc.c -I../../vacall -I. -o vacall-powerpc-macos.s + +vacall-powerpc64-aix.s : ../../vacall/vacall-powerpc64.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) rs6000-aix6.1 gcc-5.4.0 -maix64 $(GCCFLAGS) -D__powerpc64__ -S ../../vacall/vacall-powerpc64.c -I../../vacall -I. -o vacall-powerpc64-aix.s + +vacall-powerpc64-linux.S : ../../vacall/vacall-powerpc64.c ../../vacall/vacall-internal.h vacall_r.h ../../common/asm-powerpc.sh ../../common/noexecstack.h $(THISFILE) + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv1 -mcpu=power4 -mlittle-endian $(GCCFLAGS) -D__powerpc64__ -S ../../vacall/vacall-powerpc64.c -I../../vacall -I. -o vacall-powerpc64-linux-le.s + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv1 -mcpu=power4 -mbig-endian $(GCCFLAGS) -D__powerpc64__ -S ../../vacall/vacall-powerpc64.c -I../../vacall -I. -o vacall-powerpc64-linux-be.s + cmp vacall-powerpc64-linux-le.s vacall-powerpc64-linux-be.s > /dev/null + (../../common/asm-powerpc.sh < vacall-powerpc64-linux-be.s ; cat ../../common/noexecstack.h) > vacall-powerpc64-linux.S + $(RM) vacall-powerpc64-linux-le.s vacall-powerpc64-linux-be.s + +vacall-powerpc64-elfv2-linux.S : ../../vacall/vacall-powerpc64.c ../../vacall/vacall-internal.h vacall_r.h ../../common/asm-powerpc.sh ../../common/noexecstack.h $(THISFILE) + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv2 -mcpu=power4 -mlittle-endian $(GCCFLAGS) -D__powerpc64__ -D__powerpc64_elfv2__ -S ../../vacall/vacall-powerpc64.c -I../../vacall -I. -o vacall-powerpc64-elfv2-linux-le.s + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv2 -mcpu=power4 -mbig-endian $(GCCFLAGS) -D__powerpc64__ -D__powerpc64_elfv2__ -S ../../vacall/vacall-powerpc64.c -I../../vacall -I. -o vacall-powerpc64-elfv2-linux-be.s +# vacall-powerpc64-linux-be.s contains endianness specific optimizations. + (../../common/asm-powerpc.sh < vacall-powerpc64-elfv2-linux-le.s ; cat ../../common/noexecstack.h) > vacall-powerpc64-elfv2-linux.S + $(RM) vacall-powerpc64-elfv2-linux-le.s vacall-powerpc64-elfv2-linux-be.s + + +vacall-ia64-linux.s : ../../vacall/vacall-ia64.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) ia64-linux gcc -V 4.0.1 $(GCCFLAGS) -D__ia64__ -S ../../vacall/vacall-ia64.c -I../../vacall -I. -o vacall-ia64-linux.s + +vacall-ia64-macro.S : vacall-ia64-linux.s ../../common/noexecstack.h $(THISFILE) + cat vacall-ia64-linux.s ../../common/noexecstack.h > vacall-ia64-macro.S + + +vacall-x86_64-linux.s : ../../vacall/vacall-x86_64.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) x86_64-linux gcc-4.0.2 $(GCCFLAGS) -D__x86_64__ -S ../../vacall/vacall-x86_64.c -I../../vacall -I. -o vacall-x86_64-linux.s + +vacall-x86_64-macro.S : vacall-x86_64-linux.s ../../common/asm-x86_64.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-x86_64.h"' ; ../../common/asm-x86_64.sh < vacall-x86_64-linux.s ; cat ../../common/noexecstack.h) > vacall-x86_64-macro.S + +vacall-x86_64-x32-linux.s : ../../vacall/vacall-x86_64.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) x86_64-linux gcc-5.4.0 -mx32 $(GCCFLAGS) -D__x86_64__ -D__x86_64_x32__ -S ../../vacall/vacall-x86_64.c -I../../vacall -I. -o vacall-x86_64-x32-linux.s + +vacall-x86_64-windows.s : ../../vacall/vacall-x86_64-windows.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) x86_64-linux gcc-5.4.0 -mabi=ms $(GCCFLAGS) -fno-reorder-blocks-and-partition -D__x86_64__ -D_WIN32 -S ../../vacall/vacall-x86_64-windows.c -I../../vacall -I. -o vacall-x86_64-windows.s + +vacall-x86_64-windows-macro.S : vacall-x86_64-windows.s ../../common/asm-x86_64.sh ../../common/noexecstack.h $(THISFILE) + (echo '#include "asm-x86_64.h"' ; ../../common/asm-x86_64.sh < vacall-x86_64-windows.s ; cat ../../common/noexecstack.h) > vacall-x86_64-windows-macro.S + + +vacall-s390-linux.s : ../../vacall/vacall-s390.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) s390-linux gcc -V 3.1 $(GCCFLAGS) -D__s390__ -S ../../vacall/vacall-s390.c -I../../vacall -I. -o vacall-s390-linux.s + +vacall-s390-macro.S : vacall-s390-linux.s ../../common/asm-s390.sh ../../common/noexecstack.h $(THISFILE) + (../../common/asm-s390.sh < vacall-s390-linux.s ; cat ../../common/noexecstack.h) > vacall-s390-macro.S + + +vacall-s390x-linux.s : ../../vacall/vacall-s390x.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) s390x-linux gcc-5.4.0 $(GCCFLAGS) -D__s390x__ -S ../../vacall/vacall-s390x.c -I../../vacall -I. -o vacall-s390x-linux.s + +vacall-s390x-macro.S : vacall-s390x-linux.s ../../common/asm-s390.sh ../../common/noexecstack.h $(THISFILE) + (../../common/asm-s390.sh < vacall-s390x-linux.s ; cat ../../common/noexecstack.h) > vacall-s390x-macro.S + + +vacall-riscv32-ilp32d-linux.s : ../../vacall/vacall-riscv32.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) riscv32-linux gcc-7.3.0 $(GCCFLAGS) -D__riscv32__ -S ../../vacall/vacall-riscv32.c -I../../vacall -I. -o vacall-riscv32-ilp32d-linux.s + +vacall-riscv32-ilp32d-macro.S : vacall-riscv32-ilp32d-linux.s ../../common/asm-riscv.sh ../../common/noexecstack.h $(THISFILE) + (../../common/asm-riscv.sh < vacall-riscv32-ilp32d-linux.s ; cat ../../common/noexecstack.h) > vacall-riscv32-ilp32d-macro.S + + +vacall-riscv64-lp64d-linux.s : ../../vacall/vacall-riscv64.c ../../vacall/vacall-internal.h vacall_r.h $(THISFILE) + $(CROSS_TOOL) riscv64-linux gcc-7.3.0 $(GCCFLAGS) -D__riscv64__ -S ../../vacall/vacall-riscv64.c -I../../vacall -I. -o vacall-riscv64-lp64d-linux.s + +vacall-riscv64-lp64d-macro.S : vacall-riscv64-lp64d-linux.s ../../common/asm-riscv.sh ../../common/noexecstack.h $(THISFILE) + (../../common/asm-riscv.sh < vacall-riscv64-lp64d-linux.s ; cat ../../common/noexecstack.h) > vacall-riscv64-lp64d-macro.S diff --git a/callback/vacall_r/Makefile.in b/callback/vacall_r/Makefile.in new file mode 100644 index 0000000..012f4d9 --- /dev/null +++ b/callback/vacall_r/Makefile.in @@ -0,0 +1,356 @@ +# Makefile for vacall + +#### Start of system configuration section. #### + +HOST = @host@ +CPU = @HOST_CPU_C_ABI@ +OS = @host_os@ + +# Directories used by "make": +srcdir = @srcdir@ + +# Directories used by "make install": +prefix = @prefix@ +local_prefix = /usr/local +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +mandir = @mandir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +htmldir = $(datadir)/html + +# Programs used by "make": +CC = @CC@ +CFLAGS = @CFLAGS@ +CPPFLAGS = @CPPFLAGS@ +CPP = @CPP@ +INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../../vacall -I../.. -I$(srcdir)/../.. +INCLUDES_WITH_GNULIB = $(INCLUDES) -I../../gnulib-lib -I$(srcdir)/../../gnulib-lib +ASPFLAGS = `if test @AS_UNDERSCORE@ = true; then echo '-DASM_UNDERSCORE'; fi` +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile +LIBTOOL_LINK = $(LIBTOOL) --mode=link +LIBTOOL_INSTALL = $(LIBTOOL) --mode=install +LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall +AR = @AR@ +AR_FLAGS = rc +RANLIB = @RANLIB@ +MV = mv +LN = @LN@ +RM = rm -f +@SET_MAKE@ + +# Programs used by "make install": +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +#### End of system configuration section. #### + +SHELL = /bin/sh + +# Needed by $(LIBTOOL). +top_builddir = ../.. + +OBJECTS = vacall.lo vacall-libapi.lo vacall-structcpy.lo + +all : $(OBJECTS) libvacall.la + +vacall.lo : vacall-$(CPU).lo + $(RM) vacall.lo vacall.@OBJEXT@ + $(LN) vacall-$(CPU).lo vacall.lo + if test -f vacall-$(CPU).@OBJEXT@; then $(LN) vacall-$(CPU).@OBJEXT@ vacall.@OBJEXT@; fi + +@IFNOT_MSVC@vacall-i386.lo : vacall-i386.s +@IFNOT_MSVC@ $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-i386.s + +@IFNOT_MSVC@vacall-i386.s : $(srcdir)/vacall-i386-macro.S +@IFNOT_MSVC@ $(CPP) $(ASPFLAGS) -I$(srcdir) -I$(srcdir)/../../common - < $(srcdir)/vacall-i386-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,@ ,@,g' -e 's,//.*$$,,' -e 's/##//g' > vacall-i386.s + +@IF_MSVC@vacall-i386.lo : $(srcdir)/vacall-i386-msvc.c +@IF_MSVC@ $(LIBTOOL_COMPILE) $(CC) $(INCLUDES) -I$(srcdir)/../../common $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/vacall-i386-msvc.c -o vacall-i386.lo + +vacall-sparc.lo : vacall-sparc.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-sparc.s + +vacall-sparc.s : $(srcdir)/vacall-sparc-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common - < $(srcdir)/vacall-sparc-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//.*$$,,' -e 's,\$$,#,g' -e 's,# ,#,g' > vacall-sparc.s + +vacall-sparc64.lo : vacall-sparc64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-sparc64.s + +vacall-sparc64.s : $(srcdir)/vacall-sparc64-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common - < $(srcdir)/vacall-sparc64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//.*$$,,' -e 's,\$$,#,g' -e 's,# ,#,g' > vacall-sparc64.s + +vacall-m68k.lo : vacall-m68k.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-m68k.s + +vacall-m68k.s : $(srcdir)/vacall-m68k.mit.S $(srcdir)/vacall-m68k.motorola.S + $(CPP) $(ASPFLAGS) -I$(srcdir) -I$(srcdir)/../../common $(srcdir)/vacall-m68k.motorola.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' | if test @AS_UNDERSCORE@ = true; then sed -e 's/\$$//g'; else sed -e 's/\$$/%/g'; fi > vacall-m68k.s + +vacall-mips.lo : vacall-mips.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-mips.s + +vacall-mips.s : $(srcdir)/vacall-mips@ENDIANNESS@-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir) -I$(srcdir)/../../common $(srcdir)/vacall-mips@ENDIANNESS@-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-mips.s + +vacall-mipsn32.lo : vacall-mipsn32.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-mipsn32.s + +vacall-mipsn32.s : $(srcdir)/vacall-mipsn32@ENDIANNESS@-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir) -I$(srcdir)/../../common $(srcdir)/vacall-mipsn32@ENDIANNESS@-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-mipsn32.s + +vacall-mips64.lo : vacall-mips64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-mips64.s + +vacall-mips64.s : $(srcdir)/vacall-mips64@ENDIANNESS@-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir) -I$(srcdir)/../../common $(srcdir)/vacall-mips64@ENDIANNESS@-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-mips64.s + +vacall-alpha.lo : vacall-alpha.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-alpha.s + +vacall-alpha.s : $(srcdir)/vacall-alpha-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir) -I$(srcdir)/../../common $(srcdir)/vacall-alpha-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-alpha.s + +vacall-hppa.lo : vacall-hppa.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-hppa.s + +vacall-hppa.s : $(srcdir)/vacall-hppa-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common $(srcdir)/vacall-hppa-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > vacall-hppa.s + +vacall-hppa64.lo : vacall-hppa64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-hppa64.s + +vacall-hppa64.s : $(srcdir)/vacall-hppa64-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common $(srcdir)/vacall-hppa64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > vacall-hppa64.s + +vacall-arm.lo : vacall-arm.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-arm.s + +vacall-arm.s : $(srcdir)/vacall-arm-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir) -I$(srcdir)/../../common $(srcdir)/vacall-arm-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > vacall-arm.s + +vacall-armhf.lo : vacall-armhf.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-armhf.s + +vacall-armhf.s : $(srcdir)/vacall-armhf-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir) -I$(srcdir)/../../common $(srcdir)/vacall-armhf-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > vacall-armhf.s + +vacall-arm64.lo : vacall-arm64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-arm64.s + +vacall-arm64.s : $(srcdir)/vacall-arm64-macro.S $(srcdir)/vacall-arm64-macos-macro.S + case "$(OS)" in \ + macos* | darwin*) input=vacall-arm64-macos-macro.S ;; \ + *) input=vacall-arm64-macro.S ;; \ + esac; \ + $(CPP) $(ASPFLAGS) -I$(srcdir) -I$(srcdir)/../../common $(srcdir)/$${input} | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > vacall-arm64.s + +vacall-powerpc.lo : vacall-powerpc.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-powerpc.s + +vacall-powerpc.s : $(srcdir)/vacall-powerpc-aix.s $(srcdir)/vacall-powerpc-linux-macro.S $(srcdir)/vacall-powerpc-macos.s $(srcdir)/vacall-powerpc-sysv4-macro.S + case "$(OS)" in \ + aix*) syntax=aix;; \ + linux* | netbsd* | openbsd*) syntax=linux;; \ + macos* | darwin*) syntax=macos;; \ + *) syntax=sysv4;; \ + esac; \ + case $${syntax} in \ + linux | netbsd | sysv4) \ + $(CPP) $(ASPFLAGS) -I$(srcdir) $(srcdir)/vacall-powerpc-$${syntax}-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > vacall-powerpc.s || exit 1 ;; \ + macos) \ + grep -v '\.machine' $(srcdir)/vacall-powerpc-$${syntax}.s > vacall-powerpc.s || exit 1 ;; \ + *) \ + cp $(srcdir)/vacall-powerpc-$${syntax}.s vacall-powerpc.s || exit 1 ;; \ + esac + +vacall-powerpc64.lo : vacall-powerpc64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-powerpc64.s + +vacall-powerpc64.s : $(srcdir)/vacall-powerpc64-aix.s $(srcdir)/vacall-powerpc64-linux.S + case "$(OS)" in \ + aix*) syntax=aix;; \ + *) syntax=linux;; \ + esac; \ + case $${syntax} in \ + linux) \ + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-powerpc64-$${syntax}.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-powerpc64.s || exit 1 ;; \ + *) \ + cp $(srcdir)/vacall-powerpc64-$${syntax}.s vacall-powerpc64.s || exit 1 ;; \ + esac + +vacall-powerpc64-elfv2.lo : vacall-powerpc64-elfv2.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-powerpc64-elfv2.s + +vacall-powerpc64-elfv2.s : $(srcdir)/vacall-powerpc64-elfv2-linux.S + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-powerpc64-elfv2-linux.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-powerpc64-elfv2.s + +vacall-ia64.lo : vacall-ia64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-ia64.s + +vacall-ia64.s : $(srcdir)/vacall-ia64-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-ia64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-ia64.s + +@IFNOT_MSVC@vacall-x86_64.lo : vacall-x86_64.s +@IFNOT_MSVC@ $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-x86_64.s + +@IFNOT_MSVC@vacall-x86_64.s : $(srcdir)/vacall-x86_64-macro.S $(srcdir)/vacall-x86_64-windows-macro.S +@IFNOT_MSVC@ case "$(OS)" in \ +@IFNOT_MSVC@ cygwin* | mingw*) variant='-windows';; \ +@IFNOT_MSVC@ *) variant='';; \ +@IFNOT_MSVC@ esac; \ +@IFNOT_MSVC@ $(CPP) $(ASPFLAGS) -I$(srcdir) -I$(srcdir)/../../common - < $(srcdir)/vacall-x86_64$${variant}-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,@ ,@,g' -e 's,//.*$$,,' -e 's/##//g' > vacall-x86_64.s + +@IF_MSVC@vacall-x86_64.lo : vacall-x86_64.asm vacall-libapi.lo +@IF_MSVC@ ml64 -c -nologo vacall-x86_64.asm +@IF_MSVC@ mkdir -p .libs; cp vacall-x86_64.@OBJEXT@ .libs/vacall-x86_64.@OBJEXT@ +@IF_MSVC@ sed -e 's/vacall-libapi/vacall-x86_64/g' < vacall-libapi.lo > vacall-x86_64.lo + +@IF_MSVC@vacall-x86_64.asm : $(srcdir)/vacall-x86_64-windows-macro.S +@IF_MSVC@ { $(CPP) $(ASPFLAGS) -I$(srcdir)/../../common $(srcdir)/vacall-x86_64-windows-macro.S | grep -v '^#'; echo 'END'; } > vacall-x86_64.asm + +vacall-x86_64-x32.lo : vacall-x86_64-x32.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-x86_64-x32.s + +vacall-x86_64-x32.s : $(srcdir)/vacall-x86_64-x32-linux.s + cp $(srcdir)/vacall-x86_64-x32-linux.s vacall-x86_64-x32.s + +vacall-s390.lo : vacall-s390.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-s390.s + +vacall-s390.s : $(srcdir)/vacall-s390-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir) $(srcdir)/vacall-s390-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-s390.s + +vacall-s390x.lo : vacall-s390x.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-s390x.s + +vacall-s390x.s : $(srcdir)/vacall-s390x-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir) $(srcdir)/vacall-s390x-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-s390x.s + +vacall-riscv32-ilp32d.lo : vacall-riscv32-ilp32d.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-riscv32-ilp32d.s + +vacall-riscv32-ilp32d.s : $(srcdir)/vacall-riscv32-ilp32d-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir) $(srcdir)/vacall-riscv32-ilp32d-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-riscv32-ilp32d.s + +vacall-riscv64-lp64d.lo : vacall-riscv64-lp64d.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c vacall-riscv64-lp64d.s + +vacall-riscv64-lp64d.s : $(srcdir)/vacall-riscv64-lp64d-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir) $(srcdir)/vacall-riscv64-lp64d-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-riscv64-lp64d.s + +vacall-libapi.lo : $(srcdir)/vacall-libapi.c $(srcdir)/../../vacall/vacall-internal.h $(srcdir)/vacall_r.h ../../config.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES_WITH_GNULIB) $(CPPFLAGS) $(CFLAGS) @DISABLE_TYPE_BASED_ALIASING@ -DREENTRANT -c $(srcdir)/vacall-libapi.c + +vacall-structcpy.lo : $(srcdir)/vacall-structcpy.c $(srcdir)/../../common/structcpy.c + $(LIBTOOL_COMPILE) $(CC) -I$(srcdir)/../../common $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/vacall-structcpy.c + +libvacall.la : $(OBJECTS) + $(LIBTOOL_LINK) $(CC) -o libvacall.la -rpath $(libdir) -no-undefined $(OBJECTS) $(LDFLAGS) + +# Installs the library and include files only. Typically called with only +# $(libdir) and $(includedir) - don't use $(prefix) and $(exec_prefix) here. +install-lib : all force + mkdir -p $(includedir) + $(INSTALL_DATA) $(srcdir)/vacall_r.h $(includedir)/vacall_r.h + +install : all force + mkdir -p $(DESTDIR)$(prefix) +# mkdir -p $(DESTDIR)$(exec_prefix) +# mkdir -p $(DESTDIR)$(libdir) +# $(LIBTOOL_INSTALL) $(INSTALL_DATA) libvacall.la $(DESTDIR)$(libdir)/libvacall.la + mkdir -p $(DESTDIR)$(includedir) + $(INSTALL_DATA) $(srcdir)/vacall_r.h $(DESTDIR)$(includedir)/vacall_r.h +# mkdir -p $(DESTDIR)$(mandir) +# mkdir -p $(DESTDIR)$(mandir)/man3 +# $(INSTALL_DATA) $(srcdir)/vacall_r.3 $(DESTDIR)$(mandir)/man3/vacall_r.3 +# mkdir -p $(DESTDIR)$(datadir) +# mkdir -p $(DESTDIR)$(htmldir) +# $(INSTALL_DATA) $(srcdir)/vacall_r.html $(DESTDIR)$(htmldir)/vacall_r.html + +installdirs : force + mkdir -p $(DESTDIR)$(prefix) +# mkdir -p $(DESTDIR)$(exec_prefix) +# mkdir -p $(DESTDIR)$(libdir) + mkdir -p $(DESTDIR)$(includedir) +# mkdir -p $(DESTDIR)$(mandir) +# mkdir -p $(DESTDIR)$(mandir)/man3 +# mkdir -p $(DESTDIR)$(datadir) +# mkdir -p $(DESTDIR)$(htmldir) + +uninstall : force +# $(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libvacall.la + $(RM) $(DESTDIR)$(includedir)/vacall_r.h +# $(RM) $(DESTDIR)$(mandir)/man3/vacall_r.3 +# $(RM) $(DESTDIR)$(htmldir)/vacall_r.html + +check : all + +extracheck : all + +mostlyclean : clean + +clean : force + $(RM) *.@OBJEXT@ *.lo *.a libvacall.* core + $(RM) vacall-i386.s vacall-sparc.s vacall-sparc64.s vacall-m68k.s vacall-mips.s vacall-mipsn32.s vacall-mips64.s vacall-alpha.s vacall-hppa.s vacall-hppa64.s vacall-arm.s vacall-armhf.s vacall-arm64.s vacall-powerpc.s vacall-powerpc64.s vacall-powerpc64-elfv2.s vacall-ia64.s vacall-x86_64.s vacall-x86_64.asm vacall-x86_64-x32.s vacall-s390.s vacall-s390x.s vacall-riscv32-ilp32d.s vacall-riscv64-lp64d.s + $(RM) -r .libs _libs + +distclean : clean + $(RM) Makefile + +maintainer-clean : distclean + + +# List of source files (committed in version control or generated by Makefile.devel). +SOURCE_FILES = \ + COPYING \ + README \ + Makefile.devel \ + Makefile.maint \ + Makefile.in \ + vacall_r.h \ + get_receiver.c \ + vacall-alpha-linux.s vacall-alpha-macro.S \ + vacall-arm-macro.S \ + vacall-armhf-macro.S \ + vacall-arm64-macro.S vacall-arm64-macos-macro.S \ + vacall-hppa-linux.s vacall-hppa-macro.S \ + vacall-hppa64-linux.s vacall-hppa64-macro.S \ + vacall-i386-linux.s vacall-i386-macro.S \ + vacall-ia64-linux.s vacall-ia64-macro.S \ + vacall-m68k-linux.s vacall-m68k-sun.s vacall-m68k.mit.S vacall-m68k.motorola.S \ + vacall-mipseb-linux.s vacall-mipsel-linux.s vacall-mipseb-macro.S vacall-mipsel-macro.S \ + vacall-mipsn32eb-linux.s vacall-mipsn32el-linux.s vacall-mipsn32eb-macro.S vacall-mipsn32el-macro.S \ + vacall-mips64eb-linux.s vacall-mips64el-linux.s vacall-mips64eb-macro.S vacall-mips64el-macro.S \ + vacall-powerpc-aix.s \ + vacall-powerpc-linux.s vacall-powerpc-linux-macro.S \ + vacall-powerpc-macos.s \ + vacall-powerpc-sysv4-macro.S \ + vacall-powerpc64-aix.s vacall-powerpc64-linux.S vacall-powerpc64-elfv2-linux.S \ + vacall-riscv32-ilp32d-linux.s vacall-riscv32-ilp32d-macro.S \ + vacall-riscv64-lp64d-linux.s vacall-riscv64-lp64d-macro.S \ + vacall-s390-linux.s vacall-s390-macro.S \ + vacall-s390x-linux.s vacall-s390x-macro.S \ + vacall-sparc-linux.s vacall-sparc-macro.S \ + vacall-sparc64-linux.s vacall-sparc64-macro.S \ + vacall-x86_64-linux.s vacall-x86_64-macro.S vacall-x86_64-x32-linux.s \ + vacall-x86_64-windows.s vacall-x86_64-windows-macro.S \ + vacall-libapi.c \ + vacall-structcpy.c +# List of distributed files generated by Makefile.maint. +GENERATED_FILES = \ + vacall-i386-msvc.c +# List of distributed files. +DISTFILES = $(SOURCE_FILES) $(GENERATED_FILES) + +distdir : $(DISTFILES) + for file in $(DISTFILES); do \ + if test -f $$file; then dir='.'; else dir='$(srcdir)'; fi; \ + cp -p "$$dir/$$file" '$(distdir)'/$$file || exit 1; \ + done + + +force : diff --git a/callback/vacall_r/Makefile.maint b/callback/vacall_r/Makefile.maint new file mode 100644 index 0000000..c9074f4 --- /dev/null +++ b/callback/vacall_r/Makefile.maint @@ -0,0 +1,17 @@ +# maintainer -*-Makefile-*- + +LN = ln -s +RM = rm -f + +# ==================== Easily regeneratable files ==================== + +all : vacall-i386-msvc.c + +vacall-i386-msvc.c : vacall-i386-macro.S + (echo '#ifdef _MSC_VER' ; echo '#include "vacall_r.h"' ; echo '#endif' ; sed -e '/FUNEND(callback_receiver,/q' < vacall-i386-macro.S ; cat get_receiver.c) > vacall-i386-msvc.c + +totally-clean : force + $(RM) vacall-i386-msvc.c + + +force : diff --git a/callback/vacall_r/README b/callback/vacall_r/README new file mode 100644 index 0000000..801a9b9 --- /dev/null +++ b/callback/vacall_r/README @@ -0,0 +1,9 @@ +This directory contains a reentrant version of the vacall package. + +Instead of using a global variable for the function to be called, +a pointer is passed in a special CPU register, pointing to: + - a function code pointer in the first word, + - a data word in the second word, to be passed before the va_alist. + +The include file is renamed to . + diff --git a/callback/vacall_r/get_receiver.c b/callback/vacall_r/get_receiver.c new file mode 100644 index 0000000..5394019 --- /dev/null +++ b/callback/vacall_r/get_receiver.c @@ -0,0 +1,24 @@ +/* Implementation of callback_get_receiver */ + +/* + * Copyright 2017 Bruno Haible + * + * 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, see . + */ + +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} diff --git a/callback/vacall_r/vacall-alpha-linux.s b/callback/vacall_r/vacall-alpha-linux.s new file mode 100644 index 0000000..75fbe8f --- /dev/null +++ b/callback/vacall_r/vacall-alpha-linux.s @@ -0,0 +1,196 @@ + .set noreorder + .set volatile + .set noat + .set nomacro + .text + .align 2 + .align 4 + .ent callback_receiver +callback_receiver: + .frame $15,192,$26,48 + .mask 0x4008000,-192 + ldah $29,0($27) !gpdisp!1 + lda $29,0($29) !gpdisp!1 +$callback_receiver..ng: + lda $30,-192($30) + ldq $27,0($1) + stq $15,8($30) + mov $30,$15 + lda $3,144($15) + stq $26,0($30) + .prologue 1 + stq $31,48($15) + lda $2,88($15) + stq $16,144($15) + subq $2,$3,$2 + ldq $16,8($1) + stq $17,152($15) + lda $3,192($15) + stq $2,80($15) + lda $17,16($15) + lda $2,144($15) + stq $3,72($15) + stq $18,160($15) + stq $19,168($15) + stq $20,176($15) + stq $21,184($15) + stt $f16,88($15) + stt $f17,96($15) + stt $f18,104($15) + stt $f19,112($15) + stt $f20,120($15) + stt $f21,128($15) + stl $31,16($15) + stq $2,40($15) + stl $31,56($15) + jsr $26,($27),0 + ldah $29,0($26) !gpdisp!2 + lda $29,0($29) !gpdisp!2 + ldl $2,56($15) + beq $2,$L43 + zapnot $2,15,$3 + cmpeq $3,1,$2 + bne $2,$L44 + cmpeq $3,2,$2 + bne $2,$L44 + cmpeq $3,3,$2 + bne $2,$L50 + cmpeq $3,4,$2 + bne $2,$L51 + cmpeq $3,5,$2 + bne $2,$L52 + cmpeq $3,6,$2 + bne $2,$L53 + cmpeq $3,7,$2 + bne $2,$L54 + cmpeq $3,8,$2 + bne $2,$L48 + cmpeq $3,9,$2 + bne $2,$L48 + cmpeq $3,10,$2 + bne $2,$L48 + cmpeq $3,11,$2 + bne $2,$L48 + cmpeq $3,12,$2 + bne $2,$L55 + cmpeq $3,13,$2 + bne $2,$L56 + cmpeq $3,14,$2 + bne $2,$L48 + cmpeq $3,15,$2 + beq $2,$L43 + lda $2,1024($31) + ldl $3,16($15) + and $2,$3,$2 + beq $2,$L43 + ldq $3,64($15) + cmpeq $3,1,$2 + bne $2,$L57 + cmpeq $3,2,$2 + bne $2,$L58 + cmpeq $3,4,$2 + bne $2,$L59 + cmpeq $3,8,$2 + bne $2,$L60 + cmpeq $3,16,$2 + beq $2,$L43 + ldq $2,48($15) + ldq $1,8($2) + ldq $0,0($2) + .align 4 +$L43: + mov $15,$30 + ldq $26,0($30) + ldq $15,8($30) + lda $30,192($30) + ret $31,($26),1 + .align 4 +$L44: + mov $15,$30 + ldl $2,24($15) + ldq $26,0($30) + sll $2,56,$2 + sra $2,56,$0 + ldq $15,8($30) + lda $30,192($30) + ret $31,($26),1 +$L51: + ldl $2,24($15) + sll $2,48,$2 + sra $2,48,$0 + br $31,$L43 +$L50: + ldl $2,24($15) + bis $31,$31,$31 + and $2,0xff,$0 + br $31,$L43 +$L48: + ldq $0,24($15) + br $31,$L43 +$L52: + ldl $2,24($15) + bis $31,$31,$31 + zapnot $2,3,$0 + br $31,$L43 +$L53: + ldl $3,24($15) + bis $31,$31,$31 + mov $3,$0 + br $31,$L43 +$L54: + ldl $2,24($15) + bis $31,$31,$31 + zapnot $2,15,$0 + br $31,$L43 +$L55: + lds $f0,24($15) + br $31,$L43 +$L56: + ldt $f0,24($15) + br $31,$L43 +$L57: + ldq $3,48($15) + ldq_u $2,0($3) + extbl $2,$3,$0 + br $31,$L43 +$L58: + ldq $3,48($15) + ldq_u $2,0($3) + extwl $2,$3,$0 + br $31,$L43 +$L60: + ldq $2,48($15) + bis $31,$31,$31 + ldq $0,0($2) + br $31,$L43 +$L59: + ldq $2,48($15) + ldl $3,0($2) + zapnot $3,15,$0 + br $31,$L43 + .end callback_receiver + .align 2 + .align 4 + .globl callback_get_receiver + .ent callback_get_receiver +callback_get_receiver: + .frame $15,16,$26,0 + .mask 0x4008000,-16 + ldah $29,0($27) !gpdisp!3 + lda $29,0($29) !gpdisp!3 +$callback_get_receiver..ng: + lda $30,-16($30) + ldah $2,callback_receiver($29) !gprelhigh + stq $15,8($30) + mov $30,$15 + stq $26,0($30) + .prologue 1 + mov $15,$30 + lda $0,callback_receiver($2) !gprellow + ldq $26,0($30) + ldq $15,8($30) + lda $30,16($30) + ret $31,($26),1 + .end callback_get_receiver + .ident "GCC: (GNU) 4.0.2" + .section .note.GNU-stack,"",@progbits diff --git a/callback/vacall_r/vacall-alpha-macro.S b/callback/vacall_r/vacall-alpha-macro.S new file mode 100644 index 0000000..a5ba6c6 --- /dev/null +++ b/callback/vacall_r/vacall-alpha-macro.S @@ -0,0 +1,197 @@ + .set noreorder + .set volatile + .set noat + .set nomacro + .text + .align 2 + .align 4 + .ent callback_receiver +callback_receiver: + .frame $15,192,$26,48 + .mask 0x4008000,-192 + ldah $29,0($27) !gpdisp!1 + lda $29,0($29) !gpdisp!1 +$callback_receiver..ng: + lda $30,-192($30) + ldq $27,0($1) + stq $15,8($30) + mov $30,$15 + lda $3,144($15) + stq $26,0($30) + .prologue 1 + stq $31,48($15) + lda $2,88($15) + stq $16,144($15) + subq $2,$3,$2 + ldq $16,8($1) + stq $17,152($15) + lda $3,192($15) + stq $2,80($15) + lda $17,16($15) + lda $2,144($15) + stq $3,72($15) + stq $18,160($15) + stq $19,168($15) + stq $20,176($15) + stq $21,184($15) + stt $f16,88($15) + stt $f17,96($15) + stt $f18,104($15) + stt $f19,112($15) + stt $f20,120($15) + stt $f21,128($15) + stl $31,16($15) + stq $2,40($15) + stl $31,56($15) + jsr $26,($27),0 + ldah $29,0($26) !gpdisp!2 + lda $29,0($29) !gpdisp!2 + ldl $2,56($15) + beq $2,$L43 + zapnot $2,15,$3 + cmpeq $3,1,$2 + bne $2,$L44 + cmpeq $3,2,$2 + bne $2,$L44 + cmpeq $3,3,$2 + bne $2,$L50 + cmpeq $3,4,$2 + bne $2,$L51 + cmpeq $3,5,$2 + bne $2,$L52 + cmpeq $3,6,$2 + bne $2,$L53 + cmpeq $3,7,$2 + bne $2,$L54 + cmpeq $3,8,$2 + bne $2,$L48 + cmpeq $3,9,$2 + bne $2,$L48 + cmpeq $3,10,$2 + bne $2,$L48 + cmpeq $3,11,$2 + bne $2,$L48 + cmpeq $3,12,$2 + bne $2,$L55 + cmpeq $3,13,$2 + bne $2,$L56 + cmpeq $3,14,$2 + bne $2,$L48 + cmpeq $3,15,$2 + beq $2,$L43 + lda $2,1024($31) + ldl $3,16($15) + and $2,$3,$2 + beq $2,$L43 + ldq $3,64($15) + cmpeq $3,1,$2 + bne $2,$L57 + cmpeq $3,2,$2 + bne $2,$L58 + cmpeq $3,4,$2 + bne $2,$L59 + cmpeq $3,8,$2 + bne $2,$L60 + cmpeq $3,16,$2 + beq $2,$L43 + ldq $2,48($15) + ldq $1,8($2) + ldq $0,0($2) + .align 4 +$L43: + mov $15,$30 + ldq $26,0($30) + ldq $15,8($30) + lda $30,192($30) + ret $31,($26),1 + .align 4 +$L44: + mov $15,$30 + ldl $2,24($15) + ldq $26,0($30) + sll $2,56,$2 + sra $2,56,$0 + ldq $15,8($30) + lda $30,192($30) + ret $31,($26),1 +$L51: + ldl $2,24($15) + sll $2,48,$2 + sra $2,48,$0 + br $31,$L43 +$L50: + ldl $2,24($15) + bis $31,$31,$31 + and $2,0xff,$0 + br $31,$L43 +$L48: + ldq $0,24($15) + br $31,$L43 +$L52: + ldl $2,24($15) + bis $31,$31,$31 + zapnot $2,3,$0 + br $31,$L43 +$L53: + ldl $3,24($15) + bis $31,$31,$31 + mov $3,$0 + br $31,$L43 +$L54: + ldl $2,24($15) + bis $31,$31,$31 + zapnot $2,15,$0 + br $31,$L43 +$L55: + lds $f0,24($15) + br $31,$L43 +$L56: + ldt $f0,24($15) + br $31,$L43 +$L57: + ldq $3,48($15) + ldq_u $2,0($3) + extbl $2,$3,$0 + br $31,$L43 +$L58: + ldq $3,48($15) + ldq_u $2,0($3) + extwl $2,$3,$0 + br $31,$L43 +$L60: + ldq $2,48($15) + bis $31,$31,$31 + ldq $0,0($2) + br $31,$L43 +$L59: + ldq $2,48($15) + ldl $3,0($2) + zapnot $3,15,$0 + br $31,$L43 + .end callback_receiver + .align 2 + .align 4 + .globl callback_get_receiver + .ent callback_get_receiver +callback_get_receiver: + .frame $15,16,$26,0 + .mask 0x4008000,-16 + ldah $29,0($27) !gpdisp!3 + lda $29,0($29) !gpdisp!3 +$callback_get_receiver..ng: + lda $30,-16($30) + ldah $2,callback_receiver($29) !gprelhigh + stq $15,8($30) + mov $30,$15 + stq $26,0($30) + .prologue 1 + mov $15,$30 + lda $0,callback_receiver($2) !gprellow + ldq $26,0($30) + ldq $15,8($30) + lda $30,16($30) + ret $31,($26),1 + .end callback_get_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-arm-macro.S b/callback/vacall_r/vacall-arm-macro.S new file mode 100644 index 0000000..ec08a56 --- /dev/null +++ b/callback/vacall_r/vacall-arm-macro.S @@ -0,0 +1,110 @@ +#include "asm-arm.h" + .text + .align 2 + DECLARE_FUNCTION(callback_receiver) +FUNBEGIN(callback_receiver) + // args = 28, pretend = 0, frame = 32 + // frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {r4, fp, ip, lr, pc} + mov r2, $0 + sub fp, ip, $4 + sub sp, sp, $32 + ldr r4, [fp, $4] + str r2, [fp, $-28] + add r3, fp, $28 + str r2, [fp, $-24] + str r2, [fp, $-48] + str r3, [fp, $-32] + bic sp, sp, $7 + ldr r0, [r4, $4] + sub r1, fp, $48 + mov lr, pc + ldr pc, [r4, $0] + ldr r2, [fp, $-24] + cmp r2, $0 + ldmeqea fp, {r4, fp, sp, pc} + cmp r2, $1 + beq L(36) + cmp r2, $2 + ldreqsb r0, [fp, $-40] + ldmeqea fp, {r4, fp, sp, pc} + cmp r2, $3 + beq L(36) + cmp r2, $4 + ldreqsh r0, [fp, $-40] + ldmeqea fp, {r4, fp, sp, pc} + cmp r2, $5 + ldreqh r0, [fp, $-40] + ldmeqea fp, {r4, fp, sp, pc} + cmp r2, $6 + beq L(40) + cmp r2, $7 + beq L(40) + cmp r2, $8 + beq L(40) + cmp r2, $9 + beq L(40) + sub r3, r2, $10 + cmp r3, $1 + bls L(41) + cmp r2, $12 + ldreq r0, [fp, $-40] // float + ldmeqea fp, {r4, fp, sp, pc} + cmp r2, $13 + beq L(41) + cmp r2, $14 + beq L(40) + cmp r2, $15 + ldmneea fp, {r4, fp, sp, pc} + ldr r3, [fp, $-48] + tst r3, $1024 + ldmeqea fp, {r4, fp, sp, pc} + ldr r3, [fp, $-20] + cmp r3, $1 + ldreq r3, [fp, $-28] + ldreqb r0, [r3, $0] // zero_extendqisi2 + ldmeqea fp, {r4, fp, sp, pc} + cmp r3, $2 + ldreq r3, [fp, $-28] + ldrne r3, [fp, $-28] + ldreqh r0, [r3, $0] + ldrne r0, [r3, $0] + ldmea fp, {r4, fp, sp, pc} +L(40): + ldr r0, [fp, $-40] + ldmea fp, {r4, fp, sp, pc} +L(41): + sub r0, fp, $40 + ldmia r0, {r0, r1} // phole ldm + ldmea fp, {r4, fp, sp, pc} +L(36): + ldrb r0, [fp, $-40] // zero_extendqisi2 + ldmea fp, {r4, fp, sp, pc} +L(fe1): + FUNEND(callback_receiver) + .align 2 + .global C(callback_get_receiver) + DECLARE_FUNCTION(callback_get_receiver) +FUNBEGIN(callback_get_receiver) + // args = 0, pretend = 0, frame = 0 + // frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + stmfd sp!, {sl, fp, ip, lr, pc} + ldr sl, L(44) + ldr r3, L(44)+4 +L(43): + add sl, pc, sl + sub fp, ip, $4 + add r0, sl, r3 + ldmea fp, {sl, fp, sp, pc} +L(45): + .align 2 +L(44): + .word _GLOBAL_OFFSET_TABLE_-(L(43)+8) + .word callback_receiver(GOTOFF) +L(fe2): + FUNEND(callback_get_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/callback/vacall_r/vacall-arm64-macos-macro.S b/callback/vacall_r/vacall-arm64-macos-macro.S new file mode 100644 index 0000000..4e32962 --- /dev/null +++ b/callback/vacall_r/vacall-arm64-macos-macro.S @@ -0,0 +1,190 @@ +#include "asm-arm64.h" + .cpu generic+fp+simd + .text + .align 2 + .p2align 3,,7 + DECLARE_FUNCTION(callback_receiver) +FUNBEGIN(callback_receiver) + stp x29, x30, [sp, -256]! + add x29, sp, 0 + ldr x10, [x18] + add x11, x29, 256 + stp s0, s1, [x29, 156] + stp s2, s3, [x29, 164] + stp x0, x1, [x29, 88] + stp s4, s5, [x29, 172] + stp x11, xzr, [x29, 40] + stp s6, s7, [x29, 180] + str x8, [x29, 72] + stp d0, d1, [x29, 192] + stp x2, x3, [x29, 104] + stp d2, d3, [x29, 208] + stp x4, x5, [x29, 120] + stp d4, d5, [x29, 224] + stp x6, x7, [x29, 136] + stp d6, d7, [x29, 240] + str wzr, [x29, 24] + add x1, x29, 24 + str wzr, [x29, 56] + ldr x0, [x18, 8] + str wzr, [x29, 80] + str wzr, [x29, 152] + blr x10 + ldr w9, [x29, 56] + cbz w9, L(1) + cmp w9, 1 + beq L(25) + cmp w9, 2 + beq L(29) + cmp w9, 3 + beq L(25) + cmp w9, 4 + beq L(30) + cmp w9, 5 + beq L(31) + cmp w9, 6 + beq L(32) + cmp w9, 7 + beq L(33) + and w10, w9, -3 + cmp w10, 8 + beq L(27) + cmp w10, 9 + beq L(27) + cmp w9, 12 + beq L(34) + cmp w9, 13 + beq L(35) + cmp w9, 14 + beq L(27) + cmp w9, 15 + bne L(1) + ldr w9, [x29, 24] + tbz x9, 10, L(1) + ldr x9, [x29, 64] + sub x10, x9, $1 + cmp x10, 15 + bhi L(1) + ldr x11, [x29, 48] + cmp x9, 8 + and x10, x11, 7 + and x11, x11, -8 + add x9, x9, x10 + bhi L(15) + cmp x9, 8 + lsl w9, w9, 3 + bhi L(16) + mov x12, 2 + sub w9, w9, $1 + lsl x9, x12, x9 + ldr x11, [x11] + sub x9, x9, $1 + lsl w10, w10, 3 + and x9, x9, x11 + asr x0, x9, x10 +L(1): + ldp x29, x30, [sp], 256 + ret + .p2align 3 +L(25): + ldrb w0, [x29, 32] + ldp x29, x30, [sp], 256 + ret + .p2align 3 +L(27): + ldr x0, [x29, 32] + b L(1) + .p2align 3 +L(29): + ldrsb x0, [x29, 32] + b L(1) + .p2align 3 +L(30): + ldrsh x0, [x29, 32] + b L(1) + .p2align 3 +L(31): + ldrh w0, [x29, 32] + b L(1) + .p2align 3 +L(32): + ldrsw x0, [x29, 32] + b L(1) + .p2align 3 +L(33): + ldr w0, [x29, 32] + b L(1) +L(34): + ldr s0, [x29, 32] + b L(1) +L(35): + ldr d0, [x29, 32] + b L(1) +L(15): + cmp x9, 16 + lsl w9, w9, 3 + bls L(36) + mov x13, 2 + sub w9, w9, $129 + ldp x14, x12, [x11, 8] + lsl x9, x13, x9 + lsl w15, w10, 3 + sub x9, x9, $1 + neg w10, w10, lsl 3 + ldr x11, [x11] + add w10, w10, 64 + and x9, x9, x12 + lsl x16, x14, x10 + asr x11, x11, x15 + asr x14, x14, x15 + lsl x10, x9, x10 + orr x0, x11, x16 + orr x1, x10, x14 + b L(1) +L(16): + mov w13, -8 + mov x14, 2 + sub w9, w9, $65 + lsl w15, w10, 3 + ldr x12, [x11, 8] + lsl x9, x14, x9 + mul w10, w13, w10 + sub x9, x9, $1 + ldr x11, [x11] + add w10, w10, 64 + and x9, x9, x12 + asr x11, x11, x15 + lsl x9, x9, x10 + orr x0, x9, x11 + b L(1) +L(36): + mov w13, -4 + mov x14, 2 + sub w9, w9, $65 + lsl w15, w10, 3 + ldr x12, [x11, 8] + lsl x9, x14, x9 + mul w10, w13, w10 + sub x9, x9, $1 + ldr x11, [x11] + add w10, w10, 32 + and x9, x9, x12 + asr x1, x9, x15 + lsl x9, x9, x10 + asr x11, x11, x15 + lsl x9, x9, x10 + orr x0, x11, x9 + b L(1) + FUNEND(callback_receiver) + .align 2 + .p2align 3,,7 + .global C(callback_get_receiver) + DECLARE_FUNCTION(callback_get_receiver) +FUNBEGIN(callback_get_receiver) + adrp x9, PAGE(C(callback_receiver)) + add x0, x9, PAGEOFF(C(callback_receiver)) + ret + FUNEND(callback_get_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/callback/vacall_r/vacall-arm64-macro.S b/callback/vacall_r/vacall-arm64-macro.S new file mode 100644 index 0000000..911990e --- /dev/null +++ b/callback/vacall_r/vacall-arm64-macro.S @@ -0,0 +1,190 @@ +#include "asm-arm64.h" + .cpu generic+fp+simd + .text + .align 2 + .p2align 3,,7 + DECLARE_FUNCTION(callback_receiver) +FUNBEGIN(callback_receiver) + stp x29, x30, [sp, -256]! + add x29, sp, 0 + ldr x10, [x18] + add x11, x29, 256 + stp s0, s1, [x29, 156] + stp s2, s3, [x29, 164] + stp x0, x1, [x29, 88] + stp s4, s5, [x29, 172] + stp x11, xzr, [x29, 40] + stp s6, s7, [x29, 180] + str x8, [x29, 72] + stp d0, d1, [x29, 192] + stp x2, x3, [x29, 104] + stp d2, d3, [x29, 208] + stp x4, x5, [x29, 120] + stp d4, d5, [x29, 224] + stp x6, x7, [x29, 136] + stp d6, d7, [x29, 240] + str wzr, [x29, 16] + add x1, x29, 16 + str wzr, [x29, 56] + ldr x0, [x18, 8] + str wzr, [x29, 80] + str wzr, [x29, 152] + blr x10 + ldr w9, [x29, 56] + cbz w9, L(1) + cmp w9, 1 + beq L(25) + cmp w9, 2 + beq L(29) + cmp w9, 3 + beq L(25) + cmp w9, 4 + beq L(30) + cmp w9, 5 + beq L(31) + cmp w9, 6 + beq L(32) + cmp w9, 7 + beq L(33) + and w10, w9, -3 + cmp w10, 8 + beq L(27) + cmp w10, 9 + beq L(27) + cmp w9, 12 + beq L(34) + cmp w9, 13 + beq L(35) + cmp w9, 14 + beq L(27) + cmp w9, 15 + bne L(1) + ldr w9, [x29, 16] + tbz x9, 10, L(1) + ldr x9, [x29, 64] + sub x10, x9, $1 + cmp x10, 15 + bhi L(1) + ldr x11, [x29, 48] + cmp x9, 8 + and x10, x11, 7 + and x11, x11, -8 + add x9, x9, x10 + bhi L(15) + cmp x9, 8 + lsl w9, w9, 3 + bhi L(16) + mov x12, 2 + sub w9, w9, $1 + lsl x9, x12, x9 + ldr x11, [x11] + sub x9, x9, $1 + lsl w10, w10, 3 + and x9, x9, x11 + asr x0, x9, x10 +L(1): + ldp x29, x30, [sp], 256 + ret + .p2align 3 +L(25): + ldrb w0, [x29, 24] + ldp x29, x30, [sp], 256 + ret + .p2align 3 +L(27): + ldr x0, [x29, 24] + b L(1) + .p2align 3 +L(29): + ldrsb x0, [x29, 24] + b L(1) + .p2align 3 +L(30): + ldrsh x0, [x29, 24] + b L(1) + .p2align 3 +L(31): + ldrh w0, [x29, 24] + b L(1) + .p2align 3 +L(32): + ldrsw x0, [x29, 24] + b L(1) + .p2align 3 +L(33): + ldr w0, [x29, 24] + b L(1) +L(34): + ldr s0, [x29, 24] + b L(1) +L(35): + ldr d0, [x29, 24] + b L(1) +L(15): + cmp x9, 16 + lsl w9, w9, 3 + bls L(36) + mov x13, 2 + sub w9, w9, $129 + ldp x14, x12, [x11, 8] + lsl x9, x13, x9 + lsl w15, w10, 3 + sub x9, x9, $1 + neg w10, w10, lsl 3 + ldr x11, [x11] + add w10, w10, 64 + and x9, x9, x12 + lsl x16, x14, x10 + asr x11, x11, x15 + asr x14, x14, x15 + lsl x10, x9, x10 + orr x0, x11, x16 + orr x1, x10, x14 + b L(1) +L(16): + mov w13, -8 + mov x14, 2 + sub w9, w9, $65 + lsl w15, w10, 3 + ldr x12, [x11, 8] + lsl x9, x14, x9 + mul w10, w13, w10 + sub x9, x9, $1 + ldr x11, [x11] + add w10, w10, 64 + and x9, x9, x12 + asr x11, x11, x15 + lsl x9, x9, x10 + orr x0, x9, x11 + b L(1) +L(36): + mov w13, -4 + mov x14, 2 + sub w9, w9, $65 + lsl w15, w10, 3 + ldr x12, [x11, 8] + lsl x9, x14, x9 + mul w10, w13, w10 + sub x9, x9, $1 + ldr x11, [x11] + add w10, w10, 32 + and x9, x9, x12 + asr x1, x9, x15 + lsl x9, x9, x10 + asr x11, x11, x15 + lsl x9, x9, x10 + orr x0, x11, x9 + b L(1) + FUNEND(callback_receiver) + .align 2 + .p2align 3,,7 + .global C(callback_get_receiver) + DECLARE_FUNCTION(callback_get_receiver) +FUNBEGIN(callback_get_receiver) + adrp x9, PAGE(C(callback_receiver)) + add x0, x9, PAGEOFF(C(callback_receiver)) + ret + FUNEND(callback_get_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/callback/vacall_r/vacall-armhf-macro.S b/callback/vacall_r/vacall-armhf-macro.S new file mode 100644 index 0000000..f9e743a --- /dev/null +++ b/callback/vacall_r/vacall-armhf-macro.S @@ -0,0 +1,167 @@ +#include "asm-arm.h" + .arch armv6 + .eabi_attribute 28, 1 + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 1 + .eabi_attribute 30, 2 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .text + .align 2 + .global C(callback_receiver) + .syntax unified + .arm + .fpu vfpv3-d16 + .type callback_receiver, %function +FUNBEGIN(callback_receiver) + // args = 28, pretend = 0, frame = 176 + // frame_needed = 1, uses_anonymous_args = 0 + push {fp, lr} + add fp, sp, $4 + sub sp, sp, $176 + ldr r2, [fp, $4] + mov r3, $0 + add lr, fp, $28 + add ip, fp, $44 + vstr.32 s0, [fp, $-136] + vstr.32 s1, [fp, $-132] + vstr.32 s2, [fp, $-128] + vstr.32 s3, [fp, $-124] + vstr.32 s4, [fp, $-120] + vstr.32 s5, [fp, $-116] + vstr.32 s6, [fp, $-112] + vstr.32 s7, [fp, $-108] + vstr.32 s8, [fp, $-104] + vstr.32 s9, [fp, $-100] + vstr.32 s10, [fp, $-96] + vstr.32 s11, [fp, $-92] + vstr.32 s12, [fp, $-88] + vstr.32 s13, [fp, $-84] + vstr.32 s14, [fp, $-80] + vstr.32 s15, [fp, $-76] + vstr.64 d0, [fp, $-68] + vstr.64 d1, [fp, $-60] + vstr.64 d2, [fp, $-52] + vstr.64 d3, [fp, $-44] + vstr.64 d4, [fp, $-36] + vstr.64 d5, [fp, $-28] + vstr.64 d6, [fp, $-20] + vstr.64 d7, [fp, $-12] + str r3, [fp, $-180] + str r3, [fp, $-144] + str r3, [fp, $-140] + str r3, [fp, $-160] + strb r3, [fp, $-156] + sub r1, fp, $180 + str lr, [fp, $-148] + ldr r3, [r2] + str ip, [fp, $-164] + ldr r0, [r2, $4] + blx r3 + ldrb r3, [fp, $-156] // zero_extendqisi2 + cmp r3, $0 + beq L(1) + cmp r3, $1 + beq L(25) + cmp r3, $2 + ldrsbeq r0, [fp, $-172] + beq L(1) + cmp r3, $3 + beq L(25) + cmp r3, $4 + ldrsheq r0, [fp, $-172] + beq L(1) + cmp r3, $5 + ldrheq r0, [fp, $-172] + beq L(1) + cmp r3, $6 + beq L(27) + cmp r3, $7 + beq L(27) + cmp r3, $8 + beq L(27) + cmp r3, $9 + beq L(27) + sub r2, r3, $10 + cmp r2, $1 + bls L(29) + cmp r3, $12 + vldreq.32 s0, [fp, $-172] + beq L(1) + cmp r3, $13 + beq L(30) + cmp r3, $14 + beq L(27) + cmp r3, $15 + bne L(1) + ldr r3, [fp, $-180] + tst r3, $1024 + beq L(1) + ldr r3, [fp, $-152] + cmp r3, $1 + beq L(31) + cmp r3, $2 + ldr r3, [fp, $-160] + ldrheq r0, [r3] + ldrne r0, [r3] +L(1): + sub sp, fp, $4 + // sp needed + pop {fp, pc} +L(25): + ldrb r0, [fp, $-172] // zero_extendqisi2 + sub sp, fp, $4 + // sp needed + pop {fp, pc} +L(27): + ldr r0, [fp, $-172] + sub sp, fp, $4 + // sp needed + pop {fp, pc} +L(30): + vldr.64 d0, [fp, $-172] + b L(1) +L(29): + ldr r0, [fp, $-172] + ldr r1, [fp, $-168] + b L(1) +L(31): + ldr r3, [fp, $-160] + ldrb r0, [r3] // zero_extendqisi2 + b L(1) + FUNEND(callback_receiver) + .align 2 + .global C(callback_get_receiver) + .syntax unified + .arm + .fpu vfpv3-d16 + .type callback_get_receiver, %function +FUNBEGIN(callback_get_receiver) + // args = 0, pretend = 0, frame = 0 + // frame_needed = 1, uses_anonymous_args = 0 + // link register save eliminated. + ldr r3, L(34) + ldr r2, L(34)+4 +L(PIC0): + add r3, pc, r3 + str fp, [sp, $-4]! + add fp, sp, $0 + ldr r3, [r3, r2] + mov r0, r3 + add sp, fp, $0 + // sp needed + ldr fp, [sp], $4 + bx lr +L(35): + .align 2 +L(34): + .word _GLOBAL_OFFSET_TABLE_-(L(PIC0)+8) + .word callback_receiver(GOT) + FUNEND(callback_get_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/callback/vacall_r/vacall-hppa-linux.s b/callback/vacall_r/vacall-hppa-linux.s new file mode 100644 index 0000000..bc5c935 --- /dev/null +++ b/callback/vacall_r/vacall-hppa-linux.s @@ -0,0 +1,218 @@ + .LEVEL 1.1 + .text + .align 4 + .type callback_receiver,@function +callback_receiver: + .PROC + .CALLINFO FRAME=192,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=5 + .ENTRY + copy %r3,%r1 + stw %r2,-20(%r30) + copy %r30,%r3 + stwm %r1,192(%r30) + ldo -32(%r3),%r2 + ldo 16(%r3),%r21 + ldo 88(%r3),%r20 + stw %r5,96(%r3) + sub %r21,%r2,%r31 + copy %r19,%r5 + stw %r4,100(%r3) + ldo 80(%r31),%r4 + ldo 64(%r31),%r31 + stw %r19,-32(%r30) + stw %r25,-40(%r3) + copy %r21,%r25 + ldo 80(%r3),%r21 + fstds %fr5,0(%r20) + ldo 76(%r3),%r20 + fstws %fr4L,0(%r20) + ldo 68(%r3),%r20 + stw %r0,36(%r3) + stw %r28,48(%r3) + fstds %fr7,0(%r21) + ldo 72(%r3),%r21 + fstws %fr5L,0(%r21) + ldo 64(%r3),%r21 + fstws %fr6L,0(%r20) + ldo -48(%r3),%r20 + stw %r26,-36(%r3) + fstws %fr7L,0(%r21) + ldw 0(%r29),%r22 + stw %r20,52(%r3) + stw %r31,56(%r3) + stw %r4,60(%r3) + stw %r24,-44(%r3) + stw %r23,-48(%r3) + stw %r0,16(%r3) + stw %r2,32(%r3) + stw %r0,40(%r3) + ldw 4(%r29),%r26 + .CALL ARGW0=GR + bl $$dyncall,%r31 + copy %r31,%r2 + ldw 40(%r3),%r21 + comib,= 0,%r21,.L1 + copy %r5,%r19 + comib,= 1,%r21,.L48 + ldb 24(%r3),%r20 + comib,=,n 2,%r21,.L48 + comib,=,n 3,%r21,.L43 + comib,=,n 4,%r21,.L44 + comib,=,n 5,%r21,.L45 + comib,=,n 6,%r21,.L41 + comib,=,n 7,%r21,.L41 + comib,=,n 8,%r21,.L41 + comib,= 9,%r21,.L41 + ldo -10(%r21),%r20 + comib,<<,n 1,%r20,.L22 + ldw 24(%r3),%r28 +.L40: + ldw 28(%r3),%r29 +.L1: + ldw -20(%r3),%r2 +.L49: +.L50: + ldw 96(%r3),%r5 + ldw 100(%r3),%r4 + ldo 64(%r3),%r30 + bv %r0(%r2) + ldwm -64(%r30),%r3 +.L22: + comib,= 12,%r21,.L46 + ldo 24(%r3),%r20 + comib,=,n 13,%r21,.L47 + comib,=,n 14,%r21,.L1 + ldw 24(%r3),%r28 + comib,<> 15,%r21,.L49 + ldw -20(%r3),%r2 + ldw 16(%r3),%r20 + bb,>= %r20,30,.L49 + ldw 44(%r3),%r4 + ldo -1(%r4),%r20 + comib,<< 7,%r20,.L50 + ldw 36(%r3),%r20 + extru %r20,31,2,%r31 + copy %r20,%r2 + depi 0,31,2,%r2 + comib,<< 4,%r4,.L33 + addl %r31,%r4,%r5 + zdep %r31,28,29,%r31 + mtsar %r31 + zvdepi 2,32,%r20 + comib,<< 4,%r5,.L34 + ldo -1(%r20),%r31 + ldw 0(%r2),%r20 + zdep %r5,28,29,%r21 + ldo -1(%r21),%r21 + and %r20,%r31,%r20 + mtsar %r21 + vextrs %r20,32,%r20 + movb,tr %r20,%r28,.L49 + ldw -20(%r3),%r2 +.L34: + ldw 0(%r2),%r20 + zdep %r5,28,29,%r22 + ldw 4(%r2),%r21 + and %r20,%r31,%r20 + ldo -33(%r22),%r2 + subi 63,%r22,%r22 + mtsar %r22 + zvdep %r20,32,%r20 + mtsar %r2 + vextrs %r21,32,%r21 +.L39: + b .L1 + or %r21,%r20,%r28 +.L33: + zdep %r31,28,29,%r31 + mtsar %r31 + zvdepi 2,32,%r20 + comib,<< 8,%r5,.L37 + ldo -1(%r20),%r4 + ldw 0(%r2),%r22 + zdep %r5,29,30,%r20 + and %r22,%r4,%r22 + ldw 4(%r2),%r31 + subi 47,%r20,%r4 + zdep %r5,28,29,%r20 + mtsar %r4 + ldo -33(%r20),%r20 + zvdep %r22,32,%r21 + zvdep %r21,32,%r21 + mtsar %r20 + vextrs %r31,32,%r31 + vextrs %r22,32,%r22 + movb,tr %r22,%r28,.L1 + or %r21,%r31,%r29 +.L37: + ldw 0(%r2),%r21 + zdep %r5,28,29,%r31 + ldw 8(%r2),%r22 + and %r21,%r4,%r21 + ldo -65(%r31),%r4 + ldw 4(%r2),%r20 + mtsar %r4 + subi 95,%r31,%r2 + vextrs %r22,32,%r22 + mtsar %r2 + zvdep %r20,32,%r31 + zvdep %r21,32,%r21 + or %r31,%r22,%r29 + mtsar %r4 + b .L39 + vextrs %r20,32,%r20 +.L41: + b .L1 + ldw 24(%r3),%r28 +.L47: + ldw 24(%r3),%r28 + b .L40 + fldds 0(%r20),%fr4 +.L46: + ldw 24(%r3),%r28 + b .L1 + fldws 0(%r20),%fr4L +.L45: + b .L1 + ldh 24(%r3),%r28 +.L44: + ldh 24(%r3),%r20 + b .L1 + extrs %r20,31,16,%r28 +.L43: + b .L1 + ldb 24(%r3),%r28 +.L48: + b .L1 + extrs %r20,31,8,%r28 + .EXIT + .PROCEND +.Lfe1: + .size callback_receiver,.Lfe1-callback_receiver + .data + .align 4 +.LC0: + .word P%callback_receiver + .text + .align 4 +.globl callback_get_receiver + .type callback_get_receiver,@function +callback_get_receiver: + .PROC + .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + copy %r3,%r1 + copy %r30,%r3 + stwm %r1,64(%r30) + addil LT'.LC0,%r19 + stw %r19,-32(%r30) + ldw RT'.LC0(%r1),%r1 + ldw 0(%r1),%r28 + ldo 64(%r3),%r30 + bv %r0(%r2) + ldwm -64(%r30),%r3 + .EXIT + .PROCEND +.Lfe2: + .size callback_get_receiver,.Lfe2-callback_get_receiver + .ident "GCC: (GNU) 3.1" diff --git a/callback/vacall_r/vacall-hppa-macro.S b/callback/vacall_r/vacall-hppa-macro.S new file mode 100644 index 0000000..d5613be --- /dev/null +++ b/callback/vacall_r/vacall-hppa-macro.S @@ -0,0 +1,224 @@ +#include "asm-hppa.h" + .LEVEL 1.1 + IMPORT_MILLICODE($$dyncall) + TEXT1() + TEXT2() + .align 4 + DECLARE_FUNCTION(callback_receiver) +DEF(callback_receiver) + .PROC + .CALLINFO FRAME=192,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=5 + .ENTRY + copy %r3,%r1 + stw %r2,-20(%r30) + copy %r30,%r3 + stwm %r1,192(%r30) + ldo -32(%r3),%r2 + ldo 16(%r3),%r21 + ldo 88(%r3),%r20 + stw %r5,96(%r3) + sub %r21,%r2,%r31 + copy %r19,%r5 + stw %r4,100(%r3) + ldo 80(%r31),%r4 + ldo 64(%r31),%r31 + stw %r19,-32(%r30) + stw %r25,-40(%r3) + copy %r21,%r25 + ldo 80(%r3),%r21 + fstds %fr5,0(%r20) + ldo 76(%r3),%r20 + fstws %fr4L,0(%r20) + ldo 68(%r3),%r20 + stw %r0,36(%r3) + stw %r28,48(%r3) + fstds %fr7,0(%r21) + ldo 72(%r3),%r21 + fstws %fr5L,0(%r21) + ldo 64(%r3),%r21 + fstws %fr6L,0(%r20) + ldo -48(%r3),%r20 + stw %r26,-36(%r3) + fstws %fr7L,0(%r21) + ldw 0(%r29),%r22 + stw %r20,52(%r3) + stw %r31,56(%r3) + stw %r4,60(%r3) + stw %r24,-44(%r3) + stw %r23,-48(%r3) + stw %r0,16(%r3) + stw %r2,32(%r3) + stw %r0,40(%r3) + ldw 4(%r29),%r26 + .CALL ARGW0=GR + bl $$dyncall,%r31 + copy %r31,%r2 + ldw 40(%r3),%r21 + comib,= 0,%r21,L(1) + copy %r5,%r19 + comib,= 1,%r21,L(48) + ldb 24(%r3),%r20 + comib,=,n 2,%r21,L(48) + comib,=,n 3,%r21,L(43) + comib,=,n 4,%r21,L(44) + comib,=,n 5,%r21,L(45) + comib,=,n 6,%r21,L(41) + comib,=,n 7,%r21,L(41) + comib,=,n 8,%r21,L(41) + comib,= 9,%r21,L(41) + ldo -10(%r21),%r20 + comib,<<,n 1,%r20,L(22) + ldw 24(%r3),%r28 +DEF(L(40)) + ldw 28(%r3),%r29 +DEF(L(1)) + ldw -20(%r3),%r2 +DEF(L(49)) +DEF(L(50)) + ldw 96(%r3),%r5 + ldw 100(%r3),%r4 + ldo 64(%r3),%r30 + bv %r0(%r2) + ldwm -64(%r30),%r3 +DEF(L(22)) + comib,= 12,%r21,L(46) + ldo 24(%r3),%r20 + comib,=,n 13,%r21,L(47) + comib,=,n 14,%r21,L(1) + ldw 24(%r3),%r28 + comib,<> 15,%r21,L(49) + ldw -20(%r3),%r2 + ldw 16(%r3),%r20 + bb,>= %r20,30,L(49) + ldw 44(%r3),%r4 + ldo -1(%r4),%r20 + comib,<< 7,%r20,L(50) + ldw 36(%r3),%r20 + extru %r20,31,2,%r31 + copy %r20,%r2 + depi 0,31,2,%r2 + comib,<< 4,%r4,L(33) + addl %r31,%r4,%r5 + zdep %r31,28,29,%r31 + mtsar %r31 + zvdepi 2,32,%r20 + comib,<< 4,%r5,L(34) + ldo -1(%r20),%r31 + ldw 0(%r2),%r20 + zdep %r5,28,29,%r21 + ldo -1(%r21),%r21 + and %r20,%r31,%r20 + mtsar %r21 + vextrs %r20,32,%r20 + movb,tr %r20,%r28,L(49) + ldw -20(%r3),%r2 +DEF(L(34)) + ldw 0(%r2),%r20 + zdep %r5,28,29,%r22 + ldw 4(%r2),%r21 + and %r20,%r31,%r20 + ldo -33(%r22),%r2 + subi 63,%r22,%r22 + mtsar %r22 + zvdep %r20,32,%r20 + mtsar %r2 + vextrs %r21,32,%r21 +DEF(L(39)) + b L(1) + or %r21,%r20,%r28 +DEF(L(33)) + zdep %r31,28,29,%r31 + mtsar %r31 + zvdepi 2,32,%r20 + comib,<< 8,%r5,L(37) + ldo -1(%r20),%r4 + ldw 0(%r2),%r22 + zdep %r5,29,30,%r20 + and %r22,%r4,%r22 + ldw 4(%r2),%r31 + subi 47,%r20,%r4 + zdep %r5,28,29,%r20 + mtsar %r4 + ldo -33(%r20),%r20 + zvdep %r22,32,%r21 + zvdep %r21,32,%r21 + mtsar %r20 + vextrs %r31,32,%r31 + vextrs %r22,32,%r22 + movb,tr %r22,%r28,L(1) + or %r21,%r31,%r29 +DEF(L(37)) + ldw 0(%r2),%r21 + zdep %r5,28,29,%r31 + ldw 8(%r2),%r22 + and %r21,%r4,%r21 + ldo -65(%r31),%r4 + ldw 4(%r2),%r20 + mtsar %r4 + subi 95,%r31,%r2 + vextrs %r22,32,%r22 + mtsar %r2 + zvdep %r20,32,%r31 + zvdep %r21,32,%r21 + or %r31,%r22,%r29 + mtsar %r4 + b L(39) + vextrs %r20,32,%r20 +DEF(L(41)) + b L(1) + ldw 24(%r3),%r28 +DEF(L(47)) + ldw 24(%r3),%r28 + b L(40) + fldds 0(%r20),%fr4 +DEF(L(46)) + ldw 24(%r3),%r28 + b L(1) + fldws 0(%r20),%fr4L +DEF(L(45)) + b L(1) + ldh 24(%r3),%r28 +DEF(L(44)) + ldh 24(%r3),%r20 + b L(1) + extrs %r20,31,16,%r28 +DEF(L(43)) + b L(1) + ldb 24(%r3),%r28 +DEF(L(48)) + b L(1) + extrs %r20,31,8,%r28 + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(callback_receiver) + .data + .align 4 +DEF(L(C0)) + .word P%callback_receiver + TEXT1() + TEXT2() + .align 4 +GLOBL(callback_get_receiver) + DECLARE_FUNCTION(callback_get_receiver) +DEF(callback_get_receiver) + .PROC + .CALLINFO FRAME=64,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + copy %r3,%r1 + copy %r30,%r3 + stwm %r1,64(%r30) + addil LT!L(C0),%r19 + stw %r19,-32(%r30) + ldw RT!L(C0)(%r1),%r1 + ldw 0(%r1),%r28 + ldo 64(%r3),%r30 + bv %r0(%r2) + ldwm -64(%r30),%r3 + .EXIT + .PROCEND +DEF(L(fe2)) + FUNEND(callback_get_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-hppa64-linux.s b/callback/vacall_r/vacall-hppa64-linux.s new file mode 100644 index 0000000..6426765 --- /dev/null +++ b/callback/vacall_r/vacall-hppa64-linux.s @@ -0,0 +1,251 @@ + .LEVEL 2.0w + .text + .align 8 +.globl callback_receiver + .type callback_receiver,@function +callback_receiver: + .PROC + .CALLINFO FRAME=384,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=9 + .ENTRY + copy %r3,%r1 + std %r2,-16(%r30) + copy %r30,%r3 + std,ma %r1,384(%r30) + std %r5,224(%r3) + copy %r27,%r5 + std %r9,192(%r3) + std %r8,200(%r3) + std %r7,208(%r3) + std %r6,216(%r3) + std %r4,232(%r3) + std %r26,-64(%r29) + std %r25,-56(%r29) + std %r19,-8(%r29) + std %r24,-48(%r29) + std %r23,-40(%r29) + std %r22,-32(%r29) + std %r21,-24(%r29) + std %r20,-16(%r29) +#APP + fstw %fr4R,88(%r3) + fstw %fr5R,92(%r3) + fstw %fr6R,96(%r3) + fstw %fr7R,100(%r3) + fstw %fr8R,104(%r3) + fstw %fr9R,108(%r3) + fstw %fr10R,112(%r3) + fstw %fr11R,116(%r3) +#NO_APP + fstd %fr10,168(%r3) + ldo -64(%r29),%r2 + ldo 16(%r3),%r25 + std %r0,48(%r3) + std %r2,40(%r3) + std %r29,80(%r3) + ldo -16(%r30),%r29 + fstd %fr11,176(%r3) + fstd %fr4,120(%r3) + fstd %fr5,128(%r3) + fstd %fr6,136(%r3) + fstd %fr7,144(%r3) + fstd %fr8,152(%r3) + fstd %fr9,160(%r3) + stw %r0,16(%r3) + stw %r0,56(%r3) + ldd 0(%r31),%r4 + ldd 8(%r31),%r26 + ldd 16(%r4),%r2 + ldd 24(%r4),%r27 + bve,l (%r2),%r2 + nop + ldw 56(%r3),%r2 + cmpib,= 0,%r2,.L1 + copy %r5,%r27 + cmpib,=,n 1,%r2,.L43 + cmpib,=,n 2,%r2,.L43 + cmpib,=,n 3,%r2,.L44 + cmpib,=,n 4,%r2,.L45 + cmpib,=,n 5,%r2,.L46 + cmpib,=,n 6,%r2,.L47 + cmpib,=,n 7,%r2,.L41 + cmpib,=,n 8,%r2,.L40 + cmpib,=,n 10,%r2,.L40 + cmpib,=,n 9,%r2,.L40 + cmpib,=,n 11,%r2,.L40 + cmpib,=,n 12,%r2,.L48 + cmpib,=,n 13,%r2,.L49 + cmpib,=,n 14,%r2,.L40 + cmpib,= 15,%r2,.L50 + ldw 16(%r3),%r2 +.L1: + ldd -16(%r3),%r2 + ldd 192(%r3),%r9 + ldd 200(%r3),%r8 + ldd 208(%r3),%r7 + ldd 216(%r3),%r6 + ldd 224(%r3),%r5 + ldd 232(%r3),%r4 + ldo 64(%r3),%r30 + bve (%r2) + ldd,mb -64(%r30),%r3 +.L50: + extrd,u %r2,53+1-1,1,%r2 + cmpib,= 0,%r2,.L1 + ldd 48(%r3),%r28 + ldd 48(%r3),%r2 + ldd 64(%r3),%r4 + extrd,u %r2,63,3,%r7 + copy %r2,%r1 + depdi 0,63,3,%r1 + cmpib,*<< 8,%r4,.L32 + add,l %r7,%r4,%r5 + cmpib,*<< 8,%r5,.L33 + depd,z %r5,60,61,%r2 + subi 64,%r2,%r2 + ldd 0(%r1),%r4 + extrd,s %r2,63,32,%r2 + mtsarcm %r2 + depd,z %r7,60,61,%r5 + depdi,z 1,%sar,64,%r2 + mtsarcm %r5 + sub %r0,%r2,%r2 + and %r4,%r2,%r4 + depd,z %r4,%sar,64,%r4 + b .L1 + copy %r4,%r28 +.L33: + subi 128,%r2,%r2 + depd,z %r7,60,61,%r4 + extrd,s %r2,63,32,%r2 + subi 64,%r4,%r6 + mtsarcm %r2 + subi 63,%r4,%r8 + depdi,z 1,%sar,64,%r2 + mtsar %r8 + ldd 8(%r1),%r5 + sub %r0,%r2,%r2 + extrd,s %r6,63,32,%r6 + ldd 0(%r1),%r4 + subi 63,%r6,%r6 + and %r5,%r2,%r5 + depd,z %r4,%sar,64,%r4 + mtsar %r6 + extrd,s %r5,%sar,64,%r5 +.L39: + b .L1 + or %r5,%r4,%r28 +.L32: + ldi 16,%r2 + cmpb,*<< %r2,%r5,.L36 + depd,z %r5,60,61,%r2 + subi 128,%r2,%r2 + depd,z %r7,61,62,%r4 + extrd,s %r2,63,32,%r2 + subi 32,%r4,%r4 + mtsarcm %r2 + extrd,s %r4,63,32,%r4 + depdi,z 1,%sar,64,%r2 + subi 63,%r4,%r8 + ldd 8(%r1),%r5 + sub %r0,%r2,%r2 + mtsar %r8 + ldd 0(%r1),%r6 + and %r5,%r2,%r5 + depd,z %r7,60,61,%r2 + extrd,s %r5,%sar,64,%r4 + subi 63,%r2,%r2 + extrd,s %r4,%sar,64,%r4 + mtsar %r2 + depd,z %r5,%sar,64,%r5 + depd,z %r6,%sar,64,%r6 + copy %r5,%r29 + b .L1 + or %r6,%r4,%r28 +.L36: + subi 192,%r2,%r2 + depd,z %r7,60,61,%r4 + extrd,s %r2,63,32,%r2 + subi 64,%r4,%r7 + mtsarcm %r2 + subi 63,%r4,%r9 + depdi,z 1,%sar,64,%r2 + mtsar %r9 + ldd 8(%r1),%r4 + sub %r0,%r2,%r2 + ldd 16(%r1),%r6 + extrd,s %r7,63,32,%r7 + subi 63,%r7,%r7 + and %r6,%r2,%r6 + ldd 0(%r1),%r5 + depd,z %r4,%sar,64,%r2 + mtsar %r7 + extrd,s %r6,%sar,64,%r6 + mtsar %r9 + depd,z %r5,%sar,64,%r5 + or %r2,%r6,%r29 + mtsar %r7 + b .L39 + extrd,s %r4,%sar,64,%r4 +.L40: + b .L1 + ldd 24(%r3),%r28 +.L49: + b .L40 + fldd 24(%r3),%fr4 +.L48: +#APP + fldw 24(%r3),%fr4R +#NO_APP +.L41: + ldw 24(%r3),%r2 +.L42: + b .L1 + copy %r2,%r28 +.L47: + ldw 24(%r3),%r2 + b .L1 + extrd,s %r2,63,32,%r28 +.L46: + b .L42 + ldh 24(%r3),%r2 +.L45: + ldh 24(%r3),%r2 + b .L1 + extrd,s %r2,63,16,%r28 +.L44: + b .L42 + ldb 24(%r3),%r2 +.L43: + ldb 24(%r3),%r2 + b .L1 + extrd,s %r2,63,8,%r28 + .EXIT + .PROCEND +.Lfe1: + .size callback_receiver,.Lfe1-callback_receiver + .data + .align 8 +.LC0: + .dword P%callback_receiver + .text + .align 8 +.globl callback_get_receiver + .type callback_get_receiver,@function +callback_get_receiver: + .PROC + .CALLINFO FRAME=128,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + copy %r3,%r1 + copy %r30,%r3 + std,ma %r1,128(%r30) + addil LT'.LC0,%r27 + ldd RT'.LC0(%r1),%r1 + ldd 0(%r1),%r28 + ldo 64(%r3),%r30 + bve (%r2) + ldd,mb -64(%r30),%r3 + .EXIT + .PROCEND +.Lfe2: + .size callback_get_receiver,.Lfe2-callback_get_receiver + .ident "GCC: (GNU) 3.1" diff --git a/callback/vacall_r/vacall-hppa64-macro.S b/callback/vacall_r/vacall-hppa64-macro.S new file mode 100644 index 0000000..628dccf --- /dev/null +++ b/callback/vacall_r/vacall-hppa64-macro.S @@ -0,0 +1,252 @@ +#include "asm-hppa64.h" + .LEVEL 2.0w + TEXT1() + TEXT2() + .align 8 +GLOBL(callback_receiver) + DECLARE_FUNCTION(callback_receiver) +DEF(callback_receiver) + .PROC + .CALLINFO FRAME=384,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=9 + .ENTRY + copy %r3,%r1 + std %r2,-16(%r30) + copy %r30,%r3 + std,ma %r1,384(%r30) + std %r5,224(%r3) + copy %r27,%r5 + std %r9,192(%r3) + std %r8,200(%r3) + std %r7,208(%r3) + std %r6,216(%r3) + std %r4,232(%r3) + std %r26,-64(%r29) + std %r25,-56(%r29) + std %r19,-8(%r29) + std %r24,-48(%r29) + std %r23,-40(%r29) + std %r22,-32(%r29) + std %r21,-24(%r29) + std %r20,-16(%r29) + fstw %fr4R,88(%r3) + fstw %fr5R,92(%r3) + fstw %fr6R,96(%r3) + fstw %fr7R,100(%r3) + fstw %fr8R,104(%r3) + fstw %fr9R,108(%r3) + fstw %fr10R,112(%r3) + fstw %fr11R,116(%r3) + fstd %fr10,168(%r3) + ldo -64(%r29),%r2 + ldo 16(%r3),%r25 + std %r0,48(%r3) + std %r2,40(%r3) + std %r29,80(%r3) + ldo -16(%r30),%r29 + fstd %fr11,176(%r3) + fstd %fr4,120(%r3) + fstd %fr5,128(%r3) + fstd %fr6,136(%r3) + fstd %fr7,144(%r3) + fstd %fr8,152(%r3) + fstd %fr9,160(%r3) + stw %r0,16(%r3) + stw %r0,56(%r3) + ldd 0(%r31),%r4 + ldd 8(%r31),%r26 + ldd 16(%r4),%r2 + ldd 24(%r4),%r27 + bve,l (%r2),%r2 + nop + ldw 56(%r3),%r2 + cmpib,= 0,%r2,L(1) + copy %r5,%r27 + cmpib,=,n 1,%r2,L(43) + cmpib,=,n 2,%r2,L(43) + cmpib,=,n 3,%r2,L(44) + cmpib,=,n 4,%r2,L(45) + cmpib,=,n 5,%r2,L(46) + cmpib,=,n 6,%r2,L(47) + cmpib,=,n 7,%r2,L(41) + cmpib,=,n 8,%r2,L(40) + cmpib,=,n 10,%r2,L(40) + cmpib,=,n 9,%r2,L(40) + cmpib,=,n 11,%r2,L(40) + cmpib,=,n 12,%r2,L(48) + cmpib,=,n 13,%r2,L(49) + cmpib,=,n 14,%r2,L(40) + cmpib,= 15,%r2,L(50) + ldw 16(%r3),%r2 +DEF(L(1)) + ldd -16(%r3),%r2 + ldd 192(%r3),%r9 + ldd 200(%r3),%r8 + ldd 208(%r3),%r7 + ldd 216(%r3),%r6 + ldd 224(%r3),%r5 + ldd 232(%r3),%r4 + ldo 64(%r3),%r30 + bve (%r2) + ldd,mb -64(%r30),%r3 +DEF(L(50)) + extrd,u %r2,53+1-1,1,%r2 + cmpib,= 0,%r2,L(1) + ldd 48(%r3),%r28 + ldd 48(%r3),%r2 + ldd 64(%r3),%r4 + extrd,u %r2,63,3,%r7 + copy %r2,%r1 + depdi 0,63,3,%r1 + cmpib,*<< 8,%r4,L(32) + add,l %r7,%r4,%r5 + cmpib,*<< 8,%r5,L(33) + depd,z %r5,60,61,%r2 + subi 64,%r2,%r2 + ldd 0(%r1),%r4 + extrd,s %r2,63,32,%r2 + mtsarcm %r2 + depd,z %r7,60,61,%r5 + depdi,z 1,%sar,64,%r2 + mtsarcm %r5 + sub %r0,%r2,%r2 + and %r4,%r2,%r4 + depd,z %r4,%sar,64,%r4 + b L(1) + copy %r4,%r28 +DEF(L(33)) + subi 128,%r2,%r2 + depd,z %r7,60,61,%r4 + extrd,s %r2,63,32,%r2 + subi 64,%r4,%r6 + mtsarcm %r2 + subi 63,%r4,%r8 + depdi,z 1,%sar,64,%r2 + mtsar %r8 + ldd 8(%r1),%r5 + sub %r0,%r2,%r2 + extrd,s %r6,63,32,%r6 + ldd 0(%r1),%r4 + subi 63,%r6,%r6 + and %r5,%r2,%r5 + depd,z %r4,%sar,64,%r4 + mtsar %r6 + extrd,s %r5,%sar,64,%r5 +DEF(L(39)) + b L(1) + or %r5,%r4,%r28 +DEF(L(32)) + ldi 16,%r2 + cmpb,*<< %r2,%r5,L(36) + depd,z %r5,60,61,%r2 + subi 128,%r2,%r2 + depd,z %r7,61,62,%r4 + extrd,s %r2,63,32,%r2 + subi 32,%r4,%r4 + mtsarcm %r2 + extrd,s %r4,63,32,%r4 + depdi,z 1,%sar,64,%r2 + subi 63,%r4,%r8 + ldd 8(%r1),%r5 + sub %r0,%r2,%r2 + mtsar %r8 + ldd 0(%r1),%r6 + and %r5,%r2,%r5 + depd,z %r7,60,61,%r2 + extrd,s %r5,%sar,64,%r4 + subi 63,%r2,%r2 + extrd,s %r4,%sar,64,%r4 + mtsar %r2 + depd,z %r5,%sar,64,%r5 + depd,z %r6,%sar,64,%r6 + copy %r5,%r29 + b L(1) + or %r6,%r4,%r28 +DEF(L(36)) + subi 192,%r2,%r2 + depd,z %r7,60,61,%r4 + extrd,s %r2,63,32,%r2 + subi 64,%r4,%r7 + mtsarcm %r2 + subi 63,%r4,%r9 + depdi,z 1,%sar,64,%r2 + mtsar %r9 + ldd 8(%r1),%r4 + sub %r0,%r2,%r2 + ldd 16(%r1),%r6 + extrd,s %r7,63,32,%r7 + subi 63,%r7,%r7 + and %r6,%r2,%r6 + ldd 0(%r1),%r5 + depd,z %r4,%sar,64,%r2 + mtsar %r7 + extrd,s %r6,%sar,64,%r6 + mtsar %r9 + depd,z %r5,%sar,64,%r5 + or %r2,%r6,%r29 + mtsar %r7 + b L(39) + extrd,s %r4,%sar,64,%r4 +DEF(L(40)) + b L(1) + ldd 24(%r3),%r28 +DEF(L(49)) + b L(40) + fldd 24(%r3),%fr4 +DEF(L(48)) + fldw 24(%r3),%fr4R +DEF(L(41)) + ldw 24(%r3),%r2 +DEF(L(42)) + b L(1) + copy %r2,%r28 +DEF(L(47)) + ldw 24(%r3),%r2 + b L(1) + extrd,s %r2,63,32,%r28 +DEF(L(46)) + b L(42) + ldh 24(%r3),%r2 +DEF(L(45)) + ldh 24(%r3),%r2 + b L(1) + extrd,s %r2,63,16,%r28 +DEF(L(44)) + b L(42) + ldb 24(%r3),%r2 +DEF(L(43)) + ldb 24(%r3),%r2 + b L(1) + extrd,s %r2,63,8,%r28 + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(callback_receiver) + .data + .align 8 +DEF(L(C0)) + .dword P%callback_receiver + TEXT1() + TEXT2() + .align 8 +GLOBL(callback_get_receiver) + DECLARE_FUNCTION(callback_get_receiver) +DEF(callback_get_receiver) + .PROC + .CALLINFO FRAME=128,NO_CALLS,SAVE_SP,ENTRY_GR=3 + .ENTRY + copy %r3,%r1 + copy %r30,%r3 + std,ma %r1,128(%r30) + addil LT!L(C0),%r27 + ldd RT!L(C0)(%r1),%r1 + ldd 0(%r1),%r28 + ldo 64(%r3),%r30 + bve (%r2) + ldd,mb -64(%r30),%r3 + .EXIT + .PROCEND +DEF(L(fe2)) + FUNEND(callback_get_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-i386-linux.s b/callback/vacall_r/vacall-i386-linux.s new file mode 100644 index 0000000..42dac11 --- /dev/null +++ b/callback/vacall_r/vacall-i386-linux.s @@ -0,0 +1,172 @@ + .file "vacall-i386.c" + .text + .align 2 + .p2align 2,,3 + .type callback_receiver,@function +callback_receiver: + pushl %ebp + movl %esp, %ebp + pushl %edi + pushl %esi + leal 8(%ebp), %edx + subl $56, %esp + movl %edx, -40(%ebp) + leal -56(%ebp), %edx + movl $0, -56(%ebp) + movl $0, -36(%ebp) + movl $0, -32(%ebp) + movl %ebx, -24(%ebp) + pushl %edx + pushl 4(%ecx) + call *(%ecx) + movl -32(%ebp), %esi + addl $16, %esp + testl %esi, %esi + je .L43 + cmpl $1, %esi + je .L44 + cmpl $2, %esi + je .L44 + cmpl $3, %esi + je .L49 + cmpl $4, %esi + je .L50 + cmpl $5, %esi + je .L51 + cmpl $6, %esi + je .L48 + cmpl $7, %esi + je .L48 + cmpl $8, %esi + je .L48 + cmpl $9, %esi + je .L48 + leal -10(%esi), %edx + cmpl $1, %edx + ja .L22 + movl -48(%ebp), %eax +#APP + movl -44(%ebp),%edx +.L33: + .p2align 2,,3 +#NO_APP +.L43: + movl -56(%ebp), %esi +.L3: + andl $512, %esi + je .L1 +#APP + movl 0(%ebp),%ecx +#NO_APP + movl -40(%ebp), %esp +#APP + jmp *%ecx +#NO_APP +.L1: + leal -8(%ebp), %esp + popl %esi + popl %edi + leave + ret +.L22: + cmpl $12, %esi + je .L52 + cmpl $13, %esi + je .L53 + cmpl $14, %esi + je .L48 + cmpl $15, %esi + jne .L43 + movl -56(%ebp), %esi + testl $1024, %esi + movl %esi, %edi + je .L31 + movl -28(%ebp), %edx + cmpl $1, %edx + je .L54 + cmpl $2, %edx + je .L55 + cmpl $4, %edx + je .L56 + cmpl $8, %edx + je .L57 +.L31: + andl $16, %edi + movl -36(%ebp), %eax + jne .L3 +#APP + leal -8(%ebp), %esp + popl %esi + popl %edi + leave + ret $4 +#NO_APP + jmp .L3 +.L57: + movl -36(%ebp), %edx + movl (%edx), %eax +#APP + movl 4(%edx),%edx +#NO_APP + jmp .L3 +.L56: + movl -36(%ebp), %edx + movl (%edx), %eax + jmp .L3 +.L55: + movl -36(%ebp), %edx + movzwl (%edx), %eax + jmp .L3 +.L54: + movl -36(%ebp), %edx + movzbl (%edx), %eax + jmp .L3 + .p2align 2,,3 +.L48: + movl -48(%ebp), %eax + jmp .L43 +.L53: +#APP + fldl -48(%ebp) +#NO_APP + jmp .L43 +.L52: +#APP + flds -48(%ebp) +#NO_APP + jmp .L43 + .p2align 2,,3 +.L51: + movzwl -48(%ebp), %eax + jmp .L43 +.L50: + movswl -48(%ebp),%eax + jmp .L43 +.L49: + movzbl -48(%ebp), %eax + jmp .L43 + .p2align 2,,3 +.L44: + movsbl -48(%ebp),%eax + jmp .L43 +.Lfe1: + .size callback_receiver,.Lfe1-callback_receiver + .align 2 + .p2align 2,,3 +.globl callback_get_receiver + .type callback_get_receiver,@function +callback_get_receiver: + pushl %ebp + movl %esp, %ebp + pushl %ebx + call .L59 +.L59: + popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-.L59], %ebx + leal callback_receiver@GOTOFF(%ebx), %eax + movl (%esp), %ebx + leave + ret +.Lfe2: + .size callback_get_receiver,.Lfe2-callback_get_receiver + .ident "GCC: (GNU) 3.1" diff --git a/callback/vacall_r/vacall-i386-macro.S b/callback/vacall_r/vacall-i386-macro.S new file mode 100644 index 0000000..ecc611b --- /dev/null +++ b/callback/vacall_r/vacall-i386-macro.S @@ -0,0 +1,167 @@ +#include "asm-i386.h" + TEXT() + ALIGN(2) + P2ALIGN(2,3) + DECLARE_FUNCTION(callback_receiver) +FUNBEGIN(callback_receiver) + INSN1(push,l ,R(ebp)) + INSN2(mov,l ,R(esp), R(ebp)) + INSN1(push,l ,R(edi)) + INSN1(push,l ,R(esi)) + INSN2(lea,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(sub,l ,NUM(56), R(esp)) + INSN2(mov,l ,R(edx),X4 MEM_DISP(ebp,-40)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-56), R(edx)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-56)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-36)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-32)) + INSN2(mov,l ,R(ebx),X4 MEM_DISP(ebp,-24)) + INSN1(push,l ,R(edx)) + INSN1(push,l ,X4 MEM_DISP(ecx,4)) + INSN1(call,_ ,INDIR(X4 MEM(ecx))) + INSN2(mov,l ,X4 MEM_DISP(ebp,-32), R(esi)) + INSN2(add,l ,NUM(16), R(esp)) + INSN2(test,l ,R(esi), R(esi)) + INSN1(je,_ ,L(43)) + INSN2(cmp,l ,NUM(1), R(esi)) + INSN1(je,_ ,L(44)) + INSN2(cmp,l ,NUM(2), R(esi)) + INSN1(je,_ ,L(44)) + INSN2(cmp,l ,NUM(3), R(esi)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(4), R(esi)) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(5), R(esi)) + INSN1(je,_ ,L(51)) + INSN2(cmp,l ,NUM(6), R(esi)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(7), R(esi)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(8), R(esi)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(9), R(esi)) + INSN1(je,_ ,L(48)) + INSN2(lea,l ,X4 MEM_DISP(esi,-10), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(ja,_ ,L(22)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-44),R(edx)) +L(33): + P2ALIGN(2,3) +L(43): + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(esi)) +L(3): + INSN2(and,l ,NUM(512), R(esi)) + INSN1(je,_ ,L(1)) + INSN2(mov,l ,X4 MEM_DISP(ebp,0),R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-40), R(esp)) + INSN1(jmp,_ ,INDIR(R(ecx))) +L(1): + INSN2(lea,l ,X4 MEM_DISP(ebp,-8), R(esp)) + INSN1(pop,l ,R(esi)) + INSN1(pop,l ,R(edi)) + leave + ret +L(22): + INSN2(cmp,l ,NUM(12), R(esi)) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(13), R(esi)) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(14), R(esi)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(15), R(esi)) + INSN1(jne,_ ,L(43)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(esi)) + INSN2(test,l ,NUM(1024), R(esi)) + INSN2(mov,l ,R(esi), R(edi)) + INSN1(je,_ ,L(31)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-28), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(2), R(edx)) + INSN1(je,_ ,L(55)) + INSN2(cmp,l ,NUM(4), R(edx)) + INSN1(je,_ ,L(56)) + INSN2(cmp,l ,NUM(8), R(edx)) + INSN1(je,_ ,L(57)) +L(31): + INSN2(and,l ,NUM(16), R(edi)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(eax)) + INSN1(jne,_ ,L(3)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-8), R(esp)) + INSN1(pop,l ,R(esi)) + INSN1(pop,l ,R(edi)) + leave + ret NUM(4) + INSN1(jmp,_ ,L(3)) +L(57): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(edx,4),R(edx)) + INSN1(jmp,_ ,L(3)) +L(56): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(55): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,w,X2 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(54): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,b,X1 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) + P2ALIGN(2,3) +L(48): + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(53): + INSN1(fld,l ,X8 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) +L(52): + INSN1(fld,s ,X4 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(51): + INSN2MOVXL(movz,w,X2 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(50): + INSN2MOVXL(movs,w,X2 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(49): + INSN2MOVXL(movz,b,X1 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(44): + INSN2MOVXL(movs,b,X1 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(fe1): + FUNEND(callback_receiver,L(fe1)-callback_receiver) + ALIGN(2) + P2ALIGN(2,3) +GLOBL(C(callback_get_receiver)) + DECLARE_FUNCTION(callback_get_receiver) +FUNBEGIN(callback_get_receiver) + INSN1(push,l ,R(ebp)) + INSN2(mov,l ,R(esp), R(ebp)) + INSN1(push,l ,R(ebx)) + INSN1(call,_ ,L(59)) +L(59): + INSN1(pop,l ,R(ebx)) +#ifdef __ELF__ + INSN2(add,l ,NUM()_GLOBAL_OFFSET_TABLE_+[.-L(59)],R(ebx)) +#endif +#ifdef __ELF__ + INSN2(lea,l ,callback_receiver@MEM_DISP(ebx,GOTOFF), R(eax)) +#else + INSN2(lea,l ,C(callback_receiver)-L(59)MEM(ebx), R(eax)) +#endif + INSN2(mov,l ,X4 MEM(esp), R(ebx)) + leave + ret +L(fe2): + FUNEND(callback_get_receiver,L(fe2)-callback_get_receiver) + +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-i386-msvc.c b/callback/vacall_r/vacall-i386-msvc.c new file mode 100644 index 0000000..339a063 --- /dev/null +++ b/callback/vacall_r/vacall-i386-msvc.c @@ -0,0 +1,166 @@ +#ifdef _MSC_VER +#include "vacall_r.h" +#endif +#include "asm-i386.h" + TEXT() + ALIGN(2) + P2ALIGN(2,3) + DECLARE_FUNCTION(callback_receiver) +FUNBEGIN(callback_receiver) + INSN1(push,l ,R(ebp)) + INSN2(mov,l ,R(esp), R(ebp)) + INSN1(push,l ,R(edi)) + INSN1(push,l ,R(esi)) + INSN2(lea,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(sub,l ,NUM(56), R(esp)) + INSN2(mov,l ,R(edx),X4 MEM_DISP(ebp,-40)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-56), R(edx)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-56)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-36)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-32)) + INSN2(mov,l ,R(ebx),X4 MEM_DISP(ebp,-24)) + INSN1(push,l ,R(edx)) + INSN1(push,l ,X4 MEM_DISP(ecx,4)) + INSN1(call,_ ,INDIR(X4 MEM(ecx))) + INSN2(mov,l ,X4 MEM_DISP(ebp,-32), R(esi)) + INSN2(add,l ,NUM(16), R(esp)) + INSN2(test,l ,R(esi), R(esi)) + INSN1(je,_ ,L(43)) + INSN2(cmp,l ,NUM(1), R(esi)) + INSN1(je,_ ,L(44)) + INSN2(cmp,l ,NUM(2), R(esi)) + INSN1(je,_ ,L(44)) + INSN2(cmp,l ,NUM(3), R(esi)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(4), R(esi)) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(5), R(esi)) + INSN1(je,_ ,L(51)) + INSN2(cmp,l ,NUM(6), R(esi)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(7), R(esi)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(8), R(esi)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(9), R(esi)) + INSN1(je,_ ,L(48)) + INSN2(lea,l ,X4 MEM_DISP(esi,-10), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(ja,_ ,L(22)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-44),R(edx)) +L(33): + P2ALIGN(2,3) +L(43): + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(esi)) +L(3): + INSN2(and,l ,NUM(512), R(esi)) + INSN1(je,_ ,L(1)) + INSN2(mov,l ,X4 MEM_DISP(ebp,0),R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-40), R(esp)) + INSN1(jmp,_ ,INDIR(R(ecx))) +L(1): + INSN2(lea,l ,X4 MEM_DISP(ebp,-8), R(esp)) + INSN1(pop,l ,R(esi)) + INSN1(pop,l ,R(edi)) + leave + ret +L(22): + INSN2(cmp,l ,NUM(12), R(esi)) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(13), R(esi)) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(14), R(esi)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(15), R(esi)) + INSN1(jne,_ ,L(43)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(esi)) + INSN2(test,l ,NUM(1024), R(esi)) + INSN2(mov,l ,R(esi), R(edi)) + INSN1(je,_ ,L(31)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-28), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(2), R(edx)) + INSN1(je,_ ,L(55)) + INSN2(cmp,l ,NUM(4), R(edx)) + INSN1(je,_ ,L(56)) + INSN2(cmp,l ,NUM(8), R(edx)) + INSN1(je,_ ,L(57)) +L(31): + INSN2(and,l ,NUM(16), R(edi)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(eax)) + INSN1(jne,_ ,L(3)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-8), R(esp)) + INSN1(pop,l ,R(esi)) + INSN1(pop,l ,R(edi)) + leave + ret NUM(4) + INSN1(jmp,_ ,L(3)) +L(57): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(edx,4),R(edx)) + INSN1(jmp,_ ,L(3)) +L(56): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(55): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,w,X2 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(54): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,b,X1 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) + P2ALIGN(2,3) +L(48): + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(53): + INSN1(fld,l ,X8 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) +L(52): + INSN1(fld,s ,X4 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(51): + INSN2MOVXL(movz,w,X2 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(50): + INSN2MOVXL(movs,w,X2 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(49): + INSN2MOVXL(movz,b,X1 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(44): + INSN2MOVXL(movs,b,X1 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(fe1): + FUNEND(callback_receiver,L(fe1)-callback_receiver) +/* Implementation of callback_get_receiver */ + +/* + * Copyright 2017 Bruno Haible + * + * 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, see . + */ + +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} diff --git a/callback/vacall_r/vacall-ia64-linux.s b/callback/vacall_r/vacall-ia64-linux.s new file mode 100644 index 0000000..30457bf --- /dev/null +++ b/callback/vacall_r/vacall-ia64-linux.s @@ -0,0 +1,851 @@ + .file "vacall-ia64.c" + .pred.safe_across_calls p1-p5,p16-p63 + .text + .align 16 + .proc callback_receiver# +callback_receiver: + .prologue 14, 42 + .spill 48 + .mmb + .save ar.pfs, r43 + alloc r43 = ar.pfs, 8, 6, 2, 0 + .vframe r44 + mov r44 = r12 + nop 0 + .mmi + adds r12 = -208, r12 + adds r18 = 8, r15 + mov r45 = r1 + ;; + .mmi + adds r16 = -48, r44 + adds r14 = -136, r44 + adds r17 = -48, r44 + .mmi + adds r40 = -152, r44 + adds r47 = -192, r44 + adds r41 = -160, r44 + ;; + .mmb + st8 [r14] = r8 + adds r14 = -32, r44 + nop 0 + .mfi + st8 [r16] = r32, 8 + nop 0 + .save rp, r42 + mov r42 = b0 + .body + ;; + .mfi + st8 [r14] = r34 + nop 0 + adds r14 = -24, r44 + .mmb + st8 [r16] = r33 + ld8 r16 = [r15] + nop 0 + ;; + .mmi + nop 0 + st8 [r14] = r35 + adds r14 = -16, r44 + .mmi + st8 [r41] = r0 + ;; + st8 [r14] = r36 + adds r14 = -8, r44 + .mmb + st4 [r40] = r0 + ld8 r46 = [r18] + nop 0 + ;; + .mmi + nop 0 + st8 [r14] = r37 + adds r14 = 8, r44 + .mmi + st8 [r44] = r38 + ;; + st8 [r14] = r39 + adds r14 = -112, r44 + .mmi + st4 [r47] = r0 + ;; + stfd [r14] = f8 + nop 0 + .mmi + adds r14 = -104, r44 + ;; + stfd [r14] = f9 + adds r14 = -96, r44 + ;; + .mfi + stfd [r14] = f10 + nop 0 + adds r14 = -88, r44 + .mmi + nop 0 + ;; + stfd [r14] = f11 + nop 0 + .mmi + adds r14 = -80, r44 + ;; + stfd [r14] = f12 + adds r14 = -72, r44 + ;; + .mfi + stfd [r14] = f13 + nop 0 + adds r14 = -64, r44 + .mmi + nop 0 + ;; + stfd [r14] = f14 + nop 0 + .mmi + adds r14 = -56, r44 + ;; + stfd [r14] = f15 + adds r14 = -168, r44 + ;; + .mii + st8 [r14] = r17 + adds r14 = -128, r44 + ;; + nop 0 + .mii + st8 [r14] = r17 + adds r14 = -120, r44 + ;; + nop 0 + .mmb + st4 [r14] = r0 + ld8 r14 = [r16], 8 + nop 0 + ;; + .mib + nop 0 + mov b6 = r14 + nop 0 + .mbb + ld8 r1 = [r16] + nop 0 + br.call.sptk.many b0 = b6 + ;; + .mmb + mov r1 = r45 + ld4 r40 = [r40] + nop 0 + ;; + .mfb + cmp4.eq p6, p7 = 0, r40 + nop 0 + (p6) br.cond.dpnt .L49 + ;; + .mfb + cmp4.ne p6, p7 = 1, r40 + nop 0 + (p7) br.cond.dpnt .L50 + ;; + .mfb + cmp4.ne p6, p7 = 2, r40 + nop 0 + (p7) br.cond.dpnt .L50 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 3, r40 + ;; + (p7) adds r14 = -184, r44 + ;; + .mfb + (p7) ld1 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 4, r40 + ;; + nop 0 + .mmi + (p7) adds r14 = -184, r44 + ;; + (p7) ld2 r14 = [r14] + nop 0 + ;; + .mib + nop 0 + (p7) sxt2 r8 = r14 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 5, r40 + ;; + (p7) adds r14 = -184, r44 + ;; + .mfb + (p7) ld2 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 6, r40 + ;; + nop 0 + .mmi + (p7) adds r14 = -184, r44 + ;; + (p7) ld4 r14 = [r14] + nop 0 + ;; + .mib + nop 0 + (p7) sxt4 r8 = r14 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 7, r40 + ;; + (p7) adds r14 = -184, r44 + ;; + .mfb + (p7) ld4 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mfb + cmp4.ne p6, p7 = 8, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 9, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 10, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 11, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 12, r40 + ;; + (p7) adds r14 = -184, r44 + ;; + .mfb + (p7) ldfs f8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 13, r40 + ;; + (p7) adds r14 = -184, r44 + ;; + .mfb + (p7) ldfd f8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mfb + cmp4.ne p6, p7 = 14, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mib + nop 0 + cmp4.ne p6, p7 = 15, r40 + (p6) br.cond.dptk .L49 + .mii + nop 0 + adds r16 = -192, r44 + ;; + nop 0 + .mmi + ld4 r14 = [r16] + ;; + nop 0 + tbit.z p6, p7 = r14, 10 + .mfb + adds r14 = -144, r44 + nop 0 + (p6) br.cond.dpnt .L49 + ;; + .mmi + ld8 r22 = [r14] + ;; + adds r14 = -1, r22 + nop 0 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 31, r14 + (p6) br.cond.dpnt .L49 + .mmi + ld8 r14 = [r41] + ;; + and r21 = 7, r14 + and r24 = -8, r14 + .mii + nop 0 + cmp.ltu p6, p7 = 8, r22 + ;; + nop 0 + .mfb + add r14 = r22, r21 + nop 0 + (p6) br.cond.dptk .L35 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 8, r14 + (p6) br.cond.dptk .L37 + .mfi + shladd r16 = r14, 3, r0 + nop 0 + addl r14 = 2, r0 + .mii + ld8 r17 = [r24] + shladd r18 = r21, 3, r0 + ;; + adds r16 = -1, r16 + ;; + .mii + nop 0 + sxt4 r16 = r16 + ;; + shl r14 = r14, r16 + ;; + .mmi + adds r14 = -1, r14 + ;; + and r14 = r17, r14 + nop 0 + .mmi + nop 0 + ;; + nop 0 + shr r8 = r14, r18 +.L49: + .mii + nop 0 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 1 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L50: + .body + .copy_state 1 + .mii + nop 0 + adds r14 = -184, r44 + ;; + nop 0 + .mii + ld1 r14 = [r14] + nop 0 + ;; + sxt1 r8 = r14 + .mii + nop 0 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 2 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L54: + .body + .copy_state 2 + .mmb + nop 0 + adds r14 = -184, r44 + nop 0 + ;; + .mii + ld8 r8 = [r14] + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 3 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L35: + .body + .copy_state 3 + .mib + nop 0 + cmp.ltu p6, p7 = 16, r22 + (p6) br.cond.dptk .L39 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 16, r14 + (p6) br.cond.dptk .L41 + .mmi + shladd r16 = r14, 3, r0 + adds r14 = 8, r24 + shladd r17 = r21, 2, r0 + .mmb + shladd r19 = r21, 3, r0 + ld8 r18 = [r24] + nop 0 + ;; + .mfi + ld8 r20 = [r14] + nop 0 + addl r14 = 2, r0 + .mii + adds r16 = -65, r16 + sub r17 = 32, r17 + ;; + sxt4 r16 = r16 + .mii + nop 0 + sxt4 r17 = r17 + shr r18 = r18, r19 + ;; + .mii + nop 0 + shl r14 = r14, r16 + ;; + adds r14 = -1, r14 + ;; + .mii + nop 0 + and r14 = r20, r14 + ;; + shl r16 = r14, r17 + .mii + nop 0 + shr r9 = r14, r19 + ;; + shl r16 = r16, r17 + ;; + .mii + or r8 = r16, r18 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 4 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L37: + .body + .copy_state 4 + .mfi + shladd r16 = r14, 3, r0 + nop 0 + addl r14 = 2, r0 + .mii + ld8 r18 = [r24], 8 + shladd r19 = r21, 3, r0 + ;; + adds r16 = -65, r16 + .mii + ld8 r20 = [r24] + sub r17 = 64, r19 + ;; + sxt4 r16 = r16 + .mii + nop 0 + sxt4 r17 = r17 + ;; + shl r14 = r14, r16 + .mii + nop 0 + shr r18 = r18, r19 + ;; + adds r14 = -1, r14 + ;; + .mii + nop 0 + and r14 = r20, r14 + ;; + shl r14 = r14, r17 + ;; + .mii + or r8 = r14, r18 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 5 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L39: + .body + .copy_state 5 + .mib + nop 0 + cmp.ltu p6, p7 = 24, r22 + (p6) br.cond.dptk .L43 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 24, r14 + (p6) br.cond.dptk .L45 + .mmi + shladd r16 = r14, 3, r0 + adds r14 = 8, r24 + shladd r17 = r21, 2, r0 + .mmb + shladd r20 = r21, 3, r0 + ld8 r19 = [r24], 16 + nop 0 + ;; + .mmi + ld8 r18 = [r14] + addl r14 = 2, r0 + adds r16 = -65, r16 + .mmb + sub r17 = 32, r17 + ld8 r21 = [r24] + nop 0 + ;; + .mii + nop 0 + sxt4 r16 = r16 + sxt4 r17 = r17 + .mii + nop 0 + shr r19 = r19, r20 + ;; + shl r14 = r14, r16 + .mii + nop 0 + shl r16 = r18, r17 + shr r18 = r18, r20 + ;; + .mii + nop 0 + shl r16 = r16, r17 + adds r14 = -1, r14 + ;; + .mii + and r14 = r21, r14 + or r8 = r16, r19 + ;; + shl r16 = r14, r17 + .mii + nop 0 + shr r10 = r14, r20 + ;; + shl r16 = r16, r17 + ;; + .mii + or r9 = r16, r18 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 6 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L41: + .body + .copy_state 6 + .mfi + shladd r17 = r14, 3, r0 + nop 0 + adds r14 = 8, r24 + .mfi + ld8 r19 = [r24], 16 + nop 0 + shladd r16 = r21, 3, r0 + ;; + .mmi + ld8 r18 = [r14] + addl r14 = 2, r0 + adds r17 = -129, r17 + .mmi + ld8 r21 = [r24] + mov r20 = r16 + sub r16 = 64, r16 + ;; + .mii + nop 0 + sxt4 r17 = r17 + sxt4 r16 = r16 + ;; + .mii + nop 0 + shl r14 = r14, r17 + shr r19 = r19, r20 + .mii + nop 0 + shl r17 = r18, r16 + shr r18 = r18, r20 + ;; + .mmi + adds r14 = -1, r14 + ;; + and r14 = r21, r14 + or r8 = r17, r19 + ;; + .mib + nop 0 + shl r14 = r14, r16 + nop 0 + ;; + .mii + or r9 = r14, r18 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 7 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L45: + .body + .copy_state 7 + .mmi + shladd r17 = r14, 3, r0 + adds r14 = 24, r24 + shladd r16 = r21, 3, r0 + .mmi + adds r19 = 8, r24 + ld8 r21 = [r24] + adds r20 = 16, r24 + ;; + .mmi + ld8 r23 = [r14] + addl r14 = 2, r0 + adds r17 = -129, r17 + .mmi + mov r18 = r16 + ld8 r19 = [r19] + sub r16 = 64, r16 + ;; + .mib + nop 0 + sxt4 r17 = r17 + nop 0 + .mii + ld8 r20 = [r20] + sxt4 r16 = r16 + ;; + shl r14 = r14, r17 + .mii + nop 0 + shr r22 = r20, r18 + shl r17 = r19, r16 + .mii + nop 0 + shr r21 = r21, r18 + shr r19 = r19, r18 + .mii + nop 0 + shl r20 = r20, r16 + ;; + nop 0 + .mmi + adds r14 = -1, r14 + ;; + and r14 = r23, r14 + or r8 = r17, r21 + .mii + nop 0 + or r9 = r20, r19 + ;; + shl r14 = r14, r16 + ;; + .mii + or r10 = r14, r22 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 8 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L43: + .body + .copy_state 8 + .mib + nop 0 + cmp.ltu p6, p7 = 32, r14 + (p6) br.cond.dptk .L47 + .mmi + adds r16 = 24, r24 + shladd r14 = r14, 3, r0 + adds r18 = 8, r24 + .mmi + shladd r17 = r21, 2, r0 + adds r19 = 16, r24 + shladd r21 = r21, 3, r0 + ;; + .mmi + nop 0 + ld8 r23 = [r16] + addl r16 = 2, r0 + .mmi + adds r14 = -65, r14 + ld8 r20 = [r18] + sub r17 = 32, r17 + ;; + .mii + nop 0 + sxt4 r14 = r14 + sxt4 r17 = r17 + .mmb + ld8 r22 = [r19] + ld8 r19 = [r24] + nop 0 + ;; + .mii + nop 0 + shl r16 = r16, r14 + shl r14 = r20, r17 + .mii + nop 0 + shr r19 = r19, r21 + shl r18 = r22, r17 + ;; + .mii + nop 0 + shl r14 = r14, r17 + shr r20 = r20, r21 + .mii + adds r16 = -1, r16 + shl r18 = r18, r17 + shr r22 = r22, r21 + ;; + .mmi + nop 0 + and r16 = r23, r16 + or r8 = r14, r19 + .mmi + or r9 = r18, r20 + ;; + nop 0 + shl r14 = r16, r17 + .mii + nop 0 + shr r11 = r16, r21 + ;; + shl r14 = r14, r17 + ;; + .mii + or r10 = r14, r22 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 9 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L47: + .body + .copy_state 9 + .mmb + shladd r17 = r14, 3, r0 + adds r14 = 32, r24 + nop 0 + .mmi + adds r19 = 8, r24 + adds r20 = 16, r24 + shladd r16 = r21, 3, r0 + ;; + .mfi + ld8 r23 = [r14] + nop 0 + adds r14 = 24, r24 + .mmi + ld8 r21 = [r19] + adds r17 = -129, r17 + mov r18 = r16 + .mfi + ld8 r19 = [r20] + nop 0 + sub r16 = 64, r16 + ;; + .mmi + ld8 r20 = [r14] + addl r14 = 2, r0 + sxt4 r17 = r17 + .mii + nop 0 + sxt4 r16 = r16 + ;; + shl r22 = r21, r16 + .mii + nop 0 + shr r21 = r21, r18 + shl r14 = r14, r17 + .mii + ld8 r17 = [r24] + shr r24 = r20, r18 + shl r20 = r20, r16 + ;; + .mii + nop 0 + shr r17 = r17, r18 + shr r18 = r19, r18 + .mii + adds r14 = -1, r14 + shl r19 = r19, r16 + ;; + and r14 = r23, r14 + .mmi + nop 0 + or r8 = r22, r17 + or r10 = r20, r18 + .mii + nop 0 + or r9 = r19, r21 + ;; + shl r14 = r14, r16 + ;; + .mii + or r11 = r14, r24 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 + .endp callback_receiver# + .align 16 + .global callback_get_receiver# + .proc callback_get_receiver# +callback_get_receiver: + .prologue 2, 2 + .mfi + .vframe r2 + mov r2 = r12 + .body + nop 0 + addl r8 = @ltoff(@fptr(callback_receiver#)), gp + ;; + .mib + ld8 r8 = [r8] + .restore sp + mov r12 = r2 + br.ret.sptk.many b0 + .endp callback_get_receiver# + .ident "GCC: (GNU) 4.0.1" diff --git a/callback/vacall_r/vacall-ia64-macro.S b/callback/vacall_r/vacall-ia64-macro.S new file mode 100644 index 0000000..1d24177 --- /dev/null +++ b/callback/vacall_r/vacall-ia64-macro.S @@ -0,0 +1,854 @@ + .file "vacall-ia64.c" + .pred.safe_across_calls p1-p5,p16-p63 + .text + .align 16 + .proc callback_receiver# +callback_receiver: + .prologue 14, 42 + .spill 48 + .mmb + .save ar.pfs, r43 + alloc r43 = ar.pfs, 8, 6, 2, 0 + .vframe r44 + mov r44 = r12 + nop 0 + .mmi + adds r12 = -208, r12 + adds r18 = 8, r15 + mov r45 = r1 + ;; + .mmi + adds r16 = -48, r44 + adds r14 = -136, r44 + adds r17 = -48, r44 + .mmi + adds r40 = -152, r44 + adds r47 = -192, r44 + adds r41 = -160, r44 + ;; + .mmb + st8 [r14] = r8 + adds r14 = -32, r44 + nop 0 + .mfi + st8 [r16] = r32, 8 + nop 0 + .save rp, r42 + mov r42 = b0 + .body + ;; + .mfi + st8 [r14] = r34 + nop 0 + adds r14 = -24, r44 + .mmb + st8 [r16] = r33 + ld8 r16 = [r15] + nop 0 + ;; + .mmi + nop 0 + st8 [r14] = r35 + adds r14 = -16, r44 + .mmi + st8 [r41] = r0 + ;; + st8 [r14] = r36 + adds r14 = -8, r44 + .mmb + st4 [r40] = r0 + ld8 r46 = [r18] + nop 0 + ;; + .mmi + nop 0 + st8 [r14] = r37 + adds r14 = 8, r44 + .mmi + st8 [r44] = r38 + ;; + st8 [r14] = r39 + adds r14 = -112, r44 + .mmi + st4 [r47] = r0 + ;; + stfd [r14] = f8 + nop 0 + .mmi + adds r14 = -104, r44 + ;; + stfd [r14] = f9 + adds r14 = -96, r44 + ;; + .mfi + stfd [r14] = f10 + nop 0 + adds r14 = -88, r44 + .mmi + nop 0 + ;; + stfd [r14] = f11 + nop 0 + .mmi + adds r14 = -80, r44 + ;; + stfd [r14] = f12 + adds r14 = -72, r44 + ;; + .mfi + stfd [r14] = f13 + nop 0 + adds r14 = -64, r44 + .mmi + nop 0 + ;; + stfd [r14] = f14 + nop 0 + .mmi + adds r14 = -56, r44 + ;; + stfd [r14] = f15 + adds r14 = -168, r44 + ;; + .mii + st8 [r14] = r17 + adds r14 = -128, r44 + ;; + nop 0 + .mii + st8 [r14] = r17 + adds r14 = -120, r44 + ;; + nop 0 + .mmb + st4 [r14] = r0 + ld8 r14 = [r16], 8 + nop 0 + ;; + .mib + nop 0 + mov b6 = r14 + nop 0 + .mbb + ld8 r1 = [r16] + nop 0 + br.call.sptk.many b0 = b6 + ;; + .mmb + mov r1 = r45 + ld4 r40 = [r40] + nop 0 + ;; + .mfb + cmp4.eq p6, p7 = 0, r40 + nop 0 + (p6) br.cond.dpnt .L49 + ;; + .mfb + cmp4.ne p6, p7 = 1, r40 + nop 0 + (p7) br.cond.dpnt .L50 + ;; + .mfb + cmp4.ne p6, p7 = 2, r40 + nop 0 + (p7) br.cond.dpnt .L50 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 3, r40 + ;; + (p7) adds r14 = -184, r44 + ;; + .mfb + (p7) ld1 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 4, r40 + ;; + nop 0 + .mmi + (p7) adds r14 = -184, r44 + ;; + (p7) ld2 r14 = [r14] + nop 0 + ;; + .mib + nop 0 + (p7) sxt2 r8 = r14 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 5, r40 + ;; + (p7) adds r14 = -184, r44 + ;; + .mfb + (p7) ld2 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 6, r40 + ;; + nop 0 + .mmi + (p7) adds r14 = -184, r44 + ;; + (p7) ld4 r14 = [r14] + nop 0 + ;; + .mib + nop 0 + (p7) sxt4 r8 = r14 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 7, r40 + ;; + (p7) adds r14 = -184, r44 + ;; + .mfb + (p7) ld4 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mfb + cmp4.ne p6, p7 = 8, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 9, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 10, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 11, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 12, r40 + ;; + (p7) adds r14 = -184, r44 + ;; + .mfb + (p7) ldfs f8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 13, r40 + ;; + (p7) adds r14 = -184, r44 + ;; + .mfb + (p7) ldfd f8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mfb + cmp4.ne p6, p7 = 14, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mib + nop 0 + cmp4.ne p6, p7 = 15, r40 + (p6) br.cond.dptk .L49 + .mii + nop 0 + adds r16 = -192, r44 + ;; + nop 0 + .mmi + ld4 r14 = [r16] + ;; + nop 0 + tbit.z p6, p7 = r14, 10 + .mfb + adds r14 = -144, r44 + nop 0 + (p6) br.cond.dpnt .L49 + ;; + .mmi + ld8 r22 = [r14] + ;; + adds r14 = -1, r22 + nop 0 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 31, r14 + (p6) br.cond.dpnt .L49 + .mmi + ld8 r14 = [r41] + ;; + and r21 = 7, r14 + and r24 = -8, r14 + .mii + nop 0 + cmp.ltu p6, p7 = 8, r22 + ;; + nop 0 + .mfb + add r14 = r22, r21 + nop 0 + (p6) br.cond.dptk .L35 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 8, r14 + (p6) br.cond.dptk .L37 + .mfi + shladd r16 = r14, 3, r0 + nop 0 + addl r14 = 2, r0 + .mii + ld8 r17 = [r24] + shladd r18 = r21, 3, r0 + ;; + adds r16 = -1, r16 + ;; + .mii + nop 0 + sxt4 r16 = r16 + ;; + shl r14 = r14, r16 + ;; + .mmi + adds r14 = -1, r14 + ;; + and r14 = r17, r14 + nop 0 + .mmi + nop 0 + ;; + nop 0 + shr r8 = r14, r18 +.L49: + .mii + nop 0 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 1 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L50: + .body + .copy_state 1 + .mii + nop 0 + adds r14 = -184, r44 + ;; + nop 0 + .mii + ld1 r14 = [r14] + nop 0 + ;; + sxt1 r8 = r14 + .mii + nop 0 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 2 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L54: + .body + .copy_state 2 + .mmb + nop 0 + adds r14 = -184, r44 + nop 0 + ;; + .mii + ld8 r8 = [r14] + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 3 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L35: + .body + .copy_state 3 + .mib + nop 0 + cmp.ltu p6, p7 = 16, r22 + (p6) br.cond.dptk .L39 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 16, r14 + (p6) br.cond.dptk .L41 + .mmi + shladd r16 = r14, 3, r0 + adds r14 = 8, r24 + shladd r17 = r21, 2, r0 + .mmb + shladd r19 = r21, 3, r0 + ld8 r18 = [r24] + nop 0 + ;; + .mfi + ld8 r20 = [r14] + nop 0 + addl r14 = 2, r0 + .mii + adds r16 = -65, r16 + sub r17 = 32, r17 + ;; + sxt4 r16 = r16 + .mii + nop 0 + sxt4 r17 = r17 + shr r18 = r18, r19 + ;; + .mii + nop 0 + shl r14 = r14, r16 + ;; + adds r14 = -1, r14 + ;; + .mii + nop 0 + and r14 = r20, r14 + ;; + shl r16 = r14, r17 + .mii + nop 0 + shr r9 = r14, r19 + ;; + shl r16 = r16, r17 + ;; + .mii + or r8 = r16, r18 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 4 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L37: + .body + .copy_state 4 + .mfi + shladd r16 = r14, 3, r0 + nop 0 + addl r14 = 2, r0 + .mii + ld8 r18 = [r24], 8 + shladd r19 = r21, 3, r0 + ;; + adds r16 = -65, r16 + .mii + ld8 r20 = [r24] + sub r17 = 64, r19 + ;; + sxt4 r16 = r16 + .mii + nop 0 + sxt4 r17 = r17 + ;; + shl r14 = r14, r16 + .mii + nop 0 + shr r18 = r18, r19 + ;; + adds r14 = -1, r14 + ;; + .mii + nop 0 + and r14 = r20, r14 + ;; + shl r14 = r14, r17 + ;; + .mii + or r8 = r14, r18 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 5 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L39: + .body + .copy_state 5 + .mib + nop 0 + cmp.ltu p6, p7 = 24, r22 + (p6) br.cond.dptk .L43 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 24, r14 + (p6) br.cond.dptk .L45 + .mmi + shladd r16 = r14, 3, r0 + adds r14 = 8, r24 + shladd r17 = r21, 2, r0 + .mmb + shladd r20 = r21, 3, r0 + ld8 r19 = [r24], 16 + nop 0 + ;; + .mmi + ld8 r18 = [r14] + addl r14 = 2, r0 + adds r16 = -65, r16 + .mmb + sub r17 = 32, r17 + ld8 r21 = [r24] + nop 0 + ;; + .mii + nop 0 + sxt4 r16 = r16 + sxt4 r17 = r17 + .mii + nop 0 + shr r19 = r19, r20 + ;; + shl r14 = r14, r16 + .mii + nop 0 + shl r16 = r18, r17 + shr r18 = r18, r20 + ;; + .mii + nop 0 + shl r16 = r16, r17 + adds r14 = -1, r14 + ;; + .mii + and r14 = r21, r14 + or r8 = r16, r19 + ;; + shl r16 = r14, r17 + .mii + nop 0 + shr r10 = r14, r20 + ;; + shl r16 = r16, r17 + ;; + .mii + or r9 = r16, r18 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 6 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L41: + .body + .copy_state 6 + .mfi + shladd r17 = r14, 3, r0 + nop 0 + adds r14 = 8, r24 + .mfi + ld8 r19 = [r24], 16 + nop 0 + shladd r16 = r21, 3, r0 + ;; + .mmi + ld8 r18 = [r14] + addl r14 = 2, r0 + adds r17 = -129, r17 + .mmi + ld8 r21 = [r24] + mov r20 = r16 + sub r16 = 64, r16 + ;; + .mii + nop 0 + sxt4 r17 = r17 + sxt4 r16 = r16 + ;; + .mii + nop 0 + shl r14 = r14, r17 + shr r19 = r19, r20 + .mii + nop 0 + shl r17 = r18, r16 + shr r18 = r18, r20 + ;; + .mmi + adds r14 = -1, r14 + ;; + and r14 = r21, r14 + or r8 = r17, r19 + ;; + .mib + nop 0 + shl r14 = r14, r16 + nop 0 + ;; + .mii + or r9 = r14, r18 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 7 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L45: + .body + .copy_state 7 + .mmi + shladd r17 = r14, 3, r0 + adds r14 = 24, r24 + shladd r16 = r21, 3, r0 + .mmi + adds r19 = 8, r24 + ld8 r21 = [r24] + adds r20 = 16, r24 + ;; + .mmi + ld8 r23 = [r14] + addl r14 = 2, r0 + adds r17 = -129, r17 + .mmi + mov r18 = r16 + ld8 r19 = [r19] + sub r16 = 64, r16 + ;; + .mib + nop 0 + sxt4 r17 = r17 + nop 0 + .mii + ld8 r20 = [r20] + sxt4 r16 = r16 + ;; + shl r14 = r14, r17 + .mii + nop 0 + shr r22 = r20, r18 + shl r17 = r19, r16 + .mii + nop 0 + shr r21 = r21, r18 + shr r19 = r19, r18 + .mii + nop 0 + shl r20 = r20, r16 + ;; + nop 0 + .mmi + adds r14 = -1, r14 + ;; + and r14 = r23, r14 + or r8 = r17, r21 + .mii + nop 0 + or r9 = r20, r19 + ;; + shl r14 = r14, r16 + ;; + .mii + or r10 = r14, r22 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 8 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L43: + .body + .copy_state 8 + .mib + nop 0 + cmp.ltu p6, p7 = 32, r14 + (p6) br.cond.dptk .L47 + .mmi + adds r16 = 24, r24 + shladd r14 = r14, 3, r0 + adds r18 = 8, r24 + .mmi + shladd r17 = r21, 2, r0 + adds r19 = 16, r24 + shladd r21 = r21, 3, r0 + ;; + .mmi + nop 0 + ld8 r23 = [r16] + addl r16 = 2, r0 + .mmi + adds r14 = -65, r14 + ld8 r20 = [r18] + sub r17 = 32, r17 + ;; + .mii + nop 0 + sxt4 r14 = r14 + sxt4 r17 = r17 + .mmb + ld8 r22 = [r19] + ld8 r19 = [r24] + nop 0 + ;; + .mii + nop 0 + shl r16 = r16, r14 + shl r14 = r20, r17 + .mii + nop 0 + shr r19 = r19, r21 + shl r18 = r22, r17 + ;; + .mii + nop 0 + shl r14 = r14, r17 + shr r20 = r20, r21 + .mii + adds r16 = -1, r16 + shl r18 = r18, r17 + shr r22 = r22, r21 + ;; + .mmi + nop 0 + and r16 = r23, r16 + or r8 = r14, r19 + .mmi + or r9 = r18, r20 + ;; + nop 0 + shl r14 = r16, r17 + .mii + nop 0 + shr r11 = r16, r21 + ;; + shl r14 = r14, r17 + ;; + .mii + or r10 = r14, r22 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .label_state 9 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 +.L47: + .body + .copy_state 9 + .mmb + shladd r17 = r14, 3, r0 + adds r14 = 32, r24 + nop 0 + .mmi + adds r19 = 8, r24 + adds r20 = 16, r24 + shladd r16 = r21, 3, r0 + ;; + .mfi + ld8 r23 = [r14] + nop 0 + adds r14 = 24, r24 + .mmi + ld8 r21 = [r19] + adds r17 = -129, r17 + mov r18 = r16 + .mfi + ld8 r19 = [r20] + nop 0 + sub r16 = 64, r16 + ;; + .mmi + ld8 r20 = [r14] + addl r14 = 2, r0 + sxt4 r17 = r17 + .mii + nop 0 + sxt4 r16 = r16 + ;; + shl r22 = r21, r16 + .mii + nop 0 + shr r21 = r21, r18 + shl r14 = r14, r17 + .mii + ld8 r17 = [r24] + shr r24 = r20, r18 + shl r20 = r20, r16 + ;; + .mii + nop 0 + shr r17 = r17, r18 + shr r18 = r19, r18 + .mii + adds r14 = -1, r14 + shl r19 = r19, r16 + ;; + and r14 = r23, r14 + .mmi + nop 0 + or r8 = r22, r17 + or r10 = r20, r18 + .mii + nop 0 + or r9 = r19, r21 + ;; + shl r14 = r14, r16 + ;; + .mii + or r11 = r14, r24 + mov ar.pfs = r43 + mov b0 = r42 + .mib + nop 0 + .restore sp + mov r12 = r44 + br.ret.sptk.many b0 + .endp callback_receiver# + .align 16 + .global callback_get_receiver# + .proc callback_get_receiver# +callback_get_receiver: + .prologue 2, 2 + .mfi + .vframe r2 + mov r2 = r12 + .body + nop 0 + addl r8 = @ltoff(@fptr(callback_receiver#)), gp + ;; + .mib + ld8 r8 = [r8] + .restore sp + mov r12 = r2 + br.ret.sptk.many b0 + .endp callback_get_receiver# + .ident "GCC: (GNU) 4.0.1" +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-libapi.c b/callback/vacall_r/vacall-libapi.c new file mode 100644 index 0000000..60ccee5 --- /dev/null +++ b/callback/vacall_r/vacall-libapi.c @@ -0,0 +1,210 @@ +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +#include "config.h" +#include +#include +#include + +#include "vacall-internal.h" + +/* Room for returning structs according to the Sun C non-reentrant struct return convention. */ +typedef union { __vaword room[__VA_ALIST_WORDS]; double align; } __va_struct_buffer_t; +static __va_struct_buffer_t vacall_struct_buffer; + +static _Noreturn void +vacall_error_type_mismatch (enum __VAtype start_type, enum __VAtype return_type) +{ + /* If you see this, fix your code. */ + fprintf (stderr, "vacall: va_start type %d and va_return type %d disagree.\n", + (int)start_type, (int)return_type); + abort(); +} + +static _Noreturn void +vacall_error_struct_too_large (unsigned int size) +{ + /* If you see this, increase __VA_ALIST_WORDS: */ + fprintf (stderr, "vacall: struct of size %u too large for Sun C struct return.\n", + size); + abort(); +} + +void vacall_start (va_alist list, int rettype, int flags) +{ + __va_start(list,rettype,flags); +} + +void vacall_start_struct (va_alist list, size_t type_size, size_t type_align, int type_splittable, int flags) +{ + __va_start_struct(list,type_size,type_align,type_splittable,flags); +} + +char vacall_arg_char (va_alist list) +{ + return _va_arg_char(list); +} + +signed char vacall_arg_schar (va_alist list) +{ + return _va_arg_schar(list); +} + +unsigned char vacall_arg_uchar (va_alist list) +{ + return _va_arg_uchar(list); +} + +short vacall_arg_short (va_alist list) +{ + return _va_arg_short(list); +} + +unsigned short vacall_arg_ushort (va_alist list) +{ + return _va_arg_ushort(list); +} + +int vacall_arg_int (va_alist list) +{ + return _va_arg_int(list); +} + +unsigned int vacall_arg_uint (va_alist list) +{ + return _va_arg_uint(list); +} + +long vacall_arg_long (va_alist list) +{ + return _va_arg_long(list); +} + +unsigned long vacall_arg_ulong (va_alist list) +{ + return _va_arg_ulong(list); +} + +long long vacall_arg_longlong (va_alist list) +{ + return _va_arg_longlong(list); +} + +unsigned long long vacall_arg_ulonglong (va_alist list) +{ + return _va_arg_ulonglong(list); +} + +float vacall_arg_float (va_alist list) +{ + return _va_arg_float(list); +} + +double vacall_arg_double (va_alist list) +{ + return _va_arg_double(list); +} + +void* vacall_arg_ptr (va_alist list) +{ + return _va_arg_ptr(list); +} + +void* vacall_arg_struct (va_alist list, size_t type_size, size_t type_align) +{ + return __va_arg_struct(list,type_size,type_align); +} + +void vacall_return_void (va_alist list) +{ + _va_return_void(list); +} + +void vacall_return_char (va_alist list, char val) +{ + _va_return_char(list,val); +} + +void vacall_return_schar (va_alist list, signed char val) +{ + _va_return_schar(list,val); +} + +void vacall_return_uchar (va_alist list, unsigned char val) +{ + _va_return_uchar(list,val); +} + +void vacall_return_short (va_alist list, short val) +{ + _va_return_short(list,val); +} + +void vacall_return_ushort (va_alist list, unsigned short val) +{ + _va_return_ushort(list,val); +} + +void vacall_return_int (va_alist list, int val) +{ + _va_return_int(list,val); +} + +void vacall_return_uint (va_alist list, unsigned int val) +{ + _va_return_uint(list,val); +} + +void vacall_return_long (va_alist list, long val) +{ + _va_return_long(list,val); +} + +void vacall_return_ulong (va_alist list, unsigned long val) +{ + _va_return_ulong(list,val); +} + +void vacall_return_longlong (va_alist list, long long val) +{ + _va_return_longlong(list,val); +} + +void vacall_return_ulonglong (va_alist list, unsigned long long val) +{ + _va_return_ulonglong(list,val); +} + +void vacall_return_float (va_alist list, float val) +{ + _va_return_float(list,val); +} + +void vacall_return_double (va_alist list, double val) +{ + _va_return_double(list,val); +} + +void vacall_return_ptr (va_alist list, void* val) +{ + _va_return_ptr(list,val); +} + +void vacall_return_struct (va_alist list, size_t type_size, size_t type_align, const void* val_addr) +{ + __va_return_struct(list,type_size,type_align,val_addr); +} diff --git a/callback/vacall_r/vacall-m68k-linux.s b/callback/vacall_r/vacall-m68k-linux.s new file mode 100644 index 0000000..a687a7e --- /dev/null +++ b/callback/vacall_r/vacall-m68k-linux.s @@ -0,0 +1,185 @@ + .file "vacall-m68k.c" + .text + .align 2 + .type callback_receiver,@function +callback_receiver: + link.w %a6,#-32 + movm.l #0x3030,-(%sp) + clr.l -32(%a6) + lea (8,%a6),%a2 + move.l %a2,-20(%a6) + clr.l -16(%a6) + clr.l -12(%a6) + move.l %a1,-4(%a6) + pea -32(%a6) + move.l 4(%a0),-(%sp) + move.l (%a0),%a2 + jsr (%a2) + addq.l #8,%sp + move.l -12(%a6),%a3 + tst.l %a3 + jbeq .L1 + moveq.l #1,%d2 + cmp.l %a3,%d2 + jbeq .L46 + moveq.l #2,%d3 + cmp.l %a3,%d3 + jbeq .L46 + moveq.l #3,%d2 + cmp.l %a3,%d2 + jbeq .L47 + moveq.l #4,%d3 + cmp.l %a3,%d3 + jbeq .L48 + moveq.l #5,%d2 + cmp.l %a3,%d2 + jbeq .L49 + moveq.l #6,%d3 + cmp.l %a3,%d3 + jbeq .L45 + moveq.l #7,%d2 + cmp.l %a3,%d2 + jbeq .L45 + moveq.l #8,%d3 + cmp.l %a3,%d3 + jbeq .L45 + moveq.l #9,%d2 + cmp.l %a3,%d2 + jbeq .L45 + lea (-10,%a3),%a2 + moveq.l #1,%d3 + cmp.l %a2,%d3 + jbcs .L22 + move.l -28(%a6),%d0 + move.l -24(%a6),%d1 + jbra .L1 + .align 2 +.L22: + moveq.l #12,%d2 + cmp.l %a3,%d2 + jbeq .L50 + moveq.l #13,%d2 + cmp.l %a3,%d2 + jbeq .L51 + moveq.l #14,%d3 + cmp.l %a3,%d3 + jbeq .L52 + moveq.l #15,%d2 + cmp.l %a3,%d2 + jbne .L1 + btst #2,-30(%a6) + jbeq .L1 + move.l -8(%a6),%d2 + moveq.l #1,%d3 + cmp.l %d2,%d3 + jbeq .L53 + moveq.l #2,%d3 + cmp.l %d2,%d3 + jbeq .L54 + moveq.l #4,%d3 + cmp.l %d2,%d3 + jbeq .L55 + moveq.l #8,%d3 + cmp.l %d2,%d3 + jbne .L1 + move.l -16(%a6),%a2 + move.l (%a2),%d0 + move.l 4(%a2),%d1 + jbra .L1 + .align 2 +.L55: + move.l -16(%a6),%a2 + move.l (%a2),%d0 + jbra .L1 + .align 2 +.L54: + move.l -16(%a6),%a2 + clr.l %d0 + move.w (%a2),%d0 + jbra .L1 + .align 2 +.L53: + move.l -16(%a6),%a2 + clr.l %d0 + move.b (%a2),%d0 + jbra .L1 + .align 2 +.L52: + move.l -28(%a6),%d0 + move.l %d0,%a0 + jbra .L1 + .align 2 +.L51: + btst #6,-29(%a6) + jbeq .L31 + fmove.d -28(%a6),%fp0 + jbra .L1 + .align 2 +.L31: + move.l -28(%a6),%d0 + move.l -24(%a6),%d1 + jbra .L1 + .align 2 +.L50: + move.l -32(%a6),%d2 + btst #6,%d2 + jbeq .L25 + fmove.s -28(%a6),%fp0 + jbra .L1 + .align 2 +.L25: + btst #5,%d2 + jbeq .L27 + fmove.s -28(%a6),%fp1 + fmove.d %fp1,-(%sp) + move.l (%sp)+,%d0 + move.l (%sp)+,%d1 + jbra .L1 + .align 2 +.L27: + move.l -28(%a6),%d0 + jbra .L1 + .align 2 +.L45: + move.l -28(%a6),%d0 + jbra .L1 + .align 2 +.L49: + clr.l %d0 + move.w -28(%a6),%d0 + jbra .L1 + .align 2 +.L48: + move.w -28(%a6),%d0 + ext.l %d0 + jbra .L1 + .align 2 +.L47: + clr.l %d0 + move.b -28(%a6),%d0 + jbra .L1 + .align 2 +.L46: + move.b -28(%a6),%d0 + extb.l %d0 +.L1: + movm.l -48(%a6),#0xc0c + unlk %a6 + rts +.Lfe1: + .size callback_receiver,.Lfe1-callback_receiver + .align 2 + .globl callback_get_receiver + .type callback_get_receiver,@function +callback_get_receiver: + link.w %a6,#0 + move.l %a5,-(%sp) + lea (%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %a5 + move.l callback_receiver@GOT(%a5),%a0 + move.l %a0,%d0 + move.l (%sp)+,%a5 + unlk %a6 + rts +.Lfe2: + .size callback_get_receiver,.Lfe2-callback_get_receiver + .ident "GCC: (GNU) 3.1" diff --git a/callback/vacall_r/vacall-m68k-sun.s b/callback/vacall_r/vacall-m68k-sun.s new file mode 100644 index 0000000..86f3f16 --- /dev/null +++ b/callback/vacall_r/vacall-m68k-sun.s @@ -0,0 +1,178 @@ +#NO_APP + .text + .even +_callback_receiver: + link a6,#-32 + moveml #0x3030,sp@- + clrl a6@(-32) + lea a6@(8),a2 + movel a2,a6@(-20) + clrl a6@(-16) + clrl a6@(-12) + movel a1,a6@(-4) + pea a6@(-32) + movel a0@(4),sp@- + movel a0@,a2 + jsr a2@ + addql #8,sp + movel a6@(-12),a3 + tstl a3 + jeq L1 + moveq #1,d2 + cmpl a3,d2 + jeq L46 + moveq #2,d3 + cmpl a3,d3 + jeq L46 + moveq #3,d2 + cmpl a3,d2 + jeq L47 + moveq #4,d3 + cmpl a3,d3 + jeq L48 + moveq #5,d2 + cmpl a3,d2 + jeq L49 + moveq #6,d3 + cmpl a3,d3 + jeq L45 + moveq #7,d2 + cmpl a3,d2 + jeq L45 + moveq #8,d3 + cmpl a3,d3 + jeq L45 + moveq #9,d2 + cmpl a3,d2 + jeq L45 + lea a3@(-10),a2 + moveq #1,d3 + cmpl a2,d3 + jcs L22 + movel a6@(-28),d0 + movel a6@(-24),d1 + jra L1 + .even +L22: + moveq #12,d2 + cmpl a3,d2 + jeq L50 + moveq #13,d2 + cmpl a3,d2 + jeq L51 + moveq #14,d3 + cmpl a3,d3 + jeq L52 + moveq #15,d2 + cmpl a3,d2 + jne L1 + btst #2,a6@(-30) + jeq L1 + movel a6@(-8),d2 + moveq #1,d3 + cmpl d2,d3 + jeq L53 + moveq #2,d3 + cmpl d2,d3 + jeq L54 + moveq #4,d3 + cmpl d2,d3 + jeq L55 + moveq #8,d3 + cmpl d2,d3 + jne L1 + movel a6@(-16),a2 + movel a2@,d0 + movel a2@(4),d1 + jra L1 + .even +L55: + movel a6@(-16),a2 + movel a2@,d0 + jra L1 + .even +L54: + movel a6@(-16),a2 + clrl d0 + movew a2@,d0 + jra L1 + .even +L53: + movel a6@(-16),a2 + clrl d0 + moveb a2@,d0 + jra L1 + .even +L52: + movel a6@(-28),d0 + movel d0,a0 + jra L1 + .even +L51: + btst #6,a6@(-29) + jeq L31 + fmoved a6@(-28),fp0 + jra L1 + .even +L31: + movel a6@(-28),d0 + movel a6@(-24),d1 + jra L1 + .even +L50: + movel a6@(-32),d2 + btst #6,d2 + jeq L25 + fmoves a6@(-28),fp0 + jra L1 + .even +L25: + btst #5,d2 + jeq L27 + fmoves a6@(-28),fp1 + fmoved fp1,sp@- + movel sp@+,d0 + movel sp@+,d1 + jra L1 + .even +L27: + movel a6@(-28),d0 + jra L1 + .even +L45: + movel a6@(-28),d0 + jra L1 + .even +L49: + clrl d0 + movew a6@(-28),d0 + jra L1 + .even +L48: + movew a6@(-28),d0 + extl d0 + jra L1 + .even +L47: + clrl d0 + moveb a6@(-28),d0 + jra L1 + .even +L46: + moveb a6@(-28),d0 + extbl d0 +L1: + moveml a6@(-48),#0xc0c + unlk a6 + rts + .even + .globl _callback_get_receiver +_callback_get_receiver: + link a6,#0 + movel a5,sp@- + movel #__GLOBAL_OFFSET_TABLE_, a5 + lea pc@(0,a5:l),a5 + movel a5@(_callback_receiver:l),d0 + movel sp@+,a5 + unlk a6 + rts diff --git a/callback/vacall_r/vacall-m68k.mit.S b/callback/vacall_r/vacall-m68k.mit.S new file mode 100644 index 0000000..5acb6a8 --- /dev/null +++ b/callback/vacall_r/vacall-m68k.mit.S @@ -0,0 +1,183 @@ +#include "asm-m68k.h" + .text + .even +FUNBEGIN(callback_receiver) + link $a6,#-32 + moveml #0x3030,$sp@- + clrl $a6@(-32) + lea $a6@(8),$a2 + movel $a2,$a6@(-20) + clrl $a6@(-16) + clrl $a6@(-12) + movel $a1,$a6@(-4) + pea $a6@(-32) + movel $a0@(4),$sp@- + movel $a0@,$a2 + jsr $a2@ + addql #8,$sp + movel $a6@(-12),$a3 + tstl $a3 + jeq L(1) + moveq #1,$d2 + cmpl $a3,$d2 + jeq L(46) + moveq #2,$d3 + cmpl $a3,$d3 + jeq L(46) + moveq #3,$d2 + cmpl $a3,$d2 + jeq L(47) + moveq #4,$d3 + cmpl $a3,$d3 + jeq L(48) + moveq #5,$d2 + cmpl $a3,$d2 + jeq L(49) + moveq #6,$d3 + cmpl $a3,$d3 + jeq L(45) + moveq #7,$d2 + cmpl $a3,$d2 + jeq L(45) + moveq #8,$d3 + cmpl $a3,$d3 + jeq L(45) + moveq #9,$d2 + cmpl $a3,$d2 + jeq L(45) + lea $a3@(-10),$a2 + moveq #1,$d3 + cmpl $a2,$d3 + jcs L(22) + movel $a6@(-28),$d0 + movel $a6@(-24),$d1 + jra L(1) + .even +L(22): + moveq #12,$d2 + cmpl $a3,$d2 + jeq L(50) + moveq #13,$d2 + cmpl $a3,$d2 + jeq L(51) + moveq #14,$d3 + cmpl $a3,$d3 + jeq L(52) + moveq #15,$d2 + cmpl $a3,$d2 + jne L(1) + btst #2,$a6@(-30) + jeq L(1) + movel $a6@(-8),$d2 + moveq #1,$d3 + cmpl $d2,$d3 + jeq L(53) + moveq #2,$d3 + cmpl $d2,$d3 + jeq L(54) + moveq #4,$d3 + cmpl $d2,$d3 + jeq L(55) + moveq #8,$d3 + cmpl $d2,$d3 + jne L(1) + movel $a6@(-16),$a2 + movel $a2@,$d0 + movel $a2@(4),$d1 + jra L(1) + .even +L(55): + movel $a6@(-16),$a2 + movel $a2@,$d0 + jra L(1) + .even +L(54): + movel $a6@(-16),$a2 + clrl $d0 + movew $a2@,$d0 + jra L(1) + .even +L(53): + movel $a6@(-16),$a2 + clrl $d0 + moveb $a2@,$d0 + jra L(1) + .even +L(52): + movel $a6@(-28),$d0 + movel $d0,$a0 + jra L(1) + .even +L(51): + btst #6,$a6@(-29) + jeq L(31) + fmoved $a6@(-28),$fp0 + jra L(1) + .even +L(31): + movel $a6@(-28),$d0 + movel $a6@(-24),$d1 + jra L(1) + .even +L(50): + movel $a6@(-32),$d2 + btst #6,$d2 + jeq L(25) + fmoves $a6@(-28),$fp0 + jra L(1) + .even +L(25): + btst #5,$d2 + jeq L(27) + fmoves $a6@(-28),$fp1 + fmoved $fp1,$sp@- + movel $sp@+,$d0 + movel $sp@+,$d1 + jra L(1) + .even +L(27): + movel $a6@(-28),$d0 + jra L(1) + .even +L(45): + movel $a6@(-28),$d0 + jra L(1) + .even +L(49): + clrl $d0 + movew $a6@(-28),$d0 + jra L(1) + .even +L(48): + movew $a6@(-28),$d0 + extl $d0 + jra L(1) + .even +L(47): + clrl $d0 + moveb $a6@(-28),$d0 + jra L(1) + .even +L(46): + moveb $a6@(-28),$d0 + extbl $d0 +L(1): + moveml $a6@(-48),#0xc0c + unlk $a6 + rts + .even + .globl C(callback_get_receiver) + DECLARE_FUNCTION(callback_get_receiver) +FUNBEGIN(callback_get_receiver) + link $a6,#0 + movel $a5,$sp@- + movel #C(_GLOBAL_OFFSET_TABLE_), $a5 + lea $pc@(0,$a5:l),$a5 + movel $a5@(C(callback_receiver):l),$d0 + movel $sp@+,$a5 + unlk $a6 + rts +FUNEND(callback_get_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-m68k.motorola.S b/callback/vacall_r/vacall-m68k.motorola.S new file mode 100644 index 0000000..7910d88 --- /dev/null +++ b/callback/vacall_r/vacall-m68k.motorola.S @@ -0,0 +1,187 @@ +#include "asm-m68k.h" + .text + .align 2 + DECLARE_FUNCTION(callback_receiver) +FUNBEGIN(callback_receiver) + link.w %a6,#-32 + movm.l #0x3030,-(%sp) + clr.l -32(%a6) + lea (8,%a6),%a2 + move.l %a2,-20(%a6) + clr.l -16(%a6) + clr.l -12(%a6) + move.l %a1,-4(%a6) + pea -32(%a6) + move.l 4(%a0),-(%sp) + move.l (%a0),%a2 + jsr (%a2) + addq.l #8,%sp + move.l -12(%a6),%a3 + tst.l %a3 + jbeq L(1) + moveq.l #1,%d2 + cmp.l %a3,%d2 + jbeq L(46) + moveq.l #2,%d3 + cmp.l %a3,%d3 + jbeq L(46) + moveq.l #3,%d2 + cmp.l %a3,%d2 + jbeq L(47) + moveq.l #4,%d3 + cmp.l %a3,%d3 + jbeq L(48) + moveq.l #5,%d2 + cmp.l %a3,%d2 + jbeq L(49) + moveq.l #6,%d3 + cmp.l %a3,%d3 + jbeq L(45) + moveq.l #7,%d2 + cmp.l %a3,%d2 + jbeq L(45) + moveq.l #8,%d3 + cmp.l %a3,%d3 + jbeq L(45) + moveq.l #9,%d2 + cmp.l %a3,%d2 + jbeq L(45) + lea (-10,%a3),%a2 + moveq.l #1,%d3 + cmp.l %a2,%d3 + jbcs L(22) + move.l -28(%a6),%d0 + move.l -24(%a6),%d1 + jbra L(1) + .align 2 +L(22): + moveq.l #12,%d2 + cmp.l %a3,%d2 + jbeq L(50) + moveq.l #13,%d2 + cmp.l %a3,%d2 + jbeq L(51) + moveq.l #14,%d3 + cmp.l %a3,%d3 + jbeq L(52) + moveq.l #15,%d2 + cmp.l %a3,%d2 + jbne L(1) + btst #2,-30(%a6) + jbeq L(1) + move.l -8(%a6),%d2 + moveq.l #1,%d3 + cmp.l %d2,%d3 + jbeq L(53) + moveq.l #2,%d3 + cmp.l %d2,%d3 + jbeq L(54) + moveq.l #4,%d3 + cmp.l %d2,%d3 + jbeq L(55) + moveq.l #8,%d3 + cmp.l %d2,%d3 + jbne L(1) + move.l -16(%a6),%a2 + move.l (%a2),%d0 + move.l 4(%a2),%d1 + jbra L(1) + .align 2 +L(55): + move.l -16(%a6),%a2 + move.l (%a2),%d0 + jbra L(1) + .align 2 +L(54): + move.l -16(%a6),%a2 + clr.l %d0 + move.w (%a2),%d0 + jbra L(1) + .align 2 +L(53): + move.l -16(%a6),%a2 + clr.l %d0 + move.b (%a2),%d0 + jbra L(1) + .align 2 +L(52): + move.l -28(%a6),%d0 + move.l %d0,%a0 + jbra L(1) + .align 2 +L(51): + btst #6,-29(%a6) + jbeq L(31) + fmove.d -28(%a6),%fp0 + jbra L(1) + .align 2 +L(31): + move.l -28(%a6),%d0 + move.l -24(%a6),%d1 + jbra L(1) + .align 2 +L(50): + move.l -32(%a6),%d2 + btst #6,%d2 + jbeq L(25) + fmove.s -28(%a6),%fp0 + jbra L(1) + .align 2 +L(25): + btst #5,%d2 + jbeq L(27) + fmove.s -28(%a6),%fp1 + fmove.d %fp1,-(%sp) + move.l (%sp)+,%d0 + move.l (%sp)+,%d1 + jbra L(1) + .align 2 +L(27): + move.l -28(%a6),%d0 + jbra L(1) + .align 2 +L(45): + move.l -28(%a6),%d0 + jbra L(1) + .align 2 +L(49): + clr.l %d0 + move.w -28(%a6),%d0 + jbra L(1) + .align 2 +L(48): + move.w -28(%a6),%d0 + ext.l %d0 + jbra L(1) + .align 2 +L(47): + clr.l %d0 + move.b -28(%a6),%d0 + jbra L(1) + .align 2 +L(46): + move.b -28(%a6),%d0 + extb.l %d0 +L(1): + movm.l -48(%a6),#0xc0c + unlk %a6 + rts +L(fe1): + FUNEND(callback_receiver) + .align 2 + .globl C(callback_get_receiver) + DECLARE_FUNCTION(callback_get_receiver) +FUNBEGIN(callback_get_receiver) + link.w %a6,#0 + move.l %a5,-(%sp) + lea (%pc, _GLOBAL_OFFSET_TABLE_@GOTPC), %a5 + move.l callback_receiver@GOT(%a5),%a0 + move.l %a0,%d0 + move.l (%sp)+,%a5 + unlk %a6 + rts +L(fe2): + FUNEND(callback_get_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-mips64eb-linux.s b/callback/vacall_r/vacall-mips64eb-linux.s new file mode 100644 index 0000000..26582be --- /dev/null +++ b/callback/vacall_r/vacall-mips64eb-linux.s @@ -0,0 +1,385 @@ + .file 1 "vacall-mips64.c" + .section .mdebug.abi64 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .set nomips16 + .set nomicromips + .ent callback_receiver + .type callback_receiver, @function +callback_receiver: + .frame $fp,272,$31 # vars= 160, regs= 6/0, args= 0, gp= 0 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + daddiu $sp,$sp,-272 + sd $fp,192($sp) + move $fp,$sp + sd $4,208($fp) + ld $4,8($2) + ld $25,0($2) + daddiu $12,$fp,208 + sd $31,200($sp) + sd $18,176($sp) + sd $17,168($sp) + sd $16,160($sp) + sd $5,216($fp) + sd $6,224($fp) + sd $7,232($fp) + sd $8,240($fp) + sd $9,248($fp) + sd $10,256($fp) + sd $11,264($fp) + sdc1 $f12,96($fp) + sdc1 $f13,104($fp) + sdc1 $f14,112($fp) + sdc1 $f15,120($fp) + sdc1 $f16,128($fp) + sdc1 $f17,136($fp) + sdc1 $f18,144($fp) + sdc1 $f19,152($fp) + swc1 $f12,60($fp) + swc1 $f13,64($fp) + swc1 $f14,68($fp) + swc1 $f15,72($fp) + swc1 $f16,76($fp) + swc1 $f17,80($fp) + swc1 $f18,84($fp) + move $5,$fp + swc1 $f19,88($fp) + sd $12,24($fp) + sw $0,0($fp) + sd $0,32($fp) + sw $0,40($fp) + jalr $25 + sw $0,56($fp) + + lw $12,40($fp) + beq $12,$0,.L1 + li $13,1 # 0x1 + + beq $12,$13,.L43 + li $13,2 # 0x2 + + beq $12,$13,.L43 + li $13,3 # 0x3 + + beq $12,$13,.L46 + li $13,4 # 0x4 + + beq $12,$13,.L47 + li $13,5 # 0x5 + + beq $12,$13,.L48 + li $13,6 # 0x6 + + beq $12,$13,.L49 + li $13,7 # 0x7 + + beq $12,$13,.L50 + li $13,8 # 0x8 + + beq $12,$13,.L44 + li $13,9 # 0x9 + + beq $12,$13,.L44 + li $13,10 # 0xa + + beq $12,$13,.L44 + li $13,11 # 0xb + + beq $12,$13,.L44 + li $13,12 # 0xc + + beq $12,$13,.L51 + li $13,13 # 0xd + + beq $12,$13,.L52 + li $13,14 # 0xe + + beq $12,$13,.L44 + li $13,15 # 0xf + + bnel $12,$13,.L58 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + ld $14,48($fp) + + ld $12,48($fp) + li $13,1 # 0x1 + beq $12,$13,.L53 + li $13,2 # 0x2 + + beq $12,$13,.L54 + li $13,4 # 0x4 + + beq $12,$13,.L55 + li $13,8 # 0x8 + + bnel $12,$13,.L58 + move $sp,$fp + + ld $12,32($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L58: + ld $31,200($sp) + ld $fp,192($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L43: + move $sp,$fp + ld $31,200($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + lb $2,8($fp) + ld $fp,192($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L44: + b .L1 + ld $2,8($fp) + + .align 3 +.L46: + b .L1 + lbu $2,8($fp) + + .align 3 +.L47: + b .L1 + lh $2,8($fp) + + .align 3 +.L48: + b .L1 + lhu $2,8($fp) + + .align 3 +.L49: + b .L1 + lw $2,8($fp) + + .align 3 +.L51: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L50: + b .L1 + lwu $2,8($fp) + +.L52: + b .L1 + ldc1 $f0,8($fp) + +.L19: + daddiu $13,$14,-1 + sltu $13,$13,16 + beql $13,$0,.L59 + andi $13,$12,0x800 + + ld $13,32($fp) + li $24,-8 # 0xfffffffffffffff8 + sltu $25,$14,9 + andi $15,$13,0x7 + and $24,$13,$24 + beq $25,$0,.L24 + daddu $13,$14,$15 + + sltu $25,$13,9 + sll $13,$13,0 + beq $25,$0,.L25 + subu $13,$0,$13 + + ld $25,0($24) + sll $13,$13,3 + li $24,-1 # 0xffffffffffffffff + dsll $13,$24,$13 + and $13,$13,$25 + sll $15,$15,3 + dsll $2,$13,$15 +.L23: + andi $13,$12,0x800 +.L59: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 # 0x4 + beq $14,$13,.L56 + li $13,8 # 0x8 + + beql $14,$13,.L57 + ld $13,32($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L58 + move $sp,$fp + + li $12,16 # 0x10 +.L60: + bnel $14,$12,.L58 + move $sp,$fp + + ld $12,32($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 # 0x8 + + bne $14,$12,.L60 + li $12,16 # 0x10 + + ld $13,32($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + sll $13,$13,0 + + ld $18,8($24) + subu $13,$0,$13 + move $16,$15 + li $25,-1 # 0xffffffffffffffff + subu $15,$0,$15 + sll $13,$13,3 + dsll $13,$25,$13 + ld $17,0($24) + sll $25,$15,2 + addiu $24,$25,32 + and $13,$13,$18 + sll $15,$16,3 + dsra $25,$13,$24 + dsll $16,$17,$15 + dsra $24,$25,$24 + or $2,$16,$24 + b .L23 + dsll $3,$13,$15 + +.L53: + ld $12,32($fp) + b .L1 + lbu $2,0($12) + +.L54: + ld $12,32($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $18,16($24) + subu $13,$0,$13 + ld $16,8($24) + ld $17,0($24) + subu $25,$0,$15 + sll $13,$13,3 + li $24,-1 # 0xffffffffffffffff + dsll $24,$24,$13 + sll $25,$25,3 + sll $15,$15,3 + addiu $25,$25,64 + and $13,$24,$18 + dsra $13,$13,$25 + dsll $24,$17,$15 + dsra $17,$16,$25 + dsll $15,$16,$15 + or $2,$24,$17 + b .L23 + or $3,$13,$15 + +.L56: + ld $12,32($fp) + b .L1 + lwc1 $f0,0($12) + +.L55: + ld $12,32($fp) + b .L1 + lwu $2,0($12) + +.L25: + ld $16,8($24) + ld $25,0($24) + sll $13,$13,3 + li $24,-1 # 0xffffffffffffffff + dsll $13,$24,$13 + subu $24,$0,$15 + and $13,$13,$16 + sll $24,$24,3 + sll $15,$15,3 + dsra $13,$13,$24 + dsll $15,$25,$15 + b .L23 + or $2,$13,$15 + +.L57: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .align 3 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: + .frame $fp,16,$31 # vars= 0, regs= 1/0, args= 0, gp= 0 + .mask 0x40000000,-8 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + lui $13,%hi(%neg(%gp_rel(callback_get_receiver))) + daddu $13,$13,$25 + daddiu $13,$13,%lo(%neg(%gp_rel(callback_get_receiver))) + daddiu $sp,$sp,-16 + ld $12,%got_page(callback_receiver)($13) + sd $fp,8($sp) + move $fp,$sp + move $sp,$fp + ld $fp,8($sp) + daddiu $2,$12,%got_ofst(callback_receiver) + j $31 + daddiu $sp,$sp,16 + + .set macro + .set reorder + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/callback/vacall_r/vacall-mips64eb-macro.S b/callback/vacall_r/vacall-mips64eb-macro.S new file mode 100644 index 0000000..a0cd04c --- /dev/null +++ b/callback/vacall_r/vacall-mips64eb-macro.S @@ -0,0 +1,379 @@ +#include "asm-mips.h" + .file 1 "vacall-mips64.c" + .text + .align 2 + .align 3 + .set nomips16 + .set nomicromips + .ent callback_receiver + DECLARE_FUNCTION(callback_receiver) +callback_receiver: + .frame $fp,272,$31 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + daddiu $sp,$sp,-272 + sd $fp,192($sp) + move $fp,$sp + sd $4,208($fp) + ld $4,8($2) + ld $25,0($2) + daddiu $12,$fp,208 + sd $31,200($sp) + sd $18,176($sp) + sd $17,168($sp) + sd $16,160($sp) + sd $5,216($fp) + sd $6,224($fp) + sd $7,232($fp) + sd $8,240($fp) + sd $9,248($fp) + sd $10,256($fp) + sd $11,264($fp) + sdc1 $f12,96($fp) + sdc1 $f13,104($fp) + sdc1 $f14,112($fp) + sdc1 $f15,120($fp) + sdc1 $f16,128($fp) + sdc1 $f17,136($fp) + sdc1 $f18,144($fp) + sdc1 $f19,152($fp) + swc1 $f12,60($fp) + swc1 $f13,64($fp) + swc1 $f14,68($fp) + swc1 $f15,72($fp) + swc1 $f16,76($fp) + swc1 $f17,80($fp) + swc1 $f18,84($fp) + move $5,$fp + swc1 $f19,88($fp) + sd $12,24($fp) + sw $0,0($fp) + sd $0,32($fp) + sw $0,40($fp) + jalr $25 + sw $0,56($fp) + + lw $12,40($fp) + beq $12,$0,.L1 + li $13,1 + + beq $12,$13,.L43 + li $13,2 + + beq $12,$13,.L43 + li $13,3 + + beq $12,$13,.L46 + li $13,4 + + beq $12,$13,.L47 + li $13,5 + + beq $12,$13,.L48 + li $13,6 + + beq $12,$13,.L49 + li $13,7 + + beq $12,$13,.L50 + li $13,8 + + beq $12,$13,.L44 + li $13,9 + + beq $12,$13,.L44 + li $13,10 + + beq $12,$13,.L44 + li $13,11 + + beq $12,$13,.L44 + li $13,12 + + beq $12,$13,.L51 + li $13,13 + + beq $12,$13,.L52 + li $13,14 + + beq $12,$13,.L44 + li $13,15 + + bnel $12,$13,.L58 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + ld $14,48($fp) + + ld $12,48($fp) + li $13,1 + beq $12,$13,.L53 + li $13,2 + + beq $12,$13,.L54 + li $13,4 + + beq $12,$13,.L55 + li $13,8 + + bnel $12,$13,.L58 + move $sp,$fp + + ld $12,32($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L58: + ld $31,200($sp) + ld $fp,192($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L43: + move $sp,$fp + ld $31,200($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + lb $2,8($fp) + ld $fp,192($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L44: + b .L1 + ld $2,8($fp) + + .align 3 +.L46: + b .L1 + lbu $2,8($fp) + + .align 3 +.L47: + b .L1 + lh $2,8($fp) + + .align 3 +.L48: + b .L1 + lhu $2,8($fp) + + .align 3 +.L49: + b .L1 + lw $2,8($fp) + + .align 3 +.L51: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L50: + b .L1 + lwu $2,8($fp) + +.L52: + b .L1 + ldc1 $f0,8($fp) + +.L19: + daddiu $13,$14,-1 + sltu $13,$13,16 + beql $13,$0,.L59 + andi $13,$12,0x800 + + ld $13,32($fp) + li $24,-8 + sltu $25,$14,9 + andi $15,$13,0x7 + and $24,$13,$24 + beq $25,$0,.L24 + daddu $13,$14,$15 + + sltu $25,$13,9 + sll $13,$13,0 + beq $25,$0,.L25 + subu $13,$0,$13 + + ld $25,0($24) + sll $13,$13,3 + li $24,-1 + dsll $13,$24,$13 + and $13,$13,$25 + sll $15,$15,3 + dsll $2,$13,$15 +.L23: + andi $13,$12,0x800 +.L59: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 + beq $14,$13,.L56 + li $13,8 + + beql $14,$13,.L57 + ld $13,32($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L58 + move $sp,$fp + + li $12,16 +.L60: + bnel $14,$12,.L58 + move $sp,$fp + + ld $12,32($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 + + bne $14,$12,.L60 + li $12,16 + + ld $13,32($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + sll $13,$13,0 + + ld $18,8($24) + subu $13,$0,$13 + move $16,$15 + li $25,-1 + subu $15,$0,$15 + sll $13,$13,3 + dsll $13,$25,$13 + ld $17,0($24) + sll $25,$15,2 + addiu $24,$25,32 + and $13,$13,$18 + sll $15,$16,3 + dsra $25,$13,$24 + dsll $16,$17,$15 + dsra $24,$25,$24 + or $2,$16,$24 + b .L23 + dsll $3,$13,$15 + +.L53: + ld $12,32($fp) + b .L1 + lbu $2,0($12) + +.L54: + ld $12,32($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $18,16($24) + subu $13,$0,$13 + ld $16,8($24) + ld $17,0($24) + subu $25,$0,$15 + sll $13,$13,3 + li $24,-1 + dsll $24,$24,$13 + sll $25,$25,3 + sll $15,$15,3 + addiu $25,$25,64 + and $13,$24,$18 + dsra $13,$13,$25 + dsll $24,$17,$15 + dsra $17,$16,$25 + dsll $15,$16,$15 + or $2,$24,$17 + b .L23 + or $3,$13,$15 + +.L56: + ld $12,32($fp) + b .L1 + lwc1 $f0,0($12) + +.L55: + ld $12,32($fp) + b .L1 + lwu $2,0($12) + +.L25: + ld $16,8($24) + ld $25,0($24) + sll $13,$13,3 + li $24,-1 + dsll $13,$24,$13 + subu $24,$0,$15 + and $13,$13,$16 + sll $24,$24,3 + sll $15,$15,3 + dsra $13,$13,$24 + dsll $15,$25,$15 + b .L23 + or $2,$13,$15 + +.L57: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .align 3 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + DECLARE_FUNCTION(callback_get_receiver) +callback_get_receiver: + .frame $fp,16,$31 + .mask 0x40000000,-8 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + lui $13,%hi(%neg(%gp_rel(callback_get_receiver))) + daddu $13,$13,$25 + daddiu $13,$13,%lo(%neg(%gp_rel(callback_get_receiver))) + daddiu $sp,$sp,-16 + ld $12,%got_page(callback_receiver)($13) + sd $fp,8($sp) + move $fp,$sp + move $sp,$fp + ld $fp,8($sp) + daddiu $2,$12,%got_ofst(callback_receiver) + j $31 + daddiu $sp,$sp,16 + + .set macro + .set reorder + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver diff --git a/callback/vacall_r/vacall-mips64el-linux.s b/callback/vacall_r/vacall-mips64el-linux.s new file mode 100644 index 0000000..152978d --- /dev/null +++ b/callback/vacall_r/vacall-mips64el-linux.s @@ -0,0 +1,389 @@ + .file 1 "vacall-mips64.c" + .section .mdebug.abi64 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .set nomips16 + .set nomicromips + .ent callback_receiver + .type callback_receiver, @function +callback_receiver: + .frame $fp,272,$31 # vars= 160, regs= 6/0, args= 0, gp= 0 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + daddiu $sp,$sp,-272 + sd $fp,192($sp) + move $fp,$sp + sd $4,208($fp) + ld $4,8($2) + ld $25,0($2) + daddiu $12,$fp,208 + sd $31,200($sp) + sd $18,176($sp) + sd $17,168($sp) + sd $16,160($sp) + sd $5,216($fp) + sd $6,224($fp) + sd $7,232($fp) + sd $8,240($fp) + sd $9,248($fp) + sd $10,256($fp) + sd $11,264($fp) + sdc1 $f12,96($fp) + sdc1 $f13,104($fp) + sdc1 $f14,112($fp) + sdc1 $f15,120($fp) + sdc1 $f16,128($fp) + sdc1 $f17,136($fp) + sdc1 $f18,144($fp) + sdc1 $f19,152($fp) + swc1 $f12,60($fp) + swc1 $f13,64($fp) + swc1 $f14,68($fp) + swc1 $f15,72($fp) + swc1 $f16,76($fp) + swc1 $f17,80($fp) + swc1 $f18,84($fp) + move $5,$fp + swc1 $f19,88($fp) + sd $12,24($fp) + sw $0,0($fp) + sd $0,32($fp) + sw $0,40($fp) + jalr $25 + sw $0,56($fp) + + lw $12,40($fp) + beq $12,$0,.L1 + li $13,1 # 0x1 + + beq $12,$13,.L43 + li $13,2 # 0x2 + + beq $12,$13,.L43 + li $13,3 # 0x3 + + beq $12,$13,.L46 + li $13,4 # 0x4 + + beq $12,$13,.L47 + li $13,5 # 0x5 + + beq $12,$13,.L48 + li $13,6 # 0x6 + + beq $12,$13,.L49 + li $13,7 # 0x7 + + beq $12,$13,.L50 + li $13,8 # 0x8 + + beq $12,$13,.L44 + li $13,9 # 0x9 + + beq $12,$13,.L44 + li $13,10 # 0xa + + beq $12,$13,.L44 + li $13,11 # 0xb + + beq $12,$13,.L44 + li $13,12 # 0xc + + beq $12,$13,.L51 + li $13,13 # 0xd + + beq $12,$13,.L52 + li $13,14 # 0xe + + beq $12,$13,.L44 + li $13,15 # 0xf + + bnel $12,$13,.L58 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + ld $14,48($fp) + + ld $12,48($fp) + li $13,1 # 0x1 + beq $12,$13,.L53 + li $13,2 # 0x2 + + beq $12,$13,.L54 + li $13,4 # 0x4 + + beq $12,$13,.L55 + li $13,8 # 0x8 + + bnel $12,$13,.L58 + move $sp,$fp + + ld $12,32($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L58: + ld $31,200($sp) + ld $fp,192($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L43: + move $sp,$fp + ld $31,200($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + lb $2,8($fp) + ld $fp,192($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L44: + b .L1 + ld $2,8($fp) + + .align 3 +.L46: + b .L1 + lbu $2,8($fp) + + .align 3 +.L47: + b .L1 + lh $2,8($fp) + + .align 3 +.L48: + b .L1 + lhu $2,8($fp) + + .align 3 +.L49: + b .L1 + lw $2,8($fp) + + .align 3 +.L51: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L50: + b .L1 + lwu $2,8($fp) + +.L52: + b .L1 + ldc1 $f0,8($fp) + +.L19: + daddiu $13,$14,-1 + sltu $13,$13,16 + beql $13,$0,.L59 + andi $13,$12,0x800 + + ld $13,32($fp) + li $15,-8 # 0xfffffffffffffff8 + sltu $25,$14,9 + andi $24,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + daddu $13,$14,$24 + + sltu $25,$13,9 + beq $25,$0,.L25 + dsll $13,$13,3 + + daddiu $13,$13,-1 + ld $25,0($15) + sll $13,$13,0 + li $15,2 # 0x2 + dsll $13,$15,$13 + daddiu $13,$13,-1 + and $13,$13,$25 + sll $24,$24,3 + dsra $2,$13,$24 +.L23: + andi $13,$12,0x800 +.L59: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 # 0x4 + beq $14,$13,.L56 + li $13,8 # 0x8 + + beql $14,$13,.L57 + ld $13,32($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L58 + move $sp,$fp + + li $12,16 # 0x10 +.L60: + bnel $14,$12,.L58 + move $sp,$fp + + ld $12,32($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 # 0x8 + + bne $14,$12,.L60 + li $12,16 # 0x10 + + ld $13,32($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + dsll $13,$13,3 + + daddiu $13,$13,-65 + ld $17,8($15) + li $25,2 # 0x2 + sll $13,$13,0 + dsll $13,$25,$13 + subu $25,$0,$24 + sll $25,$25,2 + ld $16,0($15) + daddiu $13,$13,-1 + addiu $15,$25,32 + and $13,$13,$17 + sll $24,$24,3 + dsll $25,$13,$15 + dsra $16,$16,$24 + dsll $15,$25,$15 + or $2,$16,$15 + b .L23 + dsra $3,$13,$24 + +.L53: + ld $12,32($fp) + b .L1 + lbu $2,0($12) + +.L54: + ld $12,32($fp) + b .L1 + lhu $2,0($12) + +.L26: + daddiu $13,$13,-129 + ld $16,8($15) + ld $17,0($15) + sll $13,$13,0 + ld $18,16($15) + li $15,2 # 0x2 + subu $25,$0,$24 + dsll $15,$15,$13 + daddiu $15,$15,-1 + sll $25,$25,3 + sll $24,$24,3 + addiu $25,$25,64 + and $13,$15,$18 + dsll $13,$13,$25 + dsra $15,$17,$24 + dsll $17,$16,$25 + dsra $24,$16,$24 + or $2,$15,$17 + b .L23 + or $3,$13,$24 + +.L56: + ld $12,32($fp) + b .L1 + lwc1 $f0,0($12) + +.L55: + ld $12,32($fp) + b .L1 + lwu $2,0($12) + +.L25: + daddiu $13,$13,-65 + li $25,2 # 0x2 + sll $13,$13,0 + ld $17,8($15) + dsll $13,$25,$13 + ld $25,0($15) + daddiu $13,$13,-1 + subu $16,$0,$24 + and $15,$13,$17 + sll $24,$24,3 + sll $13,$16,3 + dsll $13,$15,$13 + dsra $24,$25,$24 + b .L23 + or $2,$13,$24 + +.L57: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .align 3 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: + .frame $fp,16,$31 # vars= 0, regs= 1/0, args= 0, gp= 0 + .mask 0x40000000,-8 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + lui $13,%hi(%neg(%gp_rel(callback_get_receiver))) + daddu $13,$13,$25 + daddiu $13,$13,%lo(%neg(%gp_rel(callback_get_receiver))) + daddiu $sp,$sp,-16 + ld $12,%got_page(callback_receiver)($13) + sd $fp,8($sp) + move $fp,$sp + move $sp,$fp + ld $fp,8($sp) + daddiu $2,$12,%got_ofst(callback_receiver) + j $31 + daddiu $sp,$sp,16 + + .set macro + .set reorder + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/callback/vacall_r/vacall-mips64el-macro.S b/callback/vacall_r/vacall-mips64el-macro.S new file mode 100644 index 0000000..d2d7d89 --- /dev/null +++ b/callback/vacall_r/vacall-mips64el-macro.S @@ -0,0 +1,383 @@ +#include "asm-mips.h" + .file 1 "vacall-mips64.c" + .text + .align 2 + .align 3 + .set nomips16 + .set nomicromips + .ent callback_receiver + DECLARE_FUNCTION(callback_receiver) +callback_receiver: + .frame $fp,272,$31 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + daddiu $sp,$sp,-272 + sd $fp,192($sp) + move $fp,$sp + sd $4,208($fp) + ld $4,8($2) + ld $25,0($2) + daddiu $12,$fp,208 + sd $31,200($sp) + sd $18,176($sp) + sd $17,168($sp) + sd $16,160($sp) + sd $5,216($fp) + sd $6,224($fp) + sd $7,232($fp) + sd $8,240($fp) + sd $9,248($fp) + sd $10,256($fp) + sd $11,264($fp) + sdc1 $f12,96($fp) + sdc1 $f13,104($fp) + sdc1 $f14,112($fp) + sdc1 $f15,120($fp) + sdc1 $f16,128($fp) + sdc1 $f17,136($fp) + sdc1 $f18,144($fp) + sdc1 $f19,152($fp) + swc1 $f12,60($fp) + swc1 $f13,64($fp) + swc1 $f14,68($fp) + swc1 $f15,72($fp) + swc1 $f16,76($fp) + swc1 $f17,80($fp) + swc1 $f18,84($fp) + move $5,$fp + swc1 $f19,88($fp) + sd $12,24($fp) + sw $0,0($fp) + sd $0,32($fp) + sw $0,40($fp) + jalr $25 + sw $0,56($fp) + + lw $12,40($fp) + beq $12,$0,.L1 + li $13,1 + + beq $12,$13,.L43 + li $13,2 + + beq $12,$13,.L43 + li $13,3 + + beq $12,$13,.L46 + li $13,4 + + beq $12,$13,.L47 + li $13,5 + + beq $12,$13,.L48 + li $13,6 + + beq $12,$13,.L49 + li $13,7 + + beq $12,$13,.L50 + li $13,8 + + beq $12,$13,.L44 + li $13,9 + + beq $12,$13,.L44 + li $13,10 + + beq $12,$13,.L44 + li $13,11 + + beq $12,$13,.L44 + li $13,12 + + beq $12,$13,.L51 + li $13,13 + + beq $12,$13,.L52 + li $13,14 + + beq $12,$13,.L44 + li $13,15 + + bnel $12,$13,.L58 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + ld $14,48($fp) + + ld $12,48($fp) + li $13,1 + beq $12,$13,.L53 + li $13,2 + + beq $12,$13,.L54 + li $13,4 + + beq $12,$13,.L55 + li $13,8 + + bnel $12,$13,.L58 + move $sp,$fp + + ld $12,32($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L58: + ld $31,200($sp) + ld $fp,192($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L43: + move $sp,$fp + ld $31,200($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + lb $2,8($fp) + ld $fp,192($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L44: + b .L1 + ld $2,8($fp) + + .align 3 +.L46: + b .L1 + lbu $2,8($fp) + + .align 3 +.L47: + b .L1 + lh $2,8($fp) + + .align 3 +.L48: + b .L1 + lhu $2,8($fp) + + .align 3 +.L49: + b .L1 + lw $2,8($fp) + + .align 3 +.L51: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L50: + b .L1 + lwu $2,8($fp) + +.L52: + b .L1 + ldc1 $f0,8($fp) + +.L19: + daddiu $13,$14,-1 + sltu $13,$13,16 + beql $13,$0,.L59 + andi $13,$12,0x800 + + ld $13,32($fp) + li $15,-8 + sltu $25,$14,9 + andi $24,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + daddu $13,$14,$24 + + sltu $25,$13,9 + beq $25,$0,.L25 + dsll $13,$13,3 + + daddiu $13,$13,-1 + ld $25,0($15) + sll $13,$13,0 + li $15,2 + dsll $13,$15,$13 + daddiu $13,$13,-1 + and $13,$13,$25 + sll $24,$24,3 + dsra $2,$13,$24 +.L23: + andi $13,$12,0x800 +.L59: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 + beq $14,$13,.L56 + li $13,8 + + beql $14,$13,.L57 + ld $13,32($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L58 + move $sp,$fp + + li $12,16 +.L60: + bnel $14,$12,.L58 + move $sp,$fp + + ld $12,32($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 + + bne $14,$12,.L60 + li $12,16 + + ld $13,32($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + dsll $13,$13,3 + + daddiu $13,$13,-65 + ld $17,8($15) + li $25,2 + sll $13,$13,0 + dsll $13,$25,$13 + subu $25,$0,$24 + sll $25,$25,2 + ld $16,0($15) + daddiu $13,$13,-1 + addiu $15,$25,32 + and $13,$13,$17 + sll $24,$24,3 + dsll $25,$13,$15 + dsra $16,$16,$24 + dsll $15,$25,$15 + or $2,$16,$15 + b .L23 + dsra $3,$13,$24 + +.L53: + ld $12,32($fp) + b .L1 + lbu $2,0($12) + +.L54: + ld $12,32($fp) + b .L1 + lhu $2,0($12) + +.L26: + daddiu $13,$13,-129 + ld $16,8($15) + ld $17,0($15) + sll $13,$13,0 + ld $18,16($15) + li $15,2 + subu $25,$0,$24 + dsll $15,$15,$13 + daddiu $15,$15,-1 + sll $25,$25,3 + sll $24,$24,3 + addiu $25,$25,64 + and $13,$15,$18 + dsll $13,$13,$25 + dsra $15,$17,$24 + dsll $17,$16,$25 + dsra $24,$16,$24 + or $2,$15,$17 + b .L23 + or $3,$13,$24 + +.L56: + ld $12,32($fp) + b .L1 + lwc1 $f0,0($12) + +.L55: + ld $12,32($fp) + b .L1 + lwu $2,0($12) + +.L25: + daddiu $13,$13,-65 + li $25,2 + sll $13,$13,0 + ld $17,8($15) + dsll $13,$25,$13 + ld $25,0($15) + daddiu $13,$13,-1 + subu $16,$0,$24 + and $15,$13,$17 + sll $24,$24,3 + sll $13,$16,3 + dsll $13,$15,$13 + dsra $24,$25,$24 + b .L23 + or $2,$13,$24 + +.L57: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .align 3 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + DECLARE_FUNCTION(callback_get_receiver) +callback_get_receiver: + .frame $fp,16,$31 + .mask 0x40000000,-8 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + lui $13,%hi(%neg(%gp_rel(callback_get_receiver))) + daddu $13,$13,$25 + daddiu $13,$13,%lo(%neg(%gp_rel(callback_get_receiver))) + daddiu $sp,$sp,-16 + ld $12,%got_page(callback_receiver)($13) + sd $fp,8($sp) + move $fp,$sp + move $sp,$fp + ld $fp,8($sp) + daddiu $2,$12,%got_ofst(callback_receiver) + j $31 + daddiu $sp,$sp,16 + + .set macro + .set reorder + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver diff --git a/callback/vacall_r/vacall-mipseb-linux.s b/callback/vacall_r/vacall-mipseb-linux.s new file mode 100644 index 0000000..7d3634c --- /dev/null +++ b/callback/vacall_r/vacall-mipseb-linux.s @@ -0,0 +1,322 @@ + .file 1 "vacall-mips.c" + .section .mdebug.abi32 + .previous + .nan legacy + .module fp=xx + .module nooddspreg + .abicalls + .text + .align 2 + .set nomips16 + .set nomicromips + .ent callback_receiver + .type callback_receiver, @function +callback_receiver: + .frame $fp,104,$31 # vars= 72, regs= 2/0, args= 16, gp= 8 + .mask 0xc0000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-104 + sw $fp,96($sp) + move $fp,$sp + sw $31,100($sp) + lw $25,0($2) + sw $4,104($fp) + lw $4,4($2) + sw $5,108($fp) + addiu $5,$fp,104 + sw $5,40($fp) + addiu $5,$fp,120 + sw $5,56($fp) + .cprestore 16 + sw $6,112($fp) + sw $7,116($fp) + sdc1 $f12,80($fp) + sdc1 $f14,88($fp) + swc1 $f12,68($fp) + swc1 $f14,72($fp) + sw $0,24($fp) + sw $0,44($fp) + sw $0,48($fp) + sw $0,60($fp) + sw $0,64($fp) + addiu $5,$fp,24 + jal $25 + lw $4,48($fp) + .set noreorder + .set nomacro + beq $4,$0,$L1 + li $5,1 # 0x1 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,3 # 0x3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L29 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L30 + li $5,5 # 0x5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L31 + li $5,6 # 0x6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,7 # 0x7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,9 # 0x9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + addiu $5,$4,-10 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bne $5,$0,$L32 + li $5,12 # 0xc + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L33 + li $5,13 # 0xd + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L34 + li $5,14 # 0xe + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,15 # 0xf + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,24($fp) + andi $4,$4,0x2 + .set noreorder + .set nomacro + beql $4,$0,$L38 + lw $2,44($fp) + .set macro + .set reorder + + lw $4,52($fp) + li $5,1 # 0x1 + .set noreorder + .set nomacro + beql $4,$5,$L35 + lw $4,44($fp) + .set macro + .set reorder + + li $5,2 # 0x2 + .set noreorder + .set nomacro + beq $4,$5,$L36 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,44($fp) + lw $2,0($4) +$L1: +$L38: + move $sp,$fp +$L37: + lw $31,100($sp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L23: + move $sp,$fp + lw $31,100($sp) + lb $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L27: + move $sp,$fp + lw $31,100($sp) + lw $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L29: + .set noreorder + .set nomacro + b $L1 + lbu $2,32($fp) + .set macro + .set reorder + +$L30: + .set noreorder + .set nomacro + b $L1 + lh $2,32($fp) + .set macro + .set reorder + +$L31: + .set noreorder + .set nomacro + b $L1 + lhu $2,32($fp) + .set macro + .set reorder + +$L34: + .set noreorder + .set nomacro + b $L1 + ldc1 $f0,32($fp) + .set macro + .set reorder + +$L32: + lw $2,32($fp) + .set noreorder + .set nomacro + b $L1 + lw $3,36($fp) + .set macro + .set reorder + +$L33: + .set noreorder + .set nomacro + b $L1 + lwc1 $f0,32($fp) + .set macro + .set reorder + +$L35: + .set noreorder + .set nomacro + b $L1 + lbu $2,0($4) + .set macro + .set reorder + +$L36: + lw $4,44($fp) + .set noreorder + .set nomacro + b $L1 + lhu $2,0($4) + .set macro + .set reorder + + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: + .frame $fp,8,$31 # vars= 0, regs= 1/0, args= 0, gp= 0 + .mask 0x40000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-8 + sw $fp,4($sp) + move $fp,$sp + move $sp,$fp + lw $fp,4($sp) + la $2,callback_receiver + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,8 + .set macro + .set reorder + + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/callback/vacall_r/vacall-mipseb-macro.S b/callback/vacall_r/vacall-mipseb-macro.S new file mode 100644 index 0000000..f97bbb4 --- /dev/null +++ b/callback/vacall_r/vacall-mipseb-macro.S @@ -0,0 +1,316 @@ +#include "asm-mips.h" + .file 1 "vacall-mips.c" + .text + .align 2 + .set nomips16 + .set nomicromips + .ent callback_receiver + DECLARE_FUNCTION(callback_receiver) +callback_receiver: + .frame $fp,104,$31 + .mask 0xc0000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-104 + sw $fp,96($sp) + move $fp,$sp + sw $31,100($sp) + lw $25,0($2) + sw $4,104($fp) + lw $4,4($2) + sw $5,108($fp) + addiu $5,$fp,104 + sw $5,40($fp) + addiu $5,$fp,120 + sw $5,56($fp) + .cprestore 16 + sw $6,112($fp) + sw $7,116($fp) + sdc1 $f12,80($fp) + sdc1 $f14,88($fp) + swc1 $f12,68($fp) + swc1 $f14,72($fp) + sw $0,24($fp) + sw $0,44($fp) + sw $0,48($fp) + sw $0,60($fp) + sw $0,64($fp) + addiu $5,$fp,24 + jal $25 + lw $4,48($fp) + .set noreorder + .set nomacro + beq $4,$0,$L1 + li $5,1 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L29 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L30 + li $5,5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L31 + li $5,6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + addiu $5,$4,-10 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bne $5,$0,$L32 + li $5,12 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L33 + li $5,13 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L34 + li $5,14 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,15 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,24($fp) + andi $4,$4,0x2 + .set noreorder + .set nomacro + beql $4,$0,$L38 + lw $2,44($fp) + .set macro + .set reorder + + lw $4,52($fp) + li $5,1 + .set noreorder + .set nomacro + beql $4,$5,$L35 + lw $4,44($fp) + .set macro + .set reorder + + li $5,2 + .set noreorder + .set nomacro + beq $4,$5,$L36 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,44($fp) + lw $2,0($4) +$L1: +$L38: + move $sp,$fp +$L37: + lw $31,100($sp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L23: + move $sp,$fp + lw $31,100($sp) + lb $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L27: + move $sp,$fp + lw $31,100($sp) + lw $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L29: + .set noreorder + .set nomacro + b $L1 + lbu $2,32($fp) + .set macro + .set reorder + +$L30: + .set noreorder + .set nomacro + b $L1 + lh $2,32($fp) + .set macro + .set reorder + +$L31: + .set noreorder + .set nomacro + b $L1 + lhu $2,32($fp) + .set macro + .set reorder + +$L34: + .set noreorder + .set nomacro + b $L1 + ldc1 $f0,32($fp) + .set macro + .set reorder + +$L32: + lw $2,32($fp) + .set noreorder + .set nomacro + b $L1 + lw $3,36($fp) + .set macro + .set reorder + +$L33: + .set noreorder + .set nomacro + b $L1 + lwc1 $f0,32($fp) + .set macro + .set reorder + +$L35: + .set noreorder + .set nomacro + b $L1 + lbu $2,0($4) + .set macro + .set reorder + +$L36: + lw $4,44($fp) + .set noreorder + .set nomacro + b $L1 + lhu $2,0($4) + .set macro + .set reorder + + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + DECLARE_FUNCTION(callback_get_receiver) +callback_get_receiver: + .frame $fp,8,$31 + .mask 0x40000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-8 + sw $fp,4($sp) + move $fp,$sp + move $sp,$fp + lw $fp,4($sp) + la $2,callback_receiver + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,8 + .set macro + .set reorder + + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver diff --git a/callback/vacall_r/vacall-mipsel-linux.s b/callback/vacall_r/vacall-mipsel-linux.s new file mode 100644 index 0000000..7d3634c --- /dev/null +++ b/callback/vacall_r/vacall-mipsel-linux.s @@ -0,0 +1,322 @@ + .file 1 "vacall-mips.c" + .section .mdebug.abi32 + .previous + .nan legacy + .module fp=xx + .module nooddspreg + .abicalls + .text + .align 2 + .set nomips16 + .set nomicromips + .ent callback_receiver + .type callback_receiver, @function +callback_receiver: + .frame $fp,104,$31 # vars= 72, regs= 2/0, args= 16, gp= 8 + .mask 0xc0000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-104 + sw $fp,96($sp) + move $fp,$sp + sw $31,100($sp) + lw $25,0($2) + sw $4,104($fp) + lw $4,4($2) + sw $5,108($fp) + addiu $5,$fp,104 + sw $5,40($fp) + addiu $5,$fp,120 + sw $5,56($fp) + .cprestore 16 + sw $6,112($fp) + sw $7,116($fp) + sdc1 $f12,80($fp) + sdc1 $f14,88($fp) + swc1 $f12,68($fp) + swc1 $f14,72($fp) + sw $0,24($fp) + sw $0,44($fp) + sw $0,48($fp) + sw $0,60($fp) + sw $0,64($fp) + addiu $5,$fp,24 + jal $25 + lw $4,48($fp) + .set noreorder + .set nomacro + beq $4,$0,$L1 + li $5,1 # 0x1 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,3 # 0x3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L29 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L30 + li $5,5 # 0x5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L31 + li $5,6 # 0x6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,7 # 0x7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,9 # 0x9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + addiu $5,$4,-10 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bne $5,$0,$L32 + li $5,12 # 0xc + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L33 + li $5,13 # 0xd + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L34 + li $5,14 # 0xe + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,15 # 0xf + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,24($fp) + andi $4,$4,0x2 + .set noreorder + .set nomacro + beql $4,$0,$L38 + lw $2,44($fp) + .set macro + .set reorder + + lw $4,52($fp) + li $5,1 # 0x1 + .set noreorder + .set nomacro + beql $4,$5,$L35 + lw $4,44($fp) + .set macro + .set reorder + + li $5,2 # 0x2 + .set noreorder + .set nomacro + beq $4,$5,$L36 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,44($fp) + lw $2,0($4) +$L1: +$L38: + move $sp,$fp +$L37: + lw $31,100($sp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L23: + move $sp,$fp + lw $31,100($sp) + lb $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L27: + move $sp,$fp + lw $31,100($sp) + lw $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L29: + .set noreorder + .set nomacro + b $L1 + lbu $2,32($fp) + .set macro + .set reorder + +$L30: + .set noreorder + .set nomacro + b $L1 + lh $2,32($fp) + .set macro + .set reorder + +$L31: + .set noreorder + .set nomacro + b $L1 + lhu $2,32($fp) + .set macro + .set reorder + +$L34: + .set noreorder + .set nomacro + b $L1 + ldc1 $f0,32($fp) + .set macro + .set reorder + +$L32: + lw $2,32($fp) + .set noreorder + .set nomacro + b $L1 + lw $3,36($fp) + .set macro + .set reorder + +$L33: + .set noreorder + .set nomacro + b $L1 + lwc1 $f0,32($fp) + .set macro + .set reorder + +$L35: + .set noreorder + .set nomacro + b $L1 + lbu $2,0($4) + .set macro + .set reorder + +$L36: + lw $4,44($fp) + .set noreorder + .set nomacro + b $L1 + lhu $2,0($4) + .set macro + .set reorder + + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: + .frame $fp,8,$31 # vars= 0, regs= 1/0, args= 0, gp= 0 + .mask 0x40000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-8 + sw $fp,4($sp) + move $fp,$sp + move $sp,$fp + lw $fp,4($sp) + la $2,callback_receiver + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,8 + .set macro + .set reorder + + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/callback/vacall_r/vacall-mipsel-macro.S b/callback/vacall_r/vacall-mipsel-macro.S new file mode 100644 index 0000000..f97bbb4 --- /dev/null +++ b/callback/vacall_r/vacall-mipsel-macro.S @@ -0,0 +1,316 @@ +#include "asm-mips.h" + .file 1 "vacall-mips.c" + .text + .align 2 + .set nomips16 + .set nomicromips + .ent callback_receiver + DECLARE_FUNCTION(callback_receiver) +callback_receiver: + .frame $fp,104,$31 + .mask 0xc0000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-104 + sw $fp,96($sp) + move $fp,$sp + sw $31,100($sp) + lw $25,0($2) + sw $4,104($fp) + lw $4,4($2) + sw $5,108($fp) + addiu $5,$fp,104 + sw $5,40($fp) + addiu $5,$fp,120 + sw $5,56($fp) + .cprestore 16 + sw $6,112($fp) + sw $7,116($fp) + sdc1 $f12,80($fp) + sdc1 $f14,88($fp) + swc1 $f12,68($fp) + swc1 $f14,72($fp) + sw $0,24($fp) + sw $0,44($fp) + sw $0,48($fp) + sw $0,60($fp) + sw $0,64($fp) + addiu $5,$fp,24 + jal $25 + lw $4,48($fp) + .set noreorder + .set nomacro + beq $4,$0,$L1 + li $5,1 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L29 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L30 + li $5,5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L31 + li $5,6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + addiu $5,$4,-10 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bne $5,$0,$L32 + li $5,12 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L33 + li $5,13 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L34 + li $5,14 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,15 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,24($fp) + andi $4,$4,0x2 + .set noreorder + .set nomacro + beql $4,$0,$L38 + lw $2,44($fp) + .set macro + .set reorder + + lw $4,52($fp) + li $5,1 + .set noreorder + .set nomacro + beql $4,$5,$L35 + lw $4,44($fp) + .set macro + .set reorder + + li $5,2 + .set noreorder + .set nomacro + beq $4,$5,$L36 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,44($fp) + lw $2,0($4) +$L1: +$L38: + move $sp,$fp +$L37: + lw $31,100($sp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L23: + move $sp,$fp + lw $31,100($sp) + lb $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L27: + move $sp,$fp + lw $31,100($sp) + lw $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L29: + .set noreorder + .set nomacro + b $L1 + lbu $2,32($fp) + .set macro + .set reorder + +$L30: + .set noreorder + .set nomacro + b $L1 + lh $2,32($fp) + .set macro + .set reorder + +$L31: + .set noreorder + .set nomacro + b $L1 + lhu $2,32($fp) + .set macro + .set reorder + +$L34: + .set noreorder + .set nomacro + b $L1 + ldc1 $f0,32($fp) + .set macro + .set reorder + +$L32: + lw $2,32($fp) + .set noreorder + .set nomacro + b $L1 + lw $3,36($fp) + .set macro + .set reorder + +$L33: + .set noreorder + .set nomacro + b $L1 + lwc1 $f0,32($fp) + .set macro + .set reorder + +$L35: + .set noreorder + .set nomacro + b $L1 + lbu $2,0($4) + .set macro + .set reorder + +$L36: + lw $4,44($fp) + .set noreorder + .set nomacro + b $L1 + lhu $2,0($4) + .set macro + .set reorder + + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + DECLARE_FUNCTION(callback_get_receiver) +callback_get_receiver: + .frame $fp,8,$31 + .mask 0x40000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-8 + sw $fp,4($sp) + move $fp,$sp + move $sp,$fp + lw $fp,4($sp) + la $2,callback_receiver + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,8 + .set macro + .set reorder + + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver diff --git a/callback/vacall_r/vacall-mipsn32eb-linux.s b/callback/vacall_r/vacall-mipsn32eb-linux.s new file mode 100644 index 0000000..96318a1 --- /dev/null +++ b/callback/vacall_r/vacall-mipsn32eb-linux.s @@ -0,0 +1,381 @@ + .file 1 "vacall-mipsn32.c" + .section .mdebug.abiN32 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .set nomips16 + .set nomicromips + .ent callback_receiver + .type callback_receiver, @function +callback_receiver: + .frame $fp,256,$31 # vars= 144, regs= 6/0, args= 0, gp= 0 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + addiu $sp,$sp,-256 + sd $fp,176($sp) + move $fp,$sp + sd $4,192($fp) + lw $4,4($2) + lw $25,0($2) + addiu $12,$fp,192 + sd $31,184($sp) + sd $18,160($sp) + sd $17,152($sp) + sd $16,144($sp) + sd $5,200($fp) + sd $6,208($fp) + sd $7,216($fp) + sd $8,224($fp) + sd $9,232($fp) + sd $10,240($fp) + sd $11,248($fp) + sdc1 $f12,80($fp) + sdc1 $f13,88($fp) + sdc1 $f14,96($fp) + sdc1 $f15,104($fp) + sdc1 $f16,112($fp) + sdc1 $f17,120($fp) + sdc1 $f18,128($fp) + sdc1 $f19,136($fp) + swc1 $f12,44($fp) + swc1 $f13,48($fp) + swc1 $f14,52($fp) + swc1 $f15,56($fp) + swc1 $f16,60($fp) + swc1 $f17,64($fp) + swc1 $f18,68($fp) + move $5,$fp + swc1 $f19,72($fp) + sw $12,24($fp) + sw $0,0($fp) + sw $0,28($fp) + sw $0,32($fp) + jalr $25 + sw $0,40($fp) + + lw $12,32($fp) + beq $12,$0,.L1 + li $13,1 # 0x1 + + beq $12,$13,.L43 + li $13,2 # 0x2 + + beq $12,$13,.L43 + li $13,3 # 0x3 + + beq $12,$13,.L49 + li $13,4 # 0x4 + + beq $12,$13,.L50 + li $13,5 # 0x5 + + beq $12,$13,.L51 + li $13,6 # 0x6 + + beq $12,$13,.L46 + li $13,7 # 0x7 + + beq $12,$13,.L45 + li $13,8 # 0x8 + + beq $12,$13,.L46 + li $13,9 # 0x9 + + beq $12,$13,.L45 + li $13,10 # 0xa + + beq $12,$13,.L47 + li $13,11 # 0xb + + beq $12,$13,.L47 + li $13,12 # 0xc + + beq $12,$13,.L52 + li $13,13 # 0xd + + beq $12,$13,.L53 + li $13,14 # 0xe + + beq $12,$13,.L46 + li $13,15 # 0xf + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + lw $24,36($fp) + + lw $12,36($fp) + li $13,1 # 0x1 + beq $12,$13,.L54 + li $13,2 # 0x2 + + beq $12,$13,.L55 + li $13,4 # 0x4 + + beq $12,$13,.L56 + li $13,8 # 0x8 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,28($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L59: + ld $31,184($sp) + ld $fp,176($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L43: + move $sp,$fp + ld $31,184($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + lb $2,8($fp) + ld $fp,176($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L46: + b .L1 + lw $2,8($fp) + + .align 3 +.L49: + b .L1 + lbu $2,8($fp) + + .align 3 +.L50: + b .L1 + lh $2,8($fp) + + .align 3 +.L45: + b .L1 + lwu $2,8($fp) + + .align 3 +.L51: + b .L1 + lhu $2,8($fp) + + .align 3 +.L52: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L47: + b .L1 + ld $2,8($fp) + +.L53: + b .L1 + ldc1 $f0,8($fp) + +.L19: + addiu $13,$24,-1 + sltu $13,$13,16 + beql $13,$0,.L60 + andi $13,$12,0x800 + + lw $13,28($fp) + li $15,-8 # 0xfffffffffffffff8 + sltu $25,$24,9 + andi $14,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + addu $13,$24,$14 + + sltu $25,$13,9 + beq $25,$0,.L25 + subu $13,$0,$13 + + ld $25,0($15) + sll $13,$13,3 + li $15,-1 # 0xffffffffffffffff + dsll $13,$15,$13 + and $13,$13,$25 + sll $14,$14,3 + dsll $2,$13,$14 +.L23: + andi $13,$12,0x800 +.L60: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 # 0x4 + beq $24,$13,.L57 + li $13,8 # 0x8 + + beql $24,$13,.L58 + lw $13,28($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L59 + move $sp,$fp + + li $12,16 # 0x10 +.L61: + bnel $24,$12,.L59 + move $sp,$fp + + lw $12,28($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 # 0x8 + + bne $24,$12,.L61 + li $12,16 # 0x10 + + lw $13,28($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + subu $13,$0,$13 + + ld $17,8($15) + subu $16,$0,$14 + li $25,-1 # 0xffffffffffffffff + sll $13,$13,3 + dsll $13,$25,$13 + sll $25,$16,2 + ld $16,0($15) + and $13,$13,$17 + addiu $15,$25,32 + sll $14,$14,3 + dsra $25,$13,$15 + dsll $16,$16,$14 + dsra $15,$25,$15 + or $2,$16,$15 + b .L23 + dsll $3,$13,$14 + +.L54: + lw $12,28($fp) + b .L1 + lbu $2,0($12) + +.L55: + lw $12,28($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $18,16($15) + ld $16,8($15) + ld $17,0($15) + subu $25,$0,$14 + li $15,-1 # 0xffffffffffffffff + sll $13,$13,3 + sll $25,$25,3 + dsll $13,$15,$13 + sll $14,$14,3 + addiu $15,$25,64 + and $13,$13,$18 + dsll $25,$17,$14 + dsra $13,$13,$15 + dsra $17,$16,$15 + dsll $14,$16,$14 + or $2,$25,$17 + b .L23 + or $3,$13,$14 + +.L57: + lw $12,28($fp) + b .L1 + lwc1 $f0,0($12) + +.L56: + lw $12,28($fp) + b .L1 + lwu $2,0($12) + +.L25: + ld $16,8($15) + ld $25,0($15) + sll $13,$13,3 + li $15,-1 # 0xffffffffffffffff + dsll $13,$15,$13 + subu $15,$0,$14 + and $13,$13,$16 + sll $15,$15,3 + sll $14,$14,3 + dsra $13,$13,$15 + dsll $14,$25,$14 + b .L23 + or $2,$13,$14 + +.L58: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .align 3 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: + .frame $fp,16,$31 # vars= 0, regs= 1/0, args= 0, gp= 0 + .mask 0x40000000,-8 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + lui $13,%hi(%neg(%gp_rel(callback_get_receiver))) + addu $13,$13,$25 + addiu $13,$13,%lo(%neg(%gp_rel(callback_get_receiver))) + addiu $sp,$sp,-16 + lw $12,%got_page(callback_receiver)($13) + sd $fp,8($sp) + move $fp,$sp + move $sp,$fp + ld $fp,8($sp) + addiu $2,$12,%got_ofst(callback_receiver) + j $31 + addiu $sp,$sp,16 + + .set macro + .set reorder + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/callback/vacall_r/vacall-mipsn32eb-macro.S b/callback/vacall_r/vacall-mipsn32eb-macro.S new file mode 100644 index 0000000..6f1e482 --- /dev/null +++ b/callback/vacall_r/vacall-mipsn32eb-macro.S @@ -0,0 +1,375 @@ +#include "asm-mips.h" + .file 1 "vacall-mipsn32.c" + .text + .align 2 + .align 3 + .set nomips16 + .set nomicromips + .ent callback_receiver + DECLARE_FUNCTION(callback_receiver) +callback_receiver: + .frame $fp,256,$31 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + addiu $sp,$sp,-256 + sd $fp,176($sp) + move $fp,$sp + sd $4,192($fp) + lw $4,4($2) + lw $25,0($2) + addiu $12,$fp,192 + sd $31,184($sp) + sd $18,160($sp) + sd $17,152($sp) + sd $16,144($sp) + sd $5,200($fp) + sd $6,208($fp) + sd $7,216($fp) + sd $8,224($fp) + sd $9,232($fp) + sd $10,240($fp) + sd $11,248($fp) + sdc1 $f12,80($fp) + sdc1 $f13,88($fp) + sdc1 $f14,96($fp) + sdc1 $f15,104($fp) + sdc1 $f16,112($fp) + sdc1 $f17,120($fp) + sdc1 $f18,128($fp) + sdc1 $f19,136($fp) + swc1 $f12,44($fp) + swc1 $f13,48($fp) + swc1 $f14,52($fp) + swc1 $f15,56($fp) + swc1 $f16,60($fp) + swc1 $f17,64($fp) + swc1 $f18,68($fp) + move $5,$fp + swc1 $f19,72($fp) + sw $12,24($fp) + sw $0,0($fp) + sw $0,28($fp) + sw $0,32($fp) + jalr $25 + sw $0,40($fp) + + lw $12,32($fp) + beq $12,$0,.L1 + li $13,1 + + beq $12,$13,.L43 + li $13,2 + + beq $12,$13,.L43 + li $13,3 + + beq $12,$13,.L49 + li $13,4 + + beq $12,$13,.L50 + li $13,5 + + beq $12,$13,.L51 + li $13,6 + + beq $12,$13,.L46 + li $13,7 + + beq $12,$13,.L45 + li $13,8 + + beq $12,$13,.L46 + li $13,9 + + beq $12,$13,.L45 + li $13,10 + + beq $12,$13,.L47 + li $13,11 + + beq $12,$13,.L47 + li $13,12 + + beq $12,$13,.L52 + li $13,13 + + beq $12,$13,.L53 + li $13,14 + + beq $12,$13,.L46 + li $13,15 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + lw $24,36($fp) + + lw $12,36($fp) + li $13,1 + beq $12,$13,.L54 + li $13,2 + + beq $12,$13,.L55 + li $13,4 + + beq $12,$13,.L56 + li $13,8 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,28($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L59: + ld $31,184($sp) + ld $fp,176($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L43: + move $sp,$fp + ld $31,184($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + lb $2,8($fp) + ld $fp,176($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L46: + b .L1 + lw $2,8($fp) + + .align 3 +.L49: + b .L1 + lbu $2,8($fp) + + .align 3 +.L50: + b .L1 + lh $2,8($fp) + + .align 3 +.L45: + b .L1 + lwu $2,8($fp) + + .align 3 +.L51: + b .L1 + lhu $2,8($fp) + + .align 3 +.L52: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L47: + b .L1 + ld $2,8($fp) + +.L53: + b .L1 + ldc1 $f0,8($fp) + +.L19: + addiu $13,$24,-1 + sltu $13,$13,16 + beql $13,$0,.L60 + andi $13,$12,0x800 + + lw $13,28($fp) + li $15,-8 + sltu $25,$24,9 + andi $14,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + addu $13,$24,$14 + + sltu $25,$13,9 + beq $25,$0,.L25 + subu $13,$0,$13 + + ld $25,0($15) + sll $13,$13,3 + li $15,-1 + dsll $13,$15,$13 + and $13,$13,$25 + sll $14,$14,3 + dsll $2,$13,$14 +.L23: + andi $13,$12,0x800 +.L60: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 + beq $24,$13,.L57 + li $13,8 + + beql $24,$13,.L58 + lw $13,28($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L59 + move $sp,$fp + + li $12,16 +.L61: + bnel $24,$12,.L59 + move $sp,$fp + + lw $12,28($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 + + bne $24,$12,.L61 + li $12,16 + + lw $13,28($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + subu $13,$0,$13 + + ld $17,8($15) + subu $16,$0,$14 + li $25,-1 + sll $13,$13,3 + dsll $13,$25,$13 + sll $25,$16,2 + ld $16,0($15) + and $13,$13,$17 + addiu $15,$25,32 + sll $14,$14,3 + dsra $25,$13,$15 + dsll $16,$16,$14 + dsra $15,$25,$15 + or $2,$16,$15 + b .L23 + dsll $3,$13,$14 + +.L54: + lw $12,28($fp) + b .L1 + lbu $2,0($12) + +.L55: + lw $12,28($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $18,16($15) + ld $16,8($15) + ld $17,0($15) + subu $25,$0,$14 + li $15,-1 + sll $13,$13,3 + sll $25,$25,3 + dsll $13,$15,$13 + sll $14,$14,3 + addiu $15,$25,64 + and $13,$13,$18 + dsll $25,$17,$14 + dsra $13,$13,$15 + dsra $17,$16,$15 + dsll $14,$16,$14 + or $2,$25,$17 + b .L23 + or $3,$13,$14 + +.L57: + lw $12,28($fp) + b .L1 + lwc1 $f0,0($12) + +.L56: + lw $12,28($fp) + b .L1 + lwu $2,0($12) + +.L25: + ld $16,8($15) + ld $25,0($15) + sll $13,$13,3 + li $15,-1 + dsll $13,$15,$13 + subu $15,$0,$14 + and $13,$13,$16 + sll $15,$15,3 + sll $14,$14,3 + dsra $13,$13,$15 + dsll $14,$25,$14 + b .L23 + or $2,$13,$14 + +.L58: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .align 3 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + DECLARE_FUNCTION(callback_get_receiver) +callback_get_receiver: + .frame $fp,16,$31 + .mask 0x40000000,-8 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + lui $13,%hi(%neg(%gp_rel(callback_get_receiver))) + addu $13,$13,$25 + addiu $13,$13,%lo(%neg(%gp_rel(callback_get_receiver))) + addiu $sp,$sp,-16 + lw $12,%got_page(callback_receiver)($13) + sd $fp,8($sp) + move $fp,$sp + move $sp,$fp + ld $fp,8($sp) + addiu $2,$12,%got_ofst(callback_receiver) + j $31 + addiu $sp,$sp,16 + + .set macro + .set reorder + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver diff --git a/callback/vacall_r/vacall-mipsn32el-linux.s b/callback/vacall_r/vacall-mipsn32el-linux.s new file mode 100644 index 0000000..9f568ea --- /dev/null +++ b/callback/vacall_r/vacall-mipsn32el-linux.s @@ -0,0 +1,385 @@ + .file 1 "vacall-mipsn32.c" + .section .mdebug.abiN32 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .set nomips16 + .set nomicromips + .ent callback_receiver + .type callback_receiver, @function +callback_receiver: + .frame $fp,256,$31 # vars= 144, regs= 6/0, args= 0, gp= 0 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + addiu $sp,$sp,-256 + sd $fp,176($sp) + move $fp,$sp + sd $4,192($fp) + lw $4,4($2) + lw $25,0($2) + addiu $12,$fp,192 + sd $31,184($sp) + sd $18,160($sp) + sd $17,152($sp) + sd $16,144($sp) + sd $5,200($fp) + sd $6,208($fp) + sd $7,216($fp) + sd $8,224($fp) + sd $9,232($fp) + sd $10,240($fp) + sd $11,248($fp) + sdc1 $f12,80($fp) + sdc1 $f13,88($fp) + sdc1 $f14,96($fp) + sdc1 $f15,104($fp) + sdc1 $f16,112($fp) + sdc1 $f17,120($fp) + sdc1 $f18,128($fp) + sdc1 $f19,136($fp) + swc1 $f12,44($fp) + swc1 $f13,48($fp) + swc1 $f14,52($fp) + swc1 $f15,56($fp) + swc1 $f16,60($fp) + swc1 $f17,64($fp) + swc1 $f18,68($fp) + move $5,$fp + swc1 $f19,72($fp) + sw $12,24($fp) + sw $0,0($fp) + sw $0,28($fp) + sw $0,32($fp) + jalr $25 + sw $0,40($fp) + + lw $12,32($fp) + beq $12,$0,.L1 + li $13,1 # 0x1 + + beq $12,$13,.L43 + li $13,2 # 0x2 + + beq $12,$13,.L43 + li $13,3 # 0x3 + + beq $12,$13,.L49 + li $13,4 # 0x4 + + beq $12,$13,.L50 + li $13,5 # 0x5 + + beq $12,$13,.L51 + li $13,6 # 0x6 + + beq $12,$13,.L46 + li $13,7 # 0x7 + + beq $12,$13,.L45 + li $13,8 # 0x8 + + beq $12,$13,.L46 + li $13,9 # 0x9 + + beq $12,$13,.L45 + li $13,10 # 0xa + + beq $12,$13,.L47 + li $13,11 # 0xb + + beq $12,$13,.L47 + li $13,12 # 0xc + + beq $12,$13,.L52 + li $13,13 # 0xd + + beq $12,$13,.L53 + li $13,14 # 0xe + + beq $12,$13,.L46 + li $13,15 # 0xf + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + lw $24,36($fp) + + lw $12,36($fp) + li $13,1 # 0x1 + beq $12,$13,.L54 + li $13,2 # 0x2 + + beq $12,$13,.L55 + li $13,4 # 0x4 + + beq $12,$13,.L56 + li $13,8 # 0x8 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,28($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L59: + ld $31,184($sp) + ld $fp,176($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L43: + move $sp,$fp + ld $31,184($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + lb $2,8($fp) + ld $fp,176($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L46: + b .L1 + lw $2,8($fp) + + .align 3 +.L49: + b .L1 + lbu $2,8($fp) + + .align 3 +.L50: + b .L1 + lh $2,8($fp) + + .align 3 +.L45: + b .L1 + lwu $2,8($fp) + + .align 3 +.L51: + b .L1 + lhu $2,8($fp) + + .align 3 +.L52: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L47: + b .L1 + ld $2,8($fp) + +.L53: + b .L1 + ldc1 $f0,8($fp) + +.L19: + addiu $13,$24,-1 + sltu $13,$13,16 + beql $13,$0,.L60 + andi $13,$12,0x800 + + lw $13,28($fp) + li $15,-8 # 0xfffffffffffffff8 + sltu $25,$24,9 + andi $14,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + addu $13,$24,$14 + + sltu $25,$13,9 + beq $25,$0,.L25 + sll $13,$13,3 + + ld $25,0($15) + addiu $13,$13,-1 + li $15,2 # 0x2 + dsll $13,$15,$13 + daddiu $13,$13,-1 + and $13,$13,$25 + sll $14,$14,3 + dsra $2,$13,$14 +.L23: + andi $13,$12,0x800 +.L60: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 # 0x4 + beq $24,$13,.L57 + li $13,8 # 0x8 + + beql $24,$13,.L58 + lw $13,28($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L59 + move $sp,$fp + + li $12,16 # 0x10 +.L61: + bnel $24,$12,.L59 + move $sp,$fp + + lw $12,28($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 # 0x8 + + bne $24,$12,.L61 + li $12,16 # 0x10 + + lw $13,28($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + sll $13,$13,3 + + ld $17,8($15) + li $25,2 # 0x2 + addiu $13,$13,-65 + dsll $13,$25,$13 + subu $25,$0,$14 + sll $25,$25,2 + ld $16,0($15) + daddiu $13,$13,-1 + addiu $15,$25,32 + and $13,$13,$17 + sll $14,$14,3 + dsll $25,$13,$15 + dsra $16,$16,$14 + dsll $15,$25,$15 + or $2,$16,$15 + b .L23 + dsra $3,$13,$14 + +.L54: + lw $12,28($fp) + b .L1 + lbu $2,0($12) + +.L55: + lw $12,28($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $16,8($15) + ld $17,0($15) + addiu $13,$13,-129 + ld $18,16($15) + li $15,2 # 0x2 + subu $25,$0,$14 + dsll $15,$15,$13 + daddiu $15,$15,-1 + sll $25,$25,3 + sll $14,$14,3 + addiu $25,$25,64 + and $13,$15,$18 + dsll $13,$13,$25 + dsra $15,$17,$14 + dsll $17,$16,$25 + dsra $14,$16,$14 + or $2,$15,$17 + b .L23 + or $3,$13,$14 + +.L57: + lw $12,28($fp) + b .L1 + lwc1 $f0,0($12) + +.L56: + lw $12,28($fp) + b .L1 + lwu $2,0($12) + +.L25: + li $25,2 # 0x2 + addiu $13,$13,-65 + ld $17,8($15) + dsll $13,$25,$13 + ld $25,0($15) + daddiu $13,$13,-1 + subu $16,$0,$14 + and $15,$13,$17 + sll $14,$14,3 + sll $13,$16,3 + dsll $13,$15,$13 + dsra $14,$25,$14 + b .L23 + or $2,$13,$14 + +.L58: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .align 3 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: + .frame $fp,16,$31 # vars= 0, regs= 1/0, args= 0, gp= 0 + .mask 0x40000000,-8 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + lui $13,%hi(%neg(%gp_rel(callback_get_receiver))) + addu $13,$13,$25 + addiu $13,$13,%lo(%neg(%gp_rel(callback_get_receiver))) + addiu $sp,$sp,-16 + lw $12,%got_page(callback_receiver)($13) + sd $fp,8($sp) + move $fp,$sp + move $sp,$fp + ld $fp,8($sp) + addiu $2,$12,%got_ofst(callback_receiver) + j $31 + addiu $sp,$sp,16 + + .set macro + .set reorder + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/callback/vacall_r/vacall-mipsn32el-macro.S b/callback/vacall_r/vacall-mipsn32el-macro.S new file mode 100644 index 0000000..d1391d7 --- /dev/null +++ b/callback/vacall_r/vacall-mipsn32el-macro.S @@ -0,0 +1,379 @@ +#include "asm-mips.h" + .file 1 "vacall-mipsn32.c" + .text + .align 2 + .align 3 + .set nomips16 + .set nomicromips + .ent callback_receiver + DECLARE_FUNCTION(callback_receiver) +callback_receiver: + .frame $fp,256,$31 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + addiu $sp,$sp,-256 + sd $fp,176($sp) + move $fp,$sp + sd $4,192($fp) + lw $4,4($2) + lw $25,0($2) + addiu $12,$fp,192 + sd $31,184($sp) + sd $18,160($sp) + sd $17,152($sp) + sd $16,144($sp) + sd $5,200($fp) + sd $6,208($fp) + sd $7,216($fp) + sd $8,224($fp) + sd $9,232($fp) + sd $10,240($fp) + sd $11,248($fp) + sdc1 $f12,80($fp) + sdc1 $f13,88($fp) + sdc1 $f14,96($fp) + sdc1 $f15,104($fp) + sdc1 $f16,112($fp) + sdc1 $f17,120($fp) + sdc1 $f18,128($fp) + sdc1 $f19,136($fp) + swc1 $f12,44($fp) + swc1 $f13,48($fp) + swc1 $f14,52($fp) + swc1 $f15,56($fp) + swc1 $f16,60($fp) + swc1 $f17,64($fp) + swc1 $f18,68($fp) + move $5,$fp + swc1 $f19,72($fp) + sw $12,24($fp) + sw $0,0($fp) + sw $0,28($fp) + sw $0,32($fp) + jalr $25 + sw $0,40($fp) + + lw $12,32($fp) + beq $12,$0,.L1 + li $13,1 + + beq $12,$13,.L43 + li $13,2 + + beq $12,$13,.L43 + li $13,3 + + beq $12,$13,.L49 + li $13,4 + + beq $12,$13,.L50 + li $13,5 + + beq $12,$13,.L51 + li $13,6 + + beq $12,$13,.L46 + li $13,7 + + beq $12,$13,.L45 + li $13,8 + + beq $12,$13,.L46 + li $13,9 + + beq $12,$13,.L45 + li $13,10 + + beq $12,$13,.L47 + li $13,11 + + beq $12,$13,.L47 + li $13,12 + + beq $12,$13,.L52 + li $13,13 + + beq $12,$13,.L53 + li $13,14 + + beq $12,$13,.L46 + li $13,15 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + lw $24,36($fp) + + lw $12,36($fp) + li $13,1 + beq $12,$13,.L54 + li $13,2 + + beq $12,$13,.L55 + li $13,4 + + beq $12,$13,.L56 + li $13,8 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,28($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L59: + ld $31,184($sp) + ld $fp,176($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L43: + move $sp,$fp + ld $31,184($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + lb $2,8($fp) + ld $fp,176($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L46: + b .L1 + lw $2,8($fp) + + .align 3 +.L49: + b .L1 + lbu $2,8($fp) + + .align 3 +.L50: + b .L1 + lh $2,8($fp) + + .align 3 +.L45: + b .L1 + lwu $2,8($fp) + + .align 3 +.L51: + b .L1 + lhu $2,8($fp) + + .align 3 +.L52: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L47: + b .L1 + ld $2,8($fp) + +.L53: + b .L1 + ldc1 $f0,8($fp) + +.L19: + addiu $13,$24,-1 + sltu $13,$13,16 + beql $13,$0,.L60 + andi $13,$12,0x800 + + lw $13,28($fp) + li $15,-8 + sltu $25,$24,9 + andi $14,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + addu $13,$24,$14 + + sltu $25,$13,9 + beq $25,$0,.L25 + sll $13,$13,3 + + ld $25,0($15) + addiu $13,$13,-1 + li $15,2 + dsll $13,$15,$13 + daddiu $13,$13,-1 + and $13,$13,$25 + sll $14,$14,3 + dsra $2,$13,$14 +.L23: + andi $13,$12,0x800 +.L60: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 + beq $24,$13,.L57 + li $13,8 + + beql $24,$13,.L58 + lw $13,28($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L59 + move $sp,$fp + + li $12,16 +.L61: + bnel $24,$12,.L59 + move $sp,$fp + + lw $12,28($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 + + bne $24,$12,.L61 + li $12,16 + + lw $13,28($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + sll $13,$13,3 + + ld $17,8($15) + li $25,2 + addiu $13,$13,-65 + dsll $13,$25,$13 + subu $25,$0,$14 + sll $25,$25,2 + ld $16,0($15) + daddiu $13,$13,-1 + addiu $15,$25,32 + and $13,$13,$17 + sll $14,$14,3 + dsll $25,$13,$15 + dsra $16,$16,$14 + dsll $15,$25,$15 + or $2,$16,$15 + b .L23 + dsra $3,$13,$14 + +.L54: + lw $12,28($fp) + b .L1 + lbu $2,0($12) + +.L55: + lw $12,28($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $16,8($15) + ld $17,0($15) + addiu $13,$13,-129 + ld $18,16($15) + li $15,2 + subu $25,$0,$14 + dsll $15,$15,$13 + daddiu $15,$15,-1 + sll $25,$25,3 + sll $14,$14,3 + addiu $25,$25,64 + and $13,$15,$18 + dsll $13,$13,$25 + dsra $15,$17,$14 + dsll $17,$16,$25 + dsra $14,$16,$14 + or $2,$15,$17 + b .L23 + or $3,$13,$14 + +.L57: + lw $12,28($fp) + b .L1 + lwc1 $f0,0($12) + +.L56: + lw $12,28($fp) + b .L1 + lwu $2,0($12) + +.L25: + li $25,2 + addiu $13,$13,-65 + ld $17,8($15) + dsll $13,$25,$13 + ld $25,0($15) + daddiu $13,$13,-1 + subu $16,$0,$14 + and $15,$13,$17 + sll $14,$14,3 + sll $13,$16,3 + dsll $13,$15,$13 + dsra $14,$25,$14 + b .L23 + or $2,$13,$14 + +.L58: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end callback_receiver + .size callback_receiver, .-callback_receiver + .align 2 + .align 3 + .globl callback_get_receiver + .set nomips16 + .set nomicromips + .ent callback_get_receiver + DECLARE_FUNCTION(callback_get_receiver) +callback_get_receiver: + .frame $fp,16,$31 + .mask 0x40000000,-8 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + lui $13,%hi(%neg(%gp_rel(callback_get_receiver))) + addu $13,$13,$25 + addiu $13,$13,%lo(%neg(%gp_rel(callback_get_receiver))) + addiu $sp,$sp,-16 + lw $12,%got_page(callback_receiver)($13) + sd $fp,8($sp) + move $fp,$sp + move $sp,$fp + ld $fp,8($sp) + addiu $2,$12,%got_ofst(callback_receiver) + j $31 + addiu $sp,$sp,16 + + .set macro + .set reorder + .end callback_get_receiver + .size callback_get_receiver, .-callback_get_receiver diff --git a/callback/vacall_r/vacall-powerpc-aix.s b/callback/vacall_r/vacall-powerpc-aix.s new file mode 100644 index 0000000..6f4f595 --- /dev/null +++ b/callback/vacall_r/vacall-powerpc-aix.s @@ -0,0 +1,194 @@ + .file "../../vacall/vacall-powerpc.c" + .toc + .csect .text[PR] + .align 2 + .lglobl .callback_receiver + .csect callback_receiver[DS] +callback_receiver: + .long .callback_receiver, TOC[tc0], 0 + .csect .text[PR] +.callback_receiver: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + mflr 0 + stw 0,8(1) + stw 28,-16(1) + stw 29,-12(1) + stw 31,-4(1) + stwu 1,-216(1) + mr 31,1 + lwz 28,0(11) + li 29,0 + addi 0,31,240 + stw 9,264(31) + stw 3,240(31) + stw 4,244(31) + stw 5,248(31) + stw 6,252(31) + stw 7,256(31) + stw 8,260(31) + stw 10,268(31) + stw 29,76(31) + stfd 1,92(31) + stfd 2,100(31) + stfd 3,108(31) + stfd 4,116(31) + stfd 5,124(31) + stfd 6,132(31) + stfd 7,140(31) + stfd 8,148(31) + stfd 9,156(31) + stfd 10,164(31) + stfd 11,172(31) + stfd 12,180(31) + stfd 13,188(31) + stw 0,72(31) + stw 29,88(31) + stw 29,56(31) + stw 29,80(31) + lwz 0,0(28) + lwz 3,4(11) + mtctr 0 + addi 4,31,56 + stw 2,20(1) + lwz 11,8(28) + lwz 2,4(28) + bctrl + lwz 2,20(1) + lwz 9,80(31) + cmpwi 0,9,0 + beq- 0,L..1 + cmpwi 0,9,1 + beq- 0,L..41 + cmpwi 0,9,2 + beq- 0,L..42 + cmpwi 0,9,3 + beq- 0,L..41 + cmpwi 0,9,4 + beq- 0,L..43 + cmpwi 0,9,5 + beq- 0,L..44 + cmpwi 0,9,6 + beq- 0,L..40 + cmpwi 0,9,7 + beq- 0,L..40 + cmpwi 0,9,8 + beq- 0,L..40 + cmpwi 0,9,9 + beq- 0,L..40 + addi 0,9,-10 + cmplwi 0,0,1 + bgt- 0,L..22 + lwz 3,64(31) + lwz 4,68(31) +L..1: + lwz 1,0(1) + lwz 0,8(1) + lwz 28,-16(1) + mtlr 0 + lwz 29,-12(1) + lwz 31,-4(1) + blr +L..22: + cmpwi 0,9,12 + beq- 0,L..45 + cmpwi 0,9,13 + beq- 0,L..46 + cmpwi 0,9,14 + beq- 0,L..40 + cmpwi 0,9,15 + bne+ 0,L..1 + lwz 0,56(31) + andi. 9,0,1024 + beq- 0,L..1 + lwz 0,84(31) + cmpwi 0,0,1 + beq- 0,L..47 + cmpwi 0,0,2 + beq- 0,L..48 + cmpwi 0,0,4 + beq- 0,L..49 + cmpwi 0,0,8 + bne+ 0,L..1 + lwz 9,76(31) + lwz 4,4(9) +L..39: + lwz 3,0(9) + b L..1 +L..49: + lwz 9,76(31) + b L..39 +L..48: + lwz 9,76(31) + lhz 3,0(9) + b L..1 +L..47: + lwz 9,76(31) + lbz 3,0(9) + b L..1 +L..40: + lwz 3,64(31) + b L..1 +L..46: + lfd 1,64(31) + b L..1 +L..45: + lfs 1,64(31) + b L..1 +L..44: + lhz 3,64(31) + b L..1 +L..43: + lha 3,64(31) + b L..1 +L..41: + lbz 3,64(31) + b L..1 +L..42: + lbz 0,64(31) + slwi 0,0,24 + srawi 3,0,24 + b L..1 +LT..callback_receiver: + .long 0 + .byte 0,0,32,97,128,4,8,0 + .long 0 + .long LT..callback_receiver-.callback_receiver + .short 17 + .byte "callback_receiver" + .byte 31 + .align 2 + .toc +LC..0: + .tc callback_receiver[TC],callback_receiver + .csect .text[PR] + .align 2 + .globl callback_get_receiver + .globl .callback_get_receiver + .csect callback_get_receiver[DS] +callback_get_receiver: + .long .callback_get_receiver, TOC[tc0], 0 + .csect .text[PR] +.callback_get_receiver: + stw 31,-4(1) + stwu 1,-40(1) + mr 31,1 + lwz 1,0(1) + lwz 3,LC..0(2) + lwz 31,-4(1) + blr +LT..callback_get_receiver: + .long 0 + .byte 0,0,32,96,128,1,0,0 + .long LT..callback_get_receiver-.callback_get_receiver + .short 21 + .byte "callback_get_receiver" + .byte 31 + .align 2 +_section_.text: + .csect .data[RW],3 + .long _section_.text diff --git a/callback/vacall_r/vacall-powerpc-linux-macro.S b/callback/vacall_r/vacall-powerpc-linux-macro.S new file mode 100644 index 0000000..d0d502f --- /dev/null +++ b/callback/vacall_r/vacall-powerpc-linux-macro.S @@ -0,0 +1,179 @@ + .file "vacall-powerpc.c" + .section ".text" + .align 2 + .type callback_receiver, @function +callback_receiver: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-176(1) + mflr 0 + stw 0,180(1) + stw 31,172(1) + mr 31,1 + stw 29,164(1) + addi 0,31,184 + li 29,0 + stw 0,32(31) + stw 29,36(31) + lwz 0,0(11) + stw 3,52(31) + stw 4,56(31) + mtctr 0 + stw 9,76(31) + addi 4,31,16 + stw 30,168(1) + stw 5,60(31) + stw 6,64(31) + stw 7,68(31) + stw 8,72(31) + stw 10,80(31) + stw 29,84(31) + stfd 1,88(31) + stfd 2,96(31) + stfd 3,104(31) + stfd 4,112(31) + stfd 5,120(31) + stfd 6,128(31) + stfd 7,136(31) + stfd 8,144(31) + stw 29,16(31) + stw 29,48(31) + stw 29,40(31) + lwz 3,4(11) + bctrl + lwz 9,40(31) + cmpwi 0,9,0 + beq- 0,.L1 + cmpwi 0,9,1 + beq- 0,.L41 + cmpwi 0,9,2 + beq- 0,.L42 + cmpwi 0,9,3 + beq- 0,.L41 + cmpwi 0,9,4 + beq- 0,.L43 + cmpwi 0,9,5 + beq- 0,.L44 + cmpwi 0,9,6 + beq- 0,.L40 + cmpwi 0,9,7 + beq- 0,.L40 + cmpwi 0,9,8 + beq- 0,.L40 + cmpwi 0,9,9 + beq- 0,.L40 + addi 0,9,-10 + cmplwi 0,0,1 + bgt- 0,.L22 + lwz 3,24(31) + lwz 4,28(31) +.L1: + lwz 11,0(1) + lwz 0,4(11) + lwz 29,-12(11) + lwz 30,-8(11) + mtlr 0 + lwz 31,-4(11) + mr 1,11 + blr +.L22: + cmpwi 0,9,12 + beq- 0,.L45 + cmpwi 0,9,13 + beq- 0,.L46 + cmpwi 0,9,14 + beq- 0,.L40 + cmpwi 0,9,15 + bne+ 0,.L1 + lwz 0,16(31) + andi. 9,0,1024 + beq- 0,.L1 + lwz 0,44(31) + cmpwi 0,0,1 + beq- 0,.L47 + cmpwi 0,0,2 + beq- 0,.L48 + cmpwi 0,0,4 + beq- 0,.L49 + cmpwi 0,0,8 + bne+ 0,.L1 + lwz 9,36(31) + lwz 4,4(9) +.L39: + lwz 3,0(9) + b .L1 +.L49: + lwz 9,36(31) + b .L39 +.L48: + lwz 9,36(31) + lhz 3,0(9) + b .L1 +.L47: + lwz 9,36(31) + lbz 3,0(9) + b .L1 +.L40: + lwz 3,24(31) + b .L1 +.L46: + lfd 1,24(31) + b .L1 +.L45: + lfs 1,24(31) + b .L1 +.L44: + lhz 3,24(31) + b .L1 +.L43: + lha 3,24(31) + b .L1 +.L41: + lbz 3,24(31) + b .L1 +.L42: + lbz 0,24(31) + slwi 0,0,24 + srawi 3,0,24 + b .L1 + .size callback_receiver, .-callback_receiver + .section ".got2","aw" +.LCTOC1 = .+32768 + .section ".text" + .section ".got2","aw" +.LC0: + .long callback_receiver + .section ".text" + .align 2 + .globl callback_get_receiver +.LCL1: + .long .LCTOC1-.LCF1 + .type callback_get_receiver, @function +callback_get_receiver: + stwu 1,-32(1) + mflr 0 + bcl 20,31,.LCF1 +.LCF1: + stw 30,24(1) + mflr 30 + stw 31,28(1) + mr 31,1 + stw 0,36(1) + lwz 11,0(1) + lwz 0,.LCL1-.LCF1(30) + lwz 31,-4(11) + add 30,0,30 + lwz 0,4(11) + lwz 3,.LC0-.LCTOC1(30) + lwz 30,-8(11) + mtlr 0 + mr 1,11 + blr + .size callback_get_receiver, .-callback_get_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-powerpc-linux.s b/callback/vacall_r/vacall-powerpc-linux.s new file mode 100644 index 0000000..1456743 --- /dev/null +++ b/callback/vacall_r/vacall-powerpc-linux.s @@ -0,0 +1,178 @@ + .file "vacall-powerpc.c" + .section ".text" + .align 2 + .type callback_receiver, @function +callback_receiver: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-176(1) + mflr 0 + stw 0,180(1) + stw 31,172(1) + mr 31,1 + stw 29,164(1) + addi 0,31,184 + li 29,0 + stw 0,32(31) + stw 29,36(31) + lwz 0,0(11) + stw 3,52(31) + stw 4,56(31) + mtctr 0 + stw 9,76(31) + addi 4,31,16 + stw 30,168(1) + stw 5,60(31) + stw 6,64(31) + stw 7,68(31) + stw 8,72(31) + stw 10,80(31) + stw 29,84(31) + stfd 1,88(31) + stfd 2,96(31) + stfd 3,104(31) + stfd 4,112(31) + stfd 5,120(31) + stfd 6,128(31) + stfd 7,136(31) + stfd 8,144(31) + stw 29,16(31) + stw 29,48(31) + stw 29,40(31) + lwz 3,4(11) + bctrl + lwz 9,40(31) + cmpwi 0,9,0 + beq- 0,.L1 + cmpwi 0,9,1 + beq- 0,.L41 + cmpwi 0,9,2 + beq- 0,.L42 + cmpwi 0,9,3 + beq- 0,.L41 + cmpwi 0,9,4 + beq- 0,.L43 + cmpwi 0,9,5 + beq- 0,.L44 + cmpwi 0,9,6 + beq- 0,.L40 + cmpwi 0,9,7 + beq- 0,.L40 + cmpwi 0,9,8 + beq- 0,.L40 + cmpwi 0,9,9 + beq- 0,.L40 + addi 0,9,-10 + cmplwi 0,0,1 + bgt- 0,.L22 + lwz 3,24(31) + lwz 4,28(31) +.L1: + lwz 11,0(1) + lwz 0,4(11) + lwz 29,-12(11) + lwz 30,-8(11) + mtlr 0 + lwz 31,-4(11) + mr 1,11 + blr +.L22: + cmpwi 0,9,12 + beq- 0,.L45 + cmpwi 0,9,13 + beq- 0,.L46 + cmpwi 0,9,14 + beq- 0,.L40 + cmpwi 0,9,15 + bne+ 0,.L1 + lwz 0,16(31) + andi. 9,0,1024 + beq- 0,.L1 + lwz 0,44(31) + cmpwi 0,0,1 + beq- 0,.L47 + cmpwi 0,0,2 + beq- 0,.L48 + cmpwi 0,0,4 + beq- 0,.L49 + cmpwi 0,0,8 + bne+ 0,.L1 + lwz 9,36(31) + lwz 4,4(9) +.L39: + lwz 3,0(9) + b .L1 +.L49: + lwz 9,36(31) + b .L39 +.L48: + lwz 9,36(31) + lhz 3,0(9) + b .L1 +.L47: + lwz 9,36(31) + lbz 3,0(9) + b .L1 +.L40: + lwz 3,24(31) + b .L1 +.L46: + lfd 1,24(31) + b .L1 +.L45: + lfs 1,24(31) + b .L1 +.L44: + lhz 3,24(31) + b .L1 +.L43: + lha 3,24(31) + b .L1 +.L41: + lbz 3,24(31) + b .L1 +.L42: + lbz 0,24(31) + slwi 0,0,24 + srawi 3,0,24 + b .L1 + .size callback_receiver, .-callback_receiver + .section ".got2","aw" +.LCTOC1 = .+32768 + .section ".text" + .section ".got2","aw" +.LC0: + .long callback_receiver + .section ".text" + .align 2 + .globl callback_get_receiver +.LCL1: + .long .LCTOC1-.LCF1 + .type callback_get_receiver, @function +callback_get_receiver: + stwu 1,-32(1) + mflr 0 + bcl 20,31,.LCF1 +.LCF1: + stw 30,24(1) + mflr 30 + stw 31,28(1) + mr 31,1 + stw 0,36(1) + lwz 11,0(1) + lwz 0,.LCL1-.LCF1(30) + lwz 31,-4(11) + add 30,0,30 + lwz 0,4(11) + lwz 3,.LC0-.LCTOC1(30) + lwz 30,-8(11) + mtlr 0 + mr 1,11 + blr + .size callback_get_receiver, .-callback_get_receiver + .section .note.GNU-stack,"",@progbits + .ident "GCC: (GNU) 3.3.6" diff --git a/callback/vacall_r/vacall-powerpc-macos.s b/callback/vacall_r/vacall-powerpc-macos.s new file mode 100644 index 0000000..0c9ce3b --- /dev/null +++ b/callback/vacall_r/vacall-powerpc-macos.s @@ -0,0 +1,154 @@ +.text + .align 2 +_callback_receiver: + mflr r0 + stmw r29,-12(r1) + stw r0,8(r1) + li r29,0 + stwu r1,-224(r1) + mr r30,r1 + addi r0,r30,248 + stw r29,84(r30) + stw r0,80(r30) + lwz r0,0(r11) + stw r3,248(r30) + stw r4,252(r30) + mtctr r0 + stw r9,272(r30) + addi r4,r30,64 + stw r5,256(r30) + stw r6,260(r30) + stw r7,264(r30) + stw r8,268(r30) + stw r10,276(r30) + stw r29,96(r30) + stfd f1,100(r30) + stfd f2,108(r30) + stfd f3,116(r30) + stfd f4,124(r30) + stfd f5,132(r30) + stfd f6,140(r30) + stfd f7,148(r30) + stfd f8,156(r30) + stfd f9,164(r30) + stfd f10,172(r30) + stfd f11,180(r30) + stfd f12,188(r30) + stfd f13,196(r30) + stw r29,64(r30) + stw r29,88(r30) + lwz r3,4(r11) + bctrl + lwz r9,88(r30) + cmpwi cr0,r9,0 + beq- cr0,L1 + cmpwi cr0,r9,1 + beq- cr0,L41 + cmpwi cr0,r9,2 + beq- cr0,L41 + cmpwi cr0,r9,3 + beq- cr0,L42 + cmpwi cr0,r9,4 + beq- cr0,L43 + cmpwi cr0,r9,5 + beq- cr0,L44 + cmpwi cr0,r9,6 + beq- cr0,L40 + cmpwi cr0,r9,7 + beq- cr0,L40 + cmpwi cr0,r9,8 + beq- cr0,L40 + cmpwi cr0,r9,9 + beq- cr0,L40 + addi r0,r9,-10 + cmplwi cr0,r0,1 + bgt- cr0,L22 + lwz r3,72(r30) + lwz r4,76(r30) +L1: + lwz r1,0(r1) + lwz r0,8(r1) + lmw r29,-12(r1) + mtlr r0 + blr +L22: + cmpwi cr0,r9,12 + beq- cr0,L45 + cmpwi cr0,r9,13 + beq- cr0,L46 + cmpwi cr0,r9,14 + beq- cr0,L40 + cmpwi cr0,r9,15 + bne+ cr0,L1 + lwz r0,64(r30) + andi. r9,r0,1024 + beq- cr0,L1 + lwz r0,92(r30) + cmpwi cr0,r0,1 + beq- cr0,L47 + cmpwi cr0,r0,2 + beq- cr0,L48 + cmpwi cr0,r0,4 + beq- cr0,L49 + cmpwi cr0,r0,8 + bne+ cr0,L1 + lwz r9,84(r30) + lwz r4,4(r9) +L39: + lwz r3,0(r9) + b L1 +L49: + lwz r9,84(r30) + b L39 +L48: + lwz r9,84(r30) + lhz r3,0(r9) + b L1 +L47: + lwz r9,84(r30) + lbz r3,0(r9) + b L1 +L40: + lwz r3,72(r30) + b L1 +L46: + lfd f1,72(r30) + b L1 +L45: + lfs f1,72(r30) + b L1 +L44: + lhz r3,72(r30) + b L1 +L43: + lha r3,72(r30) + b L1 +L42: + lbz r3,72(r30) + b L1 +L41: + lbz r0,72(r30) + extsb r3,r0 + b L1 + .align 2 + .globl _callback_get_receiver +_callback_get_receiver: + mflr r0 + stmw r30,-8(r1) + stw r0,8(r1) + bcl 20,31,L1$pb +L1$pb: + stwu r1,-48(r1) + mflr r31 + addis r9,r31,ha16(L_callback_receiver$non_lazy_ptr-L1$pb) + mr r30,r1 + lwz r3,lo16(L_callback_receiver$non_lazy_ptr-L1$pb)(r9) + lwz r1,0(r1) + lwz r0,8(r1) + lmw r30,-8(r1) + mtlr r0 + blr +.data + .align 2 +L_callback_receiver$non_lazy_ptr: + .long _callback_receiver diff --git a/callback/vacall_r/vacall-powerpc-sysv4-macro.S b/callback/vacall_r/vacall-powerpc-sysv4-macro.S new file mode 100644 index 0000000..d0d502f --- /dev/null +++ b/callback/vacall_r/vacall-powerpc-sysv4-macro.S @@ -0,0 +1,179 @@ + .file "vacall-powerpc.c" + .section ".text" + .align 2 + .type callback_receiver, @function +callback_receiver: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-176(1) + mflr 0 + stw 0,180(1) + stw 31,172(1) + mr 31,1 + stw 29,164(1) + addi 0,31,184 + li 29,0 + stw 0,32(31) + stw 29,36(31) + lwz 0,0(11) + stw 3,52(31) + stw 4,56(31) + mtctr 0 + stw 9,76(31) + addi 4,31,16 + stw 30,168(1) + stw 5,60(31) + stw 6,64(31) + stw 7,68(31) + stw 8,72(31) + stw 10,80(31) + stw 29,84(31) + stfd 1,88(31) + stfd 2,96(31) + stfd 3,104(31) + stfd 4,112(31) + stfd 5,120(31) + stfd 6,128(31) + stfd 7,136(31) + stfd 8,144(31) + stw 29,16(31) + stw 29,48(31) + stw 29,40(31) + lwz 3,4(11) + bctrl + lwz 9,40(31) + cmpwi 0,9,0 + beq- 0,.L1 + cmpwi 0,9,1 + beq- 0,.L41 + cmpwi 0,9,2 + beq- 0,.L42 + cmpwi 0,9,3 + beq- 0,.L41 + cmpwi 0,9,4 + beq- 0,.L43 + cmpwi 0,9,5 + beq- 0,.L44 + cmpwi 0,9,6 + beq- 0,.L40 + cmpwi 0,9,7 + beq- 0,.L40 + cmpwi 0,9,8 + beq- 0,.L40 + cmpwi 0,9,9 + beq- 0,.L40 + addi 0,9,-10 + cmplwi 0,0,1 + bgt- 0,.L22 + lwz 3,24(31) + lwz 4,28(31) +.L1: + lwz 11,0(1) + lwz 0,4(11) + lwz 29,-12(11) + lwz 30,-8(11) + mtlr 0 + lwz 31,-4(11) + mr 1,11 + blr +.L22: + cmpwi 0,9,12 + beq- 0,.L45 + cmpwi 0,9,13 + beq- 0,.L46 + cmpwi 0,9,14 + beq- 0,.L40 + cmpwi 0,9,15 + bne+ 0,.L1 + lwz 0,16(31) + andi. 9,0,1024 + beq- 0,.L1 + lwz 0,44(31) + cmpwi 0,0,1 + beq- 0,.L47 + cmpwi 0,0,2 + beq- 0,.L48 + cmpwi 0,0,4 + beq- 0,.L49 + cmpwi 0,0,8 + bne+ 0,.L1 + lwz 9,36(31) + lwz 4,4(9) +.L39: + lwz 3,0(9) + b .L1 +.L49: + lwz 9,36(31) + b .L39 +.L48: + lwz 9,36(31) + lhz 3,0(9) + b .L1 +.L47: + lwz 9,36(31) + lbz 3,0(9) + b .L1 +.L40: + lwz 3,24(31) + b .L1 +.L46: + lfd 1,24(31) + b .L1 +.L45: + lfs 1,24(31) + b .L1 +.L44: + lhz 3,24(31) + b .L1 +.L43: + lha 3,24(31) + b .L1 +.L41: + lbz 3,24(31) + b .L1 +.L42: + lbz 0,24(31) + slwi 0,0,24 + srawi 3,0,24 + b .L1 + .size callback_receiver, .-callback_receiver + .section ".got2","aw" +.LCTOC1 = .+32768 + .section ".text" + .section ".got2","aw" +.LC0: + .long callback_receiver + .section ".text" + .align 2 + .globl callback_get_receiver +.LCL1: + .long .LCTOC1-.LCF1 + .type callback_get_receiver, @function +callback_get_receiver: + stwu 1,-32(1) + mflr 0 + bcl 20,31,.LCF1 +.LCF1: + stw 30,24(1) + mflr 30 + stw 31,28(1) + mr 31,1 + stw 0,36(1) + lwz 11,0(1) + lwz 0,.LCL1-.LCF1(30) + lwz 31,-4(11) + add 30,0,30 + lwz 0,4(11) + lwz 3,.LC0-.LCTOC1(30) + lwz 30,-8(11) + mtlr 0 + mr 1,11 + blr + .size callback_get_receiver, .-callback_get_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-powerpc64-aix.s b/callback/vacall_r/vacall-powerpc64-aix.s new file mode 100644 index 0000000..39d740a --- /dev/null +++ b/callback/vacall_r/vacall-powerpc64-aix.s @@ -0,0 +1,176 @@ + .file "../../vacall/vacall-powerpc64.c" + .csect .text[PR] + .toc + .csect .text[PR] + .align 2 + .align 4 + .lglobl .callback_receiver + .csect callback_receiver[DS],3 +callback_receiver: + .llong .callback_receiver, TOC[tc0], 0 + .csect .text[PR] +.callback_receiver: + mflr 0 + std 30,-16(1) + std 31,-8(1) + li 30,0 + std 0,16(1) + li 0,0 + stdu 1,-304(1) + ld 12,0(11) + mr 31,1 + std 9,400(31) + addi 9,31,352 + stfd 1,172(31) + stw 0,152(31) + stw 0,168(31) + std 3,352(31) + std 4,360(31) + ld 3,8(11) + std 5,368(31) + addi 4,31,112 + std 6,376(31) + std 7,384(31) + std 8,392(31) + std 10,408(31) + stfd 2,180(31) + stfd 3,188(31) + stfd 4,196(31) + stfd 5,204(31) + stfd 6,212(31) + stfd 7,220(31) + stfd 8,228(31) + stfd 9,236(31) + stfd 10,244(31) + stfd 11,252(31) + stfd 12,260(31) + stfd 13,268(31) + std 9,136(31) + std 0,144(31) + stw 30,112(31) + std 2,40(1) + ld 9,0(12) + ld 11,16(12) + mtctr 9 + ld 2,8(12) + bctrl + ld 2,40(1) + lwz 9,152(31) + cmpdi 7,9,0 + beq 7,L..1 + cmplwi 7,9,1 + beq 7,L..20 + cmplwi 7,9,2 + beq 7,L..23 + cmplwi 7,9,3 + beq 7,L..20 + cmplwi 7,9,4 + beq 7,L..24 + cmplwi 7,9,5 + beq 7,L..25 + cmplwi 7,9,6 + beq 7,L..26 + cmplwi 7,9,7 + beq 7,L..27 + cmplwi 7,9,8 + beq 7,L..21 + cmplwi 7,9,9 + beq 7,L..21 + cmplwi 7,9,10 + beq 7,L..21 + cmplwi 7,9,11 + beq 7,L..21 + cmplwi 7,9,12 + beq 7,L..28 + cmplwi 7,9,13 + beq 7,L..29 + cmplwi 7,9,14 + beq 7,L..21 +L..1: + addi 1,31,304 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .align 4 +L..20: + lbz 3,120(31) + addi 1,31,304 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .align 4 +L..23: + lbz 9,120(31) + extsb 3,9 + b L..1 + .align 4 +L..21: + ld 3,120(31) + b L..1 + .align 4 +L..24: + lha 3,120(31) + b L..1 + .align 4 +L..25: + lhz 3,120(31) + b L..1 + .align 4 +L..26: + lwa 3,120(31) + b L..1 + .align 4 +L..28: + lfs 1,120(31) + b L..1 + .align 4 +L..27: + lwz 3,120(31) + b L..1 +L..29: + lfd 1,120(31) + b L..1 +LT..callback_receiver: + .long 0 + .byte 0,0,32,97,128,2,8,0 + .long 0 + .long LT..callback_receiver-.callback_receiver + .short 17 + .byte "callback_receiver" + .byte 31 + .align 2 + .toc +LC..0: + .tc callback_receiver[TC],callback_receiver + .csect .text[PR] + .align 2 + .align 4 + .globl callback_get_receiver + .globl .callback_get_receiver + .csect callback_get_receiver[DS],3 +callback_get_receiver: + .llong .callback_get_receiver, TOC[tc0], 0 + .csect .text[PR] +.callback_get_receiver: + std 31,-8(1) + ld 3,LC..0(2) + stdu 1,-64(1) + mr 31,1 + addi 1,31,64 + ld 31,-8(1) + blr +LT..callback_get_receiver: + .long 0 + .byte 0,0,32,96,128,1,0,0 + .long LT..callback_get_receiver-.callback_get_receiver + .short 21 + .byte "callback_get_receiver" + .byte 31 + .align 2 +_section_.text: + .csect .data[RW],4 + .llong _section_.text diff --git a/callback/vacall_r/vacall-powerpc64-elfv2-linux.S b/callback/vacall_r/vacall-powerpc64-elfv2-linux.S new file mode 100644 index 0000000..25af0eb --- /dev/null +++ b/callback/vacall_r/vacall-powerpc64-elfv2-linux.S @@ -0,0 +1,241 @@ + .file "vacall-powerpc64.c" + .machine power4 + .abiversion 2 + .section ".toc","aw" + .section ".text" + .align 2 + .p2align 4,,15 + .type callback_receiver, @function +callback_receiver: +0: addis 2,12,.TOC.-0b@ha + addi 2,2,.TOC.-0b@l + .localentry callback_receiver,.-callback_receiver + mflr 0 + std 30,-16(1) + std 31,-8(1) + std 0,16(1) + stdu 1,-224(1) + li 0,0 + ld 30,0(11) + mr 31,1 + std 3,256(31) + std 4,264(31) + addi 4,31,32 + ld 3,8(11) + std 9,304(31) + mtctr 30 + li 9,0 + std 5,272(31) + std 6,280(31) + std 7,288(31) + std 8,296(31) + stw 9,32(31) + std 10,312(31) + stfd 1,96(31) + stfd 2,104(31) + mr 12,30 + addi 9,31,256 + stfd 3,112(31) + stfd 4,120(31) + stfd 5,128(31) + stfd 6,136(31) + std 9,56(31) + stfd 7,144(31) + stfd 8,152(31) + stfd 9,160(31) + stfd 10,168(31) + stfd 11,176(31) + stfd 12,184(31) + stfd 13,192(31) + std 0,64(31) + stw 0,72(31) + stw 0,88(31) + std 2,24(1) + bctrl + ld 2,24(1) + lwz 9,72(31) + cmpdi 7,9,0 + beq 7,.L1 + cmplwi 7,9,1 + beq 7,.L27 + cmplwi 7,9,2 + beq 7,.L30 + cmplwi 7,9,3 + beq 7,.L27 + cmplwi 7,9,4 + beq 7,.L31 + cmplwi 7,9,5 + beq 7,.L32 + cmplwi 7,9,6 + beq 7,.L33 + cmplwi 7,9,7 + beq 7,.L34 + cmplwi 7,9,8 + beq 7,.L28 + cmplwi 7,9,9 + beq 7,.L28 + cmplwi 7,9,10 + beq 7,.L28 + cmplwi 7,9,11 + beq 7,.L28 + cmplwi 7,9,12 + beq 7,.L35 + cmplwi 7,9,13 + beq 7,.L36 + cmplwi 7,9,14 + beq 7,.L28 + cmplwi 7,9,15 + bne 7,.L1 + lwz 9,32(31) + rldicl. 10,9,54,63 + beq 0,.L1 + ld 9,80(31) + addi 10,9,-1 + cmpldi 7,10,15 + bgt 7,.L1 + ld 8,64(31) + cmpldi 7,9,8 + rldicl 10,8,0,61 + rldicr 8,8,0,60 + add 9,9,10 + bgt 7,.L17 + cmpldi 7,9,8 + slwi 9,9,3 + bgt 7,.L18 + ld 7,0(8) + addi 9,9,-1 + li 8,2 + slwi 10,10,3 + sld 9,8,9 + addi 9,9,-1 + and 9,9,7 + srad 3,9,10 +.L1: + addi 1,31,224 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L27: + addi 1,31,224 + lbz 3,40(31) + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L30: + lbz 9,40(31) + extsb 3,9 + b .L1 + .p2align 4,,15 +.L28: + ld 3,40(31) + b .L1 + .p2align 4,,15 +.L31: + lha 3,40(31) + b .L1 + .p2align 4,,15 +.L32: + lhz 3,40(31) + b .L1 + .p2align 4,,15 +.L33: + lwa 3,40(31) + b .L1 + .p2align 4,,15 +.L35: + lfs 1,40(31) + b .L1 + .p2align 4,,15 +.L34: + lwz 3,40(31) + b .L1 +.L36: + lfd 1,40(31) + b .L1 +.L17: + cmpldi 7,9,16 + rldicl 10,10,0,32 + slwi 9,9,3 + ble 7,.L37 + li 7,2 + addi 9,9,-129 + ld 0,16(8) + ld 5,0(8) + mulli 6,10,-8 + sld 9,7,9 + ld 7,8(8) + addi 8,9,-1 + slwi 9,10,3 + addi 6,6,64 + and 10,8,0 + srad 8,5,9 + sld 5,7,6 + srad 9,7,9 + sld 10,10,6 + or 3,8,5 + or 4,10,9 + b .L1 +.L18: + rldicl 10,10,0,32 + li 7,2 + ld 6,8(8) + ld 8,0(8) + addi 9,9,-65 + sld 9,7,9 + mulli 7,10,-8 + slwi 10,10,3 + addi 9,9,-1 + srad 10,8,10 + and 9,9,6 + addi 7,7,64 + sld 9,9,7 + or 3,9,10 + b .L1 +.L37: + li 7,2 + addi 9,9,-65 + ld 5,8(8) + ld 6,0(8) + sld 9,7,9 + mulli 7,10,-4 + addi 9,9,-1 + addi 7,7,32 + and 8,9,5 + slwi 9,10,3 + sld 10,8,7 + srad 6,6,9 + srad 4,8,9 + sld 7,10,7 + or 3,6,7 + b .L1 + .long 0 + .byte 0,0,0,1,128,2,0,0 + .size callback_receiver,.-callback_receiver + .align 2 + .p2align 4,,15 + .globl callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: +0: addis 2,12,.TOC.-0b@ha + addi 2,2,.TOC.-0b@l + .localentry callback_get_receiver,.-callback_get_receiver + std 31,-8(1) + stdu 1,-48(1) + addis 3,2,callback_receiver@toc@ha + addi 3,3,callback_receiver@toc@l + mr 31,1 + addi 1,31,48 + ld 31,-8(1) + blr + .long 0 + .byte 0,0,0,0,128,1,0,0 + .size callback_get_receiver,.-callback_get_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-powerpc64-linux.S b/callback/vacall_r/vacall-powerpc64-linux.S new file mode 100644 index 0000000..581289b --- /dev/null +++ b/callback/vacall_r/vacall-powerpc64-linux.S @@ -0,0 +1,164 @@ + .file "vacall-powerpc64.c" + .machine power4 + .section ".toc","aw" + .section ".text" + .align 2 + .p2align 4,,15 + .section ".opd","aw" + .align 3 +callback_receiver: + .quad .L.callback_receiver,.TOC.@tocbase,0 + .previous + .type callback_receiver, @function +.L.callback_receiver: + mflr 0 + std 30,-16(1) + std 31,-8(1) + li 30,0 + std 0,16(1) + stdu 1,-304(1) + li 0,0 + mr 31,1 + ld 12,0(11) + std 9,400(31) + addi 9,31,352 + stw 0,152(31) + stw 0,168(31) + std 3,352(31) + std 4,360(31) + ld 3,8(11) + std 5,368(31) + std 6,376(31) + addi 4,31,112 + std 7,384(31) + std 8,392(31) + std 10,408(31) + stfd 1,176(31) + stfd 2,184(31) + stfd 3,192(31) + stfd 4,200(31) + stfd 5,208(31) + stfd 6,216(31) + stfd 7,224(31) + stfd 8,232(31) + stfd 9,240(31) + stfd 10,248(31) + stfd 11,256(31) + stfd 12,264(31) + stfd 13,272(31) + std 9,136(31) + std 0,144(31) + stw 30,112(31) + std 2,40(1) + ld 9,0(12) + ld 11,16(12) + mtctr 9 + ld 2,8(12) + bctrl + ld 2,40(1) + lwz 9,152(31) + cmpdi 7,9,0 + beq 7,.L1 + cmplwi 7,9,1 + beq 7,.L20 + cmplwi 7,9,2 + beq 7,.L23 + cmplwi 7,9,3 + beq 7,.L20 + cmplwi 7,9,4 + beq 7,.L24 + cmplwi 7,9,5 + beq 7,.L25 + cmplwi 7,9,6 + beq 7,.L26 + cmplwi 7,9,7 + beq 7,.L27 + cmplwi 7,9,8 + beq 7,.L21 + cmplwi 7,9,9 + beq 7,.L21 + cmplwi 7,9,10 + beq 7,.L21 + cmplwi 7,9,11 + beq 7,.L21 + cmplwi 7,9,12 + beq 7,.L28 + cmplwi 7,9,13 + beq 7,.L29 + cmplwi 7,9,14 + beq 7,.L21 +.L1: + addi 1,31,304 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L20: + lbz 3,120(31) + addi 1,31,304 + ld 0,16(1) + ld 30,-16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L23: + lbz 9,120(31) + extsb 3,9 + b .L1 + .p2align 4,,15 +.L21: + ld 3,120(31) + b .L1 + .p2align 4,,15 +.L24: + lha 3,120(31) + b .L1 + .p2align 4,,15 +.L25: + lhz 3,120(31) + b .L1 + .p2align 4,,15 +.L26: + lwa 3,120(31) + b .L1 + .p2align 4,,15 +.L28: + lfs 1,120(31) + b .L1 + .p2align 4,,15 +.L27: + lwz 3,120(31) + b .L1 +.L29: + lfd 1,120(31) + b .L1 + .long 0 + .byte 0,0,0,1,128,2,0,0 + .size callback_receiver,.-.L.callback_receiver + .align 2 + .p2align 4,,15 + .globl callback_get_receiver + .section ".opd","aw" + .align 3 +callback_get_receiver: + .quad .L.callback_get_receiver,.TOC.@tocbase,0 + .previous + .type callback_get_receiver, @function +.L.callback_get_receiver: + std 31,-8(1) + stdu 1,-64(1) + addis 3,2,callback_receiver@toc@ha + addi 3,3,callback_receiver@toc@l + mr 31,1 + addi 1,31,64 + ld 31,-8(1) + blr + .long 0 + .byte 0,0,0,0,128,1,0,0 + .size callback_get_receiver,.-.L.callback_get_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-riscv32-ilp32d-linux.s b/callback/vacall_r/vacall-riscv32-ilp32d-linux.s new file mode 100644 index 0000000..d01ebaa --- /dev/null +++ b/callback/vacall_r/vacall-riscv32-ilp32d-linux.s @@ -0,0 +1,174 @@ + .file "vacall-riscv32.c" + .option pic + .text + .align 1 + .type callback_receiver, @function +callback_receiver: + add sp,sp,-208 + sw ra,188(sp) + sw s0,184(sp) + add s0,sp,192 + sw a1,-144(s0) + add a1,s0,16 + lw t3,0(t2) + sw a7,12(s0) + sw a2,-140(s0) + sw a3,-136(s0) + sw a4,-132(s0) + sw a5,-128(s0) + sw a6,-124(s0) + sw a7,-120(s0) + fsw fa0,-112(s0) + fsw fa1,-108(s0) + fsw fa2,-104(s0) + fsw fa3,-100(s0) + fsw fa4,-96(s0) + fsw fa5,-92(s0) + fsw fa6,-88(s0) + fsw fa7,-84(s0) + fsd fa0,-80(s0) + fsd fa1,-72(s0) + fsd fa2,-64(s0) + fsd fa3,-56(s0) + fsd fa4,-48(s0) + fsd fa5,-40(s0) + fsd fa6,-32(s0) + fsd fa7,-24(s0) + sw a1,-168(s0) + sw a0,-148(s0) + sw zero,-184(s0) + sw zero,-164(s0) + sw zero,-160(s0) + lw a0,4(t2) + sw zero,-152(s0) + sw zero,-116(s0) + add a1,s0,-184 + jalr t3 + lw t1,-160(s0) + beqz t1,.L1 + li t3,1 + beq t1,t3,.L22 + li t3,2 + beq t1,t3,.L25 + li t3,3 + beq t1,t3,.L22 + li t3,4 + beq t1,t3,.L26 + li t3,5 + beq t1,t3,.L27 + li t3,6 + beq t1,t3,.L23 + li t3,7 + beq t1,t3,.L23 + li t3,8 + beq t1,t3,.L23 + li t3,9 + beq t1,t3,.L23 + add t3,t1,-10 + li t4,1 + bleu t3,t4,.L28 + li t3,12 + beq t1,t3,.L29 + li t3,13 + beq t1,t3,.L30 + li t3,14 + beq t1,t3,.L23 + li t3,15 + bne t1,t3,.L1 + lw t1,-184(s0) + and t1,t1,2 + beqz t1,.L1 + lw t3,-156(s0) + li t1,7 + add t5,t3,-1 + bgtu t5,t1,.L1 + lw t1,-164(s0) + lbu t5,0(t1) + mv a0,t5 + beq t3,t4,.L1 + lbu t4,1(t1) + li t6,2 + sll t4,t4,8 + or t5,t4,t5 + mv a0,t5 + beq t3,t6,.L1 + lbu t4,2(t1) + li t6,3 + sll t4,t4,16 + or t4,t4,t5 + mv a0,t4 + beq t3,t6,.L1 + lbu a0,3(t1) + li t5,4 + sll a0,a0,24 + or a0,a0,t4 + beq t3,t5,.L1 + lbu t5,4(t1) + li t4,5 + mv a1,t5 + beq t3,t4,.L1 + lbu t4,5(t1) + li t6,6 + sll t4,t4,8 + or t5,t4,t5 + mv a1,t5 + beq t3,t6,.L1 + lbu t4,6(t1) + li t6,8 + sll t4,t4,16 + or t4,t4,t5 + mv a1,t4 + bne t3,t6,.L1 + lbu a1,7(t1) + sll a1,a1,24 + or a1,a1,t4 +.L1: + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L22: + lbu a0,-176(s0) + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L23: + lw a0,-176(s0) + j .L1 +.L25: + lb a0,-176(s0) + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L26: + lh a0,-176(s0) + j .L1 +.L27: + lhu a0,-176(s0) + j .L1 +.L28: + lw a0,-176(s0) + lw a1,-172(s0) + j .L1 +.L29: + flw fa0,-176(s0) + j .L1 +.L30: + fld fa0,-176(s0) + j .L1 + .size callback_receiver, .-callback_receiver + .align 1 + .globl callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: + add sp,sp,-16 + sw s0,12(sp) + add s0,sp,16 + lw s0,12(sp) + lla a0,callback_receiver + add sp,sp,16 + jr ra + .size callback_get_receiver, .-callback_get_receiver + .ident "GCC: (GNU) 7.3.0" diff --git a/callback/vacall_r/vacall-riscv32-ilp32d-macro.S b/callback/vacall_r/vacall-riscv32-ilp32d-macro.S new file mode 100644 index 0000000..c29c138 --- /dev/null +++ b/callback/vacall_r/vacall-riscv32-ilp32d-macro.S @@ -0,0 +1,176 @@ + .file "vacall-riscv32.c" + .option pic + .text + .align 1 + .type callback_receiver, @function +callback_receiver: + add sp,sp,-208 + sw ra,188(sp) + sw s0,184(sp) + add s0,sp,192 + sw a1,-144(s0) + add a1,s0,16 + lw t3,0(t2) + sw a7,12(s0) + sw a2,-140(s0) + sw a3,-136(s0) + sw a4,-132(s0) + sw a5,-128(s0) + sw a6,-124(s0) + sw a7,-120(s0) + fsw fa0,-112(s0) + fsw fa1,-108(s0) + fsw fa2,-104(s0) + fsw fa3,-100(s0) + fsw fa4,-96(s0) + fsw fa5,-92(s0) + fsw fa6,-88(s0) + fsw fa7,-84(s0) + fsd fa0,-80(s0) + fsd fa1,-72(s0) + fsd fa2,-64(s0) + fsd fa3,-56(s0) + fsd fa4,-48(s0) + fsd fa5,-40(s0) + fsd fa6,-32(s0) + fsd fa7,-24(s0) + sw a1,-168(s0) + sw a0,-148(s0) + sw zero,-184(s0) + sw zero,-164(s0) + sw zero,-160(s0) + lw a0,4(t2) + sw zero,-152(s0) + sw zero,-116(s0) + add a1,s0,-184 + jalr t3 + lw t1,-160(s0) + beqz t1,.L1 + li t3,1 + beq t1,t3,.L22 + li t3,2 + beq t1,t3,.L25 + li t3,3 + beq t1,t3,.L22 + li t3,4 + beq t1,t3,.L26 + li t3,5 + beq t1,t3,.L27 + li t3,6 + beq t1,t3,.L23 + li t3,7 + beq t1,t3,.L23 + li t3,8 + beq t1,t3,.L23 + li t3,9 + beq t1,t3,.L23 + add t3,t1,-10 + li t4,1 + bleu t3,t4,.L28 + li t3,12 + beq t1,t3,.L29 + li t3,13 + beq t1,t3,.L30 + li t3,14 + beq t1,t3,.L23 + li t3,15 + bne t1,t3,.L1 + lw t1,-184(s0) + and t1,t1,2 + beqz t1,.L1 + lw t3,-156(s0) + li t1,7 + add t5,t3,-1 + bgtu t5,t1,.L1 + lw t1,-164(s0) + lbu t5,0(t1) + mv a0,t5 + beq t3,t4,.L1 + lbu t4,1(t1) + li t6,2 + sll t4,t4,8 + or t5,t4,t5 + mv a0,t5 + beq t3,t6,.L1 + lbu t4,2(t1) + li t6,3 + sll t4,t4,16 + or t4,t4,t5 + mv a0,t4 + beq t3,t6,.L1 + lbu a0,3(t1) + li t5,4 + sll a0,a0,24 + or a0,a0,t4 + beq t3,t5,.L1 + lbu t5,4(t1) + li t4,5 + mv a1,t5 + beq t3,t4,.L1 + lbu t4,5(t1) + li t6,6 + sll t4,t4,8 + or t5,t4,t5 + mv a1,t5 + beq t3,t6,.L1 + lbu t4,6(t1) + li t6,8 + sll t4,t4,16 + or t4,t4,t5 + mv a1,t4 + bne t3,t6,.L1 + lbu a1,7(t1) + sll a1,a1,24 + or a1,a1,t4 +.L1: + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L22: + lbu a0,-176(s0) + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L23: + lw a0,-176(s0) + j .L1 +.L25: + lb a0,-176(s0) + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L26: + lh a0,-176(s0) + j .L1 +.L27: + lhu a0,-176(s0) + j .L1 +.L28: + lw a0,-176(s0) + lw a1,-172(s0) + j .L1 +.L29: + flw fa0,-176(s0) + j .L1 +.L30: + fld fa0,-176(s0) + j .L1 + .size callback_receiver, .-callback_receiver + .align 1 + .globl callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: + add sp,sp,-16 + sw s0,12(sp) + add s0,sp,16 + lw s0,12(sp) + lla a0,callback_receiver + add sp,sp,16 + jr ra + .size callback_get_receiver, .-callback_get_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-riscv64-lp64d-linux.s b/callback/vacall_r/vacall-riscv64-lp64d-linux.s new file mode 100644 index 0000000..0eae01a --- /dev/null +++ b/callback/vacall_r/vacall-riscv64-lp64d-linux.s @@ -0,0 +1,205 @@ + .file "vacall-riscv64.c" + .option pic + .text + .align 1 + .type callback_receiver, @function +callback_receiver: + add sp,sp,-288 + sd ra,264(sp) + sd s0,256(sp) + sd s1,248(sp) + add s0,sp,272 + sd s2,240(sp) + sd a1,-192(s0) + add a1,s0,16 + ld t3,0(t2) + sd a7,8(s0) + sd a2,-184(s0) + sd a3,-176(s0) + sd a4,-168(s0) + sd a5,-160(s0) + sd a6,-152(s0) + sd a7,-144(s0) + fsw fa0,-132(s0) + fsw fa1,-128(s0) + fsw fa2,-124(s0) + fsw fa3,-120(s0) + fsw fa4,-116(s0) + fsw fa5,-112(s0) + fsw fa6,-108(s0) + fsw fa7,-104(s0) + fsd fa0,-96(s0) + fsd fa1,-88(s0) + fsd fa2,-80(s0) + fsd fa3,-72(s0) + fsd fa4,-64(s0) + fsd fa5,-56(s0) + fsd fa6,-48(s0) + fsd fa7,-40(s0) + sd a1,-240(s0) + sd a0,-200(s0) + sw zero,-264(s0) + ld a0,8(t2) + sd zero,-232(s0) + sw zero,-224(s0) + sw zero,-208(s0) + sw zero,-136(s0) + add a1,s0,-264 + jalr t3 + lw t1,-224(s0) + beqz t1,.L1 + li t3,1 + beq t1,t3,.L25 + li t3,2 + beq t1,t3,.L29 + li t3,3 + beq t1,t3,.L25 + li t3,4 + beq t1,t3,.L30 + li t3,5 + beq t1,t3,.L31 + li t3,6 + beq t1,t3,.L32 + li t3,7 + beq t1,t3,.L33 + and t3,t1,-3 + li t4,8 + beq t3,t4,.L27 + li t4,9 + beq t3,t4,.L27 + li t3,12 + beq t1,t3,.L34 + li t3,13 + beq t1,t3,.L35 + li t3,14 + beq t1,t3,.L27 + li t3,15 + bne t1,t3,.L1 + lw t3,-264(s0) + and t3,t3,1024 + beqz t3,.L1 + ld t0,-216(s0) + add t3,t0,-1 + bgtu t3,t1,.L1 + ld t5,-232(s0) + li s2,8 + and t6,t5,7 + add s1,t0,t6 + and t5,t5,-8 + sext.w t6,t6 + sllw t1,s1,3 + ld t4,0(t5) + sll t3,t6,3 + bgtu t0,s2,.L15 + bgtu s1,s2,.L16 + addw t1,t1,-1 + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t4 + sra a0,a0,t3 +.L1: + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + ld s2,240(sp) + add sp,sp,288 + jr ra +.L25: + lbu a0,-256(s0) + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + ld s2,240(sp) + add sp,sp,288 + jr ra +.L29: + lb a0,-256(s0) + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + ld s2,240(sp) + add sp,sp,288 + jr ra +.L30: + lh a0,-256(s0) + j .L1 +.L33: + lwu a0,-256(s0) + j .L1 +.L31: + lhu a0,-256(s0) + j .L1 +.L27: + ld a0,-256(s0) + j .L1 +.L32: + lw a0,-256(s0) + j .L1 +.L34: + flw fa0,-256(s0) + j .L1 +.L35: + fld fa0,-256(s0) + j .L1 +.L15: + li s2,16 + sra t4,t4,t3 + ld t0,8(t5) + bleu s1,s2,.L36 + li a1,-8 + mulw t6,a1,t6 + addw t1,t1,-129 + ld a0,16(t5) + li a1,2 + sll a1,a1,t1 + add a1,a1,-1 + and a1,a1,a0 + sra t3,t0,t3 + addw t1,t6,64 + sll a0,t0,t1 + sll a1,a1,t1 + or a0,a0,t4 + or a1,a1,t3 + j .L1 +.L16: + li a0,-8 + mulw t6,a0,t6 + addw t1,t1,-65 + ld t5,8(t5) + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t5 + sra t4,t4,t3 + sll a0,a0,t6 + or a0,a0,t4 + j .L1 +.L36: + li a1,-4 + mulw t6,a1,t6 + addw t1,t1,-65 + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t0 + sra a1,a0,t3 + addw t1,t6,32 + sll a0,a0,t1 + sll a0,a0,t1 + or a0,a0,t4 + j .L1 + .size callback_receiver, .-callback_receiver + .align 1 + .globl callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: + add sp,sp,-16 + sd s0,8(sp) + add s0,sp,16 + ld s0,8(sp) + lla a0,callback_receiver + add sp,sp,16 + jr ra + .size callback_get_receiver, .-callback_get_receiver + .ident "GCC: (GNU) 7.3.0" diff --git a/callback/vacall_r/vacall-riscv64-lp64d-macro.S b/callback/vacall_r/vacall-riscv64-lp64d-macro.S new file mode 100644 index 0000000..c245a59 --- /dev/null +++ b/callback/vacall_r/vacall-riscv64-lp64d-macro.S @@ -0,0 +1,207 @@ + .file "vacall-riscv64.c" + .option pic + .text + .align 1 + .type callback_receiver, @function +callback_receiver: + add sp,sp,-288 + sd ra,264(sp) + sd s0,256(sp) + sd s1,248(sp) + add s0,sp,272 + sd s2,240(sp) + sd a1,-192(s0) + add a1,s0,16 + ld t3,0(t2) + sd a7,8(s0) + sd a2,-184(s0) + sd a3,-176(s0) + sd a4,-168(s0) + sd a5,-160(s0) + sd a6,-152(s0) + sd a7,-144(s0) + fsw fa0,-132(s0) + fsw fa1,-128(s0) + fsw fa2,-124(s0) + fsw fa3,-120(s0) + fsw fa4,-116(s0) + fsw fa5,-112(s0) + fsw fa6,-108(s0) + fsw fa7,-104(s0) + fsd fa0,-96(s0) + fsd fa1,-88(s0) + fsd fa2,-80(s0) + fsd fa3,-72(s0) + fsd fa4,-64(s0) + fsd fa5,-56(s0) + fsd fa6,-48(s0) + fsd fa7,-40(s0) + sd a1,-240(s0) + sd a0,-200(s0) + sw zero,-264(s0) + ld a0,8(t2) + sd zero,-232(s0) + sw zero,-224(s0) + sw zero,-208(s0) + sw zero,-136(s0) + add a1,s0,-264 + jalr t3 + lw t1,-224(s0) + beqz t1,.L1 + li t3,1 + beq t1,t3,.L25 + li t3,2 + beq t1,t3,.L29 + li t3,3 + beq t1,t3,.L25 + li t3,4 + beq t1,t3,.L30 + li t3,5 + beq t1,t3,.L31 + li t3,6 + beq t1,t3,.L32 + li t3,7 + beq t1,t3,.L33 + and t3,t1,-3 + li t4,8 + beq t3,t4,.L27 + li t4,9 + beq t3,t4,.L27 + li t3,12 + beq t1,t3,.L34 + li t3,13 + beq t1,t3,.L35 + li t3,14 + beq t1,t3,.L27 + li t3,15 + bne t1,t3,.L1 + lw t3,-264(s0) + and t3,t3,1024 + beqz t3,.L1 + ld t0,-216(s0) + add t3,t0,-1 + bgtu t3,t1,.L1 + ld t5,-232(s0) + li s2,8 + and t6,t5,7 + add s1,t0,t6 + and t5,t5,-8 + sext.w t6,t6 + sllw t1,s1,3 + ld t4,0(t5) + sll t3,t6,3 + bgtu t0,s2,.L15 + bgtu s1,s2,.L16 + addw t1,t1,-1 + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t4 + sra a0,a0,t3 +.L1: + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + ld s2,240(sp) + add sp,sp,288 + jr ra +.L25: + lbu a0,-256(s0) + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + ld s2,240(sp) + add sp,sp,288 + jr ra +.L29: + lb a0,-256(s0) + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + ld s2,240(sp) + add sp,sp,288 + jr ra +.L30: + lh a0,-256(s0) + j .L1 +.L33: + lwu a0,-256(s0) + j .L1 +.L31: + lhu a0,-256(s0) + j .L1 +.L27: + ld a0,-256(s0) + j .L1 +.L32: + lw a0,-256(s0) + j .L1 +.L34: + flw fa0,-256(s0) + j .L1 +.L35: + fld fa0,-256(s0) + j .L1 +.L15: + li s2,16 + sra t4,t4,t3 + ld t0,8(t5) + bleu s1,s2,.L36 + li a1,-8 + mulw t6,a1,t6 + addw t1,t1,-129 + ld a0,16(t5) + li a1,2 + sll a1,a1,t1 + add a1,a1,-1 + and a1,a1,a0 + sra t3,t0,t3 + addw t1,t6,64 + sll a0,t0,t1 + sll a1,a1,t1 + or a0,a0,t4 + or a1,a1,t3 + j .L1 +.L16: + li a0,-8 + mulw t6,a0,t6 + addw t1,t1,-65 + ld t5,8(t5) + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t5 + sra t4,t4,t3 + sll a0,a0,t6 + or a0,a0,t4 + j .L1 +.L36: + li a1,-4 + mulw t6,a1,t6 + addw t1,t1,-65 + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t0 + sra a1,a0,t3 + addw t1,t6,32 + sll a0,a0,t1 + sll a0,a0,t1 + or a0,a0,t4 + j .L1 + .size callback_receiver, .-callback_receiver + .align 1 + .globl callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: + add sp,sp,-16 + sd s0,8(sp) + add s0,sp,16 + ld s0,8(sp) + lla a0,callback_receiver + add sp,sp,16 + jr ra + .size callback_get_receiver, .-callback_get_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-s390-linux.s b/callback/vacall_r/vacall-s390-linux.s new file mode 100644 index 0000000..999229f --- /dev/null +++ b/callback/vacall_r/vacall-s390-linux.s @@ -0,0 +1,160 @@ + .file "vacall-s390.c" +.text + .align 4 + .type callback_receiver,@function +callback_receiver: + stm %r6,%r15,24(%r15) + bras %r13,.LTN0_0 +.LT0_0: +.LC0: + .long 0 +.LC1: + .long 255 +.LC2: + .long 65535 +.LC3: + .long 1 +.LTN0_0: + lr %r1,%r0 + lr %r14,%r15 + ahi %r15,-184 + lr %r11,%r15 + lr %r9,%r0 + l %r10,0(%r1) + st %r14,0(%r15) + la %r1,280(%r11) + mvc 116(4,%r11),.LC0-.LT0_0(%r13) + st %r2,132(%r11) + st %r3,136(%r11) + la %r3,96(%r11) + st %r4,140(%r11) + st %r5,144(%r11) + st %r6,148(%r11) + std %f2,176(%r11) + std %f0,168(%r11) + ste %f2,160(%r11) + ste %f0,156(%r11) + mvc 96(4,%r11),.LC0-.LT0_0(%r13) + st %r1,112(%r11) + mvc 120(4,%r11),.LC0-.LT0_0(%r13) + mvc 128(4,%r11),.LC0-.LT0_0(%r13) + mvc 152(4,%r11),.LC0-.LT0_0(%r13) + l %r2,4(%r9) + basr %r14,%r10 + icm %r4,15,120(%r11) + je .L1 + chi %r4,1 + je .L43 + chi %r4,2 + je .L44 + chi %r4,3 + je .L43 + chi %r4,4 + je .L45 + chi %r4,5 + je .L46 + chi %r4,6 + je .L40 + chi %r4,7 + je .L40 + chi %r4,8 + je .L40 + chi %r4,9 + je .L40 + lr %r1,%r4 + ahi %r1,-10 + cl %r1,.LC3-.LT0_0(%r13) + jh .L22 + l %r2,104(%r11) + l %r3,108(%r11) +.L1: + l %r4,240(%r11) + lm %r6,%r15,208(%r11) + br %r4 +.L22: + chi %r4,12 + je .L47 + chi %r4,13 + je .L48 + chi %r4,14 + je .L40 + chi %r4,15 + jne .L1 + tm 98(%r11),4 + je .L1 + l %r1,124(%r11) + chi %r1,1 + je .L49 + chi %r1,2 + je .L50 + chi %r1,4 + je .L51 + chi %r1,8 + jne .L1 + l %r1,116(%r11) + l %r3,4(%r1) +.L39: + l %r2,0(%r1) + j .L1 +.L51: + l %r1,116(%r11) + j .L39 +.L50: + l %r1,116(%r11) + lh %r4,0(%r1) + lr %r2,%r4 +.L41: + n %r2,.LC2-.LT0_0(%r13) + j .L1 +.L49: + l %r1,116(%r11) + ic %r4,0(%r1) + lr %r2,%r4 +.L42: + n %r2,.LC1-.LT0_0(%r13) + j .L1 +.L40: + l %r2,104(%r11) + j .L1 +.L48: + ld %f0,104(%r11) + j .L1 +.L47: + le %f0,104(%r11) + j .L1 +.L46: + lh %r1,104(%r11) + lr %r2,%r1 + j .L41 +.L45: + lh %r2,104(%r11) + j .L1 +.L43: + ic %r1,104(%r11) + lr %r2,%r1 + j .L42 +.L44: + icm %r1,8,104(%r11) + lr %r2,%r1 + sra %r2,24 + j .L1 +.Lfe1: + .size callback_receiver,.Lfe1-callback_receiver + .align 4 +.globl callback_get_receiver + .type callback_get_receiver,@function +callback_get_receiver: + stm %r11,%r13,44(%r15) + bras %r13,.LTN1_0 +.LT1_0: +.LC4: + .long callback_receiver-.LT1_0 +.LTN1_0: + l %r1,.LC4-.LT1_0(%r13) + lr %r11,%r15 + la %r2,0(%r13,%r1) + lm %r11,%r13,44(%r11) + br %r14 +.Lfe2: + .size callback_get_receiver,.Lfe2-callback_get_receiver + .ident "GCC: (GNU) 3.1" diff --git a/callback/vacall_r/vacall-s390-macro.S b/callback/vacall_r/vacall-s390-macro.S new file mode 100644 index 0000000..1c5314a --- /dev/null +++ b/callback/vacall_r/vacall-s390-macro.S @@ -0,0 +1,162 @@ + .file "vacall-s390.c" +.text + .align 4 + .type callback_receiver,@function +callback_receiver: + stm %r6,%r15,24(%r15) + bras %r13,.LTN0_0 +.LT0_0: +.LC0: + .long 0 +.LC1: + .long 255 +.LC2: + .long 65535 +.LC3: + .long 1 +.LTN0_0: + lr %r1,%r0 + lr %r14,%r15 + ahi %r15,-184 + lr %r11,%r15 + lr %r9,%r0 + l %r10,0(%r1) + st %r14,0(%r15) + la %r1,280(%r11) + mvc 116(4,%r11),.LC0-.LT0_0(%r13) + st %r2,132(%r11) + st %r3,136(%r11) + la %r3,96(%r11) + st %r4,140(%r11) + st %r5,144(%r11) + st %r6,148(%r11) + std %f2,176(%r11) + std %f0,168(%r11) + ste %f2,160(%r11) + ste %f0,156(%r11) + mvc 96(4,%r11),.LC0-.LT0_0(%r13) + st %r1,112(%r11) + mvc 120(4,%r11),.LC0-.LT0_0(%r13) + mvc 128(4,%r11),.LC0-.LT0_0(%r13) + mvc 152(4,%r11),.LC0-.LT0_0(%r13) + l %r2,4(%r9) + basr %r14,%r10 + icm %r4,15,120(%r11) + je .L1 + chi %r4,1 + je .L43 + chi %r4,2 + je .L44 + chi %r4,3 + je .L43 + chi %r4,4 + je .L45 + chi %r4,5 + je .L46 + chi %r4,6 + je .L40 + chi %r4,7 + je .L40 + chi %r4,8 + je .L40 + chi %r4,9 + je .L40 + lr %r1,%r4 + ahi %r1,-10 + cl %r1,.LC3-.LT0_0(%r13) + jh .L22 + l %r2,104(%r11) + l %r3,108(%r11) +.L1: + l %r4,240(%r11) + lm %r6,%r15,208(%r11) + br %r4 +.L22: + chi %r4,12 + je .L47 + chi %r4,13 + je .L48 + chi %r4,14 + je .L40 + chi %r4,15 + jne .L1 + tm 98(%r11),4 + je .L1 + l %r1,124(%r11) + chi %r1,1 + je .L49 + chi %r1,2 + je .L50 + chi %r1,4 + je .L51 + chi %r1,8 + jne .L1 + l %r1,116(%r11) + l %r3,4(%r1) +.L39: + l %r2,0(%r1) + j .L1 +.L51: + l %r1,116(%r11) + j .L39 +.L50: + l %r1,116(%r11) + lh %r4,0(%r1) + lr %r2,%r4 +.L41: + n %r2,.LC2-.LT0_0(%r13) + j .L1 +.L49: + l %r1,116(%r11) + ic %r4,0(%r1) + lr %r2,%r4 +.L42: + n %r2,.LC1-.LT0_0(%r13) + j .L1 +.L40: + l %r2,104(%r11) + j .L1 +.L48: + ld %f0,104(%r11) + j .L1 +.L47: + le %f0,104(%r11) + j .L1 +.L46: + lh %r1,104(%r11) + lr %r2,%r1 + j .L41 +.L45: + lh %r2,104(%r11) + j .L1 +.L43: + ic %r1,104(%r11) + lr %r2,%r1 + j .L42 +.L44: + icm %r1,8,104(%r11) + lr %r2,%r1 + sra %r2,24 + j .L1 +.Lfe1: + .size callback_receiver,.Lfe1-callback_receiver + .align 4 +.globl callback_get_receiver + .type callback_get_receiver,@function +callback_get_receiver: + stm %r11,%r13,44(%r15) + bras %r13,.LTN1_0 +.LT1_0: +.LC4: + .long callback_receiver-.LT1_0 +.LTN1_0: + l %r1,.LC4-.LT1_0(%r13) + lr %r11,%r15 + la %r2,0(%r13,%r1) + lm %r11,%r13,44(%r11) + br %r14 +.Lfe2: + .size callback_get_receiver,.Lfe2-callback_get_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-s390x-linux.s b/callback/vacall_r/vacall-s390x-linux.s new file mode 100644 index 0000000..84d0283 --- /dev/null +++ b/callback/vacall_r/vacall-s390x-linux.s @@ -0,0 +1,148 @@ + .file "vacall-s390x.c" +.text + .align 8 + .type callback_receiver, @function +callback_receiver: +.LFB0: + .cfi_startproc + stmg %r10,%r15,80(%r15) + .cfi_offset 10, -80 + .cfi_offset 11, -72 + .cfi_offset 12, -64 + .cfi_offset 13, -56 + .cfi_offset 14, -48 + .cfi_offset 15, -40 + aghi %r15,-320 + .cfi_def_cfa_offset 480 + lgr %r11,%r15 + .cfi_def_cfa_register 11 + lgr %r1,%r0 + lhi %r14,0 + stg %r2,224(%r11) + lg %r10,0(%r1) + st %r14,160(%r11) + la %r14,480(%r11) + stg %r14,184(%r11) + lghi %r14,0 + stg %r3,232(%r11) + lg %r2,8(%r1) + stg %r4,240(%r11) + stg %r5,248(%r11) + stg %r6,256(%r11) + ste %f0,268(%r11) + ste %f2,272(%r11) + ste %f4,276(%r11) + ste %f6,280(%r11) + std %f0,288(%r11) + std %f2,296(%r11) + std %f4,304(%r11) + std %f6,312(%r11) + stg %r14,192(%r11) + st %r14,200(%r11) + st %r14,216(%r11) + st %r14,264(%r11) + la %r3,160(%r11) + basr %r14,%r10 + icm %r1,15,200(%r11) + je .L1 + chi %r1,1 + je .L18 + chi %r1,2 + je .L21 + chi %r1,3 + je .L18 + chi %r1,4 + je .L22 + chi %r1,5 + je .L23 + chi %r1,6 + je .L24 + chi %r1,7 + je .L25 + lr %r10,%r1 + nill %r10,65533 + chi %r10,8 + je .L19 + chi %r10,9 + je .L19 + chi %r1,12 + je .L26 + chi %r1,13 + je .L27 + chi %r1,14 + je .L19 +.L1: + lg %r4,432(%r11) + lmg %r10,%r15,400(%r11) + .cfi_remember_state + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_restore 11 + .cfi_restore 10 + .cfi_def_cfa 15, 160 + br %r4 +.L18: + .cfi_restore_state + lg %r4,432(%r11) + llgc %r2,168(%r11) + lmg %r10,%r15,400(%r11) + .cfi_remember_state + .cfi_restore 10 + .cfi_restore 11 + .cfi_restore 12 + .cfi_restore 13 + .cfi_restore 14 + .cfi_restore 15 + .cfi_def_cfa 15, 160 + br %r4 +.L21: + .cfi_restore_state + icmh %r2,8,168(%r11) + srag %r2,%r2,56 + j .L1 +.L19: + lg %r2,168(%r11) + j .L1 +.L22: + lgh %r2,168(%r11) + j .L1 +.L23: + llgh %r2,168(%r11) + j .L1 +.L24: + lgf %r2,168(%r11) + j .L1 +.L26: + le %f0,168(%r11) + j .L1 +.L25: + llgf %r2,168(%r11) + j .L1 +.L27: + ld %f0,168(%r11) + j .L1 + .cfi_endproc +.LFE0: + .size callback_receiver, .-callback_receiver + .align 8 +.globl callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: +.LFB1: + .cfi_startproc + stg %r11,88(%r15) + .cfi_offset 11, -72 + lgr %r11,%r15 + .cfi_def_cfa_register 11 + larl %r2,callback_receiver + lg %r11,88(%r11) + .cfi_restore 11 + .cfi_def_cfa_register 15 + br %r14 + .cfi_endproc +.LFE1: + .size callback_get_receiver, .-callback_get_receiver + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/callback/vacall_r/vacall-s390x-macro.S b/callback/vacall_r/vacall-s390x-macro.S new file mode 100644 index 0000000..1306be6 --- /dev/null +++ b/callback/vacall_r/vacall-s390x-macro.S @@ -0,0 +1,149 @@ + .file "vacall-s390x.c" +.text + .align 8 + .type callback_receiver, @function +callback_receiver: +.LFB0: + .cfi_startproc + stmg %r10,%r15,80(%r15) + .cfi_offset 10, -80 + .cfi_offset 11, -72 + .cfi_offset 12, -64 + .cfi_offset 13, -56 + .cfi_offset 14, -48 + .cfi_offset 15, -40 + aghi %r15,-320 + .cfi_def_cfa_offset 480 + lgr %r11,%r15 + .cfi_def_cfa_register 11 + lgr %r1,%r0 + lhi %r14,0 + stg %r2,224(%r11) + lg %r10,0(%r1) + st %r14,160(%r11) + la %r14,480(%r11) + stg %r14,184(%r11) + lghi %r14,0 + stg %r3,232(%r11) + lg %r2,8(%r1) + stg %r4,240(%r11) + stg %r5,248(%r11) + stg %r6,256(%r11) + ste %f0,268(%r11) + ste %f2,272(%r11) + ste %f4,276(%r11) + ste %f6,280(%r11) + std %f0,288(%r11) + std %f2,296(%r11) + std %f4,304(%r11) + std %f6,312(%r11) + stg %r14,192(%r11) + st %r14,200(%r11) + st %r14,216(%r11) + st %r14,264(%r11) + la %r3,160(%r11) + basr %r14,%r10 + icm %r1,15,200(%r11) + je .L1 + chi %r1,1 + je .L18 + chi %r1,2 + je .L21 + chi %r1,3 + je .L18 + chi %r1,4 + je .L22 + chi %r1,5 + je .L23 + chi %r1,6 + je .L24 + chi %r1,7 + je .L25 + lr %r10,%r1 + nill %r10,65533 + chi %r10,8 + je .L19 + chi %r10,9 + je .L19 + chi %r1,12 + je .L26 + chi %r1,13 + je .L27 + chi %r1,14 + je .L19 +.L1: + lg %r4,432(%r11) + lmg %r10,%r15,400(%r11) + .cfi_remember_state + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_restore 11 + .cfi_restore 10 + .cfi_def_cfa 15, 160 + br %r4 +.L18: + .cfi_restore_state + lg %r4,432(%r11) + llgc %r2,168(%r11) + lmg %r10,%r15,400(%r11) + .cfi_remember_state + .cfi_restore 10 + .cfi_restore 11 + .cfi_restore 12 + .cfi_restore 13 + .cfi_restore 14 + .cfi_restore 15 + .cfi_def_cfa 15, 160 + br %r4 +.L21: + .cfi_restore_state + icmh %r2,8,168(%r11) + srag %r2,%r2,56 + j .L1 +.L19: + lg %r2,168(%r11) + j .L1 +.L22: + lgh %r2,168(%r11) + j .L1 +.L23: + llgh %r2,168(%r11) + j .L1 +.L24: + lgf %r2,168(%r11) + j .L1 +.L26: + le %f0,168(%r11) + j .L1 +.L25: + llgf %r2,168(%r11) + j .L1 +.L27: + ld %f0,168(%r11) + j .L1 + .cfi_endproc +.LFE0: + .size callback_receiver, .-callback_receiver + .align 8 +.globl callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: +.LFB1: + .cfi_startproc + stg %r11,88(%r15) + .cfi_offset 11, -72 + lgr %r11,%r15 + .cfi_def_cfa_register 11 + larl %r2,callback_receiver + lg %r11,88(%r11) + .cfi_restore 11 + .cfi_def_cfa_register 15 + br %r14 + .cfi_endproc +.LFE1: + .size callback_get_receiver, .-callback_get_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-sparc-linux.s b/callback/vacall_r/vacall-sparc-linux.s new file mode 100644 index 0000000..881f004 --- /dev/null +++ b/callback/vacall_r/vacall-sparc-linux.s @@ -0,0 +1,129 @@ + .file "vacall-sparc.c" + .section ".text" + .align 4 + .global callback_receiver + .type callback_receiver,#function + .proc 020 +callback_receiver: + !#PROLOGUE# 0 + save %sp, -144, %sp + ld [%fp+64], %o0 + add %fp, 68, %o1 + st %g0, [%fp-28] + st %o0, [%fp-16] + st %o1, [%fp-32] + ld [%g2+4], %o0 + add %fp, -48, %o1 + ld [%g2], %o2 + st %i2, [%fp+76] + st %i3, [%fp+80] + st %i4, [%fp+84] + st %i5, [%fp+88] + st %i0, [%fp+68] + st %i1, [%fp+72] + st %g0, [%fp-48] + call %o2, 0 + st %g0, [%fp-24] + ld [%fp-24], %o1 + cmp %o1, 0 + be .LL1 + cmp %o1, 1 + be .LL44 + cmp %o1, 2 + be .LL44 + cmp %o1, 3 + be .LL45 + cmp %o1, 4 + be .LL46 + cmp %o1, 5 + be .LL47 + cmp %o1, 6 + be .LL43 + cmp %o1, 7 + be .LL43 + cmp %o1, 8 + be .LL43 + cmp %o1, 9 + be .LL43 + add %o1, -10, %o0 + cmp %o0, 1 + bgu .LL22 + cmp %o1, 12 + ld [%fp-40], %i0 + b .LL1 + ld [%fp-36], %i1 +.LL22: + be .LL48 + cmp %o1, 13 + be .LL49 + cmp %o1, 14 + be .LL43 + cmp %o1, 15 + bne .LL1 + ld [%fp-48], %o0 + andcc %o0, 16, %g0 + be .LL33 + andcc %o0, 2, %g0 + ld [%fp-20], %o0 + ld [%i7+8], %o1 + and %o0, 4095, %o0 + cmp %o0, %o1 + bne .LL1 + ld [%fp-28], %i0 + b .LL1 + add %i7, 4, %i7 +.LL33: + be,a .LL1 + add %i7, 4, %i7 + ld [%fp-20], %o0 + cmp %o0, 1 + be .LL50 + cmp %o0, 2 + be .LL51 + cmp %o0, 4 + bne,a .LL1 + add %i7, 4, %i7 + ld [%fp-28], %o0 + b .LL1 + ld [%o0], %i0 +.LL51: + ld [%fp-28], %o0 + b .LL1 + lduh [%o0], %i0 +.LL50: + ld [%fp-28], %o0 + b .LL1 + ldub [%o0], %i0 +.LL43: + b .LL1 + ld [%fp-40], %i0 +.LL49: + b .LL1 + ldd [%fp-40], %f0 +.LL48: + ld [%fp-48], %o0 + andcc %o0, 32, %g0 + be,a .LL1 + ld [%fp-40], %f0 + ld [%fp-40], %f2 + b .LL1 + fstod %f2, %f0 +.LL47: + b .LL1 + lduh [%fp-40], %i0 +.LL46: + b .LL1 + ldsh [%fp-40], %i0 +.LL45: + b .LL1 + ldub [%fp-40], %i0 +.LL44: + ldsb [%fp-40], %i0 +.LL38: +.LL1: + nop + ret + restore +.LLfe1: + .size callback_receiver,.LLfe1-callback_receiver + .ident "GCC: (GNU) 3.1" diff --git a/callback/vacall_r/vacall-sparc-macro.S b/callback/vacall_r/vacall-sparc-macro.S new file mode 100644 index 0000000..d4acde7 --- /dev/null +++ b/callback/vacall_r/vacall-sparc-macro.S @@ -0,0 +1,131 @@ +#include "asm-sparc.h" + .section ".text" + .align 4 + .global C(callback_receiver) + DECLARE_FUNCTION(callback_receiver) + .proc 020 +FUNBEGIN(callback_receiver) + !$PROLOGUE$ 0 + save %sp, -144, %sp + ld [%fp+64], %o0 + add %fp, 68, %o1 + st %g0, [%fp-28] + st %o0, [%fp-16] + st %o1, [%fp-32] + ld [%g2+4], %o0 + add %fp, -48, %o1 + ld [%g2], %o2 + st %i2, [%fp+76] + st %i3, [%fp+80] + st %i4, [%fp+84] + st %i5, [%fp+88] + st %i0, [%fp+68] + st %i1, [%fp+72] + st %g0, [%fp-48] + call %o2, 0 + st %g0, [%fp-24] + ld [%fp-24], %o1 + cmp %o1, 0 + be L(L1) + cmp %o1, 1 + be L(L44) + cmp %o1, 2 + be L(L44) + cmp %o1, 3 + be L(L45) + cmp %o1, 4 + be L(L46) + cmp %o1, 5 + be L(L47) + cmp %o1, 6 + be L(L43) + cmp %o1, 7 + be L(L43) + cmp %o1, 8 + be L(L43) + cmp %o1, 9 + be L(L43) + add %o1, -10, %o0 + cmp %o0, 1 + bgu L(L22) + cmp %o1, 12 + ld [%fp-40], %i0 + b L(L1) + ld [%fp-36], %i1 +L(L22): + be L(L48) + cmp %o1, 13 + be L(L49) + cmp %o1, 14 + be L(L43) + cmp %o1, 15 + bne L(L1) + ld [%fp-48], %o0 + andcc %o0, 16, %g0 + be L(L33) + andcc %o0, 2, %g0 + ld [%fp-20], %o0 + ld [%i7+8], %o1 + and %o0, 4095, %o0 + cmp %o0, %o1 + bne L(L1) + ld [%fp-28], %i0 + b L(L1) + add %i7, 4, %i7 +L(L33): + be,a L(L1) + add %i7, 4, %i7 + ld [%fp-20], %o0 + cmp %o0, 1 + be L(L50) + cmp %o0, 2 + be L(L51) + cmp %o0, 4 + bne,a L(L1) + add %i7, 4, %i7 + ld [%fp-28], %o0 + b L(L1) + ld [%o0], %i0 +L(L51): + ld [%fp-28], %o0 + b L(L1) + lduh [%o0], %i0 +L(L50): + ld [%fp-28], %o0 + b L(L1) + ldub [%o0], %i0 +L(L43): + b L(L1) + ld [%fp-40], %i0 +L(L49): + b L(L1) + ldd [%fp-40], %f0 +L(L48): + ld [%fp-48], %o0 + andcc %o0, 32, %g0 + be,a L(L1) + ld [%fp-40], %f0 + ld [%fp-40], %f2 + b L(L1) + fstod %f2, %f0 +L(L47): + b L(L1) + lduh [%fp-40], %i0 +L(L46): + b L(L1) + ldsh [%fp-40], %i0 +L(L45): + b L(L1) + ldub [%fp-40], %i0 +L(L44): + ldsb [%fp-40], %i0 +L(L38): +L(L1): + nop + ret + restore +L(Lfe1): + FUNEND(callback_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-sparc64-linux.s b/callback/vacall_r/vacall-sparc64-linux.s new file mode 100644 index 0000000..c8723aa --- /dev/null +++ b/callback/vacall_r/vacall-sparc64-linux.s @@ -0,0 +1,319 @@ + .file "vacall-sparc64.c" + .section ".text" + .align 4 + .global callback_receiver + .type callback_receiver, #function + .proc 020 +callback_receiver: + .register %g2, #scratch + .register %g3, #scratch + save %sp, -448, %sp + stx %i0, [%fp+2175] + stx %i1, [%fp+2183] + stx %i2, [%fp+2191] + stx %i3, [%fp+2199] + stx %i4, [%fp+2207] + stx %i5, [%fp+2215] + std %f0, [%fp+1903] + std %f2, [%fp+1911] + std %f4, [%fp+1919] + std %f6, [%fp+1927] + std %f8, [%fp+1935] + std %f10, [%fp+1943] + std %f12, [%fp+1951] + std %f14, [%fp+1959] + std %f16, [%fp+1967] + std %f18, [%fp+1975] + std %f20, [%fp+1983] + std %f22, [%fp+1991] + std %f24, [%fp+1999] + std %f26, [%fp+2007] + std %f28, [%fp+2015] + std %f30, [%fp+2023] + st %f1, [%fp+1835] + st %f3, [%fp+1839] + st %f5, [%fp+1843] + st %f7, [%fp+1847] + st %f9, [%fp+1851] + st %f11, [%fp+1855] + st %f13, [%fp+1859] + st %f15, [%fp+1863] + st %f17, [%fp+1867] + st %f19, [%fp+1871] + st %f21, [%fp+1875] + st %f23, [%fp+1879] + add %fp, 2175, %g2 + stx %g0, [%fp+1807] + st %f25, [%fp+1883] + st %f27, [%fp+1887] + st %f29, [%fp+1891] + st %f31, [%fp+1895] + st %g0, [%fp+1775] + st %g0, [%fp+1815] + st %g0, [%fp+1831] + ldx [%g5+8], %o0 + stx %g2, [%fp+1799] + ldx [%g5], %g3 + call %g3, 0 + add %fp, 1775, %o1 + lduw [%fp+1815], %g1 + cmp %g1, 0 + be,pn %icc, .LL61 + cmp %g1, 1 + be,pn %icc, .LL50 + cmp %g1, 2 + be,pn %icc, .LL50 + cmp %g1, 3 + be,pn %icc, .LL53 + cmp %g1, 4 + be,pn %icc, .LL54 + cmp %g1, 5 + be,pn %icc, .LL55 + cmp %g1, 6 + be,pn %icc, .LL56 + cmp %g1, 7 + be,pn %icc, .LL57 + cmp %g1, 8 + be,pn %icc, .LL51 + cmp %g1, 9 + be,pn %icc, .LL51 + cmp %g1, 10 + be,pn %icc, .LL51 + cmp %g1, 11 + be,pn %icc, .LL51 + cmp %g1, 12 + be,pn %icc, .LL58 + cmp %g1, 13 + be,pn %icc, .LL59 + cmp %g1, 14 + be,pn %icc, .LL51 + cmp %g1, 15 + bne,pt %icc, .LL61 + lduw [%fp+1775], %g1 + andcc %g1, 1024, %g0 + be,pn %xcc, .LL61 + ldx [%fp+1823], %o5 + add %o5, -1, %g1 + cmp %g1, 31 + bgu,pn %xcc, .LL61 + ldx [%fp+1807], %g1 + cmp %o5, 8 + and %g1, 7, %o1 + and %g1, -8, %l1 + bgu,pt %xcc, .LL35 + add %o5, %o1, %g2 + cmp %g2, 8 + bgu,pt %xcc, .LL37 + sllx %o1, 3, %g4 + sllx %g2, 3, %g2 + ldx [%l1], %g3 + sub %g0, %g2, %g2 + mov -1, %g1 + sllx %g1, %g2, %g1 + and %g1, %g3, %g1 + return %i7+8 + sllx %g1, %g4, %o0 +.LL47: + ldx [%l1], %g1 + sllx %g1, %o3, %g1 + ldx [%l1+8], %g4 + ldx [%l1+16], %o5 + sllx %g4, %o3, %o0 + sllx %o5, %o3, %o7 + ldx [%l1+24], %o4 + sllx %g2, 3, %o2 + sllx %o4, %o3, %l0 + ldx [%l1+32], %o1 + sub %g0, %o2, %o2 + mov 64, %g3 + sub %g3, %o3, %g3 + srax %g4, %g3, %g4 + srax %o5, %g3, %o5 + or %g1, %g4, %i0 + srax %o4, %g3, %o4 + mov -1, %g1 + or %o0, %o5, %i1 + sllx %g1, %o2, %g1 + or %o7, %o4, %i2 + and %g1, %o1, %g1 + srax %g1, %g3, %g1 + or %l0, %g1, %i3 +.LL61: + return %i7+8 + nop +.LL50: + ldsb [%fp+1783], %i0 + return %i7+8 + nop +.LL54: + ldsh [%fp+1783], %i0 + return %i7+8 + nop +.LL53: + ldub [%fp+1783], %i0 + return %i7+8 + nop +.LL51: + ldx [%fp+1783], %i0 + return %i7+8 + nop +.LL55: + lduh [%fp+1783], %i0 + return %i7+8 + nop +.LL56: + ldsw [%fp+1783], %i0 + return %i7+8 + nop +.LL57: + lduw [%fp+1783], %i0 + return %i7+8 + nop +.LL58: + ld [%fp+1783], %f0 + return %i7+8 + nop +.LL59: + ldd [%fp+1783], %f0 + return %i7+8 + nop +.LL35: + cmp %o5, 16 + bgu,pt %xcc, .LL39 + cmp %o5, 24 + cmp %g2, 16 + bgu,pt %xcc, .LL41 + sllx %o1, 3, %o4 + sllx %g2, 3, %g3 + ldx [%l1+8], %g2 + sll %o1, 3, %o5 + sllx %o1, 2, %o4 + sub %g0, %g3, %g3 + ldx [%l1], %g4 + mov -1, %g1 + sllx %g4, %o5, %g4 + sllx %g1, %g3, %g1 + and %g1, %g2, %g1 + mov 32, %g2 + sllx %g1, %o5, %i1 + sub %g2, %o4, %g2 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + return %i7+8 + or %g4, %g1, %o0 +.LL37: + sllx %g2, 3, %g3 + ldx [%l1+8], %o5 + sub %g0, %g3, %g3 + sub %g0, %g4, %o4 + ldx [%l1], %g2 + mov -1, %g1 + sllx %g2, %g4, %g2 + sllx %g1, %g3, %g1 + and %g1, %o5, %g1 + srax %g1, %o4, %g1 + return %i7+8 + or %g2, %g1, %o0 +.LL39: + bgu,pt %xcc, .LL43 + cmp %g2, 32 + cmp %g2, 24 + bgu,pt %xcc, .LL45 + sllx %o1, 3, %o3 + sllx %o1, 2, %g1 + sll %o1, 3, %o5 + sllx %g2, 3, %o4 + ldx [%l1+8], %g3 + ldx [%l1+16], %o3 + sllx %g3, %o5, %o2 + sub %g0, %o4, %o4 + mov 32, %g4 + ldx [%l1], %g2 + sub %g4, %g1, %g4 + sllx %g2, %o5, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + srax %g3, %g4, %g3 + sllx %g1, %o4, %g1 + and %g1, %o3, %g1 + sllx %g1, %o5, %i2 + srax %g1, %g4, %g1 + srax %g1, %g4, %g1 + or %o2, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +.LL41: + sllx %g2, 3, %o5 + ldx [%l1+8], %g3 + ldx [%l1+16], %o3 + sllx %g3, %o4, %o2 + sub %g0, %o5, %o5 + mov 64, %g4 + ldx [%l1], %g2 + sub %g4, %o4, %g4 + sllx %g2, %o4, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + sllx %g1, %o5, %g1 + and %g1, %o3, %g1 + srax %g1, %g4, %g1 + or %o2, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +.LL45: + ldx [%l1], %g1 + sllx %g1, %o3, %g1 + ldx [%l1+8], %g3 + ldx [%l1+16], %g4 + sllx %g3, %o3, %o2 + sllx %g4, %o3, %o0 + sllx %g2, 3, %o4 + ldx [%l1+24], %o1 + sub %g0, %o4, %o4 + mov 64, %o5 + sub %o5, %o3, %o5 + srax %g3, %o5, %g3 + srax %g4, %o5, %g4 + or %g1, %g3, %i0 + or %o2, %g4, %i1 + mov -1, %g1 + sllx %g1, %o4, %g1 + and %g1, %o1, %g1 + srax %g1, %o5, %g1 + or %o0, %g1, %i2 + return %i7+8 + nop +.LL43: + bgu,pt %xcc, .LL47 + sllx %o1, 3, %o3 + sll %o1, 3, %o4 + ldx [%l1], %g1 + sllx %g1, %o4, %g1 + sllx %o1, 2, %o3 + sllx %g2, 3, %o5 + ldx [%l1+8], %g3 + ldx [%l1+16], %g4 + sllx %g3, %o4, %o1 + sllx %g4, %o4, %o0 + ldx [%l1+24], %o2 + sub %g0, %o5, %o5 + mov 32, %g2 + sub %g2, %o3, %g2 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + or %g1, %g3, %i0 + or %o1, %g4, %i1 + mov -1, %g1 + sllx %g1, %o5, %g1 + and %g1, %o2, %g1 + sllx %g1, %o4, %i3 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + or %o0, %g1, %i2 + return %i7+8 + nop + .size callback_receiver, .-callback_receiver + .ident "GCC: (GNU) 4.0.2" + .section ".note.GNU-stack" diff --git a/callback/vacall_r/vacall-sparc64-macro.S b/callback/vacall_r/vacall-sparc64-macro.S new file mode 100644 index 0000000..da34bb9 --- /dev/null +++ b/callback/vacall_r/vacall-sparc64-macro.S @@ -0,0 +1,320 @@ +#include "asm-sparc.h" + .section ".text" + .align 4 + .global C(callback_receiver) + DECLARE_FUNCTION(callback_receiver) + .proc 020 +FUNBEGIN(callback_receiver) + .register %g2, $scratch + .register %g3, $scratch + save %sp, -448, %sp + stx %i0, [%fp+2175] + stx %i1, [%fp+2183] + stx %i2, [%fp+2191] + stx %i3, [%fp+2199] + stx %i4, [%fp+2207] + stx %i5, [%fp+2215] + std %f0, [%fp+1903] + std %f2, [%fp+1911] + std %f4, [%fp+1919] + std %f6, [%fp+1927] + std %f8, [%fp+1935] + std %f10, [%fp+1943] + std %f12, [%fp+1951] + std %f14, [%fp+1959] + std %f16, [%fp+1967] + std %f18, [%fp+1975] + std %f20, [%fp+1983] + std %f22, [%fp+1991] + std %f24, [%fp+1999] + std %f26, [%fp+2007] + std %f28, [%fp+2015] + std %f30, [%fp+2023] + st %f1, [%fp+1835] + st %f3, [%fp+1839] + st %f5, [%fp+1843] + st %f7, [%fp+1847] + st %f9, [%fp+1851] + st %f11, [%fp+1855] + st %f13, [%fp+1859] + st %f15, [%fp+1863] + st %f17, [%fp+1867] + st %f19, [%fp+1871] + st %f21, [%fp+1875] + st %f23, [%fp+1879] + add %fp, 2175, %g2 + stx %g0, [%fp+1807] + st %f25, [%fp+1883] + st %f27, [%fp+1887] + st %f29, [%fp+1891] + st %f31, [%fp+1895] + st %g0, [%fp+1775] + st %g0, [%fp+1815] + st %g0, [%fp+1831] + ldx [%g5+8], %o0 + stx %g2, [%fp+1799] + ldx [%g5], %g3 + call %g3, 0 + add %fp, 1775, %o1 + lduw [%fp+1815], %g1 + cmp %g1, 0 + be,pn %icc, L(L61) + cmp %g1, 1 + be,pn %icc, L(L50) + cmp %g1, 2 + be,pn %icc, L(L50) + cmp %g1, 3 + be,pn %icc, L(L53) + cmp %g1, 4 + be,pn %icc, L(L54) + cmp %g1, 5 + be,pn %icc, L(L55) + cmp %g1, 6 + be,pn %icc, L(L56) + cmp %g1, 7 + be,pn %icc, L(L57) + cmp %g1, 8 + be,pn %icc, L(L51) + cmp %g1, 9 + be,pn %icc, L(L51) + cmp %g1, 10 + be,pn %icc, L(L51) + cmp %g1, 11 + be,pn %icc, L(L51) + cmp %g1, 12 + be,pn %icc, L(L58) + cmp %g1, 13 + be,pn %icc, L(L59) + cmp %g1, 14 + be,pn %icc, L(L51) + cmp %g1, 15 + bne,pt %icc, L(L61) + lduw [%fp+1775], %g1 + andcc %g1, 1024, %g0 + be,pn %xcc, L(L61) + ldx [%fp+1823], %o5 + add %o5, -1, %g1 + cmp %g1, 31 + bgu,pn %xcc, L(L61) + ldx [%fp+1807], %g1 + cmp %o5, 8 + and %g1, 7, %o1 + and %g1, -8, %l1 + bgu,pt %xcc, L(L35) + add %o5, %o1, %g2 + cmp %g2, 8 + bgu,pt %xcc, L(L37) + sllx %o1, 3, %g4 + sllx %g2, 3, %g2 + ldx [%l1], %g3 + sub %g0, %g2, %g2 + mov -1, %g1 + sllx %g1, %g2, %g1 + and %g1, %g3, %g1 + return %i7+8 + sllx %g1, %g4, %o0 +L(L47): + ldx [%l1], %g1 + sllx %g1, %o3, %g1 + ldx [%l1+8], %g4 + ldx [%l1+16], %o5 + sllx %g4, %o3, %o0 + sllx %o5, %o3, %o7 + ldx [%l1+24], %o4 + sllx %g2, 3, %o2 + sllx %o4, %o3, %l0 + ldx [%l1+32], %o1 + sub %g0, %o2, %o2 + mov 64, %g3 + sub %g3, %o3, %g3 + srax %g4, %g3, %g4 + srax %o5, %g3, %o5 + or %g1, %g4, %i0 + srax %o4, %g3, %o4 + mov -1, %g1 + or %o0, %o5, %i1 + sllx %g1, %o2, %g1 + or %o7, %o4, %i2 + and %g1, %o1, %g1 + srax %g1, %g3, %g1 + or %l0, %g1, %i3 +L(L61): + return %i7+8 + nop +L(L50): + ldsb [%fp+1783], %i0 + return %i7+8 + nop +L(L54): + ldsh [%fp+1783], %i0 + return %i7+8 + nop +L(L53): + ldub [%fp+1783], %i0 + return %i7+8 + nop +L(L51): + ldx [%fp+1783], %i0 + return %i7+8 + nop +L(L55): + lduh [%fp+1783], %i0 + return %i7+8 + nop +L(L56): + ldsw [%fp+1783], %i0 + return %i7+8 + nop +L(L57): + lduw [%fp+1783], %i0 + return %i7+8 + nop +L(L58): + ld [%fp+1783], %f0 + return %i7+8 + nop +L(L59): + ldd [%fp+1783], %f0 + return %i7+8 + nop +L(L35): + cmp %o5, 16 + bgu,pt %xcc, L(L39) + cmp %o5, 24 + cmp %g2, 16 + bgu,pt %xcc, L(L41) + sllx %o1, 3, %o4 + sllx %g2, 3, %g3 + ldx [%l1+8], %g2 + sll %o1, 3, %o5 + sllx %o1, 2, %o4 + sub %g0, %g3, %g3 + ldx [%l1], %g4 + mov -1, %g1 + sllx %g4, %o5, %g4 + sllx %g1, %g3, %g1 + and %g1, %g2, %g1 + mov 32, %g2 + sllx %g1, %o5, %i1 + sub %g2, %o4, %g2 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + return %i7+8 + or %g4, %g1, %o0 +L(L37): + sllx %g2, 3, %g3 + ldx [%l1+8], %o5 + sub %g0, %g3, %g3 + sub %g0, %g4, %o4 + ldx [%l1], %g2 + mov -1, %g1 + sllx %g2, %g4, %g2 + sllx %g1, %g3, %g1 + and %g1, %o5, %g1 + srax %g1, %o4, %g1 + return %i7+8 + or %g2, %g1, %o0 +L(L39): + bgu,pt %xcc, L(L43) + cmp %g2, 32 + cmp %g2, 24 + bgu,pt %xcc, L(L45) + sllx %o1, 3, %o3 + sllx %o1, 2, %g1 + sll %o1, 3, %o5 + sllx %g2, 3, %o4 + ldx [%l1+8], %g3 + ldx [%l1+16], %o3 + sllx %g3, %o5, %o2 + sub %g0, %o4, %o4 + mov 32, %g4 + ldx [%l1], %g2 + sub %g4, %g1, %g4 + sllx %g2, %o5, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + srax %g3, %g4, %g3 + sllx %g1, %o4, %g1 + and %g1, %o3, %g1 + sllx %g1, %o5, %i2 + srax %g1, %g4, %g1 + srax %g1, %g4, %g1 + or %o2, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +L(L41): + sllx %g2, 3, %o5 + ldx [%l1+8], %g3 + ldx [%l1+16], %o3 + sllx %g3, %o4, %o2 + sub %g0, %o5, %o5 + mov 64, %g4 + ldx [%l1], %g2 + sub %g4, %o4, %g4 + sllx %g2, %o4, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + sllx %g1, %o5, %g1 + and %g1, %o3, %g1 + srax %g1, %g4, %g1 + or %o2, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +L(L45): + ldx [%l1], %g1 + sllx %g1, %o3, %g1 + ldx [%l1+8], %g3 + ldx [%l1+16], %g4 + sllx %g3, %o3, %o2 + sllx %g4, %o3, %o0 + sllx %g2, 3, %o4 + ldx [%l1+24], %o1 + sub %g0, %o4, %o4 + mov 64, %o5 + sub %o5, %o3, %o5 + srax %g3, %o5, %g3 + srax %g4, %o5, %g4 + or %g1, %g3, %i0 + or %o2, %g4, %i1 + mov -1, %g1 + sllx %g1, %o4, %g1 + and %g1, %o1, %g1 + srax %g1, %o5, %g1 + or %o0, %g1, %i2 + return %i7+8 + nop +L(L43): + bgu,pt %xcc, L(L47) + sllx %o1, 3, %o3 + sll %o1, 3, %o4 + ldx [%l1], %g1 + sllx %g1, %o4, %g1 + sllx %o1, 2, %o3 + sllx %g2, 3, %o5 + ldx [%l1+8], %g3 + ldx [%l1+16], %g4 + sllx %g3, %o4, %o1 + sllx %g4, %o4, %o0 + ldx [%l1+24], %o2 + sub %g0, %o5, %o5 + mov 32, %g2 + sub %g2, %o3, %g2 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + or %g1, %g3, %i0 + or %o1, %g4, %i1 + mov -1, %g1 + sllx %g1, %o5, %g1 + and %g1, %o2, %g1 + sllx %g1, %o4, %i3 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + or %o0, %g1, %i2 + return %i7+8 + nop + FUNEND(callback_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-structcpy.c b/callback/vacall_r/vacall-structcpy.c new file mode 100644 index 0000000..23d3e77 --- /dev/null +++ b/callback/vacall_r/vacall-structcpy.c @@ -0,0 +1,22 @@ +/* copy structs */ + +/* + * Copyright 2016 Bruno Haible + * + * 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, see . + */ + +#define __structcpy callback_structcpy + +#include "structcpy.c" diff --git a/callback/vacall_r/vacall-x86_64-linux.s b/callback/vacall_r/vacall-x86_64-linux.s new file mode 100644 index 0000000..d2d1b42 --- /dev/null +++ b/callback/vacall_r/vacall-x86_64-linux.s @@ -0,0 +1,300 @@ + .file "vacall-x86_64.c" + .text + .p2align 4,,15 + .type callback_receiver, @function +callback_receiver: +.LFB2: + pushq %rbp +.LCFI0: + movq %rsp, %rbp +.LCFI1: + pushq %r13 +.LCFI2: + pushq %r12 +.LCFI3: + subq $192, %rsp +.LCFI4: + movq %rcx, -48(%rbp) + leaq 16(%rbp), %rcx + movq %rdi, -72(%rbp) + movq %rsi, -64(%rbp) + movsd %xmm0, -144(%rbp) + movq %rcx, -184(%rbp) + movq $0, -176(%rbp) + movsd %xmm1, -136(%rbp) + movq %rdx, -56(%rbp) + movsd %xmm2, -128(%rbp) + leaq -208(%rbp), %rsi + movq %r8, -40(%rbp) + movsd %xmm3, -120(%rbp) + movq %r9, -32(%rbp) + movsd %xmm4, -112(%rbp) + movsd %xmm5, -104(%rbp) + movl $0, -208(%rbp) + movsd %xmm6, -96(%rbp) + movl $0, -168(%rbp) + movsd %xmm7, -88(%rbp) + movl $0, -80(%rbp) + movl $0, -152(%rbp) + movq 8(%r10), %rdi + call *(%r10) + movl -168(%rbp), %ecx + testl %ecx, %ecx + je .L41 + cmpl $1, %ecx + je .L42 + cmpl $2, %ecx + je .L42 + cmpl $3, %ecx + .p2align 4,,5 + je .L48 + cmpl $4, %ecx + .p2align 4,,5 + je .L49 + cmpl $5, %ecx + .p2align 4,,5 + je .L50 + cmpl $6, %ecx + .p2align 4,,5 + je .L51 + cmpl $7, %ecx + .p2align 4,,5 + je .L52 + cmpl $8, %ecx + .p2align 4,,5 + je .L46 + cmpl $9, %ecx + .p2align 4,,5 + je .L46 + cmpl $10, %ecx + .p2align 4,,5 + je .L46 + cmpl $11, %ecx + .p2align 4,,5 + je .L46 + cmpl $12, %ecx + .p2align 4,,5 + je .L53 + cmpl $13, %ecx + .p2align 4,,5 + je .L54 + cmpl $14, %ecx + .p2align 4,,5 + je .L46 + cmpl $15, %ecx + .p2align 4,,5 + jne .L41 + testb $4, -207(%rbp) + .p2align 4,,2 + je .L41 + movq -160(%rbp), %rsi + leaq -1(%rsi), %rcx + cmpq $15, %rcx + ja .L41 + movq -176(%rbp), %rcx + movq %rcx, %r12 + movq %rcx, %r8 + andl $7, %r8d + andq $-8, %r12 + cmpq $8, %rsi + leaq (%rsi,%r8), %r11 + ja .L35 + cmpq $8, %r11 + ja .L37 + leal -1(,%r11,8), %ecx + movl $2, %esi + salq %cl, %rsi + leal 0(,%r8,8), %ecx + decq %rsi + andq (%r12), %rsi + movq %rsi, %rax + sarq %cl, %rax + .p2align 4,,7 +.L41: + addq $192, %rsp + popq %r12 + popq %r13 + leave + ret + .p2align 4,,7 +.L42: + movsbq -200(%rbp),%rax + addq $192, %rsp + popq %r12 + popq %r13 + leave + ret +.L49: + movswq -200(%rbp),%rax + jmp .L41 +.L48: + movzbq -200(%rbp), %rax + jmp .L41 +.L46: + movq -200(%rbp), %rax + jmp .L41 +.L50: + movzwq -200(%rbp), %rax + jmp .L41 +.L51: + movslq -200(%rbp),%rax + jmp .L41 +.L52: + mov -200(%rbp), %eax + jmp .L41 +.L53: + movss -200(%rbp), %xmm0 + jmp .L41 +.L54: + movlpd -200(%rbp), %xmm0 + jmp .L41 +.L35: + cmpq $16, %r11 + ja .L39 + leal -65(,%r11,8), %ecx + movl $2, %esi + leal 0(,%r8,8), %r9d + movl $32, %edi + salq %cl, %rsi + leaq 0(,%r8,4), %rcx + movq (%r12), %r8 + decq %rsi + andq 8(%r12), %rsi + subl %ecx, %edi + movl %r9d, %ecx + sarq %cl, %r8 + movl %edi, %ecx + movq %r8, %rax + movq %rsi, %r11 + movq %rsi, %rdx + salq %cl, %r11 + salq %cl, %r11 + movl %r9d, %ecx + orq %r11, %rax + sarq %cl, %rdx + jmp .L41 +.L37: + movq (%r12), %rdi + leal -65(,%r11,8), %esi + salq $3, %r8 + movl %r8d, %ecx + movl $2, %r11d + sarq %cl, %rdi + movl %esi, %ecx + movl $64, %esi + salq %cl, %r11 + subl %r8d, %esi + movq %rdi, %rax + decq %r11 + andq 8(%r12), %r11 + movl %esi, %ecx + salq %cl, %r11 + orq %r11, %rax + jmp .L41 +.L39: + leaq 0(,%r8,8), %rcx + movq (%r12), %r13 + movq 8(%r12), %r8 + movl $64, %edi + subl %ecx, %edi + movl %ecx, %r9d + sarq %cl, %r13 + movq %r8, %rsi + movl %edi, %ecx + salq %cl, %rsi + movq %r13, %rax + movl %r9d, %ecx + orq %rsi, %rax + leal -129(,%r11,8), %esi + sarq %cl, %r8 + movl $2, %r9d + movq %r8, %rdx + movl %esi, %ecx + salq %cl, %r9 + movl %edi, %ecx + leaq -1(%r9), %rsi + andq 16(%r12), %rsi + salq %cl, %rsi + orq %rsi, %rdx + jmp .L41 +.LFE2: + .size callback_receiver, .-callback_receiver + .p2align 4,,15 +.globl callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: +.LFB3: + pushq %rbp +.LCFI5: + leaq callback_receiver(%rip), %rax + movq %rsp, %rbp +.LCFI6: + leave + ret +.LFE3: + .size callback_get_receiver, .-callback_get_receiver + .section .eh_frame,"a",@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 +.LSCIE1: + .long 0x0 + .byte 0x1 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .byte 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + .long .LFB2-. + .long .LFE2-.LFB2 + .uleb128 0x0 + .byte 0x4 + .long .LCFI0-.LFB2 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI4-.LCFI1 + .byte 0x8c + .uleb128 0x4 + .byte 0x8d + .uleb128 0x3 + .align 8 +.LEFDE1: +.LSFDE3: + .long .LEFDE3-.LASFDE3 +.LASFDE3: + .long .LASFDE3-.Lframe1 + .long .LFB3-. + .long .LFE3-.LFB3 + .uleb128 0x0 + .byte 0x4 + .long .LCFI5-.LFB3 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI6-.LCFI5 + .byte 0xd + .uleb128 0x6 + .align 8 +.LEFDE3: + .ident "GCC: (GNU) 4.0.2" + .section .note.GNU-stack,"",@progbits diff --git a/callback/vacall_r/vacall-x86_64-macro.S b/callback/vacall_r/vacall-x86_64-macro.S new file mode 100644 index 0000000..d114a77 --- /dev/null +++ b/callback/vacall_r/vacall-x86_64-macro.S @@ -0,0 +1,303 @@ +#include "asm-x86_64.h" + TEXT() + P2ALIGN(4,15) + DECLARE_FUNCTION(callback_receiver) +FUNBEGIN(callback_receiver) +L(FB2): + INSN1(push,q ,R(rbp)) +L(CFI0): + INSN2(mov,q ,R(rsp), R(rbp)) +L(CFI1): + INSN1(push,q ,R(r13)) +L(CFI2): + INSN1(push,q ,R(r12)) +L(CFI3): + INSN2(sub,q ,NUM(192), R(rsp)) +L(CFI4): + INSN2(mov,q ,R(rcx),X8 MEM_DISP(rbp,-48)) + INSN2(lea,q ,X8 MEM_DISP(rbp,16), R(rcx)) + INSN2(mov,q ,R(rdi),X8 MEM_DISP(rbp,-72)) + INSN2(mov,q ,R(rsi),X8 MEM_DISP(rbp,-64)) + INSN2S(movs,d ,R(xmm0),X8 MEM_DISP(rbp,-144)) + INSN2(mov,q ,R(rcx),X8 MEM_DISP(rbp,-184)) + INSN2(mov,q ,NUM(0),X8 MEM_DISP(rbp,-176)) + INSN2S(movs,d ,R(xmm1),X8 MEM_DISP(rbp,-136)) + INSN2(mov,q ,R(rdx),X8 MEM_DISP(rbp,-56)) + INSN2S(movs,d ,R(xmm2),X8 MEM_DISP(rbp,-128)) + INSN2(lea,q ,X8 MEM_DISP(rbp,-208), R(rsi)) + INSN2(mov,q ,R(r8),X8 MEM_DISP(rbp,-40)) + INSN2S(movs,d ,R(xmm3),X8 MEM_DISP(rbp,-120)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2S(movs,d ,R(xmm4),X8 MEM_DISP(rbp,-112)) + INSN2S(movs,d ,R(xmm5),X8 MEM_DISP(rbp,-104)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-208)) + INSN2S(movs,d ,R(xmm6),X8 MEM_DISP(rbp,-96)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-168)) + INSN2S(movs,d ,R(xmm7),X8 MEM_DISP(rbp,-88)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-80)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-152)) + INSN2(mov,q ,X8 MEM_DISP(r10,8), R(rdi)) + INSN1(call,_ ,INDIR(X8 MEM(r10))) + INSN2(mov,l ,X4 MEM_DISP(rbp,-168), R(ecx)) + INSN2(test,l ,R(ecx), R(ecx)) + INSN1(je,_ ,L(41)) + INSN2(cmp,l ,NUM(1), R(ecx)) + INSN1(je,_ ,L(42)) + INSN2(cmp,l ,NUM(2), R(ecx)) + INSN1(je,_ ,L(42)) + INSN2(cmp,l ,NUM(3), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(4), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(5), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(6), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(51)) + INSN2(cmp,l ,NUM(7), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(8), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(9), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(10), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(11), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(12), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(13), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(14), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(15), R(ecx)) + P2ALIGN(4,5) + INSN1(jne,_ ,L(41)) + INSN2(test,b ,NUM(4),X1 MEM_DISP(rbp,-207)) + P2ALIGN(4,2) + INSN1(je,_ ,L(41)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-160), R(rsi)) + INSN2(lea,q ,X8 MEM_DISP(rsi,-1), R(rcx)) + INSN2(cmp,q ,NUM(15), R(rcx)) + INSN1(ja,_ ,L(41)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-176), R(rcx)) + INSN2(mov,q ,R(rcx), R(r12)) + INSN2(mov,q ,R(rcx), R(r8)) + INSN2(and,l ,NUM(7), R(r8d)) + INSN2(and,q ,NUM(-8), R(r12)) + INSN2(cmp,q ,NUM(8), R(rsi)) + INSN2(lea,q ,X8 MEM_INDEX(rsi,r8), R(r11)) + INSN1(ja,_ ,L(35)) + INSN2(cmp,q ,NUM(8), R(r11)) + INSN1(ja,_ ,L(37)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-1,r11,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(esi)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,r8,8), R(ecx)) + INSN1(dec,q ,R(rsi)) + INSN2(and,q ,X8 MEM(r12), R(rsi)) + INSN2(mov,q ,R(rsi), R(rax)) + INSN2(sar,q ,R(cl), R(rax)) + P2ALIGN(4,7) +L(41): + INSN2(add,q ,NUM(192), R(rsp)) + INSN1(pop,q ,R(r12)) + INSN1(pop,q ,R(r13)) + leave + ret + P2ALIGN(4,7) +L(42): + INSN2MOVXQ(movs,b,X1 MEM_DISP(rbp,-200),R(rax)) + INSN2(add,q ,NUM(192), R(rsp)) + INSN1(pop,q ,R(r12)) + INSN1(pop,q ,R(r13)) + leave + ret +L(49): + INSN2MOVXQ(movs,w,X2 MEM_DISP(rbp,-200),R(rax)) + INSN1(jmp,_ ,L(41)) +L(48): + INSN2MOVXQ(movz,b,X1 MEM_DISP(rbp,-200), R(rax)) + INSN1(jmp,_ ,L(41)) +L(46): + INSN2(mov,q ,X8 MEM_DISP(rbp,-200), R(rax)) + INSN1(jmp,_ ,L(41)) +L(50): + INSN2MOVXQ(movz,w,X2 MEM_DISP(rbp,-200), R(rax)) + INSN1(jmp,_ ,L(41)) +L(51): + INSN2MOVXLQ(movs,l,X4 MEM_DISP(rbp,-200),R(rax)) + INSN1(jmp,_ ,L(41)) +L(52): + INSN2(mov,l ,X4 MEM_DISP(rbp,-200), R(eax)) + INSN1(jmp,_ ,L(41)) +L(53): + INSN2S(movs,s ,X4 MEM_DISP(rbp,-200), R(xmm0)) + INSN1(jmp,_ ,L(41)) +L(54): + INSN2(movlp,d ,X8 MEM_DISP(rbp,-200), R(xmm0)) + INSN1(jmp,_ ,L(41)) +L(35): + INSN2(cmp,q ,NUM(16), R(r11)) + INSN1(ja,_ ,L(39)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,r11,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(esi)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,r8,8), R(r9d)) + INSN2(mov,l ,NUM(32), R(edi)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(lea,q ,X8 MEM_DISP_SHINDEX0(0,r8,4), R(rcx)) + INSN2(mov,q ,X8 MEM(r12), R(r8)) + INSN1(dec,q ,R(rsi)) + INSN2(and,q ,X8 MEM_DISP(r12,8), R(rsi)) + INSN2(sub,l ,R(ecx), R(edi)) + INSN2(mov,l ,R(r9d), R(ecx)) + INSN2(sar,q ,R(cl), R(r8)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(mov,q ,R(r8), R(rax)) + INSN2(mov,q ,R(rsi), R(r11)) + INSN2(mov,q ,R(rsi), R(rdx)) + INSN2(sal,q ,R(cl), R(r11)) + INSN2(sal,q ,R(cl), R(r11)) + INSN2(mov,l ,R(r9d), R(ecx)) + INSN2(or,q ,R(r11), R(rax)) + INSN2(sar,q ,R(cl), R(rdx)) + INSN1(jmp,_ ,L(41)) +L(37): + INSN2(mov,q ,X8 MEM(r12), R(rdi)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,r11,8), R(esi)) + INSN2(sal,q ,NUM(3), R(r8)) + INSN2(mov,l ,R(r8d), R(ecx)) + INSN2(mov,l ,NUM(2), R(r11d)) + INSN2(sar,q ,R(cl), R(rdi)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(mov,l ,NUM(64), R(esi)) + INSN2(sal,q ,R(cl), R(r11)) + INSN2(sub,l ,R(r8d), R(esi)) + INSN2(mov,q ,R(rdi), R(rax)) + INSN1(dec,q ,R(r11)) + INSN2(and,q ,X8 MEM_DISP(r12,8), R(r11)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(sal,q ,R(cl), R(r11)) + INSN2(or,q ,R(r11), R(rax)) + INSN1(jmp,_ ,L(41)) +L(39): + INSN2(lea,q ,X8 MEM_DISP_SHINDEX0(0,r8,8), R(rcx)) + INSN2(mov,q ,X8 MEM(r12), R(r13)) + INSN2(mov,q ,X8 MEM_DISP(r12,8), R(r8)) + INSN2(mov,l ,NUM(64), R(edi)) + INSN2(sub,l ,R(ecx), R(edi)) + INSN2(mov,l ,R(ecx), R(r9d)) + INSN2(sar,q ,R(cl), R(r13)) + INSN2(mov,q ,R(r8), R(rsi)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(mov,q ,R(r13), R(rax)) + INSN2(mov,l ,R(r9d), R(ecx)) + INSN2(or,q ,R(rsi), R(rax)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-129,r11,8), R(esi)) + INSN2(sar,q ,R(cl), R(r8)) + INSN2(mov,l ,NUM(2), R(r9d)) + INSN2(mov,q ,R(r8), R(rdx)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(sal,q ,R(cl), R(r9)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(lea,q ,X8 MEM_DISP(r9,-1), R(rsi)) + INSN2(and,q ,X8 MEM_DISP(r12,16), R(rsi)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(or,q ,R(rsi), R(rdx)) + INSN1(jmp,_ ,L(41)) +L(FE2): + FUNEND(callback_receiver, .-callback_receiver) + P2ALIGN(4,15) +GLOBL(C(callback_get_receiver)) + DECLARE_FUNCTION(callback_get_receiver) +FUNBEGIN(callback_get_receiver) +L(FB3): + INSN1(push,q ,R(rbp)) +L(CFI5): + INSN2(lea,q ,ADDR_PCRELATIVE(C(callback_receiver)), R(rax)) + INSN2(mov,q ,R(rsp), R(rbp)) +L(CFI6): + leave + ret +L(FE3): + FUNEND(callback_get_receiver, .-callback_get_receiver) +#if !(defined __sun || (defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __CYGWIN__)) + .section EH_FRAME_SECTION +L(frame1): + .long L(ECIE1)-.LSCIE1 +L(SCIE1): + .long 0x0 + .byte 0x1 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .byte 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +L(ECIE1): +L(SFDE1): + .long L(EFDE1)-.LASFDE1 +L(ASFDE1): + .long L(ASFDE1)-.Lframe1 + .long L(FB2)-. + .long L(FE2)-.LFB2 + .uleb128 0x0 + .byte 0x4 + .long L(CFI0)-.LFB2 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long L(CFI1)-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long L(CFI4)-.LCFI1 + .byte 0x8c + .uleb128 0x4 + .byte 0x8d + .uleb128 0x3 + .align 8 +L(EFDE1): +L(SFDE3): + .long L(EFDE3)-.LASFDE3 +L(ASFDE3): + .long L(ASFDE3)-.Lframe1 + .long L(FB3)-. + .long L(FE3)-.LFB3 + .uleb128 0x0 + .byte 0x4 + .long L(CFI5)-.LFB3 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long L(CFI6)-.LCFI5 + .byte 0xd + .uleb128 0x6 + .align 8 +L(EFDE3): +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-x86_64-windows-macro.S b/callback/vacall_r/vacall-x86_64-windows-macro.S new file mode 100644 index 0000000..5a4ad0b --- /dev/null +++ b/callback/vacall_r/vacall-x86_64-windows-macro.S @@ -0,0 +1,390 @@ +#include "asm-x86_64.h" + TEXT() + P2ALIGN(4,15) + DECLARE_FUNCTION(callback_receiver) +FUNBEGIN(callback_receiver) +L(FB0): + INSN1(push,q ,R(rbp)) +L(CFI0): + INSN2(mov,q ,R(rsp), R(rbp)) +L(CFI1): + INSN2(sub,q ,NUM(144), R(rsp)) + INSN2(mov,q ,R(rcx),X8 MEM_DISP(rbp,16)) + INSN2(lea,q ,X8 MEM_DISP(rbp,16), R(rcx)) + INSN2(mov,q ,R(rdx),X8 MEM_DISP(rbp,24)) + INSN2(mov,q ,R(r8),X8 MEM_DISP(rbp,32)) + INSN2(lea,q ,X8 MEM_DISP(rbp,-112), R(rdx)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,40)) + INSN2(mov,q ,R(rcx),X8 MEM_DISP(rbp,-88)) + INSN2S(movs,s ,R(xmm0),X4 MEM_DISP(rbp,-52)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-112)) + INSN2S(movs,s ,R(xmm1),X4 MEM_DISP(rbp,-48)) + INSN2(mov,q ,NUM(0),X8 MEM_DISP(rbp,-80)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-72)) + INSN2S(movs,s ,R(xmm2),X4 MEM_DISP(rbp,-44)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-56)) + INSN2S(movs,s ,R(xmm3),X4 MEM_DISP(rbp,-40)) + INSN2(mov,q ,X8 MEM_DISP(r10,8), R(rcx)) + INSN2S(movs,d ,R(xmm0),X8 MEM_DISP(rbp,-32)) + INSN2S(movs,d ,R(xmm1),X8 MEM_DISP(rbp,-24)) + INSN2S(movs,d ,R(xmm2),X8 MEM_DISP(rbp,-16)) + INSN2S(movs,d ,R(xmm3),X8 MEM_DISP(rbp,-8)) + INSN1(call,_ ,INDIR(X8 MEM(r10))) + INSN2(mov,l ,X4 MEM_DISP(rbp,-72), R(edx)) + INSN2(test,l ,R(edx), R(edx)) + INSN1(je,_ ,L(1)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(je,_ ,L(34)) + INSN2(cmp,l ,NUM(2), R(edx)) + INSN1(je,_ ,L(34)) + INSN2(cmp,l ,NUM(3), R(edx)) + INSN1(je,_ ,L(37)) + INSN2(cmp,l ,NUM(4), R(edx)) + INSN1(je,_ ,L(38)) + INSN2(cmp,l ,NUM(5), R(edx)) + INSN1(je,_ ,L(39)) + INSN2(cmp,l ,NUM(6), R(edx)) + INSN1(je,_ ,L(40)) + INSN2(cmp,l ,NUM(7), R(edx)) + INSN1(je,_ ,L(41)) + INSN2(cmp,l ,NUM(8), R(edx)) + INSN1(je,_ ,L(35)) + INSN2(cmp,l ,NUM(9), R(edx)) + INSN1(je,_ ,L(35)) + INSN2(cmp,l ,NUM(10), R(edx)) + INSN1(je,_ ,L(35)) + INSN2(cmp,l ,NUM(11), R(edx)) + INSN1(je,_ ,L(35)) + INSN2(cmp,l ,NUM(12), R(edx)) + INSN1(je,_ ,L(42)) + INSN2(cmp,l ,NUM(13), R(edx)) + INSN1(je,_ ,L(43)) + INSN2(cmp,l ,NUM(14), R(edx)) + INSN1(je,_ ,L(35)) + INSN2(cmp,l ,NUM(15), R(edx)) + INSN1(jne,_ ,L(1)) + INSN2(test,b ,NUM(4),X1 MEM_DISP(rbp,-111)) + INSN1(je,_ ,L(17)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-64), R(rdx)) + INSN2(lea,q ,X8 MEM_DISP(rdx,-4), R(rcx)) + INSN2(test,q ,NUM(-5), R(rcx)) + INSN1(je,_ ,L(20)) + INSN2(lea,q ,X8 MEM_DISP(rdx,-1), R(rcx)) + INSN2(cmp,q ,NUM(1), R(rcx)) + INSN1(ja,_ ,L(1)) +L(20): + INSN2(mov,q ,X8 MEM_DISP(rbp,-80), R(r8)) + INSN2(mov,q ,R(r8), R(r9)) + INSN2(and,l ,NUM(7), R(r8d)) + INSN2(add,q ,R(r8), R(rdx)) + INSN2(and,q ,NUM(-8), R(r9)) + INSN2(cmp,q ,NUM(8), R(rdx)) + INSN1(ja,_ ,L(19)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-1,rdx,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(edx)) + INSN2(sal,q ,R(cl), R(rdx)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,r8,8), R(ecx)) + INSN2(sub,q ,NUM(1), R(rdx)) + INSN2(and,q ,X8 MEM(r9), R(rdx)) + INSN2(sar,q ,R(cl), R(rdx)) + INSN2(mov,q ,R(rdx), R(rax)) +L(1): + leave +L(CFI2): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(34): +L(CFI3): + INSN2MOVXQ(movs,b,X1 MEM_DISP(rbp,-104), R(rax)) + leave +L(CFI4): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(35): +L(CFI5): + INSN2(mov,q ,X8 MEM_DISP(rbp,-104), R(rax)) + leave +L(CFI6): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(37): +L(CFI7): + INSN2MOVXL(movz,b,X1 MEM_DISP(rbp,-104), R(eax)) + leave +L(CFI8): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(38): +L(CFI9): + INSN2MOVXQ(movs,w,X2 MEM_DISP(rbp,-104), R(rax)) + leave +L(CFI10): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(39): +L(CFI11): + INSN2MOVXL(movz,w,X2 MEM_DISP(rbp,-104), R(eax)) + leave +L(CFI12): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(40): +L(CFI13): + INSN2MOVXLQ(movs,l,X4 MEM_DISP(rbp,-104), R(rax)) + leave +L(CFI14): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(42): +L(CFI15): + INSN2S(movs,s ,X4 MEM_DISP(rbp,-104), R(xmm0)) + leave +L(CFI16): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(41): +L(CFI17): + INSN2(mov,l ,X4 MEM_DISP(rbp,-104), R(eax)) + leave +L(CFI18): + ret +L(43): +L(CFI19): + INSN2S(movs,d ,X8 MEM_DISP(rbp,-104), R(xmm0)) + leave +L(CFI20): + ret +L(17): +L(CFI21): + INSN2(mov,q ,X8 MEM_DISP(rbp,-80), R(rax)) + leave +L(CFI22): + ret +L(19): +L(CFI23): + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,rdx,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(edx)) + INSN2(sal,q ,R(cl), R(rdx)) + INSN2(mov,l ,R(r8d), R(ecx)) + INSN2(sub,q ,NUM(1), R(rdx)) + INSN2(and,q ,X8 MEM_DISP(r9,8), R(rdx)) + INSN1(neg,l ,R(ecx)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(64,rcx,8), R(ecx)) + INSN2(sal,q ,R(cl), R(rdx)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,r8,8), R(ecx)) + INSN2(mov,q ,X8 MEM(r9), R(r8)) + leave +L(CFI24): + INSN2(sar,q ,R(cl), R(r8)) + INSN2(or,q ,R(r8), R(rdx)) + INSN2(mov,q ,R(rdx), R(rax)) + ret +L(FE0): + FUNEND(callback_receiver, .-callback_receiver) + P2ALIGN(4,15) + GLOBL(C(callback_get_receiver)) + DECLARE_FUNCTION(callback_get_receiver) +FUNBEGIN(callback_get_receiver) +L(FB1): + INSN1(push,q ,R(rbp)) +L(CFI25): + INSN2(lea,q ,ADDR_PCRELATIVE(C(callback_receiver)), R(rax)) + INSN2(mov,q ,R(rsp), R(rbp)) +L(CFI26): + INSN1(pop,q ,R(rbp)) +L(CFI27): + ret +L(FE1): + FUNEND(callback_get_receiver, .-callback_get_receiver) +#if !(defined __sun || (defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __CYGWIN__)) + .section EH_FRAME_SECTION +L(frame1): + .long L(ECIE1)-.LSCIE1 +L(SCIE1): + .long 0 + .byte 0x3 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .uleb128 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +L(ECIE1): +L(SFDE1): + .long L(EFDE1)-.LASFDE1 +L(ASFDE1): + .long L(ASFDE1)-.Lframe1 + .long L(FB0)-. + .long L(FE0)-.LFB0 + .uleb128 0 + .byte 0x4 + .long L(CFI0)-.LFB0 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long L(CFI1)-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long L(CFI2)-.LCFI1 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI3)-.LCFI2 + .byte 0xb + .byte 0x4 + .long L(CFI4)-.LCFI3 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI5)-.LCFI4 + .byte 0xb + .byte 0x4 + .long L(CFI6)-.LCFI5 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI7)-.LCFI6 + .byte 0xb + .byte 0x4 + .long L(CFI8)-.LCFI7 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI9)-.LCFI8 + .byte 0xb + .byte 0x4 + .long L(CFI10)-.LCFI9 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI11)-.LCFI10 + .byte 0xb + .byte 0x4 + .long L(CFI12)-.LCFI11 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI13)-.LCFI12 + .byte 0xb + .byte 0x4 + .long L(CFI14)-.LCFI13 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI15)-.LCFI14 + .byte 0xb + .byte 0x4 + .long L(CFI16)-.LCFI15 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI17)-.LCFI16 + .byte 0xb + .byte 0x4 + .long L(CFI18)-.LCFI17 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI19)-.LCFI18 + .byte 0xb + .byte 0x4 + .long L(CFI20)-.LCFI19 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI21)-.LCFI20 + .byte 0xb + .byte 0x4 + .long L(CFI22)-.LCFI21 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI23)-.LCFI22 + .byte 0xb + .byte 0x4 + .long L(CFI24)-.LCFI23 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .align 8 +L(EFDE1): +L(SFDE3): + .long L(EFDE3)-.LASFDE3 +L(ASFDE3): + .long L(ASFDE3)-.Lframe1 + .long L(FB1)-. + .long L(FE1)-.LFB1 + .uleb128 0 + .byte 0x4 + .long L(CFI25)-.LFB1 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long L(CFI26)-.LCFI25 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long L(CFI27)-.LCFI26 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .align 8 +L(EFDE3): +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/callback/vacall_r/vacall-x86_64-windows.s b/callback/vacall_r/vacall-x86_64-windows.s new file mode 100644 index 0000000..4665ea9 --- /dev/null +++ b/callback/vacall_r/vacall-x86_64-windows.s @@ -0,0 +1,387 @@ + .file "vacall-x86_64-windows.c" + .text + .p2align 4,,15 + .type callback_receiver, @function +callback_receiver: +.LFB0: + pushq %rbp +.LCFI0: + movq %rsp, %rbp +.LCFI1: + subq $144, %rsp + movq %rcx, 16(%rbp) + leaq 16(%rbp), %rcx + movq %rdx, 24(%rbp) + movq %r8, 32(%rbp) + leaq -112(%rbp), %rdx + movq %r9, 40(%rbp) + movq %rcx, -88(%rbp) + movss %xmm0, -52(%rbp) + movl $0, -112(%rbp) + movss %xmm1, -48(%rbp) + movq $0, -80(%rbp) + movl $0, -72(%rbp) + movss %xmm2, -44(%rbp) + movl $0, -56(%rbp) + movss %xmm3, -40(%rbp) + movq 8(%r10), %rcx + movsd %xmm0, -32(%rbp) + movsd %xmm1, -24(%rbp) + movsd %xmm2, -16(%rbp) + movsd %xmm3, -8(%rbp) + call *(%r10) + movl -72(%rbp), %edx + testl %edx, %edx + je .L1 + cmpl $1, %edx + je .L34 + cmpl $2, %edx + je .L34 + cmpl $3, %edx + je .L37 + cmpl $4, %edx + je .L38 + cmpl $5, %edx + je .L39 + cmpl $6, %edx + je .L40 + cmpl $7, %edx + je .L41 + cmpl $8, %edx + je .L35 + cmpl $9, %edx + je .L35 + cmpl $10, %edx + je .L35 + cmpl $11, %edx + je .L35 + cmpl $12, %edx + je .L42 + cmpl $13, %edx + je .L43 + cmpl $14, %edx + je .L35 + cmpl $15, %edx + jne .L1 + testb $4, -111(%rbp) + je .L17 + movq -64(%rbp), %rdx + leaq -4(%rdx), %rcx + testq $-5, %rcx + je .L20 + leaq -1(%rdx), %rcx + cmpq $1, %rcx + ja .L1 +.L20: + movq -80(%rbp), %r8 + movq %r8, %r9 + andl $7, %r8d + addq %r8, %rdx + andq $-8, %r9 + cmpq $8, %rdx + ja .L19 + leal -1(,%rdx,8), %ecx + movl $2, %edx + salq %cl, %rdx + leal 0(,%r8,8), %ecx + subq $1, %rdx + andq (%r9), %rdx + sarq %cl, %rdx + movq %rdx, %rax +.L1: + leave +.LCFI2: + ret + .p2align 4,,10 + .p2align 3 +.L34: +.LCFI3: + movsbq -104(%rbp), %rax + leave +.LCFI4: + ret + .p2align 4,,10 + .p2align 3 +.L35: +.LCFI5: + movq -104(%rbp), %rax + leave +.LCFI6: + ret + .p2align 4,,10 + .p2align 3 +.L37: +.LCFI7: + movzbl -104(%rbp), %eax + leave +.LCFI8: + ret + .p2align 4,,10 + .p2align 3 +.L38: +.LCFI9: + movswq -104(%rbp), %rax + leave +.LCFI10: + ret + .p2align 4,,10 + .p2align 3 +.L39: +.LCFI11: + movzwl -104(%rbp), %eax + leave +.LCFI12: + ret + .p2align 4,,10 + .p2align 3 +.L40: +.LCFI13: + movslq -104(%rbp), %rax + leave +.LCFI14: + ret + .p2align 4,,10 + .p2align 3 +.L42: +.LCFI15: + movss -104(%rbp), %xmm0 + leave +.LCFI16: + ret + .p2align 4,,10 + .p2align 3 +.L41: +.LCFI17: + movl -104(%rbp), %eax + leave +.LCFI18: + ret +.L43: +.LCFI19: + movsd -104(%rbp), %xmm0 + leave +.LCFI20: + ret +.L17: +.LCFI21: + movq -80(%rbp), %rax + leave +.LCFI22: + ret +.L19: +.LCFI23: + leal -65(,%rdx,8), %ecx + movl $2, %edx + salq %cl, %rdx + movl %r8d, %ecx + subq $1, %rdx + andq 8(%r9), %rdx + negl %ecx + leal 64(,%rcx,8), %ecx + salq %cl, %rdx + leal 0(,%r8,8), %ecx + movq (%r9), %r8 + leave +.LCFI24: + sarq %cl, %r8 + orq %r8, %rdx + movq %rdx, %rax + ret +.LFE0: + .size callback_receiver, .-callback_receiver + .p2align 4,,15 + .globl callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: +.LFB1: + pushq %rbp +.LCFI25: + leaq callback_receiver(%rip), %rax + movq %rsp, %rbp +.LCFI26: + popq %rbp +.LCFI27: + ret +.LFE1: + .size callback_get_receiver, .-callback_get_receiver + .section .eh_frame,"a",@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 +.LSCIE1: + .long 0 + .byte 0x3 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .uleb128 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + .long .LFB0-. + .long .LFE0-.LFB0 + .uleb128 0 + .byte 0x4 + .long .LCFI0-.LFB0 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI2-.LCFI1 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI3-.LCFI2 + .byte 0xb + .byte 0x4 + .long .LCFI4-.LCFI3 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI5-.LCFI4 + .byte 0xb + .byte 0x4 + .long .LCFI6-.LCFI5 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI7-.LCFI6 + .byte 0xb + .byte 0x4 + .long .LCFI8-.LCFI7 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI9-.LCFI8 + .byte 0xb + .byte 0x4 + .long .LCFI10-.LCFI9 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI11-.LCFI10 + .byte 0xb + .byte 0x4 + .long .LCFI12-.LCFI11 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI13-.LCFI12 + .byte 0xb + .byte 0x4 + .long .LCFI14-.LCFI13 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI15-.LCFI14 + .byte 0xb + .byte 0x4 + .long .LCFI16-.LCFI15 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI17-.LCFI16 + .byte 0xb + .byte 0x4 + .long .LCFI18-.LCFI17 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI19-.LCFI18 + .byte 0xb + .byte 0x4 + .long .LCFI20-.LCFI19 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI21-.LCFI20 + .byte 0xb + .byte 0x4 + .long .LCFI22-.LCFI21 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI23-.LCFI22 + .byte 0xb + .byte 0x4 + .long .LCFI24-.LCFI23 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .align 8 +.LEFDE1: +.LSFDE3: + .long .LEFDE3-.LASFDE3 +.LASFDE3: + .long .LASFDE3-.Lframe1 + .long .LFB1-. + .long .LFE1-.LFB1 + .uleb128 0 + .byte 0x4 + .long .LCFI25-.LFB1 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI26-.LCFI25 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI27-.LCFI26 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .align 8 +.LEFDE3: + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/callback/vacall_r/vacall-x86_64-x32-linux.s b/callback/vacall_r/vacall-x86_64-x32-linux.s new file mode 100644 index 0000000..ae2bf5b --- /dev/null +++ b/callback/vacall_r/vacall-x86_64-x32-linux.s @@ -0,0 +1,338 @@ + .file "vacall-x86_64.c" + .section .text.unlikely,"ax",@progbits +.LCOLDB0: + .text +.LHOTB0: + .p2align 4,,15 + .type callback_receiver, @function +callback_receiver: +.LFB0: + pushq %rbp +.LCFI0: + movl %esp, %ebp +.LCFI1: + pushq %r14 + pushq %r12 + subl $176, %esp +.LCFI2: + movq %rdi, -72(%ebp) + leal 16(%rbp), %edi + movq %rcx, -48(%ebp) + movl (%r10d), %ecx + movsd %xmm0, -144(%ebp) + movl %edi, -168(%ebp) + movl 4(%r10d), %edi + movsd %xmm1, -136(%ebp) + movq %rsi, -64(%ebp) + movsd %xmm2, -128(%ebp) + leal -192(%rbp), %esi + movq %rdx, -56(%ebp) + movsd %xmm3, -120(%ebp) + movq %r8, -40(%ebp) + movsd %xmm4, -112(%ebp) + movq %r9, -32(%ebp) + movsd %xmm5, -104(%ebp) + movsd %xmm6, -96(%ebp) + movl $0, -192(%ebp) + movsd %xmm7, -88(%ebp) + movl $0, -164(%ebp) + movl $0, -160(%ebp) + movl $0, -80(%ebp) + movl $0, -152(%ebp) + call *%rcx + movl -160(%ebp), %ecx + testl %ecx, %ecx + je .L1 + cmpl $1, %ecx + je .L27 + cmpl $2, %ecx + je .L27 + cmpl $3, %ecx + je .L33 + cmpl $4, %ecx + je .L34 + cmpl $5, %ecx + je .L35 + cmpl $6, %ecx + je .L28 + cmpl $7, %ecx + je .L30 + cmpl $8, %ecx + je .L28 + cmpl $9, %ecx + je .L30 + cmpl $10, %ecx + je .L31 + cmpl $11, %ecx + je .L31 + cmpl $12, %ecx + je .L36 + cmpl $13, %ecx + je .L37 + cmpl $14, %ecx + je .L30 + cmpl $15, %ecx + jne .L1 + testb $4, -191(%ebp) + je .L1 + movl -156(%ebp), %ecx + leal -1(%rcx), %esi + cmpl $15, %esi + ja .L1 + movl -164(%ebp), %esi + movl %esi, %edi + andl $7, %esi + andl $-8, %edi + cmpl $8, %ecx + leal (%rcx,%rsi), %r11d + ja .L17 + cmpl $8, %r11d + ja .L18 + leal -1(,%r11,8), %ecx + movl $2, %r8d + salq %cl, %r8 + movq %r8, %rcx + subq $1, %rcx + andq (%edi), %rcx + movq %rcx, %rdi + leal 0(,%rsi,8), %ecx + sarq %cl, %rdi + movq %rdi, %rax +.L1: + addl $176, %esp + popq %r12 + popq %r14 + popq %rbp +.LCFI3: + ret + .p2align 4,,10 + .p2align 3 +.L27: +.LCFI4: + movsbq -184(%ebp), %rax + addl $176, %esp + popq %r12 + popq %r14 + popq %rbp +.LCFI5: + ret + .p2align 4,,10 + .p2align 3 +.L28: +.LCFI6: + movslq -184(%ebp), %rax + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L33: + movzbl -184(%ebp), %eax + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L34: + movswq -184(%ebp), %rax + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L30: + movl -184(%ebp), %eax + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L35: + movzwl -184(%ebp), %eax + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L36: + movss -184(%ebp), %xmm0 + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L31: + movq -184(%ebp), %rax + jmp .L1 +.L37: + movsd -184(%ebp), %xmm0 + jmp .L1 +.L17: + cmpl $16, %r11d + leal 0(,%rsi,8), %r9d + jbe .L38 + negl %esi + movq 8(%edi), %r8 + movl %r9d, %ecx + leal 64(,%rsi,8), %r12d + movq (%edi), %rsi + movq %r8, %r14 + sarq %cl, %rsi + movl %r12d, %ecx + salq %cl, %r14 + leal -129(,%r11,8), %ecx + orq %r14, %rsi + movq %rsi, %rax + movl $2, %esi + salq %cl, %rsi + movl %r12d, %ecx + subq $1, %rsi + andq 16(%edi), %rsi + salq %cl, %rsi + movl %r9d, %ecx + sarq %cl, %r8 + orq %r8, %rsi + movq %rsi, %rdx + jmp .L1 +.L18: + leal -65(,%r11,8), %ecx + movl $2, %r8d + salq %cl, %r8 + movl %esi, %ecx + subq $1, %r8 + andq 8(%edi), %r8 + negl %ecx + leal 64(,%rcx,8), %ecx + movq (%edi), %rdi + salq %cl, %r8 + leal 0(,%rsi,8), %ecx + sarq %cl, %rdi + orq %rdi, %r8 + movq %r8, %rax + jmp .L1 +.L38: + leal -65(,%r11,8), %ecx + movl $2, %r8d + movq (%edi), %r11 + imull $-4, %esi, %esi + salq %cl, %r8 + movl %r9d, %ecx + subq $1, %r8 + andq 8(%edi), %r8 + sarq %cl, %r11 + addl $32, %esi + movl %esi, %ecx + movq %r8, %rdi + salq %cl, %rdi + salq %cl, %rdi + movl %r9d, %ecx + orq %rdi, %r11 + sarq %cl, %r8 + movq %r11, %rax + movq %r8, %rdx + jmp .L1 +.LFE0: + .size callback_receiver, .-callback_receiver + .section .text.unlikely +.LCOLDE0: + .text +.LHOTE0: + .section .text.unlikely +.LCOLDB1: + .text +.LHOTB1: + .p2align 4,,15 + .globl callback_get_receiver + .type callback_get_receiver, @function +callback_get_receiver: +.LFB1: + pushq %rbp +.LCFI7: + leal callback_receiver(%rip), %eax + movl %esp, %ebp +.LCFI8: + popq %rbp +.LCFI9: + ret +.LFE1: + .size callback_get_receiver, .-callback_get_receiver + .section .text.unlikely +.LCOLDE1: + .text +.LHOTE1: + .section .eh_frame,"a",@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 +.LSCIE1: + .long 0 + .byte 0x3 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .uleb128 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 4 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + .long .LFB0-. + .long .LFE0-.LFB0 + .uleb128 0 + .byte 0x4 + .long .LCFI0-.LFB0 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI2-.LCFI1 + .byte 0x8e + .uleb128 0x3 + .byte 0x8c + .uleb128 0x4 + .byte 0x4 + .long .LCFI3-.LCFI2 + .byte 0xa + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI4-.LCFI3 + .byte 0xb + .byte 0x4 + .long .LCFI5-.LCFI4 + .byte 0xa + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI6-.LCFI5 + .byte 0xb + .align 4 +.LEFDE1: +.LSFDE3: + .long .LEFDE3-.LASFDE3 +.LASFDE3: + .long .LASFDE3-.Lframe1 + .long .LFB1-. + .long .LFE1-.LFB1 + .uleb128 0 + .byte 0x4 + .long .LCFI7-.LFB1 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI8-.LCFI7 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI9-.LCFI8 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .align 4 +.LEFDE3: + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/callback/vacall_r/vacall_r.h b/callback/vacall_r/vacall_r.h new file mode 100644 index 0000000..08b0f09 --- /dev/null +++ b/callback/vacall_r/vacall_r.h @@ -0,0 +1,556 @@ +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#ifndef _VACALL_R_H +#define _VACALL_R_H + +#include + +#include "ffcall-abi.h" + + +/* Use a consistent prefix for all symbols in libcallback. */ +#define vacall_start callback_start +#define vacall_start_struct callback_start_struct +#define vacall_arg_char callback_arg_char +#define vacall_arg_schar callback_arg_schar +#define vacall_arg_uchar callback_arg_uchar +#define vacall_arg_short callback_arg_short +#define vacall_arg_ushort callback_arg_ushort +#define vacall_arg_int callback_arg_int +#define vacall_arg_uint callback_arg_uint +#define vacall_arg_long callback_arg_long +#define vacall_arg_ulong callback_arg_ulong +#define vacall_arg_longlong callback_arg_longlong +#define vacall_arg_ulonglong callback_arg_ulonglong +#define vacall_arg_float callback_arg_float +#define vacall_arg_double callback_arg_double +#define vacall_arg_ptr callback_arg_ptr +#define vacall_arg_struct callback_arg_struct +#define vacall_return_void callback_return_void +#define vacall_return_char callback_return_char +#define vacall_return_schar callback_return_schar +#define vacall_return_uchar callback_return_uchar +#define vacall_return_short callback_return_short +#define vacall_return_ushort callback_return_ushort +#define vacall_return_int callback_return_int +#define vacall_return_uint callback_return_uint +#define vacall_return_long callback_return_long +#define vacall_return_ulong callback_return_ulong +#define vacall_return_longlong callback_return_longlong +#define vacall_return_ulonglong callback_return_ulonglong +#define vacall_return_float callback_return_float +#define vacall_return_double callback_return_double +#define vacall_return_ptr callback_return_ptr +#define vacall_return_struct callback_return_struct +#define vacall_error_type_mismatch callback_error_type_mismatch +#define vacall_error_struct_too_large callback_error_struct_too_large +#define vacall_structcpy callback_structcpy +#define vacall_struct_buffer callback_struct_buffer + + +/* Determine whether the current ABI is LLP64 + ('long' = 32-bit, 'long long' = 'void*' = 64-bit). */ +#if defined(__x86_64__) && defined(_WIN32) && !defined(__CYGWIN__) +#define __VA_LLP64 1 +#endif + +/* Determine the alignment of a type at compile time. + */ +#if defined(__GNUC__) || defined(__IBM__ALIGNOF__) +#define __VA_alignof __alignof__ +#elif defined(__cplusplus) +template struct __VA_alignof_helper { char __slot1; type __slot2; }; +#define __VA_alignof(type) offsetof (__VA_alignof_helper, __slot2) +#elif defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) /* SGI compiler */ +#define __VA_alignof __builtin_alignof +#else +#define __VA_offsetof(type,ident) ((unsigned long)&(((type*)0)->ident)) +#define __VA_alignof(type) __VA_offsetof(struct { char __slot1; type __slot2; }, __slot2) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* __vaword represents a single word that can be pushed on the stack. + * __varword represents a general-purpose register. + */ +#if defined(__arm64__) && defined(__APPLE__) && defined(__MACH__) +typedef int __vaword; +typedef long __varword; +#elif defined(__mipsn32__) || defined(__x86_64_x32__) || defined(__VA_LLP64) +typedef long long __vaword; +typedef long long __varword; +#else +typedef long __vaword; +typedef long __varword; +#endif + +/* C builtin types. + */ +enum __VAtype +{ + __VAvoid, + __VAchar, + __VAschar, + __VAuchar, + __VAshort, + __VAushort, + __VAint, + __VAuint, + __VAlong, + __VAulong, + __VAlonglong, + __VAulonglong, + __VAfloat, + __VAdouble, + __VAvoidp, + __VAstruct +}; + +enum __VA_alist_flags +{ + + /* how to return structs */ + /* There are basically 3 ways to return structs: + * a. The called function returns a pointer to static data. Not reentrant. + * Not supported any more. + * b. The caller passes the return structure address in a dedicated register + * or as a first (or last), invisible argument. The called function stores + * its result there. + * c. Like b, and the called function also returns the return structure + * address in the return value register. (This is not very distinguishable + * from b.) + * Independently of this, + * r. small structures (<= 4 or <= 8 bytes) may be returned in the return + * value register(s), or + * m. even small structures are passed in memory. + */ + /* gcc-2.6.3 employs the following strategy: + * - If PCC_STATIC_STRUCT_RETURN is defined in the machine description + * it uses method a, else method c. + * - If flag_pcc_struct_return is set (either by -fpcc-struct-return or if + * DEFAULT_PCC_STRUCT_RETURN is defined to 1 in the machine description) + * it uses method m, else (either by -freg-struct-return or if + * DEFAULT_PCC_STRUCT_RETURN is defined to 0 in the machine description) + * method r. + */ + __VA_SMALL_STRUCT_RETURN = 1<<1, /* r: special case for small structs */ + __VA_GCC_STRUCT_RETURN = 1<<2, /* consider 8 byte structs as small */ +#if defined(__sparc__) && !defined(__sparc64__) + __VA_SUNCC_STRUCT_RETURN = 1<<3, + __VA_SUNPROCC_STRUCT_RETURN = 1<<4, +#else + __VA_SUNCC_STRUCT_RETURN = 0, + __VA_SUNPROCC_STRUCT_RETURN = 0, +#endif +#if defined(__i386__) + __VA_MSVC_STRUCT_RETURN = 1<<4, +#endif + /* the default way to return structs */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another struct returning convention, + * just #define __VA_STRUCT_RETURN ... + * before or after #including . + */ +#ifndef __VA_STRUCT_RETURN + __VA_STRUCT_RETURN = +#if defined(__sparc__) && !defined(__sparc64__) && defined(__sun) && (defined(__SUNPRO_C) || defined(__SUNPRO_CC)) /* SUNWspro cc or CC */ + __VA_SUNPROCC_STRUCT_RETURN, +#else +#if (defined(__i386__) && (defined(_WIN32) || defined(__CYGWIN__) || (defined(__MACH__) && defined(__APPLE__)) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__))) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__hppa__) || defined(__hppa64__) || defined(__arm__) || defined(__armhf__) || defined(__arm64__) || defined(__powerpc64_elfv2__) || defined(__ia64__) || defined(__x86_64__) || defined(__riscv32__) || defined(__riscv64__) + __VA_SMALL_STRUCT_RETURN | +#endif +#if defined(__GNUC__) && !((defined(__mipsn32__) || defined(__mips64__)) && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3))) + __VA_GCC_STRUCT_RETURN | +#endif +#if defined(__i386__) && defined(_WIN32) && !defined(__CYGWIN__) /* native Windows */ + __VA_MSVC_STRUCT_RETURN | +#endif + 0, +#endif +#endif + + /* how to return floats */ +#if defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) + __VA_SUNCC_FLOAT_RETURN = 1<<5, +#endif +#if defined(__m68k__) + __VA_FREG_FLOAT_RETURN = 1<<6, +#endif + /* the default way to return floats */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another float returning convention, + * just #define __VA_FLOAT_RETURN ... + * before or after #including . + */ +#ifndef __VA_FLOAT_RETURN +#if (defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__))) && !defined(__GNUC__) && defined(__sun) && !(defined(__SUNPRO_C) || defined(__SUNPRO_CC)) /* Sun cc or CC */ + __VA_FLOAT_RETURN = __VA_SUNCC_FLOAT_RETURN, +#elif defined(__m68k__) + __VA_FLOAT_RETURN = __VA_FREG_FLOAT_RETURN, +#else + __VA_FLOAT_RETURN = 0, +#endif +#endif + + /* how to pass structs */ +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) + __VA_SGICC_STRUCT_ARGS = 1<<7, +#endif +#if defined(__powerpc__) || defined(__powerpc64__) + __VA_AIXCC_STRUCT_ARGS = 1<<7, +#endif +#if defined(__ia64__) + __VA_OLDGCC_STRUCT_ARGS = 1<<7, +#endif + /* the default way to pass structs */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another structs passing convention, + * just #define __VA_STRUCT_ARGS ... + * before or after #including . + */ +#ifndef __VA_STRUCT_ARGS +#if (defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)) && !defined(__GNUC__) /* SGI mips cc */ + __VA_STRUCT_ARGS = __VA_SGICC_STRUCT_ARGS, +#else +#if (defined(__mipsn32__) || defined(__mips64__)) && (!defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3)) /* SGI mips cc or gcc >= 3.4 */ + __VA_STRUCT_ARGS = __VA_SGICC_STRUCT_ARGS, +#else +#if defined(__powerpc__) && !defined(__powerpc64__) && defined(_AIX) && !defined(__GNUC__) /* AIX 32-bit cc, xlc */ + __VA_STRUCT_ARGS = __VA_AIXCC_STRUCT_ARGS, +#else +#if defined(__powerpc64__) && defined(_AIX) /* AIX 64-bit cc, xlc, gcc, xlclang */ + __VA_STRUCT_ARGS = __VA_AIXCC_STRUCT_ARGS, +#else +#if defined(__ia64__) && !(defined(__GNUC__) && (__GNUC__ >= 3)) + __VA_STRUCT_ARGS = __VA_OLDGCC_STRUCT_ARGS, +#else + __VA_STRUCT_ARGS = 0, +#endif +#endif +#endif +#endif +#endif +#endif + + /* how to pass floats */ + /* ANSI C compilers and GNU gcc pass floats as floats. + * K&R C compilers pass floats as doubles. We don't support them any more. + */ +#if defined(__powerpc64__) + __VA_AIXCC_FLOAT_ARGS = 1<<8, /* pass floats in the low 4 bytes of an 8-bytes word */ +#endif + /* the default way to pass floats */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another float passing convention, + * just #define __VA_FLOAT_ARGS ... + * before or after #including . + */ +#ifndef __VA_FLOAT_ARGS +#if defined(__powerpc64__) && defined(_AIX) && (defined(__ibmxl__) || !defined(__GNUC__)) /* AIX 64-bit xlc, xlclang */ + __VA_FLOAT_ARGS = __VA_AIXCC_FLOAT_ARGS, +#else + __VA_FLOAT_ARGS = 0, +#endif +#endif + + /* how to pass and return small integer arguments */ + __VA_ANSI_INTEGERS = 0, /* no promotions */ + __VA_TRADITIONAL_INTEGERS = 0, /* promote [u]char, [u]short to [u]int */ + /* Fortunately these two methods are compatible. Our macros work with both. */ + + /* stack cleanup policy */ + __VA_CDECL_CLEANUP = 0, /* caller pops args after return */ + __VA_STDCALL_CLEANUP = 1<<9, /* callee pops args before return */ + /* currently only supported on __i386__ */ +#ifndef __VA_CLEANUP + __VA_CLEANUP = __VA_CDECL_CLEANUP, +#endif + + /* These are for internal use only */ +#if defined(__i386__) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppa64__) || defined(__arm__) || defined(__armhf__) || defined(__arm64__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || defined(__x86_64__) || (defined(__s390__) && !defined(__s390x__)) || defined(__riscv64__) + __VA_REGISTER_STRUCT_RETURN = 1<<10, +#endif +#if defined(__mipsn32__) || defined(__mips64__) + __VA_REGISTER_FLOATSTRUCT_RETURN = 1<<11, + __VA_REGISTER_DOUBLESTRUCT_RETURN = 1<<12, +#endif + + __VA_flag_for_broken_compilers_that_dont_like_trailing_commas +}; + +/* + * Definition of the ‘va_alist’ type. + */ +struct vacall_alist +/* GNU clisp pokes in internals of the alist! */ +#ifdef LISPFUN +{ + /* some va_... macros need these flags */ + int flags; +#if defined(__i386__) || defined(__arm__) || defined(__armhf__) || (defined(__powerpc__) && !defined(__powerpc64__) && defined(__MACH__) && defined(__APPLE__)) + __vaword filler1; +#endif + /* temporary storage for return value */ + union { + char _char; + signed char _schar; + unsigned char _uchar; + short _short; + unsigned short _ushort; + int _int; + unsigned int _uint; + long _long; + unsigned long _ulong; + long long _longlong; + unsigned long long _ulonglong; + float _float; + double _double; + void* _ptr; + } tmp; +} +#endif +; +typedef struct vacall_alist * va_alist; + + +/* + * Definition of the va_start_xxx macros. + */ +#define __VA_START_FLAGS \ + __VA_STRUCT_RETURN | __VA_FLOAT_RETURN | __VA_STRUCT_ARGS | __VA_FLOAT_ARGS | __VA_CLEANUP + +extern void vacall_start (va_alist /* LIST */, int /* RETTYPE */, int /* FLAGS */); + +#define va_start_void(LIST) vacall_start(LIST,__VAvoid, __VA_START_FLAGS) +#define va_start_char(LIST) vacall_start(LIST,__VAchar, __VA_START_FLAGS) +#define va_start_schar(LIST) vacall_start(LIST,__VAschar, __VA_START_FLAGS) +#define va_start_uchar(LIST) vacall_start(LIST,__VAuchar, __VA_START_FLAGS) +#define va_start_short(LIST) vacall_start(LIST,__VAshort, __VA_START_FLAGS) +#define va_start_ushort(LIST) vacall_start(LIST,__VAushort, __VA_START_FLAGS) +#define va_start_int(LIST) vacall_start(LIST,__VAint, __VA_START_FLAGS) +#define va_start_uint(LIST) vacall_start(LIST,__VAuint, __VA_START_FLAGS) +#define va_start_long(LIST) vacall_start(LIST,__VAlong, __VA_START_FLAGS) +#define va_start_ulong(LIST) vacall_start(LIST,__VAulong, __VA_START_FLAGS) +#define va_start_longlong(LIST) vacall_start(LIST,__VAlonglong, __VA_START_FLAGS) +#define va_start_ulonglong(LIST) vacall_start(LIST,__VAulonglong,__VA_START_FLAGS) +#define va_start_float(LIST) vacall_start(LIST,__VAfloat, __VA_START_FLAGS) +#define va_start_double(LIST) vacall_start(LIST,__VAdouble, __VA_START_FLAGS) +#define va_start_ptr(LIST,TYPE) vacall_start(LIST,__VAvoidp, __VA_START_FLAGS) + +/* + * va_start_struct: Preparing structure return. + */ +extern void vacall_start_struct (va_alist /* LIST */, size_t /* TYPE_SIZE */, size_t /* TYPE_ALIGN */, int /* TYPE_SPLITTABLE */, int /* FLAGS */); + +#define va_start_struct(LIST,TYPE,TYPE_SPLITTABLE) \ + _va_start_struct(LIST,sizeof(TYPE),__VA_alignof(TYPE),TYPE_SPLITTABLE) +/* _va_start_struct() is like va_start_struct(), except that you pass + * the type's size and alignment instead of the type itself. + * Undocumented, but used by GNU clisp. + */ +#define _va_start_struct(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + vacall_start_struct(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE,__VA_START_FLAGS) + + +/* + * Definition of the va_arg_xxx macros. + */ + +extern char vacall_arg_char (va_alist /* LIST */); +extern signed char vacall_arg_schar (va_alist /* LIST */); +extern unsigned char vacall_arg_uchar (va_alist /* LIST */); +extern short vacall_arg_short (va_alist /* LIST */); +extern unsigned short vacall_arg_ushort (va_alist /* LIST */); +extern int vacall_arg_int (va_alist /* LIST */); +extern unsigned int vacall_arg_uint (va_alist /* LIST */); +extern long vacall_arg_long (va_alist /* LIST */); +extern unsigned long vacall_arg_ulong (va_alist /* LIST */); + +#define va_arg_char(LIST) vacall_arg_char(LIST) +#define va_arg_schar(LIST) vacall_arg_schar(LIST) +#define va_arg_uchar(LIST) vacall_arg_uchar(LIST) +#define va_arg_short(LIST) vacall_arg_short(LIST) +#define va_arg_ushort(LIST) vacall_arg_ushort(LIST) +#define va_arg_int(LIST) vacall_arg_int(LIST) +#define va_arg_uint(LIST) vacall_arg_uint(LIST) +#define va_arg_long(LIST) vacall_arg_long(LIST) +#define va_arg_ulong(LIST) vacall_arg_ulong(LIST) + +extern long long vacall_arg_longlong (va_alist /* LIST */); +extern unsigned long long vacall_arg_ulonglong (va_alist /* LIST */); + +#define va_arg_longlong(LIST) vacall_arg_longlong(LIST) +#define va_arg_ulonglong(LIST) vacall_arg_ulonglong(LIST) + +/* Floating point arguments. */ + +extern float vacall_arg_float (va_alist /* LIST */); +extern double vacall_arg_double (va_alist /* LIST */); + +#define va_arg_float(LIST) vacall_arg_float(LIST) +#define va_arg_double(LIST) vacall_arg_double(LIST) + +/* Pointer arguments. */ + +extern void* vacall_arg_ptr (va_alist /* LIST */); +#define va_arg_ptr(LIST,TYPE) ((TYPE)vacall_arg_ptr(LIST)) + +/* Structure arguments. */ + +extern void* vacall_arg_struct (va_alist /* LIST */, size_t /* TYPE_SIZE */, size_t /* TYPE_ALIGN */); + +#define va_arg_struct(LIST,TYPE) \ + *(TYPE*)vacall_arg_struct(LIST,sizeof(TYPE),__VA_alignof(TYPE)) +/* _va_arg_struct() is like va_arg_struct(), except that you pass the type's + * size and alignment instead of the type and get the value's address instead + * of the value itself. + * Undocumented, but used by GNU clisp. + */ +#define _va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + vacall_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) + + +/* + * Definition of the va_return_xxx macros. + */ + +extern void vacall_return_void (va_alist /* LIST */); +#define va_return_void(LIST) vacall_return_void(LIST) + +extern void vacall_return_char (va_alist /* LIST */, char /* VAL */); +extern void vacall_return_schar (va_alist /* LIST */, signed char /* VAL */); +extern void vacall_return_uchar (va_alist /* LIST */, unsigned char /* VAL */); +extern void vacall_return_short (va_alist /* LIST */, short /* VAL */); +extern void vacall_return_ushort (va_alist /* LIST */, unsigned short /* VAL */); +extern void vacall_return_int (va_alist /* LIST */, int /* VAL */); +extern void vacall_return_uint (va_alist /* LIST */, unsigned int /* VAL */); +extern void vacall_return_long (va_alist /* LIST */, long /* VAL */); +extern void vacall_return_ulong (va_alist /* LIST */, unsigned long /* VAL */); +#define va_return_char(LIST,VAL) vacall_return_char(LIST,VAL) +#define va_return_schar(LIST,VAL) vacall_return_schar(LIST,VAL) +#define va_return_uchar(LIST,VAL) vacall_return_uchar(LIST,VAL) +#define va_return_short(LIST,VAL) vacall_return_short(LIST,VAL) +#define va_return_ushort(LIST,VAL) vacall_return_ushort(LIST,VAL) +#define va_return_int(LIST,VAL) vacall_return_int(LIST,VAL) +#define va_return_uint(LIST,VAL) vacall_return_uint(LIST,VAL) +#define va_return_long(LIST,VAL) vacall_return_long(LIST,VAL) +#define va_return_ulong(LIST,VAL) vacall_return_ulong(LIST,VAL) + +extern void vacall_return_longlong (va_alist /* LIST */, long long /* VAL */); +extern void vacall_return_ulonglong (va_alist /* LIST */, unsigned long long /* VAL */); +#define va_return_longlong(LIST,VAL) vacall_return_longlong(LIST,VAL) +#define va_return_ulonglong(LIST,VAL) vacall_return_ulonglong(LIST,VAL) + +extern void vacall_return_float (va_alist /* LIST */, float /* VAL */); +extern void vacall_return_double (va_alist /* LIST */, double /* VAL */); +#define va_return_float(LIST,VAL) vacall_return_float(LIST,VAL) +#define va_return_double(LIST,VAL) vacall_return_double(LIST,VAL) + +extern void vacall_return_ptr (va_alist /* LIST */, void* /* VAL */); +#define va_return_ptr(LIST,TYPE,VAL) vacall_return_ptr(LIST,(void*)(TYPE)(VAL)) + +extern void vacall_return_struct (va_alist /* LIST */, size_t /* TYPE_SIZE */, size_t /* TYPE_ALIGN */, const void* /* VAL_ADDR */); + +#define va_return_struct(LIST,TYPE,VAL) \ + _va_return_struct(LIST,sizeof(TYPE),__VA_alignof(TYPE),&(VAL)) +/* Undocumented, but used by GNU clisp. */ +#define _va_return_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL_ADDR) \ + vacall_return_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL_ADDR) + + +/* Determine whether a struct type is word-splittable, i.e. whether each of + * its components fit into a register. + * The entire computation is done at compile time. + */ +#define va_word_splittable_1(slot1) \ + (__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) +#define va_word_splittable_2(slot1,slot2) \ + ((__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) \ + && (__va_offset2(slot1,slot2)/sizeof(__vaword) == (__va_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__vaword)) \ + ) +#define va_word_splittable_3(slot1,slot2,slot3) \ + ((__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) \ + && (__va_offset2(slot1,slot2)/sizeof(__vaword) == (__va_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__vaword)) \ + && (__va_offset3(slot1,slot2,slot3)/sizeof(__vaword) == (__va_offset3(slot1,slot2,slot3)+sizeof(slot3)-1)/sizeof(__vaword)) \ + ) +#define va_word_splittable_4(slot1,slot2,slot3,slot4) \ + ((__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) \ + && (__va_offset2(slot1,slot2)/sizeof(__vaword) == (__va_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__vaword)) \ + && (__va_offset3(slot1,slot2,slot3)/sizeof(__vaword) == (__va_offset3(slot1,slot2,slot3)+sizeof(slot3)-1)/sizeof(__vaword)) \ + && (__va_offset4(slot1,slot2,slot3,slot4)/sizeof(__vaword) == (__va_offset4(slot1,slot2,slot3,slot4)+sizeof(slot4)-1)/sizeof(__vaword)) \ + ) +#define __va_offset1(slot1) \ + 0 +#define __va_offset2(slot1,slot2) \ + ((__va_offset1(slot1)+sizeof(slot1)+__VA_alignof(slot2)-1) & -(long)__VA_alignof(slot2)) +#define __va_offset3(slot1,slot2,slot3) \ + ((__va_offset2(slot1,slot2)+sizeof(slot2)+__VA_alignof(slot3)-1) & -(long)__VA_alignof(slot3)) +#define __va_offset4(slot1,slot2,slot3,slot4) \ + ((__va_offset3(slot1,slot2,slot3)+sizeof(slot3)+__VA_alignof(slot4)-1) & -(long)__VA_alignof(slot4)) + + +/* + * Miscellaneous declarations. + */ + +#if defined(__sparc__) || defined(__sparc64__) +/* On SPARC, PIC compiled code crashes when used outside of a shared library. + Therefore, don't use the callback_get_receiver indirection on this platform. */ + +extern +#ifdef __cplusplus +"C" +#endif +void callback_receiver (); /* Actually it takes arguments and returns values! */ + +#define callback_get_receiver() (&callback_receiver) + +#else + +/* A fake type for callback_receiver. + Actually it takes arguments and returns values. */ +typedef void (*__vacall_r_t) (void); + +/* This function returns the address of callback_receiver. + callback_receiver is not a global symbol, because on ELF platforms, functions + with global visibility cannot accept additional arguments in registers. See + elf-hack.txt for more details. */ +extern +#ifdef __cplusplus +"C" +#endif +__vacall_r_t callback_get_receiver (void); + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* _VACALL_R_H */ diff --git a/common/asm-alpha.sh b/common/asm-alpha.sh new file mode 100755 index 0000000..f39b238 --- /dev/null +++ b/common/asm-alpha.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# Translate the assembler syntax of alpha assembler programs +# Usage: asm-alpha.sh < alphalinux-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,//.*$,,' + +# Copyright (C) 2017 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpremove='rm -f $tmpscript1 $tmpscript2' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove gcc self-identification +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Introduce macro syntax for assembler pseudo-ops +/\.section\([ ]\+\).*GNU-stack/d +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 + +eval "$tmpremove" diff --git a/common/asm-arm.h b/common/asm-arm.h new file mode 100644 index 0000000..fee4030 --- /dev/null +++ b/common/asm-arm.h @@ -0,0 +1,59 @@ +// Assembly language support for arm CPU. +// Bruno Haible 1999-05-29 + +// Copyright (C) 1999-2017 Bruno Haible +// +// 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, see . + +// In order not to have to maintain several copies of the assembly language +// code, we use some macros which expand into the correct syntax. +// These macros are: +// C(name) +// This expands to the name of the C variable or function `name'. +// On Unix BSD systems, this prepends an underscore. +// L(label) +// This expands to the name of a local label, having the name `label'. +// On Unix ELF systems, where there is no underscore, names beginning +// with an alphabetic character are automatically exported, so this +// prepends a dot. Note that when defining a label, the `:' must +// be inside the parentheses, not outside, because otherwise some +// ANSI C preprocessor inserts a space between the label and the `:', +// and some assemblers don't like this. +// DECLARE_FUNCTION(name) +// Declare `name' to be a global function. When assembly language +// code is compiled into a shared library, ELF linkers need to know +// which symbols are functions. +// FUNBEGIN(name) +// Start the assembly language code for the C function `name'. +// FUNEND(name) +// End the assembly language code for the C function 'name'. + +#ifdef ASM_UNDERSCORE +#define C(entrypoint) _##entrypoint +#define L(label) L##label +#else +#define C(entrypoint) entrypoint +#define L(label) .L##label +#endif + +// When assembly language code is compiled into a shared library, ELF linkers +// need to know which symbols are functions. +#if defined(__ELF__) || !defined(ASM_UNDERSCORE) +#define DECLARE_FUNCTION(name) .type C(name),%function +#define FUNEND(name) .size C(name),.-C(name) +#else +#define DECLARE_FUNCTION(name) +#define FUNEND(name) +#endif +#define FUNBEGIN(name) C(name): diff --git a/common/asm-arm.sh b/common/asm-arm.sh new file mode 100755 index 0000000..f1e4daf --- /dev/null +++ b/common/asm-arm.sh @@ -0,0 +1,65 @@ +#!/bin/sh +# Translate the assembler syntax of arm assembler programs +# Usage: asm-arm.sh < riscix-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$,#,g' + +# Copyright (C) 1999-2021 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpremove='rm -f $tmpscript1 $tmpscript2' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove gcc self-identification +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Hide comments, to avoid trouble in preprocessing +s,@,//,g +# ----------- Turn # into $, to avoid trouble in preprocessing +s,#,\$,g +# ----------- Global symbols depends on ASM_UNDERSCORE +/[ ]\.req[ ]/!{ +s/^\([A-Za-z0-9_]\+\)/C(\1)/ +} +s/\.L\([A-Za-z0-9_]\+\)/L(\1)/ +s/\.global[ ]\([A-Za-z0-9_]*\)/.global C(\1)/ +# ----------- Eliminate assembler pseudo-ops that allowed old syntax for inline +# asms but that are not understood by the FreeBSD assembler +/\.syntax divided/d +# ----------- Introduce macro syntax for assembler pseudo-ops +/\.file\([ ]\+\)/d +/\.section\([ ]\+\).*GNU-stack/d +s/^C(\([A-Za-z0-9_]*\)):/FUNBEGIN(\1)/ +# ----------- Massage the beginning of functions +/\.type/{ +s/\.type[ ]\([A-Za-z0-9_]*\), *function/DECLARE_FUNCTION(\1)/ +} +# ----------- Massage the end of functions +s/\.size[ ]\([A-Za-z0-9_]*\),\(.*\)/FUNEND(\1)/ +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 + +eval "$tmpremove" diff --git a/common/asm-arm64.h b/common/asm-arm64.h new file mode 100644 index 0000000..0386bc9 --- /dev/null +++ b/common/asm-arm64.h @@ -0,0 +1,84 @@ +// Assembly language support for arm64 CPU. +// Bruno Haible 1999-05-29 + +// Copyright (C) 1999-2021 Bruno Haible +// +// 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, see . + +// In order not to have to maintain several copies of the assembly language +// code, we use some macros which expand into the correct syntax. +// These macros are: +// C(name) +// This expands to the name of the C variable or function `name'. +// On Unix BSD systems, this prepends an underscore. +// L(label) +// This expands to the name of a local label, having the name `label'. +// On Unix ELF systems, where there is no underscore, names beginning +// with an alphabetic character are automatically exported, so this +// prepends a dot. Note that when defining a label, the `:' must +// be inside the parentheses, not outside, because otherwise some +// ANSI C preprocessor inserts a space between the label and the `:', +// and some assemblers don't like this. +// GOTPAGE(variable) +// This expands to a second argument for the 'adrp' instruction. +// GOTPAGEOFF(variable) +// This expands to an offset, to be used with GOTPAGE(variable). +// GOTINDIR(register) +// This expands to an indirect load instruction, on platforms which +// use a "large" memory model. +// PAGE(function) +// This expands to a second argument for the 'adrp' instruction. +// PAGEOFF(function) +// This expands to an offset, to be used with PAGE(function). +// DECLARE_FUNCTION(name) +// Declare `name' to be a global function. When assembly language +// code is compiled into a shared library, ELF linkers need to know +// which symbols are functions. +// FUNBEGIN(name) +// Start the assembly language code for the C function `name'. +// FUNEND(name) +// End the assembly language code for the C function 'name'. + +#ifdef ASM_UNDERSCORE +#define C(entrypoint) _##entrypoint +#define L(label) L##label +#else +#define C(entrypoint) entrypoint +#define L(label) .L##label +#endif + +#if defined __APPLE__ && defined __MACH__ +#define GOTPAGE(variable) variable@GOTPAGE +#define GOTPAGEOFF(variable) variable@GOTPAGEOFF +#define GOTINDIR(register) ldr register,[register] +#define PAGE(function) function@PAGE +#define PAGEOFF(function) function@PAGEOFF +#else +#define GOTPAGE(variable) variable +#define GOTPAGEOFF(variable) $:lo12:variable +#define GOTINDIR(register) +#define PAGE(function) function +#define PAGEOFF(function) $:lo12:function +#endif + +// When assembly language code is compiled into a shared library, ELF linkers +// need to know which symbols are functions. +#if defined(__ELF__) || !(defined(ASM_UNDERSCORE) || (defined __APPLE__ && defined __MACH__)) +#define DECLARE_FUNCTION(name) .type C(name),%function +#define FUNEND(name) .size C(name),.-C(name) +#else +#define DECLARE_FUNCTION(name) +#define FUNEND(name) +#endif +#define FUNBEGIN(name) C(name): diff --git a/common/asm-arm64.sh b/common/asm-arm64.sh new file mode 100755 index 0000000..64b628d --- /dev/null +++ b/common/asm-arm64.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# Translate the assembler syntax of arm64 assembler programs +# Usage: asm-arm64.sh < linux-arm64-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$,#,g' + +# Copyright (C) 1999-2021 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpscript3=sed$$tmp3 +tmpremove='rm -f $tmpscript1 $tmpscript2 $tmpscript3' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove gcc self-identification +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Hide comments, to avoid trouble in preprocessing +s,@,//,g +# ----------- Turn # into $, to avoid trouble in preprocessing +s,#,\$,g +# ----------- Global symbols depends on ASM_UNDERSCORE +s/^\([A-Za-z0-9_]\+\)/C(\1)/ +s/\.L\([A-Za-z0-9_]\+\)/L(\1)/ +s/\.global[ ]\([A-Za-z0-9_]*\)/.global C(\1)/ +# ----------- Introduce macro syntax for assembler pseudo-ops +/\.file\([ ]\+\)/d +/\.section\([ ]\+\).*GNU-stack/d +s/^C(\([A-Za-z0-9_]*\)):/FUNBEGIN(\1)/ +# ----------- Massage the beginning of functions +/\.type/{ +s/\.type[ ]\([A-Za-z0-9_]*\), *%function/DECLARE_FUNCTION(\1)/ +} +# ----------- Massage the end of functions +s/\.size[ ]\([A-Za-z0-9_]*\),\(.*\)/FUNEND(\1)/ +EOF + +cat > $tmpscript3 << \EOF +# ----------- Introduce macro syntax for PIC addressing of functions +s/^ adrp \([a-z0-9]*\), *\([A-Za-z0-9_]*\)/ adrp \1, PAGE(C(\2))/ +s/[$]:lo12:\([A-Za-z0-9_]*\)/PAGEOFF(C(\1))/ +s/:lo12:\([A-Za-z0-9_]*\)/PAGEOFF(C(\1))/ +# ----------- Introduce macro syntax for PIC addressing of variables +s/PAGE(C(\(vacall_function\)))/GOTPAGE(C(\1))/ +s/ ldr \([a-z0-9]*\), \[\(.*\)PAGEOFF(C(\(vacall_function\)))\].*/ ldr \1, [\2GOTPAGEOFF(C(\3))]\n GOTINDIR(\1)/ +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 | \ +sed -f $tmpscript3 + +eval "$tmpremove" diff --git a/common/asm-hppa.h b/common/asm-hppa.h new file mode 100644 index 0000000..ac6c378 --- /dev/null +++ b/common/asm-hppa.h @@ -0,0 +1,73 @@ +// Assembly language support for hppa CPU. +// Bruno Haible 2017-01-23 + +// Copyright (C) 2017-2018 Bruno Haible +// +// 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, see . + +// In order not to have to maintain several copies of the assembly language +// code, we use some macros which expand into the correct syntax. +// These macros are: +// IMPORT_MILLICODE(symbol) +// This expands to an import from the MILLICODE segment, if needed. +// IMPORT_DATA(symbol) +// This expands to an import from the DATA segment, if needed. +// TEXT1(), TEXT2() +// These expand to two lines that switch to the TEXT section/segment. +// GLOBL(symbol) +// This expands to a declaration that the given symbol, defined +// in this file, shall have global visibility. +// DEF(symbol) +// This expands to the declaration of a symbol or label. +// L(label) +// This expands to the name of a local label, having the name `label'. +// DECLARE_FUNCTION(name) +// Declare `name' to be a global function. When assembly language +// code is compiled into a shared library, ELF linkers need to know +// which symbols are functions. +// FUNEND(name) +// End the assembly language code for the C function 'name'. + +#if defined(__ELF__) +/* Linux */ +#define IMPORT_MILLICODE(symbol) +#define IMPORT_DATA(symbol) +#define TEXT1() .text +#define TEXT2() +#define GLOBL(symbol) .globl symbol +#define DEF(symbol) symbol: +#define L(label) .L##label +#define DECLARE_FUNCTION(name) .type name,%function +#define FUNEND(name) .size name,.-name +#else +/* HP-UX */ +#define IMPORT_MILLICODE(symbol) .IMPORT symbol,MILLICODE +#define IMPORT_DATA(symbol) .IMPORT symbol,DATA +#if 1 +#define TEXT1() .SPACE $TEXT$ +#define TEXT2() .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY +#else +#define TEXT1() .code +#define TEXT2() +#endif +#define GLOBL(symbol) .EXPORT symbol,ENTRY,PRIV_LEV=3 +#if 1 +#define DEF(symbol) symbol +#else +#define DEF(symbol) .label symbol +#endif +#define L(label) L$##label +#define DECLARE_FUNCTION(name) +#define FUNEND(name) +#endif diff --git a/common/asm-hppa.sh b/common/asm-hppa.sh new file mode 100755 index 0000000..180fd34 --- /dev/null +++ b/common/asm-hppa.sh @@ -0,0 +1,68 @@ +#!/bin/sh +# Translate the assembler syntax of hppa assembler programs +# Usage: asm-hppa.sh < hppalinux-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e "s,!,',g" + +# Copyright (C) 2017 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpremove='rm -f $tmpscript1 $tmpscript2' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove #APP/#NO_APP lines and gcc self-identification +/^#APP$/d +/^#NO_APP$/d +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Turn ' into !, to avoid trouble in preprocessing +s,',!,g +# ----------- Add some imports +/\.LEVEL/{ +s/$/\ + IMPORT_MILLICODE($$dyncall)/ +} +# ----------- Section switching +s/\.text/TEXT1()\ + TEXT2()/ +# ----------- Declaration of symbols and labels is different +s/^\([A-Za-z0-9_.]\+\):$/DEF(\1)/ +# ----------- Label syntax is different +/\.LEVEL/!{ +s/\.L\([A-Za-z0-9_]\+\)/L(\1)/ +} +# ----------- Introduce macro syntax for assembler pseudo-ops +s/\.globl[ ]\([A-Za-z0-9_]\+\)/GLOBL(\1)/ +# ----------- Massage the beginning of functions +/\.type/{ +s/\.type[ ]\+\([A-Za-z0-9_]*\), *@function/DECLARE_FUNCTION(\1)/ +} +# ----------- Massage the end of functions +s/\.size[ ]\([A-Za-z0-9_]*\),\(.*\)/FUNEND(\1)/ +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 + +eval "$tmpremove" diff --git a/common/asm-hppa64.h b/common/asm-hppa64.h new file mode 100644 index 0000000..fa653d1 --- /dev/null +++ b/common/asm-hppa64.h @@ -0,0 +1,69 @@ +// Assembly language support for hppa64 CPU. +// Bruno Haible 2017-01-23, 2017-08-05 + +// Copyright (C) 2017-2018 Bruno Haible +// +// 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, see . + +// In order not to have to maintain several copies of the assembly language +// code, we use some macros which expand into the correct syntax. +// These macros are: +// IMPORT_DATA(symbol) +// This expands to an import from the DATA segment, if needed. +// TEXT1(), TEXT2() +// These expand to two lines that switch to the TEXT section/segment. +// GLOBL(symbol) +// This expands to a declaration that the given symbol, defined +// in this file, shall have global visibility. +// DEF(symbol) +// This expands to the declaration of a symbol or label. +// L(label) +// This expands to the name of a local label, having the name `label'. +// DECLARE_FUNCTION(name) +// Declare `name' to be a global function. When assembly language +// code is compiled into a shared library, ELF linkers need to know +// which symbols are functions. +// FUNEND(name) +// End the assembly language code for the C function 'name'. + +#if defined(__ELF__) +/* Linux */ +#define IMPORT_DATA(symbol) +#define TEXT1() .text +#define TEXT2() +#define GLOBL(symbol) .globl symbol +#define DEF(symbol) symbol: +#define L(label) .L##label +#define DECLARE_FUNCTION(name) .type name,%function +#define FUNEND(name) .size name,.-name +#else +/* HP-UX */ +#define IMPORT_DATA(symbol) .IMPORT symbol,DATA +#if 1 +#define TEXT1() .SPACE $TEXT$,SORT=8 +#define TEXT2() .SUBSPA $CODE$,QUAD=0,ALIGN=8,ACCESS=44,CODE_ONLY,SORT=24 +#else +#define TEXT1() .code +#define TEXT2() +#endif +#define GLOBL(symbol) .EXPORT symbol,ENTRY,PRIV_LEV=3 +#if 1 +#define DEF(symbol) symbol +#else +#define DEF(symbol) .label symbol +#endif +#define L(label) L$##label +#define DECLARE_FUNCTION(name) +#define FUNEND(name) +#endif diff --git a/common/asm-hppa64.sh b/common/asm-hppa64.sh new file mode 100755 index 0000000..71d9d26 --- /dev/null +++ b/common/asm-hppa64.sh @@ -0,0 +1,63 @@ +#!/bin/sh +# Translate the assembler syntax of hppa64 assembler programs +# Usage: asm-hppa64.sh < hppalinux-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e "s,!,',g" + +# Copyright (C) 2017 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpremove='rm -f $tmpscript1 $tmpscript2' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove #APP/#NO_APP lines and gcc self-identification +/^#APP$/d +/^#NO_APP$/d +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Turn ' into !, to avoid trouble in preprocessing +s,',!,g +# ----------- Section switching +s/\.text/TEXT1()\ + TEXT2()/ +# ----------- Declaration of symbols and labels is different +s/^\([A-Za-z0-9_.]\+\):$/DEF(\1)/ +# ----------- Label syntax is different +/\.LEVEL/!{ +s/\.L\([A-Za-z0-9_]\+\)/L(\1)/ +} +# ----------- Introduce macro syntax for assembler pseudo-ops +s/\.globl[ ]\([A-Za-z0-9_]\+\)/GLOBL(\1)/ +# ----------- Massage the beginning of functions +/\.type/{ +s/\.type[ ]\+\([A-Za-z0-9_]*\), *@function/DECLARE_FUNCTION(\1)/ +} +# ----------- Massage the end of functions +s/\.size[ ]\([A-Za-z0-9_]*\),\(.*\)/FUNEND(\1)/ +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 + +eval "$tmpremove" diff --git a/common/asm-i386.h b/common/asm-i386.h new file mode 100644 index 0000000..ff1baab --- /dev/null +++ b/common/asm-i386.h @@ -0,0 +1,297 @@ +// Assembly language support for i386 CPU. +// Bruno Haible 1997-06-21 + +// Copyright (C) 1997-2018 Bruno Haible +// +// 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, see . + +// An assembly language file for the i386/i486/i586/i686/786 CPUs: +// On Unix, it is preprocessed and then assembled. NB: This file requires +// an ANSI C or C++ preprocessor which understands C++ comments. +// On Windows, with MSVC, it is preprocessed and then compiled with +// optimization. (The MSVC development environment does not have a separate +// assembler, we must use the C compiler's inline asm extension. Compiling +// without optimization pushes the registers %ebx,%esi,%edi onto the stack +// at function entry and pops them at function exit, which is not what we +// want because it affects the %esp offsets of the function arguments.) + +// The assembly language file should +// 1. include a configuration file which defines ASM_UNDERSCORE if appropriate. +// #ifndef _MSC_VER +// #include "config.h" +// #endif +// 2. include this file. +// #include "asm-i386.h" +// 3. define all assembly language code. + +// The three different assembler syntaxes for this CPU are a MAJOR annoyance. +// In order not to have to maintain several copies of the assembly language +// code, we use lots of macros which expand into the correct syntax. +// These macros are: +// C(name) +// This expands to the name of the C variable or function `name'. +// On Unix BSD systems, this prepends an underscore. +// L(label) +// This expands to the name of a local label, having the name `label'. +// On Unix ELF systems, where there is no underscore, names beginning +// with an alphabetic character are automatically exported, so this +// prepends a dot. Note that when defining a label, the `:' must +// be inside the parentheses, not outside, because otherwise some +// ANSI C preprocessor inserts a space between the label and the `:', +// and some assemblers don't like this. +// R(reg) +// This expands to a reference to register `reg'. On Unix, this +// prepends a % charater. +// NUM(value) +// This expands to an immediate value. On Unix, this prepends a $ +// character. +// ADDR(variable) +// This expands to an immediate value, the address of some variable +// or function. On Unix, this prepends a $ character. With MSVC, +// this prepends the keyword "OFFSET". +// About operand sizes: On Unix, a suffix to the instruction specifies the +// size of the operands (for example "movb", "movw", "movl"). With +// MSVC, there is no such suffix. Instead, the assembler infers the +// operand size from the names of the registers ("al" vs. "ax" vs. +// "eax"). This works well in most cases, but in instructions like +// "mul [esi]" the assembler guesses the operand size: "byte" by +// default. So it is better to explicitly specify the operand size +// of memory operands (prefix X1, X2, X4, X8). +// (Side note about Unix assemblers: Some Unix assemblers allow you +// to write "testb %eax,%eax" but silently treat this as +// "testb %al,%al".) +// X1 +// This prefixes a memory reference of 1 byte. +// X2 +// This prefixes a memory reference of 2 bytes. +// X4 +// This prefixes a memory reference of 4 bytes. +// X8 +// This prefixes a memory reference of 8 bytes. +// MEM(base) +// This expands to a memory reference at address `base'. +// MEM_DISP(base,displacement) +// This expands to a memory reference at address `base+displacement'. +// MEM_INDEX(base,index) +// This expands to a memory reference at address `base+index'. +// MEM_SHINDEX(base,index,size) +// This expands to a memory reference at address +// `base+index*size', where `size' is 1, 2, 4, or 8. +// MEM_DISP_SHINDEX0(displacement,index,size) +// This expands to a memory reference at address +// `displacement+index*size', where `size' is 1, 2, 4, or 8. +// MEM_DISP_SHINDEX(base,displacement,index,size) +// This expands to a memory reference at address +// `base+displacement+index*size', where `size' is 1, 2, 4, or 8. +// INDIR(value) +// This expands to an implicit indirection. On Unix, this prepends +// a * character. +// INSN1(mnemonic,size_suffix,dst) +// This expands to an instruction with one operand. +// INSN2(mnemonic,size_suffix,src,dst) +// This expands to an instruction with two operands. In our notation, +// `src' comes first and `dst' second, but they are reversed when +// expanding to Intel syntax. +// INSN2MOVXL(mnemonic,size_suffix,src,dst) +// This expands to an instruction with two operands, of type +// movsbl/movzbl, which in some syntaxes requires a second suffix. +// INSN2SHCL(mnemonic,size_suffix,src,dst) +// This expands to an instruction with two operands, of type +// shrd/shld, which in some syntaxes requires an additional operand +// %cl. +// REP, REPZ +// This expands to a prefix for string instructions. +// _ +// For instructions which don't have a size suffix, like jump +// instructions. Expands to nothing. Needed for MSVC, which has +// problems with empty macro arguments. +// TEXT() +// Switch to the code section. +// ALIGN(log) +// Align to 2^log bytes. +// P2ALIGN(log,max) +// Align to 2^log bytes, but insert at most max bytes. +// GLOBL(name) +// Declare `name' to be a global symbol. +// DECLARE_FUNCTION(name) +// Declare `name' to be a global function. When assembly language +// code is compiled into a shared library, ELF linkers need to know +// which symbols are functions. +// FUNBEGIN(name) +// Start the assembly language code for the C function `name'. +// FUNEND(name,size_expression) +// End the assembly language code for the C function 'name'. + +// Define the C(name) and L(label) macros. +#ifdef _MSC_VER +#define C(entrypoint) entrypoint +#define L(label) L##label +#else +#ifdef ASM_UNDERSCORE +#define C(entrypoint) _##entrypoint +#define L(label) L##label +#else +#define C(entrypoint) entrypoint +#define L(label) .L##label +#endif +#endif + +// Define one of these. +// BSD_SYNTAX for GNU assembler version 2. +// ELF_SYNTAX for SVR4 and Solaris assemblers. +// INTEL_SYNTAX for MS assembler. +// Note: INTEL_SYNTAX is not the same syntax as produced by "gcc masm=intel" +// as there are syntactic differences between that syntax and the one accepted +// by the MS assembler (for R, MEM_DISP, P2ALIGN, FUNBEGIN, FUNEND etc.). +#ifdef _MSC_VER +#define INTEL_SYNTAX +#else +// On Unix, it happens that the ELF systems (ASM_UNDERSCORE not defined) use +// the ELF syntax, while the BSD systems (ASM_UNDERSCORE defined) use the +// BSD syntax. Neat to know, this saves us from enumerating all the systems. +#ifdef ASM_UNDERSCORE +#define BSD_SYNTAX +#else +#define ELF_SYNTAX +#endif +#endif + +#if defined (BSD_SYNTAX) || defined (ELF_SYNTAX) +#define R(r) %r +#define NUM(n) $ n +#define ADDR(a) $##a +#define X1 +#define X2 +#define X4 +#define X8 +#define MEM(base)(R(base)) +#define MEM_DISP(base,displacement)displacement(R(base)) +#define MEM_INDEX(base,index)(R(base),R(index)) +#define MEM_SHINDEX(base,index,size)(R(base),R(index),size) +#define MEM_DISP_SHINDEX0(displacement,index,size)displacement(,R(index),size) +#define MEM_DISP_SHINDEX(base,displacement,index,size)displacement(R(base),R(index),size) +#define INDIR(value)*value +#define INSNCONC(mnemonic,size_suffix)mnemonic##size_suffix +#define INSN1(mnemonic,size_suffix,dst)INSNCONC(mnemonic,size_suffix) dst +#define INSN2(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,size_suffix) src,dst +#define INSN2MOVXL(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,size_suffix##l) src,dst +#if defined(__SVR4) /* Solaris */ +#define INSN2SHCL(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,size_suffix) src,dst +#else +#define INSN2SHCL(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,size_suffix) R(cl),src,dst +#endif +#if defined(BSD_SYNTAX) || defined(COHERENT) +#define REPZ repe ; +#else +#define REPZ repz ; +#endif +#define REP rep ; +#if defined(BSD_SYNTAX) && !(defined(__CYGWIN__) || defined(__MINGW32__)) +#define ALIGN(log) .align log,0x90 +#endif +#if defined(ELF_SYNTAX) || defined(__CYGWIN__) || defined(__MINGW32__) +#define ALIGN(log) .align 1< portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,@ ,@,g' -e 's,//.*$,,' -e 's/##//g' +# Warning! All comments are stripped. + +# Copyright (C) 1997-2018 Bruno Haible +# +# 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, see . + +tmpscript01=sed$$tmp01 +tmpscript02=sed$$tmp02 +tmpscript03=sed$$tmp03 +tmpscript04=sed$$tmp04 +tmpscript05=sed$$tmp05 +tmpscript06=sed$$tmp06 +tmpscript07=sed$$tmp07 +tmpscript08=sed$$tmp08 +tmpscript09=sed$$tmp09 +tmpscript10=sed$$tmp10 +tmpremove='rm -f $tmpscript01 $tmpscript02 $tmpscript03 $tmpscript04 $tmpscript05 $tmpscript06 $tmpscript07 $tmpscript08 $tmpscript09 $tmpscript10' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript01 << \EOF +# ----------- Strip comments +s,# .*,, +s,[ ][ ]*$,, +EOF + +cat > $tmpscript02 << \EOF +# ----------- Remove #APP/#NO_APP lines and gcc self-identification, add a blank line at the end +/^#APP$/d +/^#NO_APP$/d +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript03 << \EOF +# ----------- Global symbols depends on ASM_UNDERSCORE +s/^\([A-Za-z0-9_]\+\)/C(\1)/ +s/\.L\([A-Za-z0-9_]\+\)/L(\1)/ +# ----------- Massage the beginning of functions +/\.type/{ +s/\.type[ ]\([A-Za-z0-9_]*\), *@function/DECLARE_FUNCTION(\1)/ +} +# ----------- Massage the end of functions +s/\.size[ ]\([A-Za-z0-9_]*\),\(.*\)/FUNEND(\1,\2)/ +# ----------- Introduce conditionals for function references in PIC code +# Note: This is hairy. It assumes that the register clobbered with +# the 'addl $_GLOBAL_OFFSET_TABLE_ ...' instruction is the same as +# the register that the @GOTOFF instructions reference. +/^ addl \$_GLOBAL_OFFSET_TABLE_,/{ +x +s/.*/.LgotGOT/ +x +s/^ addl \$_GLOBAL_OFFSET_TABLE_, *\(%.*\)/#ifdef __ELF__\ + addl $_GLOBAL_OFFSET_TABLE_,\1\ +#else\ +.LgotGOT:\ +#endif/ +} +/^ addl \$_GLOBAL_OFFSET_TABLE_+\[\.-\(.*\)\],/{ +h +s/^ addl \$_GLOBAL_OFFSET_TABLE_+\[\.-\(.*\)\],.*/\1/ +x +s/^ addl \$_GLOBAL_OFFSET_TABLE_+\[\.-\(.*\)\], *\(%.*\)/#ifdef __ELF__\ + addl \$_GLOBAL_OFFSET_TABLE_+[.-\1],\2\ +#endif/ +} +/@GOTOFF(/{ +G +s/^ leal \([A-Za-z0-9_]\+\)@GOTOFF\(.*\)\ +\(.*\)/#ifdef __ELF__\ + leal \1@GOTOFF\2\ +#else\ + leal C(\1)-\3\2\ +#endif/ +} +EOF + +cat > $tmpscript04 << \EOF +# ----------- Introduce macro syntax for operands +s/\([-+0-9A-Z_]\+\)[(]%\(e..\)[)]/MEM_DISP(\2,\1)/g +s/[(]%\(e..\)[)]/MEM(\1)/g +s/\([-+0-9A-Z_]\+\)[(],%\(e..\),\([0-9]*\)[)]/MEM_DISP_SHINDEX0(\1,\2,\3)/g +s/\([-+0-9A-Z_]\+\)[(]%\(e..\),%\(e..\),\([0-9]*\)[)]/MEM_DISP_SHINDEX(\2,\1,\3,\4)/g +s/[(]%\(e..\),%\(e..\),\([0-9]*\)[)]/MEM_SHINDEX(\1,\2,\3)/g +s/[(]%\(e..\),%\(e..\)[)]/MEM_INDEX(\1,\2)/g +EOF + +cat > $tmpscript05 << \EOF +# ----------- Introduce macro syntax for instructions +s/\(push\|pop\|mul\|div\|not\|neg\|inc\|dec\|fld\|fstp\)\(.\)\([ ]\+\)\(.*\)$/INSN1(\1,\2 ,\4)/ +s/\(call\|jmp\|jc\|jnc\|je\|jne\|jz\|jnz\|ja\|jae\|jb\|jbe\|jl\|jge\|js\|jns\)\([ ]\+\)\(.*\)$/INSN1(\1,_ ,\3)/ +s/\(movs\|movz\)\(.\)l\([ ]\+\)\(.*\)$/INSN2MOVXL(\1,\2,\4)/ +s/\(mov\|add\|sub\|adc\|sbb\|xor\|test\|cmp\|rcl\|rcr\|and\|or\|sar\|shr\|shl\|lea\)\(.\)\([ ]\+\)\(.*\)$/INSN2(\1,\2 ,\4)/ +s/\(shld\|shrd\)\(.\)\([ ]\+\)%cl,[ ]*\(.*\)$/INSN2SHCL(\1,\2 ,\4)/ +s/rep[ ];/REP/ +s/repz[ ];/REPZ/ +EOF + +cat > $tmpscript06 << \EOF +# ----------- Add size prefixes to memory references +s/\([(]f[^(,]*,s.*\), *MEM/\1,X4 MEM/g +s/\([(]f[^(,]*,l.*\), *MEM/\1,X8 MEM/g +s/\([(][^(,]*,b.*\), *MEM/\1,X1 MEM/g +s/\([(][^(,]*,w.*\), *MEM/\1,X2 MEM/g +s/\([(][^(,]*,l.*\), *MEM/\1,X4 MEM/g +EOF + +cat > $tmpscript07 << \EOF +# ----------- Introduce macro syntax for register names +s/%\(e..\)/R(\1)/g +s/%\(..\)/R(\1)/g +s/\$\([-0-9]*\)/NUM(\1)/g +EOF + +cat > $tmpscript08 << \EOF +# ----------- Treat table jumps (hairy) +# (Needed because the MSVC inline assembler does not have pseudo-ops. +# Note that we transform a table of absolute addresses with 4 bytes +# per entry into a table of absolute addresses with 8 bytes per entry.) +s/^ \.long \(.*\)$/#ifdef _MSC_VER\ + nop\ + nop\ + push \1\ +#else\ + .long \1\ +#endif/ +s/^ \(INSN1[(]jmp,_[^,]*,\)\*MEM_DISP_SHINDEX0[(]\([^,)]*\),\([^,)]*\),4[)][)]$/#ifdef _MSC_VER\ + INSN2(lea,l ,MEM_DISP_SHINDEX0(\2+8,\3,8),R(\3))\ + INSN2(mov,l ,X4 MEM_DISP(\3,-4),R(\3))\ + INSN1(jmp,_ ,INDIR(R(\3)))\ +#else\ + \1INDIR(MEM_DISP_SHINDEX0(\2,\3,4)))\ +#endif/ +EOF + +cat > $tmpscript09 << \EOF +# ----------- Treat indirect calls +s/\(INSN1[(]\(call\|jmp\),_[^,]*,\)\*\(\(R\)[(][^)]*[)]\)[)]$/\1INDIR(\3))/ +s/\(INSN1[(]\(call\|jmp\),_[^,]*,\)\*\(\(MEM\|MEM_DISP\|C\)[(][^)]*[)]\)[)]$/\1INDIR(X4 \3))/ +EOF + +cat > $tmpscript10 << \EOF +# ----------- Introduce macro syntax for assembler pseudo-ops +/\.file\([ ]\+\)/d +s/\.text/TEXT()/ +s/^\([^#]*\)\.align \(.*\)/\1ALIGN(\2)/ +s/\.p2align \([^,]*\),,\(.*\)/P2ALIGN(\1,\2)/ +s/\.globl\( \+\)\(.*\)$/GLOBL(C(\2))/ +# ----------- Declare global symbols as functions (we have no variables) +s/^C(\([A-Za-z0-9_]*\)):/FUNBEGIN(\1)/ +EOF + +sed -f $tmpscript01 | \ +sed -f $tmpscript02 | \ +(cat - ; echo) | \ +(if [ $# = 1 -a "x$1" = "x-no-C" ] ; then cat - ; else sed -f $tmpscript03 ; fi) | \ +sed -f $tmpscript04 | \ +sed -f $tmpscript05 | \ +sed -f $tmpscript06 | \ +sed -f $tmpscript07 | \ +sed -f $tmpscript08 | \ +sed -f $tmpscript09 | \ +sed -f $tmpscript10 + +eval "$tmpremove" + diff --git a/common/asm-m68k.h b/common/asm-m68k.h new file mode 100644 index 0000000..736a7c3 --- /dev/null +++ b/common/asm-m68k.h @@ -0,0 +1,61 @@ +// Assembly language support for m68k CPU. +// Bruno Haible 1999-05-29 + +// Copyright (C) 1999-2017 Bruno Haible +// +// 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, see . + +// In order not to have to maintain several copies of the assembly language +// code, we use some macros which expand into the correct syntax. +// These macros are: +// C(name) +// This expands to the name of the C variable or function `name'. +// On Unix BSD systems, this prepends an underscore. +// L(label) +// This expands to the name of a local label, having the name `label'. +// On Unix ELF systems, where there is no underscore, names beginning +// with an alphabetic character are automatically exported, so this +// prepends a dot. Note that when defining a label, the `:' must +// be inside the parentheses, not outside, because otherwise some +// ANSI C preprocessor inserts a space between the label and the `:', +// and some assemblers don't like this. +// DECLARE_FUNCTION(name) +// Declare `name' to be a global function. When assembly language +// code is compiled into a shared library, ELF linkers need to know +// which symbols are functions. +// FUNBEGIN(name) +// Start the assembly language code for the C function `name'. +// FUNEND(name) +// End the assembly language code for the C function 'name'. + +#ifdef ASM_UNDERSCORE +// SunOS, NetBSD, OpenBSD, Linux/a.out +#define C(entrypoint) _##entrypoint +#define L(label) L##label +#else +// SVR4, A/UX, AMIX, Atari, Linux/ELF +#define C(entrypoint) entrypoint +#define L(label) .L##label +#endif + +// When assembly language code is compiled into a shared library, ELF linkers +// need to know which symbols are functions. +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__ELF__) || defined(__svr4__) +#define DECLARE_FUNCTION(name) .type C(name),@function +#define FUNEND(name) .size C(name),.-C(name) +#else +#define DECLARE_FUNCTION(name) +#define FUNEND(name) +#endif +#define FUNBEGIN(name) C(name): diff --git a/common/asm-m68k.sh b/common/asm-m68k.sh new file mode 100755 index 0000000..7912b19 --- /dev/null +++ b/common/asm-m68k.sh @@ -0,0 +1,96 @@ +#!/bin/sh +# Translate the assembler syntax of m68k assembler programs +# Usage: asm-m68k.sh < sunos-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,//.*$,,' + +# Copyright (C) 1999-2017 Bruno Haible +# +# 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, see . + +syntax="$1" + +case "$syntax" in + "") echo "missing syntax" 1>&2; exit 1;; + mit | motorola) ;; + *) echo "invalid syntax: $syntax" 1>&2; exit 1;; +esac + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpremove='rm -f $tmpscript1 $tmpscript2' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove #APP/#NO_APP lines +/^#APP$/d +/^#NO_APP$/d +# ----------- Remove gcc self-identification +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +if test $syntax = mit; then +cat > $tmpscript2 << \EOF +# ----------- Global symbols depends on ASM_UNDERSCORE +s/^L\([A-Za-z0-9_]\+\)/L(\1)/ +s/ L\([A-Za-z0-9_]\+\)/ L(\1)/ +# ----------- Prefix register names with $, to be turned into % later +s/,/, /g +s/\([^A-Za-z0-9_]\)\([ad][0-7]\|sp\|fp[0-7]\|pc\)\([^A-Za-z0-9_]\)/\1$\2\3/g +s/\([^A-Za-z0-9_]\)\([ad][0-7]\|sp\|fp[0-7]\|pc\)$/\1$\2/g +s/, /,/g +# ----------- Declare global symbols as functions (we have no variables) +s/\.globl[ ]_\([A-Za-z0-9_]*\)$/.globl _\1\ + DECLARE_FUNCTION(\1)/ +# ----------- Global symbols depends on ASM_UNDERSCORE +s/_\([A-Za-z0-9_]*\)/C(\1)/ +s/^C(\([A-Za-z0-9_]*\)):/FUNBEGIN(\1)/ +/FUNBEGIN(/{ +h +} +${ +p +s/.*// +x +s/FUNBEGIN/FUNEND/ +} +EOF +fi + +if test $syntax = motorola; then +cat > $tmpscript2 << \EOF +# ----------- Global symbols depends on ASM_UNDERSCORE +s/^\([A-Za-z0-9_]\+\)/C(\1)/ +s/\.L\([A-Za-z0-9_]\+\)/L(\1)/ +s/\.globl[ ]\([A-Za-z0-9_]*\)/.globl C(\1)/ +# ----------- Introduce macro syntax for assembler pseudo-ops +/\.file\([ ]\+\)/d +s/^C(\([A-Za-z0-9_]*\)):/FUNBEGIN(\1)/ +# ----------- Massage the beginning of functions +/\.type/{ +s/\.type[ ]\([A-Za-z0-9_]*\), *@function/DECLARE_FUNCTION(\1)/ +} +# ----------- Massage the end of functions +s/\.size[ ]\([A-Za-z0-9_]*\),\(.*\)/FUNEND(\1)/ +EOF +fi + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 + +eval "$tmpremove" diff --git a/common/asm-mips.h b/common/asm-mips.h new file mode 100644 index 0000000..0d6f20b --- /dev/null +++ b/common/asm-mips.h @@ -0,0 +1,25 @@ +// Assembly language support for mips CPU. +// Bruno Haible 1999-05-29 + +// Copyright (C) 1999-2017 Bruno Haible +// +// 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, see . + +// When assembly language code is compiled into a shared library, ELF linkers +// need to know which symbols are functions. +#if defined(__ELF__) || defined(__NetBSD__) +#define DECLARE_FUNCTION(name) .type name,@function +#else +#define DECLARE_FUNCTION(name) +#endif diff --git a/common/asm-mips.sh b/common/asm-mips.sh new file mode 100755 index 0000000..5f57256 --- /dev/null +++ b/common/asm-mips.sh @@ -0,0 +1,54 @@ +#!/bin/sh +# Translate the assembler syntax of mips assembler programs +# Usage: asm-mips.sh < irix-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,//.*$,,' + +# Copyright (C) 1999-2019 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpremove='rm -f $tmpscript1 $tmpscript2' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove gcc self-identification +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Remove comments, they would cause trouble in preprocessing +s,#.*$,, +# ----------- Remove assembler pseudo-ops that the IRIX assembler does not understand +/\.section/d +/\.previous/d +/\.abicalls/d +/\.nan/d +/\.module/d +# ----------- Massage the beginning of functions +/\.type/{ +s/\.type[ ]\+\([A-Za-z0-9_]*\), *@function/DECLARE_FUNCTION(\1)/ +} +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 + +eval "$tmpremove" diff --git a/common/asm-powerpc.sh b/common/asm-powerpc.sh new file mode 100755 index 0000000..432ed7b --- /dev/null +++ b/common/asm-powerpc.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# Translate the assembler syntax of powerpc assembler programs +# Usage: asm-powerpc.sh < powerpclinux-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,//.*$,,' + +# Copyright (C) 2017 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpremove='rm -f $tmpscript1 $tmpscript2' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove #APP/#NO_APP lines and gcc self-identification +/^#APP$/d +/^#NO_APP$/d +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Introduce macro syntax for assembler pseudo-ops +/\.section\([ ]\+\).*GNU-stack/d +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 + +eval "$tmpremove" diff --git a/common/asm-riscv.sh b/common/asm-riscv.sh new file mode 100755 index 0000000..5ef6b80 --- /dev/null +++ b/common/asm-riscv.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# Translate the assembler syntax of RISC-V assembler programs +# Usage: asm-riscv.sh < riscvlinux-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,//.*$,,' + +# Copyright (C) 2017-2018 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpremove='rm -f $tmpscript1 $tmpscript2' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove gcc self-identification +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Introduce macro syntax for assembler pseudo-ops +/\.section\([ ]\+\).*GNU-stack/d +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 + +eval "$tmpremove" diff --git a/common/asm-s390.sh b/common/asm-s390.sh new file mode 100755 index 0000000..5d9f1e9 --- /dev/null +++ b/common/asm-s390.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# Translate the assembler syntax of s390/s390x assembler programs +# Usage: asm-s390.sh < s390linux-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,//.*$,,' + +# Copyright (C) 2017 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpremove='rm -f $tmpscript1 $tmpscript2' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove gcc self-identification +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Introduce macro syntax for assembler pseudo-ops +/\.section\([ ]\+\).*GNU-stack/d +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 + +eval "$tmpremove" diff --git a/common/asm-sparc.h b/common/asm-sparc.h new file mode 100644 index 0000000..40eb787 --- /dev/null +++ b/common/asm-sparc.h @@ -0,0 +1,69 @@ +// Assembly language support for sparc CPU. +// Bruno Haible 1999-05-29 + +// Copyright (C) 1999-2017 Bruno Haible +// +// 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, see . + +// In order not to have to maintain several copies of the assembly language +// code, we use some macros which expand into the correct syntax. +// These macros are: +// C(name) +// This expands to the name of the C variable or function `name'. +// On Unix BSD systems, this prepends an underscore. +// L(label) +// This expands to the name of a local label, having the name `label'. +// On Unix ELF systems, where there is no underscore, names beginning +// with an alphabetic character are automatically exported, so this +// prepends a dot. Note that when defining a label, the `:' must +// be inside the parentheses, not outside, because otherwise some +// ANSI C preprocessor inserts a space between the label and the `:', +// and some assemblers don't like this. +// DECLARE_FUNCTION(name) +// Declare `name' to be a global function. When assembly language +// code is compiled into a shared library, ELF linkers need to know +// which symbols are functions. +// FUNBEGIN(name) +// Start the assembly language code for the C function `name'. +// FUNEND(name) +// End the assembly language code for the C function 'name'. + +#ifdef ASM_UNDERSCORE +// SunOS4, Linux/a.out +#define C(entrypoint) _##entrypoint +#define L(label) L##label +#else +// Solaris, Linux/ELF +#define C(entrypoint) entrypoint +#define L(label) .L##label +#endif + +// When assembly language code is compiled into a shared library, ELF linkers +// need to know which symbols are functions. +#if defined(__NetBSD__) || defined(__OpenBSD__) +#define DECLARE_FUNCTION(name) .type C(name),@function +#define FUNEND(name) .size C(name),.-C(name) +#elif defined(__SVR4) || defined(__ELF__) +// Solaris, Linux/ELF +// Some preprocessors keep the backslash in place, some don't. +// Some complain about the # being not in front of an ANSI C macro. +// Therefore we use a dollar, which will be sed-converted to # later. +#define DECLARE_FUNCTION(name) .type C(name),$function +#define FUNEND(name) .size C(name),.-C(name) +#else +// SunOS4, Linux/a.out +#define DECLARE_FUNCTION(name) +#define FUNEND(name) +#endif +#define FUNBEGIN(name) C(name): diff --git a/common/asm-sparc.sh b/common/asm-sparc.sh new file mode 100755 index 0000000..954ede4 --- /dev/null +++ b/common/asm-sparc.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# Translate the assembler syntax of sparc64 assembler programs +# Usage: asm-sparc.sh < sparclinux-asm-file > portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,//.*$,,' -e 's,\$,#,g' -e 's,# ,#,g' + +# Copyright (C) 1999-2017 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpremove='rm -f $tmpscript1 $tmpscript2' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove gcc self-identification +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Global symbols depends on ASM_UNDERSCORE +s/^\([A-Za-z0-9_]\+\)/C(\1)/ +s/\.L\([A-Za-z0-9_]\+\)/L(\1)/ +s/\.global[ ]\([A-Za-z0-9_]*\)$/.global C(\1)/ +# ----------- Introduce macro syntax for assembler pseudo-ops +/\.file\([ ]\+\)/d +/\.section\([ ]\+\).*GNU-stack/d +s/^C(\([A-Za-z0-9_]*\)):/FUNBEGIN(\1)/ +# ----------- Massage the beginning of functions +/\.type/{ +s/\.type[ ]\([A-Za-z0-9_]*\), *#function/DECLARE_FUNCTION(\1)/ +} +# ----------- Massage the end of functions +s/\.size[ ]\([A-Za-z0-9_]*\),\(.*\)/FUNEND(\1)/ +# ----------- Turn # into $, to avoid trouble in preprocessing +s,#,\$,g +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 + +eval "$tmpremove" diff --git a/common/asm-x86_64.h b/common/asm-x86_64.h new file mode 100644 index 0000000..b4713d7 --- /dev/null +++ b/common/asm-x86_64.h @@ -0,0 +1,290 @@ +// Assembly language support for x86_64 CPU. +// Bruno Haible 2016-12-28 + +// Copyright (C) 1997-2021 Bruno Haible +// +// 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, see . + +// In order not to have to maintain several copies of the assembly language +// code, we use some macros which expand into the correct syntax. +// These macros are: +// C(name) +// This expands to the name of the C variable or function `name'. +// On Unix BSD systems, this prepends an underscore. +// L(label) +// This expands to the name of a local label, having the name `label'. +// On Unix ELF systems, where there is no underscore, names beginning +// with an alphabetic character are automatically exported, so this +// prepends a dot. Note that when defining a label, the `:' must +// be inside the parentheses, not outside, because otherwise some +// ANSI C preprocessor inserts a space between the label and the `:', +// and some assemblers don't like this. +// R(reg) +// This expands to a reference to register `reg'. On Unix, this +// prepends a % charater. +// NUM(value) +// This expands to an immediate value. On Unix, this prepends a $ +// character. +// ADDR(variable) +// This expands to an immediate value, the address of some variable +// or function. On Unix, this prepends a $ character. With MSVC, +// this prepends the keyword "OFFSET". +// ADDR_PCRELATIVE(variable) +// This expands to the address of symbol `variable', with program +// counter (%rip) relative addressing. +// About operand sizes: On Unix, a suffix to the instruction specifies the +// size of the operands (for example "movb", "movw", "movl"). With +// MSVC, there is no such suffix. Instead, the assembler infers the +// operand size from the names of the registers ("al" vs. "ax" vs. +// "eax"). This works well in most cases, but in instructions like +// "mul [esi]" the assembler guesses the operand size: "byte" by +// default. So it is better to explicitly specify the operand size +// of memory operands (prefix X1, X2, X4, X8). +// (Side note about Unix assemblers: Some Unix assemblers allow you +// to write "testb %eax,%eax" but silently treat this as +// "testb %al,%al".) +// X1 +// This prefixes a memory reference of 1 byte. +// X2 +// This prefixes a memory reference of 2 bytes. +// X4 +// This prefixes a memory reference of 4 bytes. +// X8 +// This prefixes a memory reference of 8 bytes. +// MEM(base) +// This expands to a memory reference at address `base'. +// MEM_DISP(base,displacement) +// This expands to a memory reference at address `base+displacement'. +// MEM_INDEX(base,index) +// This expands to a memory reference at address `base+index'. +// MEM_SHINDEX(base,index,size) +// This expands to a memory reference at address +// `base+index*size', where `size' is 1, 2, 4, or 8. +// MEM_DISP_SHINDEX0(displacement,index,size) +// This expands to a memory reference at address +// `displacement+index*size', where `size' is 1, 2, 4, or 8. +// MEM_DISP_SHINDEX(base,displacement,index,size) +// This expands to a memory reference at address +// `base+displacement+index*size', where `size' is 1, 2, 4, or 8. +// MEM_PCRELATIVE(variable) +// This expands to a memory reference at symbol `variable', with +// program counter (%rip) relative addressing. +// INDIR(value) +// This expands to an implicit indirection. On Unix, this prepends +// a * character. +// INSN1(mnemonic,size_suffix,dst) +// This expands to an instruction with one operand. +// INSN2(mnemonic,size_suffix,src,dst) +// This expands to an instruction with two operands. In our notation, +// `src' comes first and `dst' second, but they are reversed when +// expanding to Intel syntax. In Intel syntax, size_suffix is omitted. +// INSN2S(mnemonic,size_suffix,src,dst) +// This expands to an instruction with two operands. In our notation, +// `src' comes first and `dst' second, but they are reversed when +// expanding to Intel syntax. In Intel syntax, size_suffix is +// preserved. +// INSN2MOVXL(mnemonic,size_suffix,src,dst) +// This expands to an instruction with two operands, of type +// movsbl/movzbl, which in some syntaxes requires a second suffix. +// INSN2MOVXQ(mnemonic,size_suffix,src,dst) +// This expands to an instruction with two operands, of type +// movsbq/movzbq, which in some syntaxes requires a second suffix. +// INSN2MOVXLQ(mnemonic,size_suffix,src,dst) +// This expands to an instruction with two operands, of type +// movslq/movzlq, which in some syntaxes requires a second suffix. +// _ +// For instructions which don't have a size suffix, like jump +// instructions. Expands to nothing. Needed for MSVC, which has +// problems with empty macro arguments. +// TEXT() +// Switch to the code section. +// P2ALIGN(log,max) +// Align to 2^log bytes, but insert at most max bytes. +// GLOBL(name) +// Declare `name' to be a global symbol. +// DECLARE_FUNCTION(name) +// Declare `name' to be a global function. When assembly language +// code is compiled into a shared library, ELF linkers need to know +// which symbols are functions. +// FUNBEGIN(name) +// Start the assembly language code for the C function `name'. +// FUNEND(name,size_expression) +// End the assembly language code for the C function 'name'. +// EH_FRAME_SECTION +// The arguments to the .section statement that introduces the +// exception handler section (on ELF platforms). + +#ifdef _MSC_VER +// MSVC +#define C(entrypoint) entrypoint +#define L(label) $L##label +#else +#ifdef ASM_UNDERSCORE +// Mac OS X +#define C(entrypoint) _##entrypoint +#define L(label) L##label +#else +// Linux/ELF, Solaris/ELF, Windows with GNU as +#define C(entrypoint) entrypoint +#define L(label) .L##label +#endif +#endif + +// The two syntaxes: +// - ATT_SYNTAX for GNU assembler version 2. +// - INTEL_SYNTAX for MS assembler. +// Note: INTEL_SYNTAX is not the same syntax as produced by "gcc masm=intel" +// as there are syntactic differences between that syntax and the one accepted +// by the MS assembler (for MEM_DISP, INDIR, P2ALIGN, FUNBEGIN, FUNEND etc.). +#ifdef _MSC_VER +// MS assembler +#define R(r) r +#define NUM(n) n +#define ADDR(a) OFFSET a +#define ADDR_PCRELATIVE(a) OFFSET a +#define X1 BYTE PTR +#define X2 WORD PTR +#define X4 DWORD PTR +#define X8 QWORD PTR +#define MEM(base) [base] +#define MEM_DISP(base,displacement) [base+(displacement)] +#define MEM_INDEX(base,index) [base+index] +#define MEM_SHINDEX(base,index,size) [base+index*size] +#define MEM_DISP_SHINDEX0(displacement,index,size) [(displacement)+index*size] +#define MEM_DISP_SHINDEX(base,displacement,index,size) [base+(displacement)+index*size] +#define MEM_PCRELATIVE(variable) variable +#define INDIR(value)value +#define INSNCONC(mnemonic,suffix)mnemonic##suffix +#define INSN1(mnemonic,size_suffix,dst)mnemonic dst +#define INSN2(mnemonic,size_suffix,src,dst)mnemonic dst,src +#define INSN2S(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,size_suffix) dst,src +#define INSN2MOVXL(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,x) dst,src +#define INSN2MOVXQ(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,x) dst,src +#define INSN2MOVXLQ(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,xd) dst,src +#else +// GNU assembler version 2 +#define R(r) %r +#define NUM(n) $ n +#define ADDR(a) $##a +#define ADDR_PCRELATIVE(a) a(%rip) +#define X1 +#define X2 +#define X4 +#define X8 +#define MEM(base)(R(base)) +#define MEM_DISP(base,displacement)displacement(R(base)) +#define MEM_INDEX(base,index)(R(base),R(index)) +#define MEM_SHINDEX(base,index,size)(R(base),R(index),size) +#define MEM_DISP_SHINDEX0(displacement,index,size)displacement(,R(index),size) +#define MEM_DISP_SHINDEX(base,displacement,index,size)displacement(R(base),R(index),size) +#define MEM_PCRELATIVE(variable) variable(%rip) +#define INDIR(value)*value +#define INSNCONC(mnemonic,size_suffix)mnemonic##size_suffix +#define INSN1(mnemonic,size_suffix,dst)INSNCONC(mnemonic,size_suffix) dst +#define INSN2(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,size_suffix) src,dst +#define INSN2S(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,size_suffix) src,dst +#define INSN2MOVXL(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,size_suffix##l) src,dst +#define INSN2MOVXQ(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,size_suffix##q) src,dst +#define INSN2MOVXLQ(mnemonic,size_suffix,src,dst)INSNCONC(mnemonic,size_suffix##q) src,dst +#endif + +#define _ + +#ifdef _MSC_VER +// MS assembler +#define TEXT() _TEXT SEGMENT +#else +#define TEXT() .text +#endif + +#ifdef _MSC_VER +// MS assembler +// There is no equivalent for "p2align 4,,7". This comes closest: +#define P2ALIGN(log,max) ALIGN 8 +#else +#if defined __sun +// Solaris +#define P2ALIGN(log,max) .align 1< portable-asm-file +# The portable-asm-file has to be +# 1. preprocessed, +# 2. grep -v '^ *#line' | grep -v '^#' +# 3. sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,@ ,@,g' -e 's,//.*$,,' -e 's/##//g' + +# Copyright (C) 1997-2018 Bruno Haible +# +# 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, see . + +tmpscript1=sed$$tmp1 +tmpscript2=sed$$tmp2 +tmpscript3=sed$$tmp3 +tmpscript4=sed$$tmp4 +tmpscript5=sed$$tmp5 +tmpscript6=sed$$tmp6 +tmpscript7=sed$$tmp7 +tmpscript8=sed$$tmp8 +tmpscript9=sed$$tmp9 +tmpremove='rm -f $tmpscript1 $tmpscript2 $tmpscript3 $tmpscript4 $tmpscript5 $tmpscript6 $tmpscript7 $tmpscript8 $tmpscript9' +trap "$tmpremove" 1 2 15 + +cat > $tmpscript1 << \EOF +# ----------- Remove #APP/#NO_APP lines and gcc self-identification +/^#APP$/d +/^#NO_APP$/d +/gcc2_compiled/d +/gnu_compiled_c/d +/\.ident/d +EOF + +cat > $tmpscript2 << \EOF +# ----------- Global symbols depends on ASM_UNDERSCORE +s/^\([A-Za-z0-9_]\+\)/C(\1)/ +s/\.L\([A-Za-z0-9_]\+\)/L(\1)/ +s/\([A-Za-z0-9_]\+\)(%rip)/C(\1)(%rip)/ +# ----------- Massage the beginning of functions +/\.type/{ +s/\.type \([A-Za-z0-9_]*\), *@function/DECLARE_FUNCTION(\1)/ +} +# ----------- Massage the end of functions +s/\.size \([A-Za-z0-9_]*\),\(.*\)/FUNEND(\1,\2)/ +# ----------- Section of frame info for exception handlers +s/\.section \.eh_frame,"a[w]*",@progbits/.section EH_FRAME_SECTION/ +# ----------- Disable the frame info for exception handlers on Solaris +# (as the Solaris linker expects a different format, see +# https://illumos.org/issues/3210) +# Likewise this section does not assemble on Mac OS X 10.5 and on Windows. +/EH_FRAME_SECTION/{ +s/^/#if !(defined __sun || (defined __APPLE__ \&\& defined __MACH__) || (defined _WIN32 || defined __CYGWIN__))\ +/ +} +${ +s/$/\ +#endif/ +} +EOF + +cat > $tmpscript3 << \EOF +# ----------- Introduce macro syntax for operands +s/\([-+0-9A-Z_]\+\)[(]%\(r[abcd]x\|r[sd]i\|r[bs]p\|r[89]\|r1[012345]\)[)]/MEM_DISP(\2,\1)/g +s/\(C[(][A-Za-z0-9_]\+[)]\)[(]%rip[)]/MEM_PCRELATIVE(\1)/g +s/[(]%\(r[abcd]x\|r[sd]i\|r[bs]p\|r[89]\|r1[012345]\)[)]/MEM(\1)/g +s/\([-+0-9A-Z_]\+\)[(],%\(r[abcd]x\|r[sd]i\|r[bs]p\|r[89]\|r1[012345]\),\([0-9]*\)[)]/MEM_DISP_SHINDEX0(\1,\2,\3)/g +s/\([-+0-9A-Z_]\+\)[(]%\(r[abcd]x\|r[sd]i\|r[bs]p\|r[89]\|r1[012345]\),%\(r[abcd]x\|r[sd]i\|r[bs]p\|r[89]\|r1[012345]\),\([0-9]*\)[)]/MEM_DISP_SHINDEX(\2,\1,\3,\4)/g +s/[(]%\(r[abcd]x\|r[sd]i\|r[bs]p\|r[89]\|r1[012345]\),%\(r[abcd]x\|r[sd]i\|r[bs]p\|r[89]\|r1[012345]\),\([0-9]*\)[)]/MEM_SHINDEX(\1,\2,\3)/g +s/[(]%\(r[abcd]x\|r[sd]i\|r[bs]p\|r[89]\|r1[012345]\),%\(r[abcd]x\|r[sd]i\|r[bs]p\|r[89]\|r1[012345]\)[)]/MEM_INDEX(\1,\2)/g +EOF + +cat > $tmpscript4 << \EOF +# ----------- Add size suffix to 'mov' instructions +s/mov\([ ]\+.*, *%\(e[abcd]x\|e[sd]i\|e[bs]p\|r[89]d\|r1[012345]d\)\)$/movl\1/ +# ----------- Introduce macro syntax for instructions +s/\(push\|pop\|mul\|div\|not\|neg\|inc\|dec\)\(.\)\([ ]\+\)\(.*\)$/INSN1(\1,\2 ,\4)/ +s/\(call\|jmp\|jc\|jnc\|je\|jne\|jz\|jnz\|ja\|jae\|jb\|jbe\|jl\|jle\|jg\|jge\|js\|jns\)\([ ]\+\)\(.*\)$/INSN1(\1,_ ,\3)/ +s/\(movs\|movz\)\(.\)l\([ ]\+\)\(.*\)$/INSN2MOVXL(\1,\2,\4)/ +s/\(movs\|movz\)\([bw]\)q\([ ]\+\)\(.*\)$/INSN2MOVXQ(\1,\2,\4)/ +s/\(movs\|movz\)\(l\)q\([ ]\+\)\(.*\)$/INSN2MOVXLQ(\1,\2,\4)/ +s/\(mov\|movlp\|add\|sub\|adc\|sbb\|xor\|xorp\|test\|cmp\|rcl\|rcr\|and\|or\|sar\|sal\|shr\|shl\|lea\)\(.\)\([ ]\+\)\(.*\)$/INSN2(\1,\2 ,\4)/ +s/\(movs\)\([sd]\)\([ ]\+\)\(.*\)$/INSN2S(\1,\2 ,\4)/ +EOF + +cat > $tmpscript5 << \EOF +# ----------- Rewrite lea operand +s/INSN2[(]lea,\([^,]*\), *MEM_PCRELATIVE[(]/INSN2(lea,\1,ADDR_PCRELATIVE(/g +EOF + +cat > $tmpscript6 << \EOF +# ----------- Add size prefixes to memory references +s/\([(][^(,]*,b.*\), *MEM/\1,X1 MEM/g +s/\([(][^(,]*,w.*\), *MEM/\1,X2 MEM/g +s/\([(][^(,]*,[ls].*\), *MEM/\1,X4 MEM/g +s/\([(][^(,]*,[qd].*\), *MEM/\1,X8 MEM/g +EOF + +cat > $tmpscript7 << \EOF +# ----------- Introduce macro syntax for register names +# Cf. https://stackoverflow.com/questions/1753602/ +s/%\([abcd]l\|[sd]il\|[bs]pl\|r[89]b\|r1[012345]b\)/R(\1)/g +s/%\([abcd]x\|[sd]i\|[bs]p\|r[89]w\|r1[012345]w\)/R(\1)/g +s/%\(e[abcd]x\|e[sd]i\|e[bs]p\|r[89]d\|r1[012345]d\)/R(\1)/g +s/%\(r[abcd]x\|r[sd]i\|r[bs]p\|r[89]\|r1[012345]\)/R(\1)/g +s/%\(xmm[0-9]\+\)/R(\1)/g +s/\$\([-0-9]*\)/NUM(\1)/g +EOF + +cat > $tmpscript8 << \EOF +# ----------- Treat indirect calls +s/\(INSN1[(]\(call\|jmp\),_[^,]*,\)\*\(\(R\)[(][^)]*[)]\)[)]$/\1INDIR(\3))/ +s/\(INSN1[(]\(call\|jmp\),_[^,]*,\)\*\(\(MEM\|MEM_DISP\|C\)[(][^)]*[)]\)[)]$/\1INDIR(X8 \3))/ +s/\(INSN1[(]\(call\|jmp\),_[^,]*,\)\*\(MEM_PCRELATIVE[(].*[)]\)[)]$/\1INDIR(X8 \3))/ +EOF + +cat > $tmpscript9 << \EOF +# ----------- Introduce macro syntax for assembler pseudo-ops +/\.file\([ ]\+\)/d +s/\.text/TEXT()/ +s/\.p2align \([^,]*\),,\(.*\)/P2ALIGN(\1,\2)/ +s/\.p2align 3$/P2ALIGN(3,7)/ +s/\.globl\([ ]\+\)\(.*\)$/GLOBL(C(\2))/ +/\.section\([ ]\+\).*GNU-stack/d +# ----------- Declare global symbols as functions (we have no variables) +s/^C(\([A-Za-z0-9_]*\)):/FUNBEGIN(\1)/ +EOF + +sed -f $tmpscript1 | \ +sed -f $tmpscript2 | \ +sed -f $tmpscript3 | \ +sed -f $tmpscript4 | \ +sed -f $tmpscript5 | \ +sed -f $tmpscript6 | \ +sed -f $tmpscript7 | \ +sed -f $tmpscript8 | \ +sed -f $tmpscript9 + +eval "$tmpremove" diff --git a/common/noexecstack-arm.h b/common/noexecstack-arm.h new file mode 100644 index 0000000..29a8aed --- /dev/null +++ b/common/noexecstack-arm.h @@ -0,0 +1,3 @@ +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/common/noexecstack.h b/common/noexecstack.h new file mode 100644 index 0000000..e9d1efd --- /dev/null +++ b/common/noexecstack.h @@ -0,0 +1,3 @@ +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/common/structcpy.c b/common/structcpy.c new file mode 100644 index 0000000..a04ce67 --- /dev/null +++ b/common/structcpy.c @@ -0,0 +1,33 @@ +/* copy structs */ + +/* + * Copyright 1995-2005 Bruno Haible + * + * 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, see . + */ + +void __structcpy (void* dest, const void* src, unsigned long size, unsigned long alignment) +{ + if (alignment % sizeof(long)) + { char* d = (char*)dest; + const char* s = (const char*)src; + do { *d++ = *s++; } while (--size > 0); + } + else + /* If the alignment is a multiple of sizeof(long), the size is as well. */ + { long* d = (long*)dest; + const long* s = (const long*)src; + do { *d++ = *s++; } while ((size -= sizeof(long)) > 0); + } +} diff --git a/common/uniq-u.c b/common/uniq-u.c new file mode 100644 index 0000000..1c9ac0a --- /dev/null +++ b/common/uniq-u.c @@ -0,0 +1,277 @@ +/* uniq -- remove duplicate lines from a sorted file + Copyright (C) 1986-2016 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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, see . */ + +/* Written by Richard Stallman and David MacKenzie. */ +/* 2000-03-22 Trimmed down to the case of "uniq -u" by Bruno Haible. */ + +#include +#include +#include +#include + +/* The name this program was run with. */ +static char *program_name; + +static void +xalloc_fail (void) +{ + fprintf (stderr, "%s: virtual memory exhausted\n", program_name); + exit (1); +} + +/* Allocate N bytes of memory dynamically, with error checking. */ + +void * +xmalloc (size_t n) +{ + void *p; + + p = malloc (n); + if (p == 0) + xalloc_fail (); + return p; +} + +/* Change the size of an allocated block of memory P to N bytes, + with error checking. + If P is NULL, run xmalloc. */ + +void * +xrealloc (void *p, size_t n) +{ + p = realloc (p, n); + if (p == 0) + xalloc_fail (); + return p; +} + +/* A ‘struct linebuffer’ holds a line of text. */ + +struct linebuffer +{ + size_t size; /* Allocated. */ + size_t length; /* Used. */ + char *buffer; +}; + +/* Initialize linebuffer LINEBUFFER for use. */ + +static void +initbuffer (struct linebuffer *linebuffer) +{ + linebuffer->length = 0; + linebuffer->size = 200; + linebuffer->buffer = (char *) xmalloc (linebuffer->size); +} + +/* Read an arbitrarily long line of text from STREAM into LINEBUFFER. + Keep the newline; append a newline if it's the last line of a file + that ends in a non-newline character. Do not null terminate. + Return LINEBUFFER, except at end of file return 0. */ + +static struct linebuffer * +readline (struct linebuffer *linebuffer, FILE *stream) +{ + int c; + char *buffer = linebuffer->buffer; + char *p = linebuffer->buffer; + char *end = buffer + linebuffer->size - 1; /* Sentinel. */ + + if (feof (stream) || ferror (stream)) + return 0; + + do + { + c = getc (stream); + if (c == EOF) + { + if (p == buffer) + return 0; + if (p[-1] == '\n') + break; + c = '\n'; + } + if (p == end) + { + linebuffer->size *= 2; + buffer = (char *) xrealloc (buffer, linebuffer->size); + p = p - linebuffer->buffer + buffer; + linebuffer->buffer = buffer; + end = buffer + linebuffer->size - 1; + } + *p++ = c; + } + while (c != '\n'); + + linebuffer->length = p - buffer; + return linebuffer; +} + +/* Free linebuffer LINEBUFFER's data. */ + +static void +freebuffer (struct linebuffer *linebuffer) +{ + free (linebuffer->buffer); +} + +/* Undefine, to avoid warning about redefinition on some systems. */ +#undef min +#define min(x, y) ((x) < (y) ? (x) : (y)) + +/* Return zero if two strings OLD and NEW match, nonzero if not. + OLD and NEW point not to the beginnings of the lines + but rather to the beginnings of the fields to compare. + OLDLEN and NEWLEN are their lengths. */ + +static int +different (const char *old, const char *new, size_t oldlen, size_t newlen) +{ + int order; + + order = memcmp (old, new, min (oldlen, newlen)); + + if (order == 0) + return oldlen - newlen; + return order; +} + +/* Output the line in linebuffer LINE to stream STREAM + provided that the switches say it should be output. + If requested, print the number of times it occurred, as well; + LINECOUNT + 1 is the number of times that the line occurred. */ + +static void +writeline (const struct linebuffer *line, FILE *stream, int linecount) +{ + if (linecount == 0) + fwrite (line->buffer, 1, line->length, stream); +} + +/* Process input file INFILE with output to OUTFILE. + If either is "-", use the standard I/O stream for it instead. */ + +static void +check_file (const char *infile, const char *outfile) +{ + FILE *istream; + FILE *ostream; + struct linebuffer lb1, lb2; + struct linebuffer *thisline, *prevline, *exch; + char *prevfield, *thisfield; + size_t prevlen, thislen; + int match_count = 0; + + if (!strcmp (infile, "-")) + istream = stdin; + else + istream = fopen (infile, "r"); + if (istream == NULL) + { + fprintf (stderr, "%s: error opening %s\n", program_name, infile); + exit (1); + } + + if (!strcmp (outfile, "-")) + ostream = stdout; + else + ostream = fopen (outfile, "w"); + if (ostream == NULL) + { + fprintf (stderr, "%s: error opening %s\n", program_name, outfile); + exit (1); + } + + thisline = &lb1; + prevline = &lb2; + + initbuffer (thisline); + initbuffer (prevline); + + if (readline (prevline, istream) == 0) + goto closefiles; + prevfield = prevline->buffer; + prevlen = prevline->length; + + while (!feof (istream)) + { + int match; + if (readline (thisline, istream) == 0) + break; + thisfield = thisline->buffer; + thislen = thisline->length; + match = !different (thisfield, prevfield, thislen, prevlen); + + if (match) + ++match_count; + + if (!match) + { + writeline (prevline, ostream, match_count); + exch = prevline; + prevline = thisline; + thisline = exch; + prevfield = thisfield; + prevlen = thislen; + if (!match) + match_count = 0; + } + } + + writeline (prevline, ostream, match_count); + + closefiles: + if (ferror (istream) || fclose (istream) == EOF) + { + fprintf (stderr, "%s: error reading %s\n", program_name, infile); + exit (1); + } + + if (ferror (ostream) || fclose (ostream) == EOF) + { + fprintf (stderr, "%s: error writing %s\n", program_name, outfile); + exit (1); + } + + freebuffer (&lb1); + freebuffer (&lb2); +} + +int +main (int argc, char **argv) +{ + const char *infile = "-"; + const char *outfile = "-"; + int optind = 1; + + program_name = argv[0]; + + if (optind < argc) + infile = argv[optind++]; + + if (optind < argc) + outfile = argv[optind++]; + + if (optind < argc) + { + fprintf (stderr, "%s: too many arguments\n", program_name); + exit (1); + } + + check_file (infile, outfile); + + exit (0); +} diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..57ba1ac --- /dev/null +++ b/config.h.in @@ -0,0 +1,1207 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* CPU and C ABI indicator */ +#ifndef __i386__ +#undef __i386__ +#endif +#ifndef __x86_64_x32__ +#undef __x86_64_x32__ +#endif +#ifndef __x86_64__ +#undef __x86_64__ +#endif +#ifndef __alpha__ +#undef __alpha__ +#endif +#ifndef __arm__ +#undef __arm__ +#endif +#ifndef __armhf__ +#undef __armhf__ +#endif +#ifndef __arm64_ilp32__ +#undef __arm64_ilp32__ +#endif +#ifndef __arm64__ +#undef __arm64__ +#endif +#ifndef __hppa__ +#undef __hppa__ +#endif +#ifndef __hppa64__ +#undef __hppa64__ +#endif +#ifndef __ia64_ilp32__ +#undef __ia64_ilp32__ +#endif +#ifndef __ia64__ +#undef __ia64__ +#endif +#ifndef __m68k__ +#undef __m68k__ +#endif +#ifndef __mips__ +#undef __mips__ +#endif +#ifndef __mipsn32__ +#undef __mipsn32__ +#endif +#ifndef __mips64__ +#undef __mips64__ +#endif +#ifndef __powerpc__ +#undef __powerpc__ +#endif +#ifndef __powerpc64__ +#undef __powerpc64__ +#endif +#ifndef __powerpc64_elfv2__ +#undef __powerpc64_elfv2__ +#endif +#ifndef __riscv32__ +#undef __riscv32__ +#endif +#ifndef __riscv64__ +#undef __riscv64__ +#endif +#ifndef __riscv32_ilp32__ +#undef __riscv32_ilp32__ +#endif +#ifndef __riscv32_ilp32f__ +#undef __riscv32_ilp32f__ +#endif +#ifndef __riscv32_ilp32d__ +#undef __riscv32_ilp32d__ +#endif +#ifndef __riscv64_ilp32__ +#undef __riscv64_ilp32__ +#endif +#ifndef __riscv64_ilp32f__ +#undef __riscv64_ilp32f__ +#endif +#ifndef __riscv64_ilp32d__ +#undef __riscv64_ilp32d__ +#endif +#ifndef __riscv64_lp64__ +#undef __riscv64_lp64__ +#endif +#ifndef __riscv64_lp64f__ +#undef __riscv64_lp64f__ +#endif +#ifndef __riscv64_lp64d__ +#undef __riscv64_lp64d__ +#endif +#ifndef __s390__ +#undef __s390__ +#endif +#ifndef __s390x__ +#undef __s390x__ +#endif +#ifndef __sh__ +#undef __sh__ +#endif +#ifndef __sparc__ +#undef __sparc__ +#endif +#ifndef __sparc64__ +#undef __sparc64__ +#endif + + +/* Define to the number of bits in type 'ptrdiff_t'. */ +#undef BITSIZEOF_PTRDIFF_T + +/* Define to the number of bits in type 'sig_atomic_t'. */ +#undef BITSIZEOF_SIG_ATOMIC_T + +/* Define to the number of bits in type 'size_t'. */ +#undef BITSIZEOF_SIZE_T + +/* Define to the number of bits in type 'wchar_t'. */ +#undef BITSIZEOF_WCHAR_T + +/* Define to the number of bits in type 'wint_t'. */ +#undef BITSIZEOF_WINT_T + +/* whether code in malloc()ed memory is executable */ +#undef CODE_EXECUTABLE + +/* Define to 1 if using 'alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if // is a file system root distinct from /. */ +#undef DOUBLE_SLASH_IS_DISTINCT_ROOT + +/* Define this to 1 if F_DUPFD behavior does not match POSIX */ +#undef FCNTL_DUPFD_BUGGY + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module fscanf shall be considered present. */ +#undef GNULIB_FSCANF + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module lock shall be considered present. */ +#undef GNULIB_LOCK + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module msvc-nothrow shall be considered present. */ +#undef GNULIB_MSVC_NOTHROW + +/* Define to 1 if printf and friends should be labeled with attribute + "__gnu_printf__" instead of "__printf__" */ +#undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module scanf shall be considered present. */ +#undef GNULIB_SCANF + +/* Define to a C preprocessor expression that evaluates to 1 or 0, depending + whether the gnulib module strerror shall be considered present. */ +#undef GNULIB_STRERROR + +/* Define to 1 when the gnulib module cloexec should be tested. */ +#undef GNULIB_TEST_CLOEXEC + +/* Define to 1 when the gnulib module close should be tested. */ +#undef GNULIB_TEST_CLOSE + +/* Define to 1 when the gnulib module dup2 should be tested. */ +#undef GNULIB_TEST_DUP2 + +/* Define to 1 when the gnulib module fcntl should be tested. */ +#undef GNULIB_TEST_FCNTL + +/* Define to 1 when the gnulib module fgetc should be tested. */ +#undef GNULIB_TEST_FGETC + +/* Define to 1 when the gnulib module fgets should be tested. */ +#undef GNULIB_TEST_FGETS + +/* Define to 1 when the gnulib module fprintf should be tested. */ +#undef GNULIB_TEST_FPRINTF + +/* Define to 1 when the gnulib module fputc should be tested. */ +#undef GNULIB_TEST_FPUTC + +/* Define to 1 when the gnulib module fputs should be tested. */ +#undef GNULIB_TEST_FPUTS + +/* Define to 1 when the gnulib module fread should be tested. */ +#undef GNULIB_TEST_FREAD + +/* Define to 1 when the gnulib module fscanf should be tested. */ +#undef GNULIB_TEST_FSCANF + +/* Define to 1 when the gnulib module fstat should be tested. */ +#undef GNULIB_TEST_FSTAT + +/* Define to 1 when the gnulib module fwrite should be tested. */ +#undef GNULIB_TEST_FWRITE + +/* Define to 1 when the gnulib module getc should be tested. */ +#undef GNULIB_TEST_GETC + +/* Define to 1 when the gnulib module getchar should be tested. */ +#undef GNULIB_TEST_GETCHAR + +/* Define to 1 when the gnulib module getdtablesize should be tested. */ +#undef GNULIB_TEST_GETDTABLESIZE + +/* Define to 1 when the gnulib module open should be tested. */ +#undef GNULIB_TEST_OPEN + +/* Define to 1 when the gnulib module printf should be tested. */ +#undef GNULIB_TEST_PRINTF + +/* Define to 1 when the gnulib module putc should be tested. */ +#undef GNULIB_TEST_PUTC + +/* Define to 1 when the gnulib module putchar should be tested. */ +#undef GNULIB_TEST_PUTCHAR + +/* Define to 1 when the gnulib module puts should be tested. */ +#undef GNULIB_TEST_PUTS + +/* Define to 1 when the gnulib module raise should be tested. */ +#undef GNULIB_TEST_RAISE + +/* Define to 1 when the gnulib module rmdir should be tested. */ +#undef GNULIB_TEST_RMDIR + +/* Define to 1 when the gnulib module scanf should be tested. */ +#undef GNULIB_TEST_SCANF + +/* Define to 1 when the gnulib module sigaction should be tested. */ +#undef GNULIB_TEST_SIGACTION + +/* Define to 1 when the gnulib module sigprocmask should be tested. */ +#undef GNULIB_TEST_SIGPROCMASK + +/* Define to 1 when the gnulib module stat should be tested. */ +#undef GNULIB_TEST_STAT + +/* Define to 1 when the gnulib module strerror should be tested. */ +#undef GNULIB_TEST_STRERROR + +/* Define to 1 when the gnulib module vfprintf should be tested. */ +#undef GNULIB_TEST_VFPRINTF + +/* Define to 1 when the gnulib module vprintf should be tested. */ +#undef GNULIB_TEST_VPRINTF + +/* Define to 1 if you have 'alloca' after including , a header that + may be supplied by this distribution. */ +#undef HAVE_ALLOCA + +/* Define to 1 if works. */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the declaration of `execvpe', and to 0 if you + don't. */ +#undef HAVE_DECL_EXECVPE + +/* Define to 1 if you have the declaration of `fcloseall', and to 0 if you + don't. */ +#undef HAVE_DECL_FCLOSEALL + +/* Define to 1 if you have the declaration of `getdtablesize', and to 0 if you + don't. */ +#undef HAVE_DECL_GETDTABLESIZE + +/* Define to 1 if you have the declaration of `program_invocation_name', and + to 0 if you don't. */ +#undef HAVE_DECL_PROGRAM_INVOCATION_NAME + +/* Define to 1 if you have the declaration of `program_invocation_short_name', + and to 0 if you don't. */ +#undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#undef HAVE_DECL_STRERROR_R + +/* Define to 1 if you have the declaration of `__argv', and to 0 if you don't. + */ +#undef HAVE_DECL___ARGV + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `fcntl' function. */ +#undef HAVE_FCNTL + +/* Define to 1 if you have the `getdtablesize' function. */ +#undef HAVE_GETDTABLESIZE + +/* Define to 1 if you have the `getexecname' function. */ +#undef HAVE_GETEXECNAME + +/* Define to 1 if you have the `getprogname' function. */ +#undef HAVE_GETPROGNAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if the system has the type 'long long int'. */ +#undef HAVE_LONG_LONG_INT + +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + +/* Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including + config.h and . */ +#undef HAVE_MAP_ANONYMOUS + +/* Define to 1 if you have the header file. */ +#undef HAVE_MINIX_CONFIG_H + +/* defines MAP_ANONYMOUS and mmaping with MAP_ANONYMOUS works */ +#undef HAVE_MMAP_ANONYMOUS + +/* mmaping of the special device /dev/zero works */ +#undef HAVE_MMAP_DEVZERO + +/* have an mmap() function that, with MAP_SHARED, can make memory pages + executable */ +#undef HAVE_MMAP_SHARED_CAN_EXEC + +/* Define to 1 if you have the `mprotect' function. */ +#undef HAVE_MPROTECT + +/* have an mprotect() function that can make malloc()ed memory pages + executable */ +#undef HAVE_MPROTECT_AFTER_MALLOC_CAN_EXEC + +/* have an mprotect() function that can make mmap()ed memory pages executable + */ +#undef HAVE_MPROTECT_AFTER_MMAP_CAN_EXEC + +/* Define to 1 on MSVC platforms that have the "invalid parameter handler" + concept. */ +#undef HAVE_MSVC_INVALID_PARAMETER_HANDLER + +/* Define if you have the header and the POSIX threads API. */ +#undef HAVE_PTHREAD_API + +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H + +/* Define if the defines PTHREAD_MUTEX_RECURSIVE. */ +#undef HAVE_PTHREAD_MUTEX_RECURSIVE + +/* Define if the POSIX multithreading library has read/write locks. */ +#undef HAVE_PTHREAD_RWLOCK + +/* Define if the 'pthread_rwlock_rdlock' function prefers a writer to a + reader. */ +#undef HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER + +/* Define to 1 if you have the `raise' function. */ +#undef HAVE_RAISE + +/* Define to 1 if you have the header file. */ +#undef HAVE_SDKDDKVER_H + +/* Define to 1 if you have the `setdtablesize' function. */ +#undef HAVE_SETDTABLESIZE + +/* Define to 1 if you have the `sigaction' function. */ +#undef HAVE_SIGACTION + +/* Define to 1 if you have the `sigaltstack' function. */ +#undef HAVE_SIGALTSTACK + +/* Define to 1 if the system has the type `siginfo_t'. */ +#undef HAVE_SIGINFO_T + +/* Define to 1 if you have the `siginterrupt' function. */ +#undef HAVE_SIGINTERRUPT + +/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ +#undef HAVE_SIGNED_SIG_ATOMIC_T + +/* Define to 1 if 'wchar_t' is a signed integer type. */ +#undef HAVE_SIGNED_WCHAR_T + +/* Define to 1 if 'wint_t' is a signed integer type. */ +#undef HAVE_SIGNED_WINT_T + +/* Define to 1 if the system has the type `sigset_t'. */ +#undef HAVE_SIGSET_T + +/* Define to 1 if the system has the type `sig_atomic_t'. */ +#undef HAVE_SIG_ATOMIC_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define if you have `strerror_r'. */ +#undef HAVE_STRERROR_R + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if `sa_sigaction' is a member of `struct sigaction'. */ +#undef HAVE_STRUCT_SIGACTION_SA_SIGACTION + +/* Define to 1 if `st_atimensec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIMENSEC + +/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC + +/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC + +/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC + +/* Define to 1 if `st_birthtimensec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC + +/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC + +/* Define to 1 if `st_birthtim.tv_nsec' is a member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC + +/* Define to 1 if you have the `symlink' function. */ +#undef HAVE_SYMLINK + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_BITYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_CACHECTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SINGLE_THREADED_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the `thrd_create' function. */ +#undef HAVE_THRD_CREATE + +/* Define to 1 if you have the header file. */ +#undef HAVE_THREADS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if the system has the type 'unsigned long long int'. */ +#undef HAVE_UNSIGNED_LONG_LONG_INT + +/* Define if you have a global __progname variable */ +#undef HAVE_VAR___PROGNAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCHAR_H + +/* Define if you have the 'wchar_t' type. */ +#undef HAVE_WCHAR_T + +/* Define to 1 if the compiler and linker support weak declarations of + symbols. */ +#undef HAVE_WEAK_SYMBOLS + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define if you have the 'wint_t' type. */ +#undef HAVE_WINT_T + +/* have a working mprotect() function */ +#undef HAVE_WORKING_MPROTECT + +/* Define to 1 if O_NOATIME works. */ +#undef HAVE_WORKING_O_NOATIME + +/* Define to 1 if O_NOFOLLOW works. */ +#undef HAVE_WORKING_O_NOFOLLOW + +/* Define to 1 if the system has the type `_Bool'. */ +#undef HAVE__BOOL + +/* Define to 1 if you have the `_set_invalid_parameter_handler' function. */ +#undef HAVE__SET_INVALID_PARAMETER_HANDLER + +/* Version number: (major<<8) + minor */ +#undef LIBFFCALL_VERSION + +/* Define to the sub-directory where libtool stores uninstalled libraries. */ +#undef LT_OBJDIR + +/* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */ +#undef MALLOC_0_IS_NONNULL + +/* Define to a substitute value for mmap()'s MAP_ANONYMOUS flag. */ +#undef MAP_ANONYMOUS + +/* Use GNU style printf and scanf. */ +#ifndef __USE_MINGW_ANSI_STDIO +# undef __USE_MINGW_ANSI_STDIO +#endif + + +/* Define to 1 if open() fails to recognize a trailing slash. */ +#undef OPEN_TRAILING_SLASH_BUG + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to the type that is the result of default argument promotions of + type mode_t. */ +#undef PROMOTED_MODE_T + +/* Define if the pthread_in_use() detection is hard. */ +#undef PTHREAD_IN_USE_DETECTION_HARD + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'ptrdiff_t'. */ +#undef PTRDIFF_T_SUFFIX + +/* Define to 1 if stat needs help when passed a file name with a trailing + slash */ +#undef REPLACE_FUNC_STAT_FILE + +/* Define to 1 if strerror(0) does not return a message implying success. */ +#undef REPLACE_STRERROR_0 + +/* Define if lists must be signal-safe. */ +#undef SIGNAL_SAFE_LIST + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'sig_atomic_t'. */ +#undef SIG_ATOMIC_T_SUFFIX + +/* Define as the maximum value of type 'size_t', if the system doesn't define + it. */ +#ifndef SIZE_MAX +# undef SIZE_MAX +#endif + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'size_t'. */ +#undef SIZE_T_SUFFIX + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + +/* Define to 1 if all of the C90 standard headers exist (not just the ones + required in a freestanding environment). This macro is provided for + backward compatibility; new code need not use it. */ +#undef STDC_HEADERS + +/* Define to 1 if strerror_r returns char *. */ +#undef STRERROR_R_CHAR_P + +/* Define to 1 if the type of the st_atim member of a struct stat is struct + timespec. */ +#undef TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC + +/* Define to the prefix of C symbols at the assembler and linker level, either + an underscore or empty. */ +#undef USER_LABEL_PREFIX + +/* Define if the combination of the ISO C and POSIX multithreading APIs can be + used. */ +#undef USE_ISOC_AND_POSIX_THREADS + +/* Define if the ISO C multithreading library can be used. */ +#undef USE_ISOC_THREADS + +/* Define if the POSIX multithreading library can be used. */ +#undef USE_POSIX_THREADS + +/* Define if references to the POSIX multithreading library should be made + weak. */ +#undef USE_POSIX_THREADS_WEAK + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif + + +/* Define if the native Windows multithreading API can be used. */ +#undef USE_WINDOWS_THREADS + +/* Version number of package */ +#undef VERSION + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wchar_t'. */ +#undef WCHAR_T_SUFFIX + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wint_t'. */ +#undef WINT_T_SUFFIX + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ +# define _GL_GNUC_PREREQ(major, minor) \ + ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) +#else +# define _GL_GNUC_PREREQ(major, minor) 0 +#endif + + +/* Define to enable the declarations of ISO C 11 types and functions. */ +#undef _ISOC11_SOURCE + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* The _Noreturn keyword of C11. */ +#ifndef _Noreturn +# if (defined __cplusplus \ + && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ + || (defined _MSC_VER && 1900 <= _MSC_VER)) \ + && 0) + /* [[noreturn]] is not practically usable, because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would only be valid with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. */ +# define _Noreturn [[noreturn]] +# elif ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || (!defined __STRICT_ANSI__ \ + && (_GL_GNUC_PREREQ (4, 7) \ + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 3 < __clang_major__ + (5 <= __clang_minor__)))))) + /* _Noreturn works as-is. */ +# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C +# define _Noreturn __attribute__ ((__noreturn__)) +# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif + + +/* For standard stat data types on VMS. */ +#undef _USE_STD_STAT + +/* Define to 1 if the system predates C++11. */ +#undef __STDC_CONSTANT_MACROS + +/* Define to 1 if the system predates C++11. */ +#undef __STDC_LIMIT_MACROS + +/* The _GL_ASYNC_SAFE marker should be attached to functions that are + signal handlers (for signals other than SIGABRT, SIGPIPE) or can be + invoked from such signal handlers. Such functions have some restrictions: + * All functions that it calls should be marked _GL_ASYNC_SAFE as well, + or should be listed as async-signal-safe in POSIX + + section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in + particular, are NOT async-signal-safe. + * All memory locations (variables and struct fields) that these functions + access must be marked 'volatile'. This holds for both read and write + accesses. Otherwise the compiler might optimize away stores to and + reads from such locations that occur in the program, depending on its + data flow analysis. For example, when the program contains a loop + that is intended to inspect a variable set from within a signal handler + while (!signal_occurred) + ; + the compiler is allowed to transform this into an endless loop if the + variable 'signal_occurred' is not declared 'volatile'. + Additionally, recall that: + * A signal handler should not modify errno (except if it is a handler + for a fatal signal and ends by raising the same signal again, thus + provoking the termination of the process). If it invokes a function + that may clobber errno, it needs to save and restore the value of + errno. */ +#define _GL_ASYNC_SAFE + + +/* Attributes. */ +#if (defined __has_attribute \ + && (!defined __clang_minor__ \ + || 3 < __clang_major__ + (5 <= __clang_minor__))) +# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) +#else +# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr +# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) +# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) +# define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_diagnose_if 0 +# define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) +# define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) +# define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) +# ifdef _ICC +# define _GL_ATTR_may_alias 0 +# else +# define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) +# endif +# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) +# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) +# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) +# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) +# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) +# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) +#endif + + +#if _GL_HAS_ATTRIBUTE (alloc_size) +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) +#else +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) +#endif + +#if _GL_HAS_ATTRIBUTE (always_inline) +# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) +#else +# define _GL_ATTRIBUTE_ALWAYS_INLINE +#endif + +#if _GL_HAS_ATTRIBUTE (artificial) +# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) +#else +# define _GL_ATTRIBUTE_ARTIFICIAL +#endif + +/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at + . + Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ +#if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ +# ifndef __SUNPRO_C +# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) +# else +# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) +# endif +#else +# define _GL_ATTRIBUTE_COLD +#endif + +#if _GL_HAS_ATTRIBUTE (const) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST +#endif + +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] +#elif _GL_HAS_ATTRIBUTE (deprecated) +# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) +#else +# define _GL_ATTRIBUTE_DEPRECATED +#endif + +#if _GL_HAS_ATTRIBUTE (error) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) +#elif _GL_HAS_ATTRIBUTE (diagnose_if) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error"))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning"))) +#else +# define _GL_ATTRIBUTE_ERROR(msg) +# define _GL_ATTRIBUTE_WARNING(msg) +#endif + +#if _GL_HAS_ATTRIBUTE (externally_visible) +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) +#else +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +#endif + +/* FALLTHROUGH is special, because it always expands to something. */ +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] +#elif _GL_HAS_ATTRIBUTE (fallthrough) +# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) +#else +# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) +#endif + +#if _GL_HAS_ATTRIBUTE (format) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define _GL_ATTRIBUTE_FORMAT(spec) +#endif + +#if _GL_HAS_ATTRIBUTE (leaf) +# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) +#else +# define _GL_ATTRIBUTE_LEAF +#endif + +/* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ +#if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C +# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) +#else +# define _GL_ATTRIBUTE_MAY_ALIAS +#endif + +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +#elif _GL_HAS_ATTRIBUTE (unused) +# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__)) +#else +# define _GL_ATTRIBUTE_MAYBE_UNUSED +#endif +/* Earlier spellings of this macro. */ +#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED +#define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED + +#if _GL_HAS_ATTRIBUTE (malloc) +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +#else +# define _GL_ATTRIBUTE_MALLOC +#endif + +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +#elif _GL_HAS_ATTRIBUTE (warn_unused_result) +# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) +#else +# define _GL_ATTRIBUTE_NODISCARD +#endif + +#if _GL_HAS_ATTRIBUTE (noinline) +# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) +#else +# define _GL_ATTRIBUTE_NOINLINE +#endif + +#if _GL_HAS_ATTRIBUTE (nonnull) +# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) +#else +# define _GL_ATTRIBUTE_NONNULL(args) +#endif + +#if _GL_HAS_ATTRIBUTE (nonstring) +# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) +#else +# define _GL_ATTRIBUTE_NONSTRING +#endif + +/* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ + +#if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus +# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) +#else +# define _GL_ATTRIBUTE_NOTHROW +#endif + +#if _GL_HAS_ATTRIBUTE (packed) +# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) +#else +# define _GL_ATTRIBUTE_PACKED +#endif + +#if _GL_HAS_ATTRIBUTE (pure) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE +#endif + +#if _GL_HAS_ATTRIBUTE (returns_nonnull) +# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) +#else +# define _GL_ATTRIBUTE_RETURNS_NONNULL +#endif + +#if _GL_HAS_ATTRIBUTE (sentinel) +# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) +#else +# define _GL_ATTRIBUTE_SENTINEL(pos) +#endif + + +/* To support C++ as well as C, use _GL_UNUSED_LABEL with trailing ';'. */ +#if !defined __cplusplus || _GL_GNUC_PREREQ (4, 5) +# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_MAYBE_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif + + +/* Please see the Gnulib manual for how to use these macros. + + Suppress extern inline with HP-UX cc, as it appears to be broken; see + . + + Suppress extern inline with Sun C in standards-conformance mode, as it + mishandles inline functions that call each other. E.g., for 'inline void f + (void) { } inline void g (void) { f (); }', c99 incorrectly complains + 'reference to static identifier "f" in extern inline function'. + This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. + + Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) + on configurations that mistakenly use 'static inline' to implement + functions or macros in standard C headers like . For example, + if isdigit is mistakenly implemented via a static inline function, + a program containing an extern inline function that calls isdigit + may not work since the C standard prohibits extern inline functions + from calling static functions (ISO C 99 section 6.7.4.(3). + This bug is known to occur on: + + OS X 10.8 and earlier; see: + https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html + + DragonFly; see + http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log + + FreeBSD; see: + https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html + + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and + for clang but remains for g++; see . + Assume DragonFly and FreeBSD will be similar. + + GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 + inline semantics, unless -fgnu89-inline is used. It defines a macro + __GNUC_STDC_INLINE__ to indicate this situation or a macro + __GNUC_GNU_INLINE__ to indicate the opposite situation. + GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline + semantics but warns, unless -fgnu89-inline is used: + warning: C99 inline functions are not supported; using GNU89 + warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute + It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. + */ +#if (((defined __APPLE__ && defined __MACH__) \ + || defined __DragonFly__ || defined __FreeBSD__) \ + && (defined __header_inline \ + ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ + && ! defined __clang__) \ + : ((! defined _DONT_USE_CTYPE_INLINE_ \ + && (defined __GNUC__ || defined __cplusplus)) \ + || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ + && defined __GNUC__ && ! defined __cplusplus)))) +# define _GL_EXTERN_INLINE_STDHEADER_BUG +#endif +#if ((__GNUC__ \ + ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + : (199901L <= __STDC_VERSION__ \ + && !defined __HP_cc \ + && !defined __PGI \ + && !(defined __SUNPRO_C && __STDC__))) \ + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) +# define _GL_INLINE inline +# define _GL_EXTERN_INLINE extern inline +# define _GL_EXTERN_INLINE_IN_USE +#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) +# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ + /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ +# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) +# else +# define _GL_INLINE extern inline +# endif +# define _GL_EXTERN_INLINE extern +# define _GL_EXTERN_INLINE_IN_USE +#else +# define _GL_INLINE static _GL_UNUSED +# define _GL_EXTERN_INLINE static _GL_UNUSED +#endif + +/* In GCC 4.6 (inclusive) to 5.1 (exclusive), + suppress bogus "no previous prototype for 'FOO'" + and "no previous declaration for 'FOO'" diagnostics, + when FOO is an inline function in the header; see + and + . */ +#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ +# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ +# define _GL_INLINE_HEADER_CONST_PRAGMA +# else +# define _GL_INLINE_HEADER_CONST_PRAGMA \ + _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") +# endif +# define _GL_INLINE_HEADER_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ + _GL_INLINE_HEADER_CONST_PRAGMA +# define _GL_INLINE_HEADER_END \ + _Pragma ("GCC diagnostic pop") +#else +# define _GL_INLINE_HEADER_BEGIN +# define _GL_INLINE_HEADER_END +#endif + +/* Define to `int' if doesn't define. */ +#undef gid_t + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif + +/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports + the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of + earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. + __APPLE__ && __MACH__ test for Mac OS X. + __APPLE_CC__ tests for the Apple compiler and its version. + __STDC_VERSION__ tests for the C99 mode. */ +#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ +# define __GNUC_STDC_INLINE__ 1 +#endif + +/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where + n1 and n2 are expressions without side effects, that evaluate to real + numbers (excluding NaN). + It returns + 1 if n1 > n2 + 0 if n1 == n2 + -1 if n1 < n2 + The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional + jump with nearly all GCC versions up to GCC 10. + This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many + GCC versions up to GCC 9. + The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 + avoids conditional jumps in all GCC versions >= 3.4. */ +#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) + + +/* Define to `int' if does not define. */ +#undef mode_t + +/* Define to the type of st_nlink in struct stat, or a supertype. */ +#undef nlink_t + +/* Define as a signed integer type capable of holding a process identifier. */ +#undef pid_t + +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported only directly. */ +#undef restrict +/* Work around a bug in older versions of Sun C++, which did not + #define __restrict__ or support _Restrict or __restrict__ + even though the corresponding Sun C compiler ended up with + "#define restrict _Restrict" or "#define restrict __restrict__" + in the previous line. This workaround can be removed once + we assume Oracle Developer Studio 12.5 (2016) or later. */ +#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ +# define _Restrict +# define __restrict__ +#endif + +/* Define as an integer type suitable for memory locations that can be + accessed atomically even in the presence of asynchronous signals. */ +#undef sig_atomic_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t + +/* Define as a signed type of the same size as size_t. */ +#undef ssize_t + +/* Define to `int' if doesn't define. */ +#undef uid_t diff --git a/configure b/configure new file mode 100755 index 0000000..6a5f1a5 --- /dev/null +++ b/configure @@ -0,0 +1,33427 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.71 for GNU libffcall 2.4. +# +# Report bugs to . +# +# +# Copyright (C) 1992-1996, 1998-2017, 2020-2021 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 more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +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 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + +# Use a proper internal environment variable to ensure we don't fall + # into an infinite loop, continuously re-executing ourselves. + if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then + _as_can_reexec=no; export _as_can_reexec; + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 + fi + # We don't want this to propagate to other subprocesses. + { _as_can_reexec=; unset _as_can_reexec;} +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="as_nop=: +if test \${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else \$as_nop + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ) +then : + +else \$as_nop + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1 +blah=\$(echo \$(echo blah)) +test x\"\$blah\" = xblah || exit 1 +test -x / || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1" + if (eval "$as_required") 2>/dev/null +then : + as_have_required=yes +else $as_nop + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null +then : + +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + as_run=a "$as_shell" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$as_shell as_have_required=yes + if as_run=a "$as_shell" -c "$as_bourne_compatible""$as_suggested" 2>/dev/null +then : + break 2 +fi +fi + done;; + esac + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + as_run=a "$SHELL" -c "$as_bourne_compatible""$as_required" 2>/dev/null +then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi +fi + + + if test "x$CONFIG_SHELL" != x +then : + export CONFIG_SHELL + # We cannot yet assume a decent shell, so we have to provide a +# neutralization value for shells without unset; and this also +# works around shells that cannot unset nonexistent variables. +# Preserve -v and -x to the replacement shell. +BASH_ENV=/dev/null +ENV=/dev/null +(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV +case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; +esac +exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} +# Admittedly, this is quite paranoid, since all the known shells bail +# out after a failed `exec'. +printf "%s\n" "$0: could not re-execute with $CONFIG_SHELL" >&2 +exit 255 +fi + + if test x$as_have_required = xno +then : + printf "%s\n" "$0: This script requires a shell more modern than all" + printf "%s\n" "$0: the shells that I found on your system." + if test ${ZSH_VERSION+y} ; then + printf "%s\n" "$0: In particular, zsh $ZSH_VERSION has bugs and should" + printf "%s\n" "$0: be upgraded to zsh 4.3.4 or later." + else + printf "%s\n" "$0: Please tell bug-autoconf@gnu.org and +$0: https://savannah.gnu.org/projects/libffcall about your +$0: system, including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + +# as_fn_nop +# --------- +# Do nothing but, unlike ":", preserve the value of $?. +as_fn_nop () +{ + return $? +} +as_nop=as_fn_nop + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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 + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { printf "%s\n" "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # If we had to re-execute with $CONFIG_SHELL, we're ensured to have + # already done that, so ensure we don't try to do so again and fall + # in an infinite loop. This has already happened in practice. + _as_can_reexec=no; export _as_can_reexec + # 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 sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval 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="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='GNU libffcall' +PACKAGE_TARNAME='libffcall' +PACKAGE_VERSION='2.4' +PACKAGE_STRING='GNU libffcall 2.4' +PACKAGE_BUGREPORT='https://savannah.gnu.org/projects/libffcall' +PACKAGE_URL='https://www.gnu.org/software/libffcall/' + +ac_unique_file="trampoline/trampoline.h" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_STDIO_H +# include +#endif +#ifdef HAVE_STDLIB_H +# include +#endif +#ifdef HAVE_STRING_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_header_c_list= +gl_use_threads_default= +gl_use_winpthreads_default= +ac_func_c_list= +ac_subst_vars='gltests_LTLIBOBJS +gltests_LIBOBJS +gl_LTLIBOBJS +gl_LIBOBJS +am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +gltests_WITNESS +HAVE_UNISTD_H +NEXT_AS_FIRST_DIRECTIVE_UNISTD_H +NEXT_UNISTD_H +GL_GNULIB_MDA_TZSET +GL_GNULIB_TZSET +GL_GNULIB_TIME_RZ +GL_GNULIB_TIME_R +GL_GNULIB_TIMESPEC_GET +GL_GNULIB_TIMEGM +GL_GNULIB_STRPTIME +GL_GNULIB_STRFTIME +GL_GNULIB_NANOSLEEP +GL_GNULIB_LOCALTIME +GL_GNULIB_MKTIME +GL_GNULIB_CTIME +TIME_H_DEFINES_TIME_UTC +UNISTD_H_DEFINES_STRUCT_TIMESPEC +PTHREAD_H_DEFINES_STRUCT_TIMESPEC +SYS_TIME_H_DEFINES_STRUCT_TIMESPEC +TIME_H_DEFINES_STRUCT_TIMESPEC +NEXT_AS_FIRST_DIRECTIVE_TIME_H +NEXT_TIME_H +REPLACE_LOCALTIME +REPLACE_GMTIME +GNULIB_GETTIMEOFDAY +REPLACE_TZSET +REPLACE_TIMEGM +REPLACE_STRFTIME +REPLACE_NANOSLEEP +REPLACE_MKTIME +REPLACE_LOCALTIME_R +REPLACE_CTIME +HAVE_TIMEZONE_T +HAVE_TIMESPEC_GET +HAVE_TIMEGM +HAVE_STRPTIME +HAVE_NANOSLEEP +HAVE_DECL_LOCALTIME_R +WINDOWS_STAT_INODES +WINDOWS_64_BIT_OFF_T +NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H +NEXT_SYS_TYPES_H +NEXT_AS_FIRST_DIRECTIVE_STRING_H +NEXT_STRING_H +GL_GNULIB_MDA_STRDUP +GL_GNULIB_MDA_MEMCCPY +GL_GNULIB_STRVERSCMP +GL_GNULIB_STRSIGNAL +GL_GNULIB_SIGDESCR_NP +GL_GNULIB_SIGABBREV_NP +GL_GNULIB_STRERRORNAME_NP +GL_GNULIB_STRERROR_R +GL_GNULIB_STRERROR +GL_GNULIB_MBSTOK_R +GL_GNULIB_MBSSEP +GL_GNULIB_MBSSPN +GL_GNULIB_MBSPBRK +GL_GNULIB_MBSCSPN +GL_GNULIB_MBSCASESTR +GL_GNULIB_MBSPCASECMP +GL_GNULIB_MBSNCASECMP +GL_GNULIB_MBSCASECMP +GL_GNULIB_MBSSTR +GL_GNULIB_MBSRCHR +GL_GNULIB_MBSCHR +GL_GNULIB_MBSNLEN +GL_GNULIB_MBSLEN +GL_GNULIB_STRTOK_R +GL_GNULIB_STRCASESTR +GL_GNULIB_STRSTR +GL_GNULIB_STRSEP +GL_GNULIB_STRPBRK +GL_GNULIB_STRNLEN +GL_GNULIB_STRNDUP +GL_GNULIB_STRNCAT +GL_GNULIB_STRDUP +GL_GNULIB_STRCHRNUL +GL_GNULIB_STPNCPY +GL_GNULIB_STPCPY +GL_GNULIB_RAWMEMCHR +GL_GNULIB_MEMRCHR +GL_GNULIB_MEMPCPY +GL_GNULIB_MEMMEM +GL_GNULIB_MEMCHR +GL_GNULIB_FFSLL +GL_GNULIB_FFSL +GL_GNULIB_EXPLICIT_BZERO +UNDEFINE_STRTOK_R +REPLACE_STRSIGNAL +REPLACE_STRERRORNAME_NP +REPLACE_STRERROR_R +REPLACE_STRERROR +REPLACE_STRTOK_R +REPLACE_STRCASESTR +REPLACE_STRSTR +REPLACE_STRNLEN +REPLACE_STRNDUP +REPLACE_STRNCAT +REPLACE_STRDUP +REPLACE_STRCHRNUL +REPLACE_STPNCPY +REPLACE_MEMMEM +REPLACE_MEMCHR +REPLACE_FFSLL +HAVE_STRVERSCMP +HAVE_DECL_STRSIGNAL +HAVE_SIGDESCR_NP +HAVE_SIGABBREV_NP +HAVE_STRERRORNAME_NP +HAVE_DECL_STRERROR_R +HAVE_DECL_STRTOK_R +HAVE_STRCASESTR +HAVE_STRSEP +HAVE_STRPBRK +HAVE_DECL_STRNLEN +HAVE_DECL_STRNDUP +HAVE_DECL_STRDUP +HAVE_STRCHRNUL +HAVE_STPNCPY +HAVE_STPCPY +HAVE_RAWMEMCHR +HAVE_DECL_MEMRCHR +HAVE_MEMPCPY +HAVE_DECL_MEMMEM +HAVE_FFSLL +HAVE_FFSL +HAVE_EXPLICIT_BZERO +HAVE_MBSLEN +GL_GENERATE_STDNORETURN_H_FALSE +GL_GENERATE_STDNORETURN_H_TRUE +STDNORETURN_H +GL_GNULIB_MDA_TEMPNAM +GL_GNULIB_MDA_PUTW +GL_GNULIB_MDA_GETW +GL_GNULIB_MDA_FILENO +GL_GNULIB_MDA_FDOPEN +GL_GNULIB_MDA_FCLOSEALL +GL_GNULIB_VSPRINTF_POSIX +GL_GNULIB_VSNPRINTF +GL_GNULIB_VPRINTF_POSIX +GL_GNULIB_VPRINTF +GL_GNULIB_VFPRINTF_POSIX +GL_GNULIB_VFPRINTF +GL_GNULIB_VDPRINTF +GL_GNULIB_VSCANF +GL_GNULIB_VFSCANF +GL_GNULIB_VASPRINTF +GL_GNULIB_TMPFILE +GL_GNULIB_STDIO_H_SIGPIPE +GL_GNULIB_STDIO_H_NONBLOCKING +GL_GNULIB_SPRINTF_POSIX +GL_GNULIB_SNPRINTF +GL_GNULIB_SCANF +GL_GNULIB_RENAMEAT +GL_GNULIB_RENAME +GL_GNULIB_REMOVE +GL_GNULIB_PUTS +GL_GNULIB_PUTCHAR +GL_GNULIB_PUTC +GL_GNULIB_PRINTF_POSIX +GL_GNULIB_PRINTF +GL_GNULIB_POPEN +GL_GNULIB_PERROR +GL_GNULIB_PCLOSE +GL_GNULIB_OBSTACK_PRINTF_POSIX +GL_GNULIB_OBSTACK_PRINTF +GL_GNULIB_GETLINE +GL_GNULIB_GETDELIM +GL_GNULIB_GETCHAR +GL_GNULIB_GETC +GL_GNULIB_FWRITE +GL_GNULIB_FTELLO +GL_GNULIB_FTELL +GL_GNULIB_FSEEKO +GL_GNULIB_FSEEK +GL_GNULIB_FSCANF +GL_GNULIB_FREOPEN +GL_GNULIB_FREAD +GL_GNULIB_FPUTS +GL_GNULIB_FPUTC +GL_GNULIB_FPURGE +GL_GNULIB_FPRINTF_POSIX +GL_GNULIB_FPRINTF +GL_GNULIB_FOPEN +GL_GNULIB_FGETS +GL_GNULIB_FGETC +GL_GNULIB_FFLUSH +GL_GNULIB_FDOPEN +GL_GNULIB_FCLOSE +GL_GNULIB_DPRINTF +NEXT_AS_FIRST_DIRECTIVE_STDIO_H +NEXT_STDIO_H +REPLACE_VSPRINTF +REPLACE_VSNPRINTF +REPLACE_VPRINTF +REPLACE_VFPRINTF +REPLACE_VDPRINTF +REPLACE_VASPRINTF +REPLACE_TMPFILE +REPLACE_STDIO_WRITE_FUNCS +REPLACE_STDIO_READ_FUNCS +REPLACE_SPRINTF +REPLACE_SNPRINTF +REPLACE_RENAMEAT +REPLACE_RENAME +REPLACE_REMOVE +REPLACE_PRINTF +REPLACE_POPEN +REPLACE_PERROR +REPLACE_OBSTACK_PRINTF +REPLACE_GETLINE +REPLACE_GETDELIM +REPLACE_FTELLO +REPLACE_FTELL +REPLACE_FSEEKO +REPLACE_FSEEK +REPLACE_FREOPEN +REPLACE_FPURGE +REPLACE_FPRINTF +REPLACE_FOPEN +REPLACE_FFLUSH +REPLACE_FDOPEN +REPLACE_FCLOSE +REPLACE_DPRINTF +HAVE_VDPRINTF +HAVE_VASPRINTF +HAVE_RENAMEAT +HAVE_POPEN +HAVE_PCLOSE +HAVE_FTELLO +HAVE_FSEEKO +HAVE_DPRINTF +HAVE_DECL_VSNPRINTF +HAVE_DECL_SNPRINTF +HAVE_DECL_OBSTACK_PRINTF +HAVE_DECL_GETLINE +HAVE_DECL_GETDELIM +HAVE_DECL_FTELLO +HAVE_DECL_FSEEKO +HAVE_DECL_FPURGE +HAVE_DECL_FCLOSEALL +GL_GENERATE_STDINT_H_FALSE +GL_GENERATE_STDINT_H_TRUE +STDINT_H +HAVE_SYS_INTTYPES_H +HAVE_SYS_BITYPES_H +HAVE_C99_STDINT_H +WINT_T_SUFFIX +WCHAR_T_SUFFIX +SIG_ATOMIC_T_SUFFIX +SIZE_T_SUFFIX +PTRDIFF_T_SUFFIX +HAVE_SIGNED_WINT_T +HAVE_SIGNED_WCHAR_T +HAVE_SIGNED_SIG_ATOMIC_T +BITSIZEOF_WINT_T +BITSIZEOF_WCHAR_T +BITSIZEOF_SIG_ATOMIC_T +BITSIZEOF_SIZE_T +BITSIZEOF_PTRDIFF_T +HAVE_STDINT_H +NEXT_AS_FIRST_DIRECTIVE_STDINT_H +NEXT_STDINT_H +HAVE_SYS_TYPES_H +HAVE_INTTYPES_H +HAVE_WCHAR_H +GNULIBHEADERS_OVERRIDE_WINT_T +NEXT_AS_FIRST_DIRECTIVE_STDDEF_H +NEXT_STDDEF_H +GL_GENERATE_STDDEF_H_FALSE +GL_GENERATE_STDDEF_H_TRUE +STDDEF_H +HAVE_WCHAR_T +HAVE_MAX_ALIGN_T +REPLACE_NULL +HAVE__BOOL +GL_GENERATE_STDBOOL_H_FALSE +GL_GENERATE_STDBOOL_H_TRUE +STDBOOL_H +NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H +NEXT_SIGNAL_H +GL_GNULIB_SIGACTION +GL_GNULIB_SIGPROCMASK +GL_GNULIB_SIGNAL_H_SIGPIPE +GL_GNULIB_RAISE +GL_GNULIB_PTHREAD_SIGMASK +REPLACE_RAISE +REPLACE_PTHREAD_SIGMASK +HAVE_SIGHANDLER_T +HAVE_TYPE_VOLATILE_SIG_ATOMIC_T +HAVE_STRUCT_SIGACTION_SA_SIGACTION +HAVE_SIGACTION +HAVE_SIGINFO_T +HAVE_SIGSET_T +HAVE_RAISE +HAVE_PTHREAD_SIGMASK +HAVE_POSIX_SIGNALBLOCKING +APPLE_UNIVERSAL_BUILD +LTLIBMULTITHREAD +LIBMULTITHREAD +LTLIBTHREAD +LIBTHREAD +LIBSTDTHREAD +LIB_SCHED_YIELD +LIBPMULTITHREAD +LIBPTHREAD +GL_GENERATE_LIMITS_H_FALSE +GL_GENERATE_LIMITS_H_TRUE +LIMITS_H +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H +NEXT_LIMITS_H +LTLIBINTL +LIBINTL +GL_GNULIB_MDA_UMASK +GL_GNULIB_MDA_MKDIR +GL_GNULIB_MDA_CHMOD +GL_GNULIB_OVERRIDES_STRUCT_STAT +GL_GNULIB_UTIMENSAT +GL_GNULIB_STAT +GL_GNULIB_MKNODAT +GL_GNULIB_MKNOD +GL_GNULIB_MKFIFOAT +GL_GNULIB_MKFIFO +GL_GNULIB_MKDIRAT +GL_GNULIB_MKDIR +GL_GNULIB_LSTAT +GL_GNULIB_LCHMOD +GL_GNULIB_GETUMASK +GL_GNULIB_FUTIMENS +GL_GNULIB_FSTATAT +GL_GNULIB_FSTAT +GL_GNULIB_FCHMODAT +WINDOWS_64_BIT_ST_SIZE +WINDOWS_STAT_TIMESPEC +NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H +NEXT_SYS_STAT_H +REPLACE_UTIMENSAT +REPLACE_STAT +REPLACE_MKNODAT +REPLACE_MKNOD +REPLACE_MKFIFOAT +REPLACE_MKFIFO +REPLACE_MKDIR +REPLACE_LSTAT +REPLACE_FUTIMENS +REPLACE_FSTATAT +REPLACE_FSTAT +REPLACE_FCHMODAT +HAVE_UTIMENSAT +HAVE_MKNODAT +HAVE_MKNOD +HAVE_MKFIFOAT +HAVE_MKFIFO +HAVE_MKDIRAT +HAVE_LSTAT +HAVE_LCHMOD +HAVE_GETUMASK +HAVE_FUTIMENS +HAVE_FSTATAT +HAVE_FCHMODAT +NEXT_AS_FIRST_DIRECTIVE_FCNTL_H +NEXT_FCNTL_H +GL_GNULIB_MDA_OPEN +GL_GNULIB_MDA_CREAT +GL_GNULIB_OPENAT +GL_GNULIB_OPEN +GL_GNULIB_NONBLOCKING +GL_GNULIB_FCNTL +GL_GNULIB_CREAT +REPLACE_OPENAT +REPLACE_OPEN +REPLACE_FCNTL +REPLACE_CREAT +HAVE_OPENAT +HAVE_FCNTL +EOVERFLOW_VALUE +EOVERFLOW_HIDDEN +ENOLINK_VALUE +ENOLINK_HIDDEN +EMULTIHOP_VALUE +EMULTIHOP_HIDDEN +GL_GENERATE_ERRNO_H_FALSE +GL_GENERATE_ERRNO_H_TRUE +ERRNO_H +NEXT_AS_FIRST_DIRECTIVE_ERRNO_H +NEXT_ERRNO_H +PRAGMA_COLUMNS +PRAGMA_SYSTEM_HEADER +INCLUDE_NEXT_AS_FIRST_DIRECTIVE +INCLUDE_NEXT +GL_GNULIB_MDA_WRITE +GL_GNULIB_MDA_UNLINK +GL_GNULIB_MDA_SWAB +GL_GNULIB_MDA_RMDIR +GL_GNULIB_MDA_READ +GL_GNULIB_MDA_LSEEK +GL_GNULIB_MDA_ISATTY +GL_GNULIB_MDA_GETPID +GL_GNULIB_MDA_GETCWD +GL_GNULIB_MDA_EXECVPE +GL_GNULIB_MDA_EXECVP +GL_GNULIB_MDA_EXECVE +GL_GNULIB_MDA_EXECV +GL_GNULIB_MDA_EXECLP +GL_GNULIB_MDA_EXECLE +GL_GNULIB_MDA_EXECL +GL_GNULIB_MDA_DUP2 +GL_GNULIB_MDA_DUP +GL_GNULIB_MDA_CLOSE +GL_GNULIB_MDA_CHDIR +GL_GNULIB_MDA_ACCESS +GL_GNULIB_WRITE +GL_GNULIB_USLEEP +GL_GNULIB_UNLINKAT +GL_GNULIB_UNLINK +GL_GNULIB_UNISTD_H_SIGPIPE +GL_GNULIB_UNISTD_H_NONBLOCKING +GL_GNULIB_TTYNAME_R +GL_GNULIB_TRUNCATE +GL_GNULIB_SYMLINKAT +GL_GNULIB_SYMLINK +GL_GNULIB_SLEEP +GL_GNULIB_SETHOSTNAME +GL_GNULIB_RMDIR +GL_GNULIB_READLINKAT +GL_GNULIB_READLINK +GL_GNULIB_READ +GL_GNULIB_PWRITE +GL_GNULIB_PREAD +GL_GNULIB_PIPE2 +GL_GNULIB_PIPE +GL_GNULIB_LSEEK +GL_GNULIB_LINKAT +GL_GNULIB_LINK +GL_GNULIB_LCHOWN +GL_GNULIB_ISATTY +GL_GNULIB_GROUP_MEMBER +GL_GNULIB_GETUSERSHELL +GL_GNULIB_GETPASS +GL_GNULIB_GETPAGESIZE +GL_GNULIB_GETOPT_POSIX +GL_GNULIB_GETLOGIN_R +GL_GNULIB_GETLOGIN +GL_GNULIB_GETHOSTNAME +GL_GNULIB_GETGROUPS +GL_GNULIB_GETENTROPY +GL_GNULIB_GETDTABLESIZE +GL_GNULIB_GETDOMAINNAME +GL_GNULIB_GETCWD +GL_GNULIB_FTRUNCATE +GL_GNULIB_FSYNC +GL_GNULIB_FDATASYNC +GL_GNULIB_FCHOWNAT +GL_GNULIB_FCHDIR +GL_GNULIB_FACCESSAT +GL_GNULIB_EXECVPE +GL_GNULIB_EXECVP +GL_GNULIB_EXECVE +GL_GNULIB_EXECV +GL_GNULIB_EXECLP +GL_GNULIB_EXECLE +GL_GNULIB_EXECL +GL_GNULIB_EUIDACCESS +GL_GNULIB_ENVIRON +GL_GNULIB_DUP3 +GL_GNULIB_DUP2 +GL_GNULIB_DUP +GL_GNULIB_COPY_FILE_RANGE +GL_GNULIB_CLOSE +GL_GNULIB_CHOWN +GL_GNULIB_CHDIR +GL_GNULIB_ACCESS +HAVE_WINSOCK2_H +HAVE_MSVC_INVALID_PARAMETER_HANDLER +UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS +UNISTD_H_HAVE_WINSOCK2_H +UNISTD_H_HAVE_SYS_RANDOM_H +REPLACE_WRITE +REPLACE_USLEEP +REPLACE_UNLINKAT +REPLACE_UNLINK +REPLACE_TTYNAME_R +REPLACE_TRUNCATE +REPLACE_SYMLINKAT +REPLACE_SYMLINK +REPLACE_SLEEP +REPLACE_RMDIR +REPLACE_READLINKAT +REPLACE_READLINK +REPLACE_READ +REPLACE_PWRITE +REPLACE_PREAD +REPLACE_LSEEK +REPLACE_LINKAT +REPLACE_LINK +REPLACE_LCHOWN +REPLACE_ISATTY +REPLACE_GETPASS +REPLACE_GETPAGESIZE +REPLACE_GETGROUPS +REPLACE_GETLOGIN_R +REPLACE_GETDTABLESIZE +REPLACE_GETDOMAINNAME +REPLACE_GETCWD +REPLACE_FTRUNCATE +REPLACE_FCHOWNAT +REPLACE_FACCESSAT +REPLACE_EXECVPE +REPLACE_EXECVP +REPLACE_EXECVE +REPLACE_EXECV +REPLACE_EXECLP +REPLACE_EXECLE +REPLACE_EXECL +REPLACE_DUP2 +REPLACE_DUP +REPLACE_CLOSE +REPLACE_CHOWN +REPLACE_ACCESS +HAVE_SYS_PARAM_H +HAVE_OS_H +HAVE_DECL_TTYNAME_R +HAVE_DECL_TRUNCATE +HAVE_DECL_SETHOSTNAME +HAVE_DECL_GETUSERSHELL +HAVE_DECL_GETPAGESIZE +HAVE_DECL_GETLOGIN_R +HAVE_DECL_GETLOGIN +HAVE_DECL_GETDOMAINNAME +HAVE_DECL_FDATASYNC +HAVE_DECL_FCHDIR +HAVE_DECL_EXECVPE +HAVE_DECL_ENVIRON +HAVE_USLEEP +HAVE_UNLINKAT +HAVE_SYMLINKAT +HAVE_SYMLINK +HAVE_SLEEP +HAVE_SETHOSTNAME +HAVE_READLINKAT +HAVE_READLINK +HAVE_PWRITE +HAVE_PREAD +HAVE_PIPE2 +HAVE_PIPE +HAVE_LINKAT +HAVE_LINK +HAVE_LCHOWN +HAVE_GROUP_MEMBER +HAVE_GETPASS +HAVE_GETPAGESIZE +HAVE_GETLOGIN +HAVE_GETHOSTNAME +HAVE_GETGROUPS +HAVE_GETENTROPY +HAVE_GETDTABLESIZE +HAVE_FTRUNCATE +HAVE_FSYNC +HAVE_FDATASYNC +HAVE_FCHOWNAT +HAVE_FCHDIR +HAVE_FACCESSAT +HAVE_EXECVPE +HAVE_EUIDACCESS +HAVE_DUP3 +HAVE_COPY_FILE_RANGE +HAVE_CHOWN +HAVE_ALLOCA_H +GL_GENERATE_ALLOCA_H_FALSE +GL_GENERATE_ALLOCA_H_TRUE +ALLOCA_H +ALLOCA +GL_COND_LIBTOOL_FALSE +GL_COND_LIBTOOL_TRUE +DISABLE_TYPE_BASED_ALIASING +WORKAROUND_BUG_81653 +CPU_OBJECTS +CXXCPP +LT_SYS_LIBRARY_PATH +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +ac_ct_AR +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +SED +LIBTOOL +OBJDUMP +DLLTOOL +AS +ENDIANNESS +HOST_CPU_C_ABI +HOST_CPU +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +LN +IFNOT_MSVC +IF_MSVC +RANLIB +ARFLAGS +AR +IF_CXX +am__fastdepCXX_FALSE +am__fastdepCXX_TRUE +CXXDEPMODE +ANSICXX_FALSE +ANSICXX_TRUE +CXXFLAGS +ac_ct_CXX +CXX +CXX_CHOICE +AS_UNDERSCORE +ASM_SYMBOL_PREFIX +GCC_X_NONE +CC_GCC +EGREP +GREP +CPP +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +am__nodep +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +AM_BACKSLASH +AM_DEFAULT_VERBOSITY +AM_DEFAULT_V +AM_V +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +runstatedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL +am__quote' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_silent_rules +enable_dependency_tracking +enable_c__ +enable_largefile +enable_threads +enable_shared +enable_static +with_pic +enable_fast_install +with_aix_soname +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_cross_guesses +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP +CXX +CXXFLAGS +LT_SYS_LIBRARY_PATH +CXXCPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# 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. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +runstatedir='${localstatedir}/run' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +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 + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -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) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$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 ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + 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 ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -runstatedir | --runstatedir | --runstatedi | --runstated \ + | --runstate | --runstat | --runsta | --runst | --runs \ + | --run | --ru | --r) + ac_prev=runstatedir ;; + -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ + | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ + | --run=* | --ru=* | --r=*) + runstatedir=$ac_optarg ;; + + -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_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: \`$ac_useropt'" + ac_useropt_orig=$ac_useropt + ac_useropt=`printf "%s\n" "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=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 ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + printf "%s\n" "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + printf "%s\n" "$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'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir runstatedir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +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 + 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 + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_myself" | + 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 + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# 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 GNU libffcall 2.4 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 \`..'] + +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] + --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] + --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libffcall] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of GNU libffcall 2.4:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-silent-rules less verbose build output (undo: "make V=1") + --disable-silent-rules verbose build output (undo: "make V=0") + --enable-dependency-tracking + do not reject slow dependency extractors + --disable-dependency-tracking + speeds up one-time build + --disable-c++ do not build C++ sources + --disable-largefile omit support for large files + --enable-threads={isoc|posix|isoc+posix|windows} + specify multithreading API + --disable-threads build without multithread safety + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-cross-guesses={conservative|risky} + specify policy for cross-compilation guesses + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use + both] + --with-aix-soname=aix|svr4|both + shared library versioning (aka "SONAME") variant to + provide on AIX, [default=aix]. + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot[=DIR] Search for dependent libraries within DIR (or the + compiler's sysroot if not specified). + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CPP C preprocessor + CXX C++ compiler command + CXXFLAGS C++ compiler flags + LT_SYS_LIBRARY_PATH + User-defined run-time library search path. + CXXCPP 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. + +Report bugs to . +GNU libffcall home page: . +General help using GNU software: . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for configure.gnu first; this name is used for a wrapper for + # Metaconfig's "Configure" on case-insensitive file systems. + 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 + else + printf "%s\n" "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +GNU libffcall configure 2.4 +generated by GNU Autoconf 2.71 + +Copyright (C) 2021 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 +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_cxx_try_compile LINENO +# ---------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_compile + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. */ + +#include +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main (void) +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_cxx_try_cpp LINENO +# ------------------------ +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || + test ! -s conftest.err + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_cpp + +# ac_fn_cxx_try_link LINENO +# ------------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_cxx_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest.beam conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + test -x conftest$ac_exeext + } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_cxx_try_link + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to run conftest.$ac_ext, and return whether this succeeded. Assumes that +# executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } +then : + ac_retval=0 +else $as_nop + printf "%s\n" "$as_me: program exited with status $ac_status" >&5 + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +printf %s "checking for $2... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_hi=$ac_mid; break +else $as_nop + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_lo=$ac_mid; break +else $as_nop + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done +else $as_nop + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0; +return test_array [0]; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_hi=$ac_mid +else $as_nop + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval (void) { return $2; } +static unsigned long int ulongval (void) { return $2; } +#include +#include +int +main (void) +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + echo >>conftest.val; read $3 &5 +printf %s "checking whether $as_decl_name is declared... " >&6; } +if eval test \${$3+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'` + eval ac_save_FLAGS=\$$6 + as_fn_append $6 " $5" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main (void) +{ +#ifndef $as_decl_name +#ifdef __cplusplus + (void) $as_decl_use; +#else + (void) $as_decl_name; +#endif +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$3=yes" +else $as_nop + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval $6=\$ac_save_FLAGS + +fi +eval ac_res=\$$3 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + ac_compile="$ac_save_ac_compile" + +} # ac_fn_check_decl + +# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES +# ---------------------------------------------------- +# Tries to find if the field MEMBER exists in type AGGR, after including +# INCLUDES, setting cache variable VAR accordingly. +ac_fn_c_check_member () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 +printf %s "checking for $2.$3... " >&6; } +if eval test \${$4+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +static $2 ac_aggr; +if (ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$4=yes" +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$5 +int +main (void) +{ +static $2 ac_aggr; +if (sizeof ac_aggr.$3) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval "$4=yes" +else $as_nop + eval "$4=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +eval ac_res=\$$4 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_member +ac_configure_args_raw= +for ac_arg +do + case $ac_arg in + *\'*) + ac_arg=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append ac_configure_args_raw " '$ac_arg'" +done + +case $ac_configure_args_raw in + *$as_nl*) + ac_safe_unquote= ;; + *) + ac_unsafe_z='|&;<>()$`\\"*?[ '' ' # This string ends in space, tab. + ac_unsafe_a="$ac_unsafe_z#~" + ac_safe_unquote="s/ '\\([^$ac_unsafe_a][^$ac_unsafe_z]*\\)'/ \\1/g" + ac_configure_args_raw=` printf "%s\n" "$ac_configure_args_raw" | sed "$ac_safe_unquote"`;; +esac + +cat >config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by GNU libffcall $as_me 2.4, which was +generated by GNU Autoconf 2.71. Invocation command line was + + $ $0$ac_configure_args_raw + +_ACEOF +exec 5>>config.log +{ +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` +/usr/bin/hostinfo = `(/usr/bin/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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + printf "%s\n" "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&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_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=`printf "%s\n" "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append 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 + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset 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: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Sanitize IFS. + IFS=" "" $as_nl" + # Save into config.log some information that might help in debugging. + { + echo + + printf "%s\n" "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + printf "%s\n" "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + printf "%s\n" "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`printf "%s\n" "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + printf "%s\n" "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + printf "%s\n" "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + printf "%s\n" "$as_me: caught signal $ac_signal" + printf "%s\n" "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +printf "%s\n" "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +printf "%s\n" "#define PACKAGE_NAME \"$PACKAGE_NAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_TARNAME \"$PACKAGE_TARNAME\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_VERSION \"$PACKAGE_VERSION\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_STRING \"$PACKAGE_STRING\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_BUGREPORT \"$PACKAGE_BUGREPORT\"" >>confdefs.h + +printf "%s\n" "#define PACKAGE_URL \"$PACKAGE_URL\"" >>confdefs.h + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +if test -n "$CONFIG_SITE"; then + ac_site_files="$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + ac_site_files="$prefix/share/config.site $prefix/etc/config.site" +else + ac_site_files="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" +fi + +for ac_site_file in $ac_site_files +do + case $ac_site_file in #( + */*) : + ;; #( + *) : + ac_site_file=./$ac_site_file ;; +esac + if test -f "$ac_site_file" && test -r "$ac_site_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +printf "%s\n" "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + 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. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +printf "%s\n" "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +printf "%s\n" "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Test code for whether the C compiler supports C89 (global declarations) +ac_c_conftest_c89_globals=' +/* Does the compiler advertise C89 conformance? + Do not test the value of __STDC__, because some compilers set it to 0 + while being otherwise adequately conformant. */ +#if !defined __STDC__ +# error "Compiler does not advertise C89 conformance" +#endif + +#include +#include +struct stat; +/* Most of the following tests are stolen from RCS 5.7 src/conf.sh. */ +struct buf { int x; }; +struct buf * (*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; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not \xHH hex character constants. + These do not provoke an error unfortunately, instead are silently treated + as an "x". The following induces an error, until -std is added to get + proper ANSI mode. Curiously \x00 != x always comes out true, for an + array size at least. It is necessary to write \x00 == 0 to get something + that is true only with -std. */ +int osf4_cc_array ['\''\x00'\'' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) '\''x'\'' +int xlc6_cc_array[FOO(a) == '\''x'\'' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, int *(*)(struct buf *, struct stat *, int), + int, int);' + +# Test code for whether the C compiler supports C89 (body of main). +ac_c_conftest_c89_main=' +ok |= (argc == 0 || f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]); +' + +# Test code for whether the C compiler supports C99 (global declarations) +ac_c_conftest_c99_globals=' +// Does the compiler advertise C99 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 199901L +# error "Compiler does not advertise C99 conformance" +#endif + +#include +extern int puts (const char *); +extern int printf (const char *, ...); +extern int dprintf (int, const char *, ...); +extern void *malloc (size_t); + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +// dprintf is used instead of fprintf to avoid needing to declare +// FILE and stderr. +#define debug(...) dprintf (2, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + #error "your preprocessor is broken" +#endif +#if BIG_OK +#else + #error "your preprocessor is broken" +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\''\0'\''; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case '\''s'\'': // string + str = va_arg (args_copy, const char *); + break; + case '\''d'\'': // int + number = va_arg (args_copy, int); + break; + case '\''f'\'': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +} +' + +# Test code for whether the C compiler supports C99 (body of main). +ac_c_conftest_c99_main=' + // Check bool. + _Bool success = false; + success |= (argc != 0); + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d'\'' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[0] = argv[0][0]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + ok |= (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == '\''x'\'' + || dynamic_array[ni.number - 1] != 543); +' + +# Test code for whether the C compiler supports C11 (global declarations) +ac_c_conftest_c11_globals=' +// Does the compiler advertise C11 conformance? +#if !defined __STDC_VERSION__ || __STDC_VERSION__ < 201112L +# error "Compiler does not advertise C11 conformance" +#endif + +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +' + +# Test code for whether the C compiler supports C11 (body of main). +ac_c_conftest_c11_main=' + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); + v1.i = 2; + v1.w.k = 5; + ok |= v1.i != 5; +' + +# Test code for whether the C compiler supports C11 (complete). +ac_c_conftest_c11_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} +${ac_c_conftest_c11_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + ${ac_c_conftest_c11_main} + return ok; +} +" + +# Test code for whether the C compiler supports C99 (complete). +ac_c_conftest_c99_program="${ac_c_conftest_c89_globals} +${ac_c_conftest_c99_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + ${ac_c_conftest_c99_main} + return ok; +} +" + +# Test code for whether the C compiler supports C89 (complete). +ac_c_conftest_c89_program="${ac_c_conftest_c89_globals} + +int +main (int argc, char **argv) +{ + int ok = 0; + ${ac_c_conftest_c89_main} + return ok; +} +" + +as_fn_append ac_header_c_list " stdio.h stdio_h HAVE_STDIO_H" +as_fn_append ac_header_c_list " stdlib.h stdlib_h HAVE_STDLIB_H" +as_fn_append ac_header_c_list " string.h string_h HAVE_STRING_H" +as_fn_append ac_header_c_list " inttypes.h inttypes_h HAVE_INTTYPES_H" +as_fn_append ac_header_c_list " stdint.h stdint_h HAVE_STDINT_H" +as_fn_append ac_header_c_list " strings.h strings_h HAVE_STRINGS_H" +as_fn_append ac_header_c_list " sys/stat.h sys_stat_h HAVE_SYS_STAT_H" +as_fn_append ac_header_c_list " sys/types.h sys_types_h HAVE_SYS_TYPES_H" +as_fn_append ac_header_c_list " unistd.h unistd_h HAVE_UNISTD_H" +as_fn_append ac_header_c_list " wchar.h wchar_h HAVE_WCHAR_H" +as_fn_append ac_header_c_list " minix/config.h minix_config_h HAVE_MINIX_CONFIG_H" +as_fn_append ac_header_c_list " pthread.h pthread_h HAVE_PTHREAD_H" +as_fn_append ac_func_c_list " _set_invalid_parameter_handler HAVE__SET_INVALID_PARAMETER_HANDLER" +as_fn_append ac_header_c_list " sys/socket.h sys_socket_h HAVE_SYS_SOCKET_H" +as_fn_append ac_func_c_list " fcntl HAVE_FCNTL" +as_fn_append ac_func_c_list " symlink HAVE_SYMLINK" +as_fn_append ac_func_c_list " getdtablesize HAVE_GETDTABLESIZE" +as_fn_append ac_func_c_list " getprogname HAVE_GETPROGNAME" +as_fn_append ac_func_c_list " getexecname HAVE_GETEXECNAME" +as_fn_append ac_header_c_list " limits.h limits_h HAVE_LIMITS_H" +as_fn_append ac_header_c_list " threads.h threads_h HAVE_THREADS_H" +as_fn_append ac_func_c_list " lstat HAVE_LSTAT" +as_fn_append ac_header_c_list " sys/param.h sys_param_h HAVE_SYS_PARAM_H" +as_fn_append ac_func_c_list " sigaction HAVE_SIGACTION" +as_fn_append ac_func_c_list " sigaltstack HAVE_SIGALTSTACK" +as_fn_append ac_func_c_list " siginterrupt HAVE_SIGINTERRUPT" +as_fn_append ac_header_c_list " sys/time.h sys_time_h HAVE_SYS_TIME_H" + +# Auxiliary files required by this configure script. +ac_aux_files="ltmain.sh config.guess config.sub compile missing install-sh" + +# Locations in which to look for auxiliary files. +ac_aux_dir_candidates="${srcdir}/build-aux" + +# Search for a directory containing all of the required auxiliary files, +# $ac_aux_files, from the $PATH-style list $ac_aux_dir_candidates. +# If we don't find one directory that contains all the files we need, +# we report the set of missing files from the *first* directory in +# $ac_aux_dir_candidates and give up. +ac_missing_aux_files="" +ac_first_candidate=: +printf "%s\n" "$as_me:${as_lineno-$LINENO}: looking for aux files: $ac_aux_files" >&5 +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in $ac_aux_dir_candidates +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + as_found=: + + printf "%s\n" "$as_me:${as_lineno-$LINENO}: trying $as_dir" >&5 + ac_aux_dir_found=yes + ac_install_sh= + for ac_aux in $ac_aux_files + do + # As a special case, if "install-sh" is required, that requirement + # can be satisfied by any of "install-sh", "install.sh", or "shtool", + # and $ac_install_sh is set appropriately for whichever one is found. + if test x"$ac_aux" = x"install-sh" + then + if test -f "${as_dir}install-sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install-sh found" >&5 + ac_install_sh="${as_dir}install-sh -c" + elif test -f "${as_dir}install.sh"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}install.sh found" >&5 + ac_install_sh="${as_dir}install.sh -c" + elif test -f "${as_dir}shtool"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}shtool found" >&5 + ac_install_sh="${as_dir}shtool install -c" + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} install-sh" + else + break + fi + fi + else + if test -f "${as_dir}${ac_aux}"; then + printf "%s\n" "$as_me:${as_lineno-$LINENO}: ${as_dir}${ac_aux} found" >&5 + else + ac_aux_dir_found=no + if $ac_first_candidate; then + ac_missing_aux_files="${ac_missing_aux_files} ${ac_aux}" + else + break + fi + fi + fi + done + if test "$ac_aux_dir_found" = yes; then + ac_aux_dir="$as_dir" + break + fi + ac_first_candidate=false + + as_found=false +done +IFS=$as_save_IFS +if $as_found +then : + +else $as_nop + as_fn_error $? "cannot find required auxiliary files:$ac_missing_aux_files" "$LINENO" 5 +fi + + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +if test -f "${ac_aux_dir}config.guess"; then + ac_config_guess="$SHELL ${ac_aux_dir}config.guess" +fi +if test -f "${ac_aux_dir}config.sub"; then + ac_config_sub="$SHELL ${ac_aux_dir}config.sub" +fi +if test -f "$ac_aux_dir/configure"; then + ac_configure="$SHELL ${ac_aux_dir}configure" +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; 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,) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +printf "%s\n" "$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 + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +printf "%s\n" "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +printf "%s\n" "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +printf "%s\n" "$as_me: former value: \`$ac_old_val'" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +printf "%s\n" "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`printf "%s\n" "$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. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +printf "%s\n" "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`${MAKE-make} distclean' and/or \`rm $cache_file' + and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +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 + + + +am__api_version='1.16' + + + + # 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" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +printf %s "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test ${ac_cv_path_install+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + # Account for fact that we put trailing slashes in our PATH walk. +case $as_dir in #(( + ./ | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /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_fn_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 + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir/" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test ${ac_cv_path_install+y}; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +printf "%s\n" "$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' + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +printf %s "checking whether build environment is sane... " >&6; } +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; +esac + +# Do 'set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + am_has_slept=no + for am_try in 1 2; do + echo "timestamp, slept: $am_has_slept" > conftest.file + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken + alias in your environment" "$LINENO" 5 + fi + if test "$2" = conftest.file || test $am_try -eq 2; then + break + fi + # Just in case. + sleep 1 + am_has_slept=yes + done + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +# If we didn't sleep, we still need to ensure time stamps of config.status and +# generated files are strictly newer. +am_sleep_pid= +if grep 'slept: no' conftest.file >/dev/null 2>&1; then + ( sleep 1 ) & + am_sleep_pid=$! +fi + +rm -f conftest.file + +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`printf "%s\n" "$program_transform_name" | sed "$ac_script"` + + +# Expand $ac_aux_dir to an absolute path. +am_aux_dir=`cd "$ac_aux_dir" && pwd` + + + if test x"${MISSING+set}" != xset; then + MISSING="\${SHELL} '$am_aux_dir/missing'" +fi +# Use eval to expand $SHELL +if eval "$MISSING --is-lightweight"; then + am_missing_run="$MISSING " +else + am_missing_run= + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 +printf "%s\n" "$as_me: WARNING: 'missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using 'strip' when the user +# run "make install-strip". However 'strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the 'STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a race-free mkdir -p" >&5 +printf %s "checking for a race-free mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if test ${ac_cv_path_mkdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + as_fn_executable_p "$as_dir$ac_prog$ac_exec_ext" || continue + case `"$as_dir$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir ('*'coreutils) '* | \ + 'BusyBox '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test ${ac_cv_path_mkdir+y}; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +printf "%s\n" "$MKDIR_P" >&6; } + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AWK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +printf "%s\n" "$AWK" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# Check whether --enable-silent-rules was given. +if test ${enable_silent_rules+y} +then : + enableval=$enable_silent_rules; +fi + +case $enable_silent_rules in # ((( + yes) AM_DEFAULT_VERBOSITY=0;; + no) AM_DEFAULT_VERBOSITY=1;; + *) AM_DEFAULT_VERBOSITY=1;; +esac +am_make=${MAKE-make} +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 +printf %s "checking whether $am_make supports nested variables... " >&6; } +if test ${am_cv_make_support_nested_variables+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if printf "%s\n" 'TRUE=$(BAR$(V)) +BAR0=false +BAR1=true +V=1 +am__doit: + @$(TRUE) +.PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then + am_cv_make_support_nested_variables=yes +else + am_cv_make_support_nested_variables=no +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 +printf "%s\n" "$am_cv_make_support_nested_variables" >&6; } +if test $am_cv_make_support_nested_variables = yes; then + AM_V='$(V)' + AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' +else + AM_V=$AM_DEFAULT_VERBOSITY + AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY +fi +AM_BACKSLASH='\' + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='libffcall' + VERSION='2.4' + + +printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h + + +printf "%s\n" "#define VERSION \"$VERSION\"" >>confdefs.h + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# For better backward compatibility. To be removed once Automake 1.9.x +# dies out for good. For more background, see: +# +# +mkdir_p='$(MKDIR_P)' + +# We need awk for the "check" target (and possibly the TAP driver). The +# system "awk" is bad on some platforms. +# Always define AMTAR for backward compatibility. Yes, it's still used +# in the wild :-( We should find a proper way to deprecate it ... +AMTAR='$${TAR-tar}' + + +# We'll loop over all known methods to create a tar archive until one works. +_am_tools='gnutar pax cpio none' + +am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' + + + + + + +# POSIX will say in a future version that running "rm -f" with no argument +# is OK; and we want to be able to make that assumption in our Makefile +# recipes. So use an aggressive probe to check that the usage we want is +# actually supported "in the wild" to an acceptable degree. +# See automake bug#10828. +# To make any issue more visible, cause the running configure to be aborted +# by default if the 'rm' program in use doesn't match our expectations; the +# user can still override this though. +if rm -f && rm -fr && rm -rf; then : OK; else + cat >&2 <<'END' +Oops! + +Your 'rm' program seems unable to run without file operands specified +on the command line, even when the '-f' option is present. This is contrary +to the behaviour of most rm programs out there, and not conforming with +the upcoming POSIX standard: + +Please tell bug-automake@gnu.org about your system, including the value +of your $PATH and any error possibly output before this message. This +can help us improve future automake versions. + +END + if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then + echo 'Configuration will proceed anyway, since you have set the' >&2 + echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 + echo >&2 + else + cat >&2 <<'END' +Aborting the configuration process, to ensure you take notice of the issue. + +You can download and install GNU coreutils to get an 'rm' implementation +that behaves properly: . + +If you want to complete the configuration process using your problematic +'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM +to "yes", and re-run configure. + +END + as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 + fi +fi + + + + +ac_config_headers="$ac_config_headers config.h" + +ac_config_headers="$ac_config_headers ffcall-version.h:ffcall-version.in.h" + + +ac_config_files="$ac_config_files Makefile" + +ac_config_files="$ac_config_files gnulib-lib/Makefile" + +ac_config_files="$ac_config_files avcall/Makefile" + +ac_config_files="$ac_config_files vacall/Makefile" + +ac_config_files="$ac_config_files trampoline/Makefile" + +ac_config_files="$ac_config_files callback/Makefile" + +ac_config_files="$ac_config_files callback/vacall_r/Makefile" + +ac_config_files="$ac_config_files callback/trampoline_r/Makefile" + + + +sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' + +version_major=`echo "${PACKAGE_VERSION}" | sed -n -e "$sed_extract_major"` +version_minor=`echo "${PACKAGE_VERSION}" | sed -n -e "$sed_extract_minor"` +HEXVERSION=`printf '0x%02X%02X' $version_major $version_minor` + +printf "%s\n" "#define LIBFFCALL_VERSION $HEXVERSION" >>confdefs.h + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +printf %s "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`printf "%s\n" "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval test \${ac_cv_prog_make_${ac_make}_set+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + SET_MAKE= +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +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 +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="gcc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_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" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +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 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}clang", so it can be a program name with args. +set dummy ${ac_tool_prefix}clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CC="${ac_tool_prefix}clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +printf "%s\n" "$CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "clang", so it can be a program name with args. +set dummy clang; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="clang" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +printf "%s\n" "$ac_ct_CC" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +fi + + +test -z "$CC" && { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion -version; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM 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. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +printf %s "checking whether the C compiler works... " >&6; } +ac_link_default=`printf "%s\n" "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test ${ac_cv_exeext+y} && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else $as_nop + ac_file='' +fi +if test -z "$ac_file" +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +printf %s "checking for C compiler default output file name... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +printf "%s\n" "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +printf %s "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +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 | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +printf "%s\n" "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +printf %s "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +printf "%s\n" "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +printf %s "checking for suffix of object files... " >&6; } +if test ${ac_cv_objext+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +printf "%s\n" "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else $as_nop + printf "%s\n" "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +printf "%s\n" "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C" >&5 +printf %s "checking whether the compiler supports GNU C... " >&6; } +if test ${ac_cv_c_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_c_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+y} +ac_save_CFLAGS=$CFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +printf %s "checking whether $CC accepts -g... " >&6; } +if test ${ac_cv_prog_cc_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +else $as_nop + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +printf "%s\n" "$ac_cv_prog_cc_g" >&6; } +if test $ac_test_CFLAGS; 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 +ac_prog_cc_stdc=no +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C11 features" >&5 +printf %s "checking for $CC option to enable C11 features... " >&6; } +if test ${ac_cv_prog_cc_c11+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c11=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c11_program +_ACEOF +for ac_arg in '' -std=gnu11 +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c11=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c11" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c11" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c11" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c11" >&5 +printf "%s\n" "$ac_cv_prog_cc_c11" >&6; } + CC="$CC $ac_cv_prog_cc_c11" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11 + ac_prog_cc_stdc=c11 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C99 features" >&5 +printf %s "checking for $CC option to enable C99 features... " >&6; } +if test ${ac_cv_prog_cc_c99+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c99=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c99_program +_ACEOF +for ac_arg in '' -std=gnu99 -std=c99 -c99 -qlanglvl=extc1x -qlanglvl=extc99 -AC99 -D_STDC_C99= +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c99=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c99" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c99" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c99" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 +printf "%s\n" "$ac_cv_prog_cc_c99" >&6; } + CC="$CC $ac_cv_prog_cc_c99" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 + ac_prog_cc_stdc=c99 +fi +fi +if test x$ac_prog_cc_stdc = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC option to enable C89 features" >&5 +printf %s "checking for $CC option to enable C89 features... " >&6; } +if test ${ac_cv_prog_cc_c89+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_c_conftest_c89_program +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +fi + +if test "x$ac_cv_prog_cc_c89" = xno +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +printf "%s\n" "unsupported" >&6; } +else $as_nop + if test "x$ac_cv_prog_cc_c89" = x +then : + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +printf "%s\n" "none needed" >&6; } +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +printf "%s\n" "$ac_cv_prog_cc_c89" >&6; } + CC="$CC $ac_cv_prog_cc_c89" +fi + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 + ac_prog_cc_stdc=c89 +fi +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 + + + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 +printf %s "checking whether $CC understands -c and -o together... " >&6; } +if test ${am_cv_prog_cc_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF + # Make sure it works both with $CC and with simple cc. + # Following AC_PROG_CC_C_O, we do the test twice because some + # compilers refuse to overwrite an existing .o file with -o, + # though they will create one. + am_cv_prog_cc_c_o=yes + for am_i in 1 2; do + if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 + ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } \ + && test -f conftest2.$ac_objext; then + : OK + else + am_cv_prog_cc_c_o=no + break + fi + done + rm -f core conftest* + unset am_i +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 +printf "%s\n" "$am_cv_prog_cc_c_o" >&6; } +if test "$am_cv_prog_cc_c_o" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +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 + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler is clang" >&5 +printf %s "checking whether the compiler is clang... " >&6; } +if test ${gl_cv_compiler_clang+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #ifdef __clang__ + barfbarf + #endif + +int +main (void) +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_compiler_clang=no +else $as_nop + gl_cv_compiler_clang=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_compiler_clang" >&5 +printf "%s\n" "$gl_cv_compiler_clang" >&6; } + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for compiler option needed when checking for declarations" >&5 +printf %s "checking for compiler option needed when checking for declarations... " >&6; } +if test ${gl_cv_compiler_check_decl_option+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $gl_cv_compiler_clang = yes; then + save_ac_compile="$ac_compile" + ac_compile="$ac_compile -Werror=implicit-function-declaration" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration' +else $as_nop + gl_cv_compiler_check_decl_option=none +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_compile="$save_ac_compile" + else + gl_cv_compiler_check_decl_option=none + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_compiler_check_decl_option" >&5 +printf "%s\n" "$gl_cv_compiler_check_decl_option" >&6; } + if test "x$gl_cv_compiler_check_decl_option" != xnone; then + ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option" + else + ac_compile_for_check_decl="$ac_compile" + fi + +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 +printf %s "checking whether ${MAKE-make} supports the include directive... " >&6; } +cat > confinc.mk << 'END' +am__doit: + @echo this is the am__doit target >confinc.out +.PHONY: am__doit +END +am__include="#" +am__quote= +# BSD make does it like this. +echo '.include "confinc.mk" # ignored' > confmf.BSD +# Other make implementations (GNU, Solaris 10, AIX) do it like this. +echo 'include confinc.mk # ignored' > confmf.GNU +_am_result=no +for s in GNU BSD; do + { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 + (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + case $?:`cat confinc.out 2>/dev/null` in #( + '0:this is the am__doit target') : + case $s in #( + BSD) : + am__include='.include' am__quote='"' ;; #( + *) : + am__include='include' am__quote='' ;; +esac ;; #( + *) : + ;; +esac + if test "$am__include" != "#"; then + _am_result="yes ($s style)" + break + fi +done +rm -f confinc.* confmf.* +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 +printf "%s\n" "${_am_result}" >&6; } + +# Check whether --enable-dependency-tracking was given. +if test ${enable_dependency_tracking+y} +then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' + am__nodep='_no' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CC" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CC_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +printf %s "checking how to run the C preprocessor... " >&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+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CC needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" 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. + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +printf "%s\n" "$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. + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +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 + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +if test $ac_cv_c_compiler_gnu = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 +printf %s "checking whether $CC needs -traditional... " >&6; } +if test ${ac_cv_prog_gcc_traditional+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_pattern="Autoconf.*'x'" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1 +then : + ac_cv_prog_gcc_traditional=yes +else $as_nop + ac_cv_prog_gcc_traditional=no +fi +rm -rf conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1 +then : + ac_cv_prog_gcc_traditional=yes +fi +rm -rf conftest* + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 +printf "%s\n" "$ac_cv_prog_gcc_traditional" >&6; } + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether using GNU C" >&5 +printf %s "checking whether using GNU C... " >&6; } +if test ${cl_cv_prog_cc_gcc+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __GNUC__ + yes + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + cl_cv_prog_cc_gcc=yes +else $as_nop + cl_cv_prog_cc_gcc=no +fi +rm -rf conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cl_cv_prog_cc_gcc" >&5 +printf "%s\n" "$cl_cv_prog_cc_gcc" >&6; } + if test $cl_cv_prog_cc_gcc = yes; then + CC_GCC=true + GCC_X_NONE='-x none' + else + CC_GCC=false + GCC_X_NONE='' + fi + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER +MicrosoftCompiler +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "MicrosoftCompiler" >/dev/null 2>&1 +then : + rm -f conftest* + echo 'int dummy;' > conftest.c + { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } >/dev/null 2>&1 + if test -f conftest.o; then + gl_asmext='s' + gl_c_asm_opt='-S' + else + gl_asmext='asm' + gl_c_asm_opt='-c -Fa' + fi + rm -f conftest* + +else $as_nop + gl_asmext='s' + gl_c_asm_opt='-S' + +fi +rm -rf conftest* + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C symbols are prefixed with underscore at the linker level" >&5 +printf %s "checking whether C symbols are prefixed with underscore at the linker level... " >&6; } +if test ${gl_cv_prog_as_underscore+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } >/dev/null 2>&1 + if LC_ALL=C $EGREP '(^|[^a-zA-Z0-9_])_foo([^a-zA-Z0-9_]|$)' conftest.$gl_asmext >/dev/null; then + gl_cv_prog_as_underscore=yes + else + gl_cv_prog_as_underscore=no + fi + rm -f conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_prog_as_underscore" >&5 +printf "%s\n" "$gl_cv_prog_as_underscore" >&6; } + if test $gl_cv_prog_as_underscore = yes; then + USER_LABEL_PREFIX=_ + else + USER_LABEL_PREFIX= + fi + +printf "%s\n" "#define USER_LABEL_PREFIX $USER_LABEL_PREFIX" >>confdefs.h + + ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"' + + + + + if test "$USER_LABEL_PREFIX" = '_'; then + AS_UNDERSCORE=true + else + AS_UNDERSCORE=false + fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to use C++" >&5 +printf %s "checking whether to use C++... " >&6; } + # Check whether --enable-c++ was given. +if test ${enable_c__+y} +then : + enableval=$enable_c__; CXX_CHOICE="$enableval" +else $as_nop + CXX_CHOICE=yes +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX_CHOICE" >&5 +printf "%s\n" "$CXX_CHOICE" >&6; } + + + + + + if test "$CXX_CHOICE" = no; then + CXX=no + fi + if test -z "$CXX"; then + if test -n "$CCC"; then + CXX="$CCC" + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi + fi + if test "$CXX" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +printf %s "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works... " >&6; } + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + echo 'int main () { return 0; }' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + gl_cv_prog_ansicxx_works=yes + if (./conftest; exit) 2>/dev/null; then + gl_cv_prog_ansicxx_cross=no + else + gl_cv_prog_ansicxx_cross=yes + fi + else + gl_cv_prog_ansicxx_works=no + fi + rm -fr conftest* + 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 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_prog_ansicxx_works" >&5 +printf "%s\n" "$gl_cv_prog_ansicxx_works" >&6; } + if test $gl_cv_prog_ansicxx_works = no; then + CXX=no + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler supports namespaces" >&5 +printf %s "checking whether the C++ compiler supports namespaces... " >&6; } + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat < conftest.$ac_ext +#include +namespace test { using namespace std; } +std::ostream* ptr; +int main () { return 0; } +EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + gl_cv_prog_ansicxx_namespaces=yes + else + gl_cv_prog_ansicxx_namespaces=no + fi + rm -fr conftest* + 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 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_prog_ansicxx_namespaces" >&5 +printf "%s\n" "$gl_cv_prog_ansicxx_namespaces" >&6; } + if test $gl_cv_prog_ansicxx_namespaces = no; then + CXX=no + fi + fi + fi + + + + if test "$CXX" != no; then + ANSICXX_TRUE= + ANSICXX_FALSE='#' +else + ANSICXX_TRUE='#' + ANSICXX_FALSE= +fi + + + if test "$CXX" != no; then + +depcc="$CXX" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + if test $ac_compiler_gnu = yes; then + GXX=yes + else + GXX= + fi + ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +else $as_nop + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else $as_nop + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +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 + + else + if false; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + fi + +if test "$CXX" != no; then + IF_CXX='' +else + IF_CXX='# ' +fi + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for Minix Amsterdam compiler" >&5 +printf %s "checking for Minix Amsterdam compiler... " >&6; } +if test ${gl_cv_c_amsterdam_compiler+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __ACK__ +Amsterdam +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Amsterdam" >/dev/null 2>&1 +then : + gl_cv_c_amsterdam_compiler=yes +else $as_nop + gl_cv_c_amsterdam_compiler=no +fi +rm -rf conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_amsterdam_compiler" >&5 +printf "%s\n" "$gl_cv_c_amsterdam_compiler" >&6; } + + if test $gl_cv_c_amsterdam_compiler = yes; then + if test -z "$AR"; then + AR='cc -c.a' + fi + if test -z "$ARFLAGS"; then + ARFLAGS='-o' + fi + else + : + fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. +set dummy ${ac_tool_prefix}ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="${ac_tool_prefix}ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AR"; then + ac_ct_AR=$AR + # Extract the first word of "ar", so it can be a program name with args. +set dummy ar; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="ar" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_AR" = x; then + AR="ar" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +else + AR="$ac_cv_prog_AR" +fi + + if test -z "$ARFLAGS"; then + ARFLAGS='cr' + fi + + + + if test -z "$RANLIB"; then + if test $gl_cv_c_amsterdam_compiler = yes; then + RANLIB=':' + else + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + + fi + fi + + + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef _MSC_VER +MicrosoftCompiler +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "MicrosoftCompiler" >/dev/null 2>&1 +then : + IF_MSVC='' + IFNOT_MSVC='# ' + +else $as_nop + IF_MSVC='# ' + IFNOT_MSVC='' + +fi +rm -rf conftest* + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to make hard links" >&5 +printf %s "checking how to make hard links... " >&6; } +if test ${cl_cv_prog_LN+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -f conftestdata conftestfile + echo data > conftestfile + if ln conftestfile conftestdata 2>/dev/null; then + cl_cv_prog_LN=ln + else + cl_cv_prog_LN="cp -p" + fi + rm -f conftestdata conftestfile + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cl_cv_prog_LN" >&5 +printf "%s\n" "$cl_cv_prog_LN" >&6; } + LN="$cl_cv_prog_LN" + + + +ac_header= ac_cache= +for ac_item in $ac_header_c_list +do + if test $ac_cache; then + ac_fn_c_check_header_compile "$LINENO" $ac_header ac_cv_header_$ac_cache "$ac_includes_default" + if eval test \"x\$ac_cv_header_$ac_cache\" = xyes; then + printf "%s\n" "#define $ac_item 1" >> confdefs.h + fi + ac_header= ac_cache= + elif test $ac_header; then + ac_cache=$ac_item + else + ac_header=$ac_item + fi +done + + + + + + + + +if test $ac_cv_header_stdlib_h = yes && test $ac_cv_header_string_h = yes +then : + +printf "%s\n" "#define STDC_HEADERS 1" >>confdefs.h + +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5 +printf %s "checking whether it is safe to define __EXTENSIONS__... " >&6; } +if test ${ac_cv_safe_to_define___extensions__+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +# define __EXTENSIONS__ 1 + $ac_includes_default +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_safe_to_define___extensions__=yes +else $as_nop + ac_cv_safe_to_define___extensions__=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5 +printf "%s\n" "$ac_cv_safe_to_define___extensions__" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether _XOPEN_SOURCE should be defined" >&5 +printf %s "checking whether _XOPEN_SOURCE should be defined... " >&6; } +if test ${ac_cv_should_define__xopen_source+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_should_define__xopen_source=no + if test $ac_cv_header_wchar_h = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define _XOPEN_SOURCE 500 + #include + mbstate_t x; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_should_define__xopen_source=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_should_define__xopen_source" >&5 +printf "%s\n" "$ac_cv_should_define__xopen_source" >&6; } + + printf "%s\n" "#define _ALL_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _DARWIN_C_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _GNU_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _HPUX_ALT_XOPEN_SOCKET_API 1" >>confdefs.h + + printf "%s\n" "#define _NETBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _OPENBSD_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_ATTRIBS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_BFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_DFP_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_FUNCS_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_IEC_60559_TYPES_EXT__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_LIB_EXT2__ 1" >>confdefs.h + + printf "%s\n" "#define __STDC_WANT_MATH_SPEC_FUNCS__ 1" >>confdefs.h + + printf "%s\n" "#define _TANDEM_SOURCE 1" >>confdefs.h + + if test $ac_cv_header_minix_config_h = yes +then : + MINIX=yes + printf "%s\n" "#define _MINIX 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_SOURCE 1" >>confdefs.h + + printf "%s\n" "#define _POSIX_1_SOURCE 2" >>confdefs.h + +else $as_nop + MINIX= +fi + if test $ac_cv_safe_to_define___extensions__ = yes +then : + printf "%s\n" "#define __EXTENSIONS__ 1" >>confdefs.h + +fi + if test $ac_cv_should_define__xopen_source = yes +then : + printf "%s\n" "#define _XOPEN_SOURCE 500" >>confdefs.h + +fi + + + + # Make sure we can run config.sub. +$SHELL "${ac_aux_dir}config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL ${ac_aux_dir}config.sub" "$LINENO" 5 + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +printf %s "checking build system type... " >&6; } +if test ${ac_cv_build+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "${ac_aux_dir}config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "${ac_aux_dir}config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +printf "%s\n" "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +printf %s "checking host system type... " >&6; } +if test ${ac_cv_host+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "${ac_aux_dir}config.sub" $host_alias` || + as_fn_error $? "$SHELL ${ac_aux_dir}config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +printf "%s\n" "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + + + + + + case "$host_os" in + openbsd*) + +printf "%s\n" "#define _ISOC11_SOURCE 1" >>confdefs.h + + ;; + esac + + + + + + + if test "$CXX_CHOICE" = no; then + CXX=no + fi + if test -z "$CXX"; then + if test -n "$CCC"; then + CXX="$CCC" + else + if test -n "$ac_tool_prefix"; then + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 +printf "%s\n" "$CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 +printf "%s\n" "$ac_ct_CXX" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_CXX" && break +done + + if test "x$ac_ct_CXX" = x; then + CXX=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CXX=$ac_ct_CXX + fi +fi + + fi + fi + if test "$CXX" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +printf %s "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works... " >&6; } + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + + echo 'int main () { return 0; }' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + gl_cv_prog_ansicxx_works=yes + if (./conftest; exit) 2>/dev/null; then + gl_cv_prog_ansicxx_cross=no + else + gl_cv_prog_ansicxx_cross=yes + fi + else + gl_cv_prog_ansicxx_works=no + fi + rm -fr conftest* + 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 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_prog_ansicxx_works" >&5 +printf "%s\n" "$gl_cv_prog_ansicxx_works" >&6; } + if test $gl_cv_prog_ansicxx_works = no; then + CXX=no + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C++ compiler supports namespaces" >&5 +printf %s "checking whether the C++ compiler supports namespaces... " >&6; } + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat < conftest.$ac_ext +#include +namespace test { using namespace std; } +std::ostream* ptr; +int main () { return 0; } +EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + gl_cv_prog_ansicxx_namespaces=yes + else + gl_cv_prog_ansicxx_namespaces=no + fi + rm -fr conftest* + 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 + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_prog_ansicxx_namespaces" >&5 +printf "%s\n" "$gl_cv_prog_ansicxx_namespaces" >&6; } + if test $gl_cv_prog_ansicxx_namespaces = no; then + CXX=no + fi + fi + fi + + + + if test "$CXX" != no; then + ANSICXX_TRUE= + ANSICXX_FALSE='#' +else + ANSICXX_TRUE='#' + ANSICXX_FALSE= +fi + + + if test "$CXX" != no; then + +depcc="$CXX" am_compiler_list= + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +printf %s "checking dependency style of $depcc... " >&6; } +if test ${am_cv_CXX_dependencies_compiler_type+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named 'D' -- because '-MD' means "put the output + # in D". + rm -rf conftest.dir + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with + # Solaris 10 /bin/sh. + echo '/* dummy */' > sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with '-c' and '-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle '-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs. + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # After this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested. + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvc7 | msvc7msys | msvisualcpp | msvcmsys) + # This compiler won't grok '-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5 +printf "%s\n" "$am_cv_CXX_dependencies_compiler_type" >&6; } +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports GNU C++" >&5 +printf %s "checking whether the compiler supports GNU C++... " >&6; } +if test ${ac_cv_cxx_compiler_gnu+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_compiler_gnu=yes +else $as_nop + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 +printf "%s\n" "$ac_cv_cxx_compiler_gnu" >&6; } +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + if test $ac_compiler_gnu = yes; then + GXX=yes + else + GXX= + fi + ac_test_CXXFLAGS=${CXXFLAGS+y} +ac_save_CXXFLAGS=$CXXFLAGS +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 +printf %s "checking whether $CXX accepts -g... " >&6; } +if test ${ac_cv_prog_cxx_g+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_cxx_werror_flag=$ac_cxx_werror_flag + ac_cxx_werror_flag=yes + ac_cv_prog_cxx_g=no + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +else $as_nop + CXXFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + +else $as_nop + ac_cxx_werror_flag=$ac_save_cxx_werror_flag + CXXFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO" +then : + ac_cv_prog_cxx_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cxx_werror_flag=$ac_save_cxx_werror_flag +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 +printf "%s\n" "$ac_cv_prog_cxx_g" >&6; } +if test $ac_test_CXXFLAGS; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +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 + + else + if false; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +fi + + fi + + + +# Check whether --enable-largefile was given. +if test ${enable_largefile+y} +then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +printf %s "checking for special C compiler options needed for large files... " >&6; } +if test ${ac_cv_sys_largefile_CC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF + if ac_fn_c_try_compile "$LINENO" +then : + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +printf "%s\n" "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +printf %s "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test ${ac_cv_sys_file_offset_bits+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +printf "%s\n" "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +printf "%s\n" "#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits" >>confdefs.h +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +printf %s "checking for _LARGE_FILES value needed for large files... " >&6; } +if test ${ac_cv_sys_large_files+y} +then : + printf %s "(cached) " >&6 +else $as_nop + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +printf "%s\n" "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +printf "%s\n" "#define _LARGE_FILES $ac_cv_sys_large_files" >>confdefs.h +;; +esac +rm -rf conftest* + fi +fi + + + + + + + + # Check whether --enable-threads was given. +if test ${enable_threads+y} +then : + enableval=$enable_threads; gl_use_threads=$enableval +else $as_nop + if test -n "$gl_use_threads_default"; then + gl_use_threads="$gl_use_threads_default" + else + case "$host_os" in + osf*) gl_use_threads=no ;; + cygwin*) + case `uname -r` in + 1.[0-5].*) gl_use_threads=no ;; + *) gl_use_threads=yes ;; + esac + ;; + mingw*) + case "$gl_use_winpthreads_default" in + yes) gl_use_threads=posix ;; + no) gl_use_threads=windows ;; + *) gl_use_threads=yes ;; + esac + ;; + *) gl_use_threads=yes ;; + esac + fi + +fi + + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = isoc \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + # For using or : + + + if test -z "$gl_anythreadlib_early_done"; then + case "$host_os" in + osf*) + # On OSF/1, the compiler needs the flag -D_REENTRANT so that it + # groks . cc also understands the flag -pthread, but + # we don't use it because 1. gcc-2.95 doesn't understand -pthread, + # 2. putting a flag into CPPFLAGS that has an effect on the linker + # causes the AC_LINK_IFELSE test below to succeed unexpectedly, + # leading to wrong values of LIBTHREAD and LTLIBTHREAD. + CPPFLAGS="$CPPFLAGS -D_REENTRANT" + ;; + esac + # Some systems optimize for single-threaded programs by default, and + # need special flags to disable these optimizations. For example, the + # definition of 'errno' in . + case "$host_os" in + aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; + solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; + esac + gl_anythreadlib_early_done=done + fi + + fi + + + + # Pre-early section. + + + + + # Code from module absolute-header: + # Code from module alloca-opt: + # Code from module ansi-c++-opt: + + # Code from module asyncsafe-spin: + # Code from module attribute: + # Code from module basename-lgpl: + # Code from module c99: + # Code from module clean-temp-simple: + # Code from module cloexec: + # Code from module close: + # Code from module double-slash-root: + # Code from module dup2: + # Code from module errno: + # Code from module error: + # Code from module extensions: + # Code from module extern-inline: + # Code from module fatal-signal: + # Code from module fcntl: + # Code from module fcntl-h: + # Code from module fd-hook: + # Code from module filename: + # Code from module fstat: + # Code from module getdtablesize: + # Code from module getprogname: + # Code from module gettext-h: + # Code from module host-cpu-c-abi: + # Code from module idx: + # Code from module include_next: + # Code from module intprops: + # Code from module largefile: + + # Code from module limits-h: + # Code from module linkedhash-list: + # Code from module list: + # Code from module lock: + # Code from module malloca: + # Code from module msvc-inval: + # Code from module msvc-nothrow: + # Code from module multiarch: + # Code from module nocrash: + # Code from module open: + # Code from module pathmax: + # Code from module raise: + # Code from module rmdir: + # Code from module sigaction: + # Code from module signal-h: + # Code from module sigprocmask: + # Code from module size_max: + # Code from module snippet/_Noreturn: + # Code from module snippet/arg-nonnull: + # Code from module snippet/c++defs: + # Code from module snippet/warn-on-use: + # Code from module sparcv8+: + + + + case "$host_cpu" in + sparc*) + if test -n "$GCC"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether SPARC v8+ instructions are supported" >&5 +printf %s "checking whether SPARC v8+ instructions are supported... " >&6; } +if test ${gl_cv_sparc_v8plus+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +asm volatile ("membar 2"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sparc_v8plus=yes +else $as_nop + gl_cv_sparc_v8plus=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sparc_v8plus" >&5 +printf "%s\n" "$gl_cv_sparc_v8plus" >&6; } + if test $gl_cv_sparc_v8plus = no; then + CC="$CC -mcpu=v9" + CXX="$CXX -mcpu=v9" + fi + fi + ;; + esac + + # Code from module ssize_t: + # Code from module stat: + # Code from module stat-time: + # Code from module std-gnu11: + # Code from module stdbool: + # Code from module stddef: + # Code from module stdint: + # Code from module stdio: + # Code from module stdnoreturn: + # Code from module strerror: + # Code from module strerror-override: + # Code from module string: + # Code from module sys_stat: + # Code from module sys_types: + # Code from module thread-optim: + # Code from module threadlib: + + + + # Code from module time: + # Code from module unistd: + # Code from module verify: + # Code from module windows-mutex: + # Code from module windows-once: + # Code from module windows-recmutex: + # Code from module windows-rwlock: + # Code from module windows-spin: + # Code from module xalloc-oversized: + # Code from module xsize: + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking host CPU and C ABI" >&5 +printf %s "checking host CPU and C ABI... " >&6; } +if test ${gl_cv_host_cpu_c_abi+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_cpu" in + + i[34567]86 ) + gl_cv_host_cpu_c_abi=i386 + ;; + + x86_64 ) + # On x86_64 systems, the C compiler may be generating code in one of + # these ABIs: + # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. + # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 + # with native Windows (mingw, MSVC). + # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if (defined __x86_64__ || defined __amd64__ \ + || defined _M_X64 || defined _M_AMD64) + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __ILP32__ || defined _ILP32 + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi=x86_64-x32 +else $as_nop + gl_cv_host_cpu_c_abi=x86_64 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +else $as_nop + gl_cv_host_cpu_c_abi=i386 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) + gl_cv_host_cpu_c_abi=alpha + ;; + + arm* | aarch64 ) + # Assume arm with EABI. + # On arm64 systems, the C compiler may be generating code in one of + # these ABIs: + # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. + # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __aarch64__ + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __ILP32__ || defined _ILP32 + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi=arm64-ilp32 +else $as_nop + gl_cv_host_cpu_c_abi=arm64 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +else $as_nop + # Don't distinguish little-endian and big-endian arm, since they + # don't require different machine code for simple operations and + # since the user can distinguish them through the preprocessor + # defines __ARMEL__ vs. __ARMEB__. + # But distinguish arm which passes floating-point arguments and + # return values in integer registers (r0, r1, ...) - this is + # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which + # passes them in float registers (s0, s1, ...) and double registers + # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer + # sets the preprocessor defines __ARM_PCS (for the first case) and + # __ARM_PCS_VFP (for the second case), but older GCC does not. + echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c + # Look for a reference to the register d0 in the .s file. + { ac_try='${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } >/dev/null 2>&1 + if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then + gl_cv_host_cpu_c_abi=armhf + else + gl_cv_host_cpu_c_abi=arm + fi + rm -f conftest* + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) + # On hppa, the C compiler may be generating 32-bit code or 64-bit + # code. In the latter case, it defines _LP64 and __LP64__. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __LP64__ + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi=hppa64 +else $as_nop + gl_cv_host_cpu_c_abi=hppa +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + ia64* ) + # On ia64 on HP-UX, the C compiler may be generating 64-bit code or + # 32-bit code. In the latter case, it defines _ILP32. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef _ILP32 + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi=ia64-ilp32 +else $as_nop + gl_cv_host_cpu_c_abi=ia64 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + mips* ) + # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this + # at 32. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi=mips64 +else $as_nop + # In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but + # may later get defined by ), and _MIPS_SIM == _ABIN32. + # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but + # may later get defined by ), and _MIPS_SIM == _ABIO32. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if (_MIPS_SIM == _ABIN32) + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi=mipsn32 +else $as_nop + gl_cv_host_cpu_c_abi=mips +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + powerpc* ) + # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. + # No need to distinguish them here; the caller may distinguish + # them based on the OS. + # On powerpc64 systems, the C compiler may still be generating + # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may + # be generating 64-bit code. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __powerpc64__ || defined __LP64__ + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + # On powerpc64, there are two ABIs on Linux: The AIX compatible + # one and the ELFv2 one. The latter defines _CALL_ELF=2. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined _CALL_ELF && _CALL_ELF == 2 + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi=powerpc64-elfv2 +else $as_nop + gl_cv_host_cpu_c_abi=powerpc64 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +else $as_nop + gl_cv_host_cpu_c_abi=powerpc +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + rs6000 ) + gl_cv_host_cpu_c_abi=powerpc + ;; + + riscv32 | riscv64 ) + # There are 2 architectures (with variants): rv32* and rv64*. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if __riscv_xlen == 64 + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + cpu=riscv64 +else $as_nop + cpu=riscv32 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. + # Size of 'long' and 'void *': + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __LP64__ + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + main_abi=lp64 +else $as_nop + main_abi=ilp32 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + # Float ABIs: + # __riscv_float_abi_double: + # 'float' and 'double' are passed in floating-point registers. + # __riscv_float_abi_single: + # 'float' are passed in floating-point registers. + # __riscv_float_abi_soft: + # No values are passed in floating-point registers. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __riscv_float_abi_double + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + float_abi=d +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __riscv_float_abi_single + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + float_abi=f +else $as_nop + float_abi='' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}" + ;; + + s390* ) + # On s390x, the C compiler may be generating 64-bit (= s390x) code + # or 31-bit (= s390) code. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __LP64__ || defined __s390x__ + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi=s390x +else $as_nop + gl_cv_host_cpu_c_abi=s390 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + sparc | sparc64 ) + # UltraSPARCs running Linux have `uname -m` = "sparc64", but the + # C compiler still generates 32-bit code. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_host_cpu_c_abi=sparc64 +else $as_nop + gl_cv_host_cpu_c_abi=sparc +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + ;; + + *) + gl_cv_host_cpu_c_abi="$host_cpu" + ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_host_cpu_c_abi" >&5 +printf "%s\n" "$gl_cv_host_cpu_c_abi" >&6; } + + HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'` + HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi" + + + + # This was + # AC_DEFINE_UNQUOTED([__${HOST_CPU}__]) + # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__]) + # earlier, but KAI C++ 3.2d doesn't like this. + sed -e 's/-/_/g' >> confdefs.h <&5 +printf %s "checking endianness... " >&6; } +if test ${ffcall_cv_endianness+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined __ARMEL__ + yes + #endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + ffcall_cv_endianness=little +else $as_nop + ffcall_cv_endianness=big +fi +rm -rf conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ffcall_cv_endianness" >&5 +printf "%s\n" "$ffcall_cv_endianness" >&6; } + ;; + mips* ) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking endianness" >&5 +printf %s "checking endianness... " >&6; } +if test ${ffcall_cv_endianness+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Compilers on IRIX define only _MIPSEB as indicator. + # Compilers on Linux define _MIPSEB, __MIPSEB__, __MIPSEB or - in + # the opposite case - _MIPSEL, __MIPSEL__, __MIPSEL. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined _MIPSEB + yes + #endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + ffcall_cv_endianness=big +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined _MIPSEL + yes + #endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + ffcall_cv_endianness=little +else $as_nop + ffcall_cv_endianness=unknown +fi +rm -rf conftest* + +fi +rm -rf conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ffcall_cv_endianness" >&5 +printf "%s\n" "$ffcall_cv_endianness" >&6; } + ;; + powerpc*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking endianness" >&5 +printf %s "checking endianness... " >&6; } +if test ${ffcall_cv_endianness+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Compilers on AIX and Linux define _BIG_ENDIAN, __BIG_ENDIAN__ or + # - in the opposite case - _LITTLE_ENDIAN, __LITTLE_ENDIAN__. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined _BIG_ENDIAN + yes + #endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + ffcall_cv_endianness=big +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined _LITTLE_ENDIAN + yes + #endif +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + ffcall_cv_endianness=little +else $as_nop + ffcall_cv_endianness=unknown +fi +rm -rf conftest* + +fi +rm -rf conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ffcall_cv_endianness" >&5 +printf "%s\n" "$ffcall_cv_endianness" >&6; } + ;; + *) ffcall_cv_endianness=known ;; + esac + case "$ffcall_cv_endianness" in + big) ENDIANNESS='eb' ;; + little) ENDIANNESS='el' ;; + *) ENDIANNESS='' ;; + esac + + + +PACKAGE=libffcall +case `pwd` in + *\ * | *\ *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +printf "%s\n" "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4.6' +macro_revision='2.4.6' + + + + + + + + + + + + + + +ltmain=$ac_aux_dir/ltmain.sh + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +printf %s "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case $ECHO in + printf*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +printf "%s\n" "printf" >&6; } ;; + print*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +printf "%s\n" "print -r" >&6; } ;; + *) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +printf "%s\n" "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +printf %s "checking for a sed that does not truncate output... " >&6; } +if test ${ac_cv_path_SED+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in sed gsed + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_SED" || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +printf "%s\n" "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +printf %s "checking for fgrep... " >&6; } +if test ${ac_cv_path_FGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in fgrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_FGREP" || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +printf "%s\n" "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test ${with_gnu_ld+y} +then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else $as_nop + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } +fi +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +printf %s "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if test ${lt_cv_path_NM+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +printf "%s\n" "$lt_cv_path_NM" >&6; } +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +printf "%s\n" "$DUMPBIN" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DUMPBIN+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +printf "%s\n" "$ac_ct_DUMPBIN" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +printf %s "checking the name lister ($NM) interface... " >&6; } +if test ${lt_cv_nm_interface+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +printf "%s\n" "$lt_cv_nm_interface" >&6; } + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +printf %s "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +printf "%s\n" "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +printf %s "checking the maximum length of command line arguments... " >&6; } +if test ${lt_cv_sys_max_cmd_len+y} +then : + printf %s "(cached) " >&6 +else $as_nop + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n "$lt_cv_sys_max_cmd_len"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +printf "%s\n" "$lt_cv_sys_max_cmd_len" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: none" >&5 +printf "%s\n" "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +printf %s "checking how to convert $build file names to $host format... " >&6; } +if test ${lt_cv_to_host_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +printf %s "checking how to convert $build file names to toolchain format... " >&6; } +if test ${lt_cv_to_tool_file_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +printf "%s\n" "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +printf %s "checking for $LD option to reload object files... " >&6; } +if test ${lt_cv_ld_reload_flag+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_reload_flag='-r' +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +printf "%s\n" "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test yes != "$GCC"; then + reload_cmds=false + fi + ;; + darwin*) + if test yes = "$GCC"; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +printf %s "checking how to recognize dependent libraries... " >&6; } +if test ${lt_cv_deplibs_check_method+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly* | midnightbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +printf "%s\n" "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +printf %s "checking how to associate runtime and link libraries... " >&6; } +if test ${lt_cv_sharedlib_from_linklib_cmd+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +printf "%s\n" "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + 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 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +printf "%s\n" "$AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AR+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AR="$ac_prog" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +printf "%s\n" "$ac_ct_AR" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +printf %s "checking for archiver @FILE support... " >&6; } +if test ${lt_cv_ar_at_file+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +printf "%s\n" "$lt_cv_ar_at_file" >&6; } + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +printf "%s\n" "$STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_STRIP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +printf "%s\n" "$ac_ct_STRIP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +printf "%s\n" "$RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_RANLIB+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +printf "%s\n" "$ac_ct_RANLIB" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +printf %s "checking command to parse $NM output from $compiler object... " >&6; } +if test ${lt_cv_sys_global_symbol_pipe+y} +then : + printf %s "(cached) " >&6 +else $as_nop + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BCDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +printf "%s\n" "failed" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +printf "%s\n" "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +printf %s "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test ${with_sysroot+y} +then : + withval=$with_sysroot; +else $as_nop + with_sysroot=no +fi + + +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 +printf "%s\n" "$with_sysroot" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +printf "%s\n" "${lt_sysroot:-no}" >&6; } + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 +printf %s "checking for a working dd... " >&6; } +if test ${ac_cv_path_lt_DD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +if test -z "$lt_DD"; then + ac_path_lt_DD_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in dd + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_lt_DD="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_lt_DD" || continue +if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi + $ac_path_lt_DD_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_lt_DD"; then + : + fi +else + ac_cv_path_lt_DD=$lt_DD +fi + +rm -f conftest.i conftest2.i conftest.out +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 +printf "%s\n" "$ac_cv_path_lt_DD" >&6; } + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 +printf %s "checking how to truncate binary pipes... " >&6; } +if test ${lt_cv_truncate_bin+y} +then : + printf %s "(cached) " >&6 +else $as_nop + printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 +printf "%s\n" "$lt_cv_truncate_bin" >&6; } + + + + + + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + +# Check whether --enable-libtool-lock was given. +if test ${enable_libtool_lock+y} +then : + enableval=$enable_libtool_lock; +fi + +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +printf %s "checking whether the C compiler needs -belf... " >&6; } +if test ${lt_cv_cc_needs_belf+y} +then : + printf %s "(cached) " >&6 +else $as_nop + 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 + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_cc_needs_belf=yes +else $as_nop + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext 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 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +printf "%s\n" "$lt_cv_cc_needs_belf" >&6; } + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +printf "%s\n" "$MANIFEST_TOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_MANIFEST_TOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +printf "%s\n" "$ac_ct_MANIFEST_TOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +printf %s "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if test ${lt_cv_path_mainfest_tool+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +printf "%s\n" "$lt_cv_path_mainfest_tool" >&6; } +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +printf "%s\n" "$DSYMUTIL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DSYMUTIL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +printf "%s\n" "$ac_ct_DSYMUTIL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +printf "%s\n" "$NMEDIT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_NMEDIT+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +printf "%s\n" "$ac_ct_NMEDIT" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +printf "%s\n" "$LIPO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_LIPO+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_LIPO="lipo" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +printf "%s\n" "$ac_ct_LIPO" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +printf "%s\n" "$OTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL="otool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +printf "%s\n" "$ac_ct_OTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +printf "%s\n" "$OTOOL64" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OTOOL64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +printf "%s\n" "$ac_ct_OTOOL64" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +printf %s "checking for -single_module linker flag... " >&6; } +if test ${lt_cv_apple_cc_single_mod+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&5 + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +printf "%s\n" "$lt_cv_apple_cc_single_mod" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +printf %s "checking for -exported_symbols_list linker flag... " >&6; } +if test ${lt_cv_ld_exported_symbols_list+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_ld_exported_symbols_list=yes +else $as_nop + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +printf "%s\n" "$lt_cv_ld_exported_symbols_list" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +printf %s "checking for -force_load linker flag... " >&6; } +if test ${lt_cv_ld_force_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&5 + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +printf "%s\n" "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[012][,.]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + +ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes +then : + printf "%s\n" "#define HAVE_DLFCN_H 1" >>confdefs.h + +fi + + + + +func_stripname_cnf () +{ + case $2 in + .*) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%\\\\$2\$%%"`;; + *) func_stripname_result=`$ECHO "$3" | $SED "s%^$1%%; s%$2\$%%"`;; + esac +} # func_stripname_cnf + + + + + +# Set options +enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. +set dummy ${ac_tool_prefix}as; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_AS+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$AS"; then + ac_cv_prog_AS="$AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_AS="${ac_tool_prefix}as" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AS=$ac_cv_prog_AS +if test -n "$AS"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 +printf "%s\n" "$AS" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_AS"; then + ac_ct_AS=$AS + # Extract the first word of "as", so it can be a program name with args. +set dummy as; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_AS+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_AS"; then + ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_AS="as" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AS=$ac_cv_prog_ac_ct_AS +if test -n "$ac_ct_AS"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 +printf "%s\n" "$ac_ct_AS" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_AS" = x; then + AS="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AS=$ac_ct_AS + fi +else + AS="$ac_cv_prog_AS" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +printf "%s\n" "$DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_DLLTOOL+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +printf "%s\n" "$ac_ct_DLLTOOL" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +printf "%s\n" "$OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +printf %s "checking for $ac_word... " >&6; } +if test ${ac_cv_prog_ac_ct_OBJDUMP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +printf "%s\n" "$ac_ct_OBJDUMP" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + + ;; +esac + +test -z "$AS" && AS=as + + + + + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + enable_dlopen=no + + + + # Check whether --enable-shared was given. +if test ${enable_shared+y} +then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test ${enable_static+y} +then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test ${with_pic+y} +then : + withval=$with_pic; lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + pic_mode=default +fi + + + + + + + + + # Check whether --enable-fast-install was given. +if test ${enable_fast_install+y} +then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac +else $as_nop + enable_fast_install=yes +fi + + + + + + + + + shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[5-9]*,yes) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 +printf %s "checking which variant of shared library versioning to provide... " >&6; } + +# Check whether --with-aix-soname was given. +if test ${with_aix_soname+y} +then : + withval=$with_aix_soname; case $withval in + aix|svr4|both) + ;; + *) + as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname +else $as_nop + if test ${lt_cv_with_aix_soname+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_with_aix_soname=aix +fi + + with_aix_soname=$lt_cv_with_aix_soname +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 +printf "%s\n" "$with_aix_soname" >&6; } + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +printf %s "checking for objdir... " >&6; } +if test ${lt_cv_objdir+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +printf "%s\n" "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +printf "%s\n" "#define LT_OBJDIR \"$lt_cv_objdir/\"" >>confdefs.h + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +printf %s "checking for ${ac_tool_prefix}file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/${ac_tool_prefix}file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac +fi + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +printf %s "checking for file... " >&6; } +if test ${lt_cv_path_MAGIC_CMD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/file"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac +fi + +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +printf "%s\n" "$MAGIC_CMD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC=$CC +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 + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +printf %s "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if test ${lt_cv_prog_compiler_rtti_exceptions+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +printf "%s\n" "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test yes = "$GCC"; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + lt_prog_compiler_pic='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + if test -n "$lt_prog_compiler_pic"; then + lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ F* | *Sun*Fortran*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + *Intel*\ [CF]*Compiler*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + *Portland\ Group*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works"; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_static_works=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works"; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } + if test no = "$hard_links"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + export_dynamic_flag_spec='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='$wl--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + export_dynamic_flag_spec='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test no = "$ld_shlibs"; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct=no + hardcode_direct_absolute=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + export_dynamic_flag_spec='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath_+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' $wl-bernotok' + allow_undefined_flag=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly* | midnightbsd*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test yes = "$GCC"; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +printf %s "checking if $CC understands -b... " >&6; } +if test ${lt_cv_prog_compiler__b+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler__b=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +printf "%s\n" "$lt_cv_prog_compiler__b" >&6; } + +if test yes = "$lt_cv_prog_compiler__b"; then + archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec='$wl+b $wl$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +printf %s "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if test ${lt_cv_irix_exported_symbol+y} +then : + printf %s "(cached) " >&6 +else $as_nop + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + lt_cv_irix_exported_symbol=yes +else $as_nop + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +printf "%s\n" "$lt_cv_irix_exported_symbol" >&6; } + if test yes = "$lt_cv_irix_exported_symbol"; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + ld_shlibs=yes + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + export_dynamic_flag_spec='$wl-E' + else + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='$wl-rpath,$libdir' + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + shrext_cmds=.dll + archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes=yes + ;; + + osf3*) + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + allow_undefined_flag=' $wl-expect_unresolved $wl\*' + archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='$wl-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='$wl-z,text' + allow_undefined_flag='$wl-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='$wl-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='$wl-Blargedynsym' + ;; + esac + fi + fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +printf "%s\n" "$ld_shlibs" >&6; } +test no = "$ld_shlibs" && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc+y} +then : + printf %s "(cached) " >&6 +else $as_nop + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } + +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([A-Za-z]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + + + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly* | midnightbsd*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test yes = "$hardcode_automatic"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && + test no != "$hardcode_minus_L"; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +printf "%s\n" "$hardcode_action" >&6; } + +if test relink = "$hardcode_action" || + test yes = "$inherit_rpath"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dl_dlopen=yes +else $as_nop + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else $as_nop + + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes +then : + lt_cv_dlopen=shl_load +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +printf %s "checking for shl_load in -ldld... " >&6; } +if test ${ac_cv_lib_dld_shl_load+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char shl_load (); +int +main (void) +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dld_shl_load=yes +else $as_nop + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +printf "%s\n" "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes +then : + lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld +else $as_nop + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes +then : + lt_cv_dlopen=dlopen +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +printf %s "checking for dlopen in -ldl... " >&6; } +if test ${ac_cv_lib_dl_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dl_dlopen=yes +else $as_nop + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +printf %s "checking for dlopen in -lsvld... " >&6; } +if test ${ac_cv_lib_svld_dlopen+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char dlopen (); +int +main (void) +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_svld_dlopen=yes +else $as_nop + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +printf "%s\n" "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes +then : + lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +printf %s "checking for dld_link in -ldld... " >&6; } +if test ${ac_cv_lib_dld_dld_link+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char dld_link (); +int +main (void) +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_dld_dld_link=yes +else $as_nop + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +printf "%s\n" "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes +then : + lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +printf %s "checking whether a program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +printf "%s\n" "$lt_cv_dlopen_self" >&6; } + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +printf %s "checking whether a statically linked program can dlopen itself... " >&6; } +if test ${lt_cv_dlopen_self_static+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test yes = "$cross_compiling"; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +printf "%s\n" "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +printf %s "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +printf "%s\n" "yes" >&6; } + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + fi + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report what library types will actually be built + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +printf %s "checking if libtool supports shared libraries... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +printf "%s\n" "$can_build_shared" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +printf %s "checking whether to build shared libraries... " >&6; } + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +printf "%s\n" "$enable_shared" >&6; } + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +printf %s "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +printf "%s\n" "$enable_static" >&6; } + + + + +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 + +CC=$lt_save_CC + + if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 +printf %s "checking how to run the C++ preprocessor... " >&6; } +if test -z "$CXXCPP"; then + if test ${ac_cv_prog_CXXCPP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Double quotes because $CXX needs to be expanded + for CXXCPP in "$CXX -E" cpp /lib/cpp + do + ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + break +fi + + done + ac_cv_prog_CXXCPP=$CXXCPP + +fi + CXXCPP=$ac_cv_prog_CXXCPP +else + ac_cv_prog_CXXCPP=$CXXCPP +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 +printf "%s\n" "$CXXCPP" >&6; } +ac_preproc_ok=false +for ac_cxx_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + Syntax error +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + +else $as_nop + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_cxx_try_cpp "$LINENO" +then : + # Broken: success on invalid input. +continue +else $as_nop + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok +then : + +else $as_nop + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +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 + +else + _lt_caught_CXX_error=yes +fi + +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +archive_cmds_need_lc_CXX=no +allow_undefined_flag_CXX= +always_export_symbols_CXX=no +archive_expsym_cmds_CXX= +compiler_needs_object_CXX=no +export_dynamic_flag_spec_CXX= +hardcode_direct_CXX=no +hardcode_direct_absolute_CXX=no +hardcode_libdir_flag_spec_CXX= +hardcode_libdir_separator_CXX= +hardcode_minus_L_CXX=no +hardcode_shlibpath_var_CXX=unsupported +hardcode_automatic_CXX=no +inherit_rpath_CXX=no +module_cmds_CXX= +module_expsym_cmds_CXX= +link_all_deplibs_CXX=unknown +old_archive_cmds_CXX=$old_archive_cmds +reload_flag_CXX=$reload_flag +reload_cmds_CXX=$reload_cmds +no_undefined_flag_CXX= +whole_archive_flag_spec_CXX= +enable_shared_with_static_runtimes_CXX=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +objext_CXX=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + + # save warnings/boilerplate of simple test code + ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + + ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + compiler_CXX=$CC + func_cc_basename $compiler +cc_basename=$func_cc_basename_result + + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' + else + lt_prog_compiler_no_builtin_flag_CXX= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + + +# Check whether --with-gnu-ld was given. +if test ${with_gnu_ld+y} +then : + withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes +else $as_nop + with_gnu_ld=no +fi + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +printf %s "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +printf %s "checking for GNU ld... " >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +printf %s "checking for non-GNU ld... " >&6; } +fi +if test ${lt_cv_path_LD+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +printf "%s\n" "$LD" >&6; } +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +printf %s "checking if the linker ($LD) is GNU ld... " >&6; } +if test ${lt_cv_prog_gnu_ld+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +printf "%s\n" "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + whole_archive_flag_spec_CXX= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + ld_shlibs_CXX=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aix[4-9]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds_CXX='' + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + file_list_spec_CXX='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + hardcode_direct_CXX=no + hardcode_direct_absolute_CXX=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct_CXX=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L_CXX=yes + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_libdir_separator_CXX= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + export_dynamic_flag_spec_CXX='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + always_export_symbols_CXX=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + no_undefined_flag_CXX='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + + archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + hardcode_libdir_flag_spec_CXX='$wl-R $libdir:/usr/lib:/lib' + allow_undefined_flag_CXX="-z nodefs" + archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + if test ${lt_cv_aix_libpath__CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath__CXX"; then + lt_cv_aix_libpath__CXX=/usr/lib:/lib + fi + +fi + + aix_libpath=$lt_cv_aix_libpath__CXX +fi + + hardcode_libdir_flag_spec_CXX='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag_CXX=' $wl-bernotok' + allow_undefined_flag_CXX=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec_CXX='$convenience' + fi + archive_cmds_need_lc_CXX=yes + archive_expsym_cmds_CXX='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + archive_expsym_cmds_CXX="$archive_expsym_cmds_CXX"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag_CXX=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + ld_shlibs_CXX=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec_CXX=' ' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=yes + file_list_spec_CXX='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' + enable_shared_with_static_runtimes_CXX=yes + # Don't use ranlib + old_postinstall_cmds_CXX='chmod 644 $oldlib' + postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec_CXX='-L$libdir' + export_dynamic_flag_spec_CXX='$wl--export-all-symbols' + allow_undefined_flag_CXX=unsupported + always_export_symbols_CXX=no + enable_shared_with_static_runtimes_CXX=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + archive_expsym_cmds_CXX='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs_CXX=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + + + archive_cmds_need_lc_CXX=no + hardcode_direct_CXX=no + hardcode_automatic_CXX=yes + hardcode_shlibpath_var_CXX=unsupported + if test yes = "$lt_cv_ld_force_load"; then + whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + + else + whole_archive_flag_spec_CXX='' + fi + link_all_deplibs_CXX=yes + allow_undefined_flag_CXX=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + module_expsym_cmds_CXX="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + if test yes != "$lt_cv_apple_cc_single_mod"; then + archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + archive_expsym_cmds_CXX="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi + + else + ld_shlibs_CXX=no + fi + + ;; + + os2*) + hardcode_libdir_flag_spec_CXX='-L$libdir' + hardcode_minus_L_CXX=yes + allow_undefined_flag_CXX=unsupported + shrext_cmds=.dll + archive_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + archive_expsym_cmds_CXX='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + old_archive_From_new_cmds_CXX='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + enable_shared_with_static_runtimes_CXX=yes + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + ld_shlibs_CXX=no + ;; + + freebsd-elf*) + archive_cmds_need_lc_CXX=no + ;; + + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + ld_shlibs_CXX=yes + ;; + + haiku*) + archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + link_all_deplibs_CXX=yes + ;; + + hpux9*) + hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_separator_CXX=: + export_dynamic_flag_spec_CXX='$wl-E' + hardcode_direct_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + hardcode_libdir_flag_spec_CXX='$wl+b $wl$libdir' + hardcode_libdir_separator_CXX=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + export_dynamic_flag_spec_CXX='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + ;; + *) + hardcode_direct_CXX=yes + hardcode_direct_absolute_CXX=yes + hardcode_minus_L_CXX=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + archive_cmds_CXX='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + interix[3-9]*) + hardcode_direct_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds_CXX='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + link_all_deplibs_CXX=yes + ;; + esac + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_separator_CXX=: + inherit_rpath_CXX=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + archive_cmds_need_lc_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + whole_archive_flag_spec_CXX='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [1-5].* | *pgcpp\ [1-5].*) + prelink_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + old_archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + archive_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='$wl--rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + whole_archive_flag_spec_CXX='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + export_dynamic_flag_spec_CXX='$wl--export-dynamic' + archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + hardcode_libdir_flag_spec_CXX='-R$libdir' + whole_archive_flag_spec_CXX='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + compiler_needs_object_CXX=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + ld_shlibs_CXX=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + hardcode_direct_CXX=yes + hardcode_shlibpath_var_CXX=no + hardcode_direct_absolute_CXX=yes + archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + export_dynamic_flag_spec_CXX='$wl-E' + whole_archive_flag_spec_CXX=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + ld_shlibs_CXX=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + hardcode_libdir_flag_spec_CXX='$wl-rpath,$libdir' + hardcode_libdir_separator_CXX=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + cxx*) + case $host in + osf3*) + allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + ;; + *) + allow_undefined_flag_CXX=' -expect_unresolved \*' + archive_cmds_CXX='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + hardcode_libdir_flag_spec_CXX='-rpath $libdir' + ;; + esac + + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + allow_undefined_flag_CXX=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + archive_cmds_CXX='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + hardcode_libdir_flag_spec_CXX='$wl-rpath $wl$libdir' + hardcode_libdir_separator_CXX=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + archive_cmds_need_lc_CXX=yes + no_undefined_flag_CXX=' -zdefs' + archive_cmds_CXX='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + hardcode_libdir_flag_spec_CXX='-R$libdir' + hardcode_shlibpath_var_CXX=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' + ;; + esac + link_all_deplibs_CXX=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + no_undefined_flag_CXX=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + archive_cmds_CXX='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + hardcode_libdir_flag_spec_CXX='$wl-R $wl$libdir' + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + whole_archive_flag_spec_CXX='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag_CXX='$wl-z,text' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag_CXX='$wl-z,text' + allow_undefined_flag_CXX='$wl-z,nodefs' + archive_cmds_need_lc_CXX=no + hardcode_shlibpath_var_CXX=no + hardcode_libdir_flag_spec_CXX='$wl-R,$libdir' + hardcode_libdir_separator_CXX=':' + link_all_deplibs_CXX=yes + export_dynamic_flag_spec_CXX='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + archive_cmds_CXX='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ + '"$old_archive_cmds_CXX" + reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ + '"$reload_cmds_CXX" + ;; + *) + archive_cmds_CXX='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds_CXX='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + + *) + # FIXME: insert proper C++ library support + ld_shlibs_CXX=no + ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } + test no = "$ld_shlibs_CXX" && can_build_shared=no + + GCC_CXX=$GXX + LD_CXX=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + # Dependencies to place before and after the object being linked: +predep_objects_CXX= +postdep_objects_CXX= +predeps_CXX= +postdeps_CXX= +compiler_lib_search_path_CXX= + +cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF + + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$compiler_lib_search_path_CXX"; then + compiler_lib_search_path_CXX=$prev$p + else + compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$postdeps_CXX"; then + postdeps_CXX=$prev$p + else + postdeps_CXX="${postdeps_CXX} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$predep_objects_CXX"; then + predep_objects_CXX=$p + else + predep_objects_CXX="$predep_objects_CXX $p" + fi + else + if test -z "$postdep_objects_CXX"; then + postdep_objects_CXX=$p + else + postdep_objects_CXX="$postdep_objects_CXX $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling CXX test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +case $host_os in +interix[3-9]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + predep_objects_CXX= + postdep_objects_CXX= + postdeps_CXX= + ;; +esac + + +case " $postdeps_CXX " in +*" -lc "*) archive_cmds_need_lc_CXX=no ;; +esac + compiler_lib_search_dirs_CXX= +if test -n "${compiler_lib_search_path_CXX}"; then + compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + lt_prog_compiler_wl_CXX= +lt_prog_compiler_pic_CXX= +lt_prog_compiler_static_CXX= + + + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + fi + lt_prog_compiler_pic_CXX='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic_CXX='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + case $host_os in + os2*) + lt_prog_compiler_static_CXX='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic_CXX='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + lt_prog_compiler_pic_CXX= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static_CXX= + ;; + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic_CXX=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + *) + lt_prog_compiler_pic_CXX='-fPIC' + ;; + esac + else + case $host_os in + aix[4-9]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static_CXX='-Bstatic' + else + lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic_CXX='-DDLL_EXPORT' + ;; + dgux*) + case $cc_basename in + ec++*) + lt_prog_compiler_pic_CXX='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + lt_prog_compiler_pic_CXX='+Z' + fi + ;; + aCC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic_CXX='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_static_CXX='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + lt_prog_compiler_wl_CXX='--backend -Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fPIC' + lt_prog_compiler_static_CXX='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-fpic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-qpic' + lt_prog_compiler_static_CXX='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + lt_prog_compiler_pic_CXX='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic_CXX='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + lt_prog_compiler_wl_CXX='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + lt_prog_compiler_pic_CXX='-pic' + ;; + cxx*) + # Digital/Compaq C++ + lt_prog_compiler_wl_CXX='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + lt_prog_compiler_pic_CXX= + lt_prog_compiler_static_CXX='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + lt_prog_compiler_wl_CXX='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + lt_prog_compiler_pic_CXX='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + lt_prog_compiler_pic_CXX='-pic' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + lcc*) + # Lucid + lt_prog_compiler_pic_CXX='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + lt_prog_compiler_wl_CXX='-Wl,' + lt_prog_compiler_pic_CXX='-KPIC' + lt_prog_compiler_static_CXX='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + lt_prog_compiler_pic_CXX='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + lt_prog_compiler_can_build_shared_CXX=no + ;; + esac + fi + +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic_CXX= + ;; + *) + lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" + ;; +esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +printf %s "checking for $compiler option to produce PIC... " >&6; } +if test ${lt_cv_prog_compiler_pic_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_CXX" >&6; } +lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic_CXX"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 +printf %s "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } +if test ${lt_cv_prog_compiler_pic_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_pic_works_CXX=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works_CXX=yes + fi + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_pic_works_CXX" >&6; } + +if test yes = "$lt_cv_prog_compiler_pic_works_CXX"; then + case $lt_prog_compiler_pic_CXX in + "" | " "*) ;; + *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; + esac +else + lt_prog_compiler_pic_CXX= + lt_prog_compiler_can_build_shared_CXX=no +fi + +fi + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +printf %s "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if test ${lt_cv_prog_compiler_static_works_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_static_works_CXX=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works_CXX=yes + fi + else + lt_cv_prog_compiler_static_works_CXX=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_static_works_CXX" >&6; } + +if test yes = "$lt_cv_prog_compiler_static_works_CXX"; then + : +else + lt_prog_compiler_static_CXX= +fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +printf %s "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if test ${lt_cv_prog_compiler_c_o_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_prog_compiler_c_o_CXX=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o_CXX=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 +printf "%s\n" "$lt_cv_prog_compiler_c_o_CXX" >&6; } + + + + +hard_links=nottested +if test no = "$lt_cv_prog_compiler_c_o_CXX" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +printf %s "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +printf "%s\n" "$hard_links" >&6; } + if test no = "$hard_links"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 +printf "%s\n" "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +printf %s "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + case $host_os in + aix[4-9]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds_CXX='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + export_symbols_cmds_CXX=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + ;; + esac + ;; + *) + export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 +printf "%s\n" "$ld_shlibs_CXX" >&6; } +test no = "$ld_shlibs_CXX" && can_build_shared=no + +with_gnu_ld_CXX=$with_gnu_ld + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc_CXX" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc_CXX=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $archive_cmds_CXX in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +printf %s "checking whether -lc should be explicitly linked in... " >&6; } +if test ${lt_cv_archive_cmds_need_lc_CXX+y} +then : + printf %s "(cached) " >&6 +else $as_nop + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl_CXX + pic_flag=$lt_prog_compiler_pic_CXX + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag_CXX + allow_undefined_flag_CXX= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc_CXX=no + else + lt_cv_archive_cmds_need_lc_CXX=yes + fi + allow_undefined_flag_CXX=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 +printf "%s\n" "$lt_cv_archive_cmds_need_lc_CXX" >&6; } + archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +printf %s "checking dynamic linker characteristics... " >&6; } + +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + + + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[4-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a(lib.so.V)' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly* | midnightbsd*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[23].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + hardcode_libdir_flag_spec_CXX='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if test ${lt_cv_shlibpath_overrides_runpath+y} +then : + printf %s "(cached) " >&6 +else $as_nop + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_link "$LINENO" +then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null +then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +printf "%s\n" "$dynamic_linker" >&6; } +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +printf %s "checking how to hardcode library paths into programs... " >&6; } +hardcode_action_CXX= +if test -n "$hardcode_libdir_flag_spec_CXX" || + test -n "$runpath_var_CXX" || + test yes = "$hardcode_automatic_CXX"; then + + # We can hardcode non-existent directories. + if test no != "$hardcode_direct_CXX" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" && + test no != "$hardcode_minus_L_CXX"; then + # Linking always hardcodes the temporary library directory. + hardcode_action_CXX=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action_CXX=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action_CXX=unsupported +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 +printf "%s\n" "$hardcode_action_CXX" >&6; } + +if test relink = "$hardcode_action_CXX" || + test yes = "$inherit_rpath_CXX"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +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 + + + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + +ac_fn_c_check_header_compile "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" +if test "x$ac_cv_header_unistd_h" = xyes +then : + printf "%s\n" "#define HAVE_UNISTD_H 1" >>confdefs.h + +fi + + + + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = xyes +then : + gl_have_mmap=yes +else $as_nop + gl_have_mmap=no +fi + + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for MAP_ANONYMOUS" >&5 +printf %s "checking for MAP_ANONYMOUS... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef MAP_ANONYMOUS + I cannot identify this map +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cannot identify this map" >/dev/null 2>&1 +then : + gl_have_mmap_anonymous=yes +fi +rm -rf conftest* + + if test $gl_have_mmap_anonymous != yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef MAP_ANON + I cannot identify this map +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "I cannot identify this map" >/dev/null 2>&1 +then : + +printf "%s\n" "#define MAP_ANONYMOUS MAP_ANON" >>confdefs.h + + gl_have_mmap_anonymous=yes +fi +rm -rf conftest* + + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_have_mmap_anonymous" >&5 +printf "%s\n" "$gl_have_mmap_anonymous" >&6; } + if test $gl_have_mmap_anonymous = yes; then + +printf "%s\n" "#define HAVE_MAP_ANONYMOUS 1" >>confdefs.h + + fi + fi + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether code in malloc()ed memory is executable" >&5 +printf %s "checking whether code in malloc()ed memory is executable... " >&6; } +if test ${ffcall_cv_codeexec+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$HOST_CPU_C_ABI--$host_os" in + hppa--* | hppa64--* | powerpc--aix* | powerpc64--* | ia64--*) + ffcall_cv_codeexec="irrelevant" + ;; + arm64--freebsd*) + ffcall_cv_codeexec=no + ;; + *) + if test "$cross_compiling" = yes +then : + case "$host_os" in + cygwin*) + case "$HOST_CPU_C_ABI" in + i386) + ffcall_cv_codeexec="guessing yes" ;; + x86_64) + ffcall_cv_codeexec="guessing no" ;; + *) + ffcall_cv_codeexec="guessing no" ;; + esac + ;; + darwin*) + case "$HOST_CPU_C_ABI" in + i386 | powerpc) + ffcall_cv_codeexec="guessing yes" ;; + x86_64) + ffcall_cv_codeexec="guessing no" ;; + *) + ffcall_cv_codeexec="guessing no" ;; + esac + ;; + irix*) + ffcall_cv_codeexec="guessing no" ;; + linux*) + case "$HOST_CPU_C_ABI" in + alpha | ia64) + ffcall_cv_codeexec="guessing yes" ;; + arm | armhf | arm64 | i386 | mips* | s390 | s390x | sparc | sparc64 | x86_64*) + ffcall_cv_codeexec="guessing no" ;; + *) + ffcall_cv_codeexec="guessing no" ;; + esac + ;; + solaris*) + case "$HOST_CPU_C_ABI" in + i386 | sparc | sparc64) + ffcall_cv_codeexec="guessing yes" ;; + x86_64) + ffcall_cv_codeexec="guessing no" ;; + *) + ffcall_cv_codeexec="guessing no" ;; + esac + ;; + *) + ffcall_cv_codeexec="guessing no" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + + #include + /* declare malloc() */ + #include + int fun () { return 31415926; } + int main () + { nocrash_init(); + {long size = (char*)&main - (char*)&fun; + char* funcopy = (char*) malloc(size); + int i; + for (i = 0; i < size; i++) { funcopy[i] = ((char*)&fun)[i]; } + return !((*(int(*)())funcopy)() == 31415926); + }} + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ffcall_cv_codeexec=yes +else $as_nop + ffcall_cv_codeexec=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ffcall_cv_codeexec" >&5 +printf "%s\n" "$ffcall_cv_codeexec" >&6; } + case "$ffcall_cv_codeexec" in + *yes | irrelevant) + +printf "%s\n" "#define CODE_EXECUTABLE /**/" >>confdefs.h + + ;; + *no) ;; + esac + + ac_fn_c_check_header_compile "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mman_h" = xyes +then : + +else $as_nop + no_mmap=1 +fi + + if test -z "$no_mmap"; then + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = xyes +then : + +else $as_nop + no_mmap=1 +fi + + if test -z "$no_mmap"; then + mmap_prog_1=' + #include + #ifdef HAVE_UNISTD_H + #include + #endif + #include + #include + #include + int main () + { + ' + mmap_prog_2=' + if (mmap(NULL,0x100000,PROT_READ|PROT_WRITE,flags,fd,0) == (void*)-1) + exit(1); + exit(0); + } + ' + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working mmap with MAP_ANONYMOUS" >&5 +printf %s "checking for working mmap with MAP_ANONYMOUS... " >&6; } +if test ${ffcall_cv_func_mmap_anonymous+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + aix* | cygwin* | darwin* | hpux* | linux* | solaris*) + ffcall_cv_func_mmap_anonymous="guessing yes" ;; + *) + ffcall_cv_func_mmap_anonymous="guessing no" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + + $mmap_prog_1 + int flags = MAP_ANONYMOUS | MAP_PRIVATE; + int fd = -1; + nocrash_init(); + $mmap_prog_2 + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + have_mmap_anon=1 + ffcall_cv_func_mmap_anonymous=yes +else $as_nop + ffcall_cv_func_mmap_anonymous=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ffcall_cv_func_mmap_anonymous" >&5 +printf "%s\n" "$ffcall_cv_func_mmap_anonymous" >&6; } + case "$ffcall_cv_func_mmap_anonymous" in + *yes) + +printf "%s\n" "#define HAVE_MMAP_ANONYMOUS 1" >>confdefs.h + + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working mmap of /dev/zero" >&5 +printf %s "checking for working mmap of /dev/zero... " >&6; } +if test ${ffcall_cv_func_mmap_devzero+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + aix* | cygwin* | hpux* | irix* | linux* | solaris*) + ffcall_cv_func_mmap_devzero="guessing yes" ;; + *) + ffcall_cv_func_mmap_devzero="guessing no" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + + $mmap_prog_1 + #ifndef MAP_FILE + #define MAP_FILE 0 + #endif + int flags = MAP_FILE | MAP_PRIVATE; + int fd = open("/dev/zero",O_RDONLY,0666); + if (fd<0) + exit(1); + nocrash_init(); + $mmap_prog_2 + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + have_mmap_devzero=1 + ffcall_cv_func_mmap_devzero=yes +else $as_nop + ffcall_cv_func_mmap_devzero=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ffcall_cv_func_mmap_devzero" >&5 +printf "%s\n" "$ffcall_cv_func_mmap_devzero" >&6; } + case "$ffcall_cv_func_mmap_devzero" in + *yes) + +printf "%s\n" "#define HAVE_MMAP_DEVZERO 1" >>confdefs.h + + ;; + esac + ;; + esac + fi + fi + + ac_fn_c_check_func "$LINENO" "mprotect" "ac_cv_func_mprotect" +if test "x$ac_cv_func_mprotect" = xyes +then : + printf "%s\n" "#define HAVE_MPROTECT 1" >>confdefs.h + +fi + + if test $ac_cv_func_mprotect = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working mprotect" >&5 +printf %s "checking for working mprotect... " >&6; } +if test ${cl_cv_func_mprotect_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $cross_compiling = no; then + mprotect_prog=' + #include + /* Declare malloc(). */ + #include + /* Declare getpagesize(). */ + #ifdef HAVE_UNISTD_H + #include + #endif + #ifdef __hpux + extern + #ifdef __cplusplus + "C" + #endif + int getpagesize (void); + #endif + /* Declare mprotect(). */ + #include + char foo; + int main () + { + unsigned long pagesize = getpagesize(); + #define page_align(address) (char*)((unsigned long)(address) & -pagesize) + ' + if test "$cross_compiling" = yes +then : + no_mprotect=1 + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + $mprotect_prog + if ((pagesize-1) & pagesize) exit(1); + exit(0); + } + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + +else $as_nop + no_mprotect=1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + mprotect_prog="$mprotect_prog"' + char* area = (char*) malloc(6*pagesize); + char* fault_address = area + pagesize*7/2; + ' + if test -z "$no_mprotect"; then + if test "$cross_compiling" = yes +then : + : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + + $mprotect_prog + nocrash_init(); + if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) + exit(0); + foo = *fault_address; /* this should cause an exception or signal */ + exit(0); + } + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + no_mprotect=1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test -z "$no_mprotect"; then + if test "$cross_compiling" = yes +then : + : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + + $mprotect_prog + nocrash_init(); + if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) + exit(0); + *fault_address = 'z'; /* this should cause an exception or signal */ + exit(0); + } + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + no_mprotect=1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test -z "$no_mprotect"; then + if test "$cross_compiling" = yes +then : + : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + + $mprotect_prog + nocrash_init(); + if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) + exit(0); + *fault_address = 'z'; /* this should cause an exception or signal */ + exit(0); + } + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + no_mprotect=1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test -z "$no_mprotect"; then + if test "$cross_compiling" = yes +then : + : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif + + $mprotect_prog + nocrash_init(); + if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) + exit(1); + if (mprotect(page_align(fault_address),pagesize,PROT_READ|PROT_WRITE) < 0) + exit(1); + *fault_address = 'z'; /* this should not cause an exception or signal */ + exit(0); + } + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + +else $as_nop + no_mprotect=1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test -z "$no_mprotect"; then + cl_cv_func_mprotect_works=yes + else + cl_cv_func_mprotect_works=no + fi + else + case "$host_os" in + aix* | cygwin* | darwin* | hpux* | irix* | linux* | solaris*) + cl_cv_func_mprotect_works="guessing yes" ;; + mingw*) + cl_cv_func_mprotect_works="guessing no" ;; + *) + cl_cv_func_mprotect_works="guessing no" ;; + esac + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $cl_cv_func_mprotect_works" >&5 +printf "%s\n" "$cl_cv_func_mprotect_works" >&6; } + case "$cl_cv_func_mprotect_works" in + *yes) + +printf "%s\n" "#define HAVE_WORKING_MPROTECT 1" >>confdefs.h + + ;; + esac + fi + + case "$ffcall_cv_codeexec" in + *yes | irrelevant) ;; + *) + case "$ac_cv_func_mprotect--$cl_cv_func_mprotect_works" in + yes--*yes) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mprotect can make malloc()ed memory executable" >&5 +printf %s "checking whether mprotect can make malloc()ed memory executable... " >&6; } +if test ${ffcall_cv_malloc_mprotect_can_exec+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" != yes -a -d /etc/selinux; then + ffcall_cv_malloc_mprotect_can_exec='determined by SELinux at runtime' + else + if test "$cross_compiling" = yes +then : + case "$host_os" in + linux*) + ffcall_cv_malloc_mprotect_can_exec='determined by SELinux at runtime' ;; + aix* | cygwin* | darwin* | irix* | solaris*) + ffcall_cv_malloc_mprotect_can_exec="guessing yes" ;; + *) + ffcall_cv_malloc_mprotect_can_exec="guessing no" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + /* Declare getpagesize(). */ + #ifdef HAVE_UNISTD_H + #include + #endif + #ifdef __hpux + extern + #ifdef __cplusplus + "C" + #endif + int getpagesize (void); + #endif + #include + /* Declare mprotect(). */ + #include + int + main () + { + unsigned int pagesize = getpagesize (); + char *p = (char *) malloc (50); + int ret; + if (p == (char*) -1) + /* malloc is not working as expected. */ + return 1; + p[5] = 0x77; + ret = mprotect (p - ((unsigned int) p & (pagesize - 1)), pagesize, PROT_READ | PROT_WRITE | PROT_EXEC); + if (ret < 0 + && (errno == EACCES || errno == ENOMEM || errno == ENOTSUP)) + /* mprotect is forbidden to make malloc()ed pages executable that were writable earlier. */ + return 2; + return 0; + } + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ffcall_cv_malloc_mprotect_can_exec=yes +else $as_nop + ffcall_cv_malloc_mprotect_can_exec=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ffcall_cv_malloc_mprotect_can_exec" >&5 +printf "%s\n" "$ffcall_cv_malloc_mprotect_can_exec" >&6; } + case "$ffcall_cv_malloc_mprotect_can_exec" in + *yes) MPROTECT_AFTER_MALLOC_CAN_EXEC=1 ;; + *no) MPROTECT_AFTER_MALLOC_CAN_EXEC=0 ;; + *runtime*) MPROTECT_AFTER_MALLOC_CAN_EXEC='-1' ;; + esac + +printf "%s\n" "#define HAVE_MPROTECT_AFTER_MALLOC_CAN_EXEC $MPROTECT_AFTER_MALLOC_CAN_EXEC" >>confdefs.h + + case "$ffcall_cv_malloc_mprotect_can_exec" in + *yes) ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether mprotect can make mmap()ed memory executable" >&5 +printf %s "checking whether mprotect can make mmap()ed memory executable... " >&6; } +if test ${ffcall_cv_mmap_mprotect_can_exec+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" != yes -a -d /etc/selinux; then + ffcall_cv_mmap_mprotect_can_exec='determined by SELinux at runtime' + else + if test "$cross_compiling" = yes +then : + case "$host_os" in + linux*) ffcall_cv_mmap_mprotect_can_exec='determined by SELinux at runtime' ;; + *) ffcall_cv_mmap_mprotect_can_exec="guessing no" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + /* Declare getpagesize(). */ + #ifdef HAVE_UNISTD_H + #include + #endif + #ifdef __hpux + extern + #ifdef __cplusplus + "C" + #endif + int getpagesize (void); + #endif + #include + /* Declare mmap(), mprotect(). */ + #include + #ifndef MAP_FILE + #define MAP_FILE 0 + #endif + #ifndef MAP_VARIABLE + #define MAP_VARIABLE 0 + #endif + int + main () + { + unsigned int pagesize = getpagesize (); + char *p; + int ret; + #if HAVE_MMAP_ANONYMOUS + p = (char *) mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_VARIABLE, -1, 0); + #elif HAVE_MMAP_DEVZERO + int zero_fd = open("/dev/zero", O_RDONLY, 0666); + if (zero_fd < 0) + return 1; + p = (char *) mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE | MAP_VARIABLE, zero_fd, 0); + #else + ?? + #endif + if (p == (char*) -1) + /* mmap is not working as expected. */ + return 1; + p[5] = 0x77; + ret = mprotect (p, pagesize, PROT_READ | PROT_WRITE | PROT_EXEC); + if (ret < 0 + && (errno == EACCES || errno == ENOMEM || errno == ENOTSUP)) + /* mprotect is forbidden to make mmap()ed pages executable that were writable earlier. */ + return 2; + return 0; + } + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ffcall_cv_mmap_mprotect_can_exec=yes +else $as_nop + ffcall_cv_mmap_mprotect_can_exec=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ffcall_cv_mmap_mprotect_can_exec" >&5 +printf "%s\n" "$ffcall_cv_mmap_mprotect_can_exec" >&6; } + case "$ffcall_cv_mmap_mprotect_can_exec" in + *yes) MPROTECT_AFTER_MMAP_CAN_EXEC=1 ;; + *no) MPROTECT_AFTER_MMAP_CAN_EXEC=0 ;; + *runtime*) MPROTECT_AFTER_MMAP_CAN_EXEC='-1' ;; + esac + +printf "%s\n" "#define HAVE_MPROTECT_AFTER_MMAP_CAN_EXEC $MPROTECT_AFTER_MMAP_CAN_EXEC" >>confdefs.h + + case "$ffcall_cv_mmap_mprotect_can_exec" in + *yes) ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether a shared mmap can make memory pages executable" >&5 +printf %s "checking whether a shared mmap can make memory pages executable... " >&6; } +if test ${ffcall_cv_mmap_shared_can_exec+y} +then : + printf %s "(cached) " >&6 +else $as_nop + filename="/tmp/trampdata$$.data" + if test "$cross_compiling" = yes +then : + ffcall_cv_mmap_shared_can_exec="guessing yes" + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + /* Declare getpagesize(). */ + #ifdef HAVE_UNISTD_H + #include + #endif + #ifdef __hpux + extern + #ifdef __cplusplus + "C" + #endif + int getpagesize (void); + #endif + /* Declare mmap(). */ + #include + #ifndef MAP_FILE + #define MAP_FILE 0 + #endif + #ifndef MAP_VARIABLE + #define MAP_VARIABLE 0 + #endif + int + main () + { + unsigned int pagesize = getpagesize (); + int fd; + char *pw; + char *px; + fd = open ("$filename", O_CREAT | O_RDWR | O_TRUNC, 0700); + if (fd < 0) + return 1; + if (ftruncate (fd, pagesize) < 0) + return 2; + pw = (char *) mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FILE | MAP_VARIABLE, fd, 0); + if (pw == (char*) -1) + return 3; + pw[5] = 0xc3; + px = (char *) mmap (NULL, pagesize, PROT_READ | PROT_EXEC, MAP_SHARED | MAP_FILE | MAP_VARIABLE, fd, 0); + if (px == (char*) -1) + return 4; + if ((char)px[5] != (char)0xc3) + return 5; + /* On i386 and x86_64 this is a 'ret' instruction that we can invoke. */ + #if (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_) || (defined __x86_64__ || defined __amd64__) + ((void (*) (void)) (px + 5)) (); + #endif + return 0; + } + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ffcall_cv_mmap_shared_can_exec=yes +else $as_nop + ffcall_cv_mmap_shared_can_exec=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f "$filename" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ffcall_cv_mmap_shared_can_exec" >&5 +printf "%s\n" "$ffcall_cv_mmap_shared_can_exec" >&6; } + case "$ffcall_cv_mmap_shared_can_exec" in + *yes) + +printf "%s\n" "#define HAVE_MMAP_SHARED_CAN_EXEC 1" >>confdefs.h + + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac + + +CPU_OBJECTS='' +if test ${HOST_CPU_C_ABI} = hppa -o ${HOST_CPU_C_ABI} = hppa64 -o ${HOST_CPU_C_ABI} = powerpc64 -o ${HOST_CPU_C_ABI} = ia64; then + CPU_OBJECTS="$CPU_OBJECTS "'tramp-$(CPU).lo' +fi +if test ${HOST_CPU_C_ABI} = powerpc; then + case "${host_os}" in + aix*) CPU_OBJECTS="$CPU_OBJECTS "'tramp-$(CPU).lo' ;; + *) ;; + esac +fi +if test ${HOST_CPU_C_ABI} = alpha -o ${HOST_CPU_C_ABI} = hppa -o ${HOST_CPU_C_ABI} = hppa64 -o ${HOST_CPU_C_ABI} = powerpc64-elfv2; then + CPU_OBJECTS="$CPU_OBJECTS "'cache-$(CPU).lo' +fi +if test ${HOST_CPU_C_ABI} = sparc -o ${HOST_CPU_C_ABI} = sparc64; then + case "${host_os}" in + solaris*) ;; + *) CPU_OBJECTS="$CPU_OBJECTS "'cache-$(CPU).lo' ;; + esac +fi +if test ${HOST_CPU_C_ABI} = powerpc; then + case "${host_os}" in + aix*) ;; + *) CPU_OBJECTS="$CPU_OBJECTS "'cache-$(CPU).lo' ;; + esac +fi + +case "${HOST_CPU_C_ABI}" in + mips* | riscv*) + ac_fn_c_check_header_compile "$LINENO" "sys/cachectl.h" "ac_cv_header_sys_cachectl_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_cachectl_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_CACHECTL_H 1" >>confdefs.h + +fi + + ;; +esac + +WORKAROUND_BUG_81653='' +if test ${HOST_CPU_C_ABI} = sparc && test -n "$GCC"; then + gcc_version=`LC_ALL=C ${CC} -v 2>&1 | grep version | sed -n -e '$p' | sed -e 's/.*version //g' -e 's/gcc //'` + case "$gcc_version" in + 2.* | 3.0-3*) ;; + *) WORKAROUND_BUG_81653='-fno-pie' ;; + esac +fi + + +if test -n "$GCC"; then + DISABLE_TYPE_BASED_ALIASING='-fno-strict-aliasing' +else + case "$host_os" in + aix*) DISABLE_TYPE_BASED_ALIASING='-qalias=noansi' + ;; + *) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __SUNPRO_C + yes + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + DISABLE_TYPE_BASED_ALIASING='-xalias_level=weak' + +else $as_nop + DISABLE_TYPE_BASED_ALIASING='' +fi +rm -rf conftest* + + ;; + esac +fi + + + + + + + + + + + # Check whether --enable-cross-guesses was given. +if test ${enable_cross_guesses+y} +then : + enableval=$enable_cross_guesses; if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: invalid argument supplied to --enable-cross-guesses" >&5 +printf "%s\n" "$as_me: WARNING: invalid argument supplied to --enable-cross-guesses" >&2;} + enableval=conservative + fi + gl_cross_guesses="$enableval" +else $as_nop + gl_cross_guesses=conservative +fi + + if test $gl_cross_guesses = risky; then + gl_cross_guess_normal="guessing yes" + gl_cross_guess_inverted="guessing no" + else + gl_cross_guess_normal="guessing no" + gl_cross_guess_inverted="guessing yes" + fi + LIBC_FATAL_STDERR_=1 + export LIBC_FATAL_STDERR_ + + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define size_t unsigned int" >>confdefs.h + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +printf %s "checking for working alloca.h... " >&6; } +if test ${ac_cv_working_alloca_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_working_alloca_h=yes +else $as_nop + ac_cv_working_alloca_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +printf "%s\n" "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +printf "%s\n" "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +printf %s "checking for alloca... " >&6; } +if test ${ac_cv_func_alloca_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test $ac_cv_working_alloca_h = yes; then + ac_cv_func_alloca_works=yes +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#ifndef alloca +# ifdef __GNUC__ +# define alloca __builtin_alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# else +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + +int +main (void) +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_func_alloca_works=yes +else $as_nop + ac_cv_func_alloca_works=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +printf "%s\n" "$ac_cv_func_alloca_works" >&6; } +fi + +if test $ac_cv_func_alloca_works = yes; then + +printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + + + + + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +printf "%s\n" "#define C_ALLOCA 1" >>confdefs.h + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +printf %s "checking stack direction for C alloca... " >&6; } +if test ${ac_cv_c_stack_direction+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + ac_cv_c_stack_direction=0 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_c_stack_direction=1 +else $as_nop + ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +printf "%s\n" "$ac_cv_c_stack_direction" >&6; } +printf "%s\n" "#define STACK_DIRECTION $ac_cv_c_stack_direction" >>confdefs.h + + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 +printf %s "checking for inline... " >&6; } +if test ${ac_cv_c_inline+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __cplusplus +typedef int foo_t; +static $ac_kw foo_t static_foo (void) {return 0; } +$ac_kw foo_t foo (void) {return 0; } +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_inline=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + test "$ac_cv_c_inline" != no && break +done + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 +printf "%s\n" "$ac_cv_c_inline" >&6; } + +case $ac_cv_c_inline in + inline | yes) ;; + *) + case $ac_cv_c_inline in + no) ac_val=;; + *) ac_val=$ac_cv_c_inline;; + esac + cat >>confdefs.h <<_ACEOF +#ifndef __cplusplus +#define inline $ac_val +#endif +_ACEOF + ;; +esac + + + + HAVE_CHOWN=1; + HAVE_COPY_FILE_RANGE=1; + HAVE_DUP3=1; + HAVE_EUIDACCESS=1; + HAVE_EXECVPE=1; + HAVE_FACCESSAT=1; + HAVE_FCHDIR=1; + HAVE_FCHOWNAT=1; + HAVE_FDATASYNC=1; + HAVE_FSYNC=1; + HAVE_FTRUNCATE=1; + HAVE_GETDTABLESIZE=1; + HAVE_GETENTROPY=1; + HAVE_GETGROUPS=1; + HAVE_GETHOSTNAME=1; + HAVE_GETLOGIN=1; + HAVE_GETPAGESIZE=1; + HAVE_GETPASS=1; + HAVE_GROUP_MEMBER=1; + HAVE_LCHOWN=1; + HAVE_LINK=1; + HAVE_LINKAT=1; + HAVE_PIPE=1; + HAVE_PIPE2=1; + HAVE_PREAD=1; + HAVE_PWRITE=1; + HAVE_READLINK=1; + HAVE_READLINKAT=1; + HAVE_SETHOSTNAME=1; + HAVE_SLEEP=1; + HAVE_SYMLINK=1; + HAVE_SYMLINKAT=1; + HAVE_UNLINKAT=1; + HAVE_USLEEP=1; + HAVE_DECL_ENVIRON=1; + HAVE_DECL_EXECVPE=1; + HAVE_DECL_FCHDIR=1; + HAVE_DECL_FDATASYNC=1; + HAVE_DECL_GETDOMAINNAME=1; + HAVE_DECL_GETLOGIN=1; + HAVE_DECL_GETLOGIN_R=1; + HAVE_DECL_GETPAGESIZE=1; + HAVE_DECL_GETUSERSHELL=1; + HAVE_DECL_SETHOSTNAME=1; + HAVE_DECL_TRUNCATE=1; + HAVE_DECL_TTYNAME_R=1; + HAVE_OS_H=0; + HAVE_SYS_PARAM_H=0; + REPLACE_ACCESS=0; + REPLACE_CHOWN=0; + REPLACE_CLOSE=0; + REPLACE_DUP=0; + REPLACE_DUP2=0; + REPLACE_EXECL=0; + REPLACE_EXECLE=0; + REPLACE_EXECLP=0; + REPLACE_EXECV=0; + REPLACE_EXECVE=0; + REPLACE_EXECVP=0; + REPLACE_EXECVPE=0; + REPLACE_FACCESSAT=0; + REPLACE_FCHOWNAT=0; + REPLACE_FTRUNCATE=0; + REPLACE_GETCWD=0; + REPLACE_GETDOMAINNAME=0; + REPLACE_GETDTABLESIZE=0; + REPLACE_GETLOGIN_R=0; + REPLACE_GETGROUPS=0; + REPLACE_GETPAGESIZE=0; + REPLACE_GETPASS=0; + REPLACE_ISATTY=0; + REPLACE_LCHOWN=0; + REPLACE_LINK=0; + REPLACE_LINKAT=0; + REPLACE_LSEEK=0; + REPLACE_PREAD=0; + REPLACE_PWRITE=0; + REPLACE_READ=0; + REPLACE_READLINK=0; + REPLACE_READLINKAT=0; + REPLACE_RMDIR=0; + REPLACE_SLEEP=0; + REPLACE_SYMLINK=0; + REPLACE_SYMLINKAT=0; + REPLACE_TRUNCATE=0; + REPLACE_TTYNAME_R=0; + REPLACE_UNLINK=0; + REPLACE_UNLINKAT=0; + REPLACE_USLEEP=0; + REPLACE_WRITE=0; + UNISTD_H_HAVE_SYS_RANDOM_H=0; + UNISTD_H_HAVE_WINSOCK2_H=0; + UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; + + +ac_func= +for ac_item in $ac_func_c_list +do + if test $ac_func; then + ac_fn_c_check_func "$LINENO" $ac_func ac_cv_func_$ac_func + if eval test \"x\$ac_cv_func_$ac_func\" = xyes; then + echo "#define $ac_item 1" >> confdefs.h + fi + ac_func= + else + ac_func=$ac_item + fi +done + + + if test $ac_cv_func__set_invalid_parameter_handler = yes; then + HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 + +printf "%s\n" "#define HAVE_MSVC_INVALID_PARAMETER_HANDLER 1" >>confdefs.h + + else + HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 + fi + + + + + + GL_GNULIB_ACCESS=0 + + + + GL_GNULIB_CHDIR=0 + + + + GL_GNULIB_CHOWN=0 + + + + GL_GNULIB_CLOSE=0 + + + + GL_GNULIB_COPY_FILE_RANGE=0 + + + + GL_GNULIB_DUP=0 + + + + GL_GNULIB_DUP2=0 + + + + GL_GNULIB_DUP3=0 + + + + GL_GNULIB_ENVIRON=0 + + + + GL_GNULIB_EUIDACCESS=0 + + + + GL_GNULIB_EXECL=0 + + + + GL_GNULIB_EXECLE=0 + + + + GL_GNULIB_EXECLP=0 + + + + GL_GNULIB_EXECV=0 + + + + GL_GNULIB_EXECVE=0 + + + + GL_GNULIB_EXECVP=0 + + + + GL_GNULIB_EXECVPE=0 + + + + GL_GNULIB_FACCESSAT=0 + + + + GL_GNULIB_FCHDIR=0 + + + + GL_GNULIB_FCHOWNAT=0 + + + + GL_GNULIB_FDATASYNC=0 + + + + GL_GNULIB_FSYNC=0 + + + + GL_GNULIB_FTRUNCATE=0 + + + + GL_GNULIB_GETCWD=0 + + + + GL_GNULIB_GETDOMAINNAME=0 + + + + GL_GNULIB_GETDTABLESIZE=0 + + + + GL_GNULIB_GETENTROPY=0 + + + + GL_GNULIB_GETGROUPS=0 + + + + GL_GNULIB_GETHOSTNAME=0 + + + + GL_GNULIB_GETLOGIN=0 + + + + GL_GNULIB_GETLOGIN_R=0 + + + + GL_GNULIB_GETOPT_POSIX=0 + + + + GL_GNULIB_GETPAGESIZE=0 + + + + GL_GNULIB_GETPASS=0 + + + + GL_GNULIB_GETUSERSHELL=0 + + + + GL_GNULIB_GROUP_MEMBER=0 + + + + GL_GNULIB_ISATTY=0 + + + + GL_GNULIB_LCHOWN=0 + + + + GL_GNULIB_LINK=0 + + + + GL_GNULIB_LINKAT=0 + + + + GL_GNULIB_LSEEK=0 + + + + GL_GNULIB_PIPE=0 + + + + GL_GNULIB_PIPE2=0 + + + + GL_GNULIB_PREAD=0 + + + + GL_GNULIB_PWRITE=0 + + + + GL_GNULIB_READ=0 + + + + GL_GNULIB_READLINK=0 + + + + GL_GNULIB_READLINKAT=0 + + + + GL_GNULIB_RMDIR=0 + + + + GL_GNULIB_SETHOSTNAME=0 + + + + GL_GNULIB_SLEEP=0 + + + + GL_GNULIB_SYMLINK=0 + + + + GL_GNULIB_SYMLINKAT=0 + + + + GL_GNULIB_TRUNCATE=0 + + + + GL_GNULIB_TTYNAME_R=0 + + + + GL_GNULIB_UNISTD_H_NONBLOCKING=0 + + + + GL_GNULIB_UNISTD_H_SIGPIPE=0 + + + + GL_GNULIB_UNLINK=0 + + + + GL_GNULIB_UNLINKAT=0 + + + + GL_GNULIB_USLEEP=0 + + + + GL_GNULIB_WRITE=0 + + + + GL_GNULIB_MDA_ACCESS=1 + + + + GL_GNULIB_MDA_CHDIR=1 + + + + GL_GNULIB_MDA_CLOSE=1 + + + + GL_GNULIB_MDA_DUP=1 + + + + GL_GNULIB_MDA_DUP2=1 + + + + GL_GNULIB_MDA_EXECL=1 + + + + GL_GNULIB_MDA_EXECLE=1 + + + + GL_GNULIB_MDA_EXECLP=1 + + + + GL_GNULIB_MDA_EXECV=1 + + + + GL_GNULIB_MDA_EXECVE=1 + + + + GL_GNULIB_MDA_EXECVP=1 + + + + GL_GNULIB_MDA_EXECVPE=1 + + + + GL_GNULIB_MDA_GETCWD=1 + + + + GL_GNULIB_MDA_GETPID=1 + + + + GL_GNULIB_MDA_ISATTY=1 + + + + GL_GNULIB_MDA_LSEEK=1 + + + + GL_GNULIB_MDA_READ=1 + + + + GL_GNULIB_MDA_RMDIR=1 + + + + GL_GNULIB_MDA_SWAB=1 + + + + GL_GNULIB_MDA_UNLINK=1 + + + + GL_GNULIB_MDA_WRITE=1 + + + +gl_mda_defines=' +#if defined _WIN32 && !defined __CYGWIN__ +#define access _access +#define chdir _chdir +#define chmod _chmod +#define close _close +#define creat _creat +#define dup _dup +#define dup2 _dup2 +#define ecvt _ecvt +#define execl _execl +#define execle _execle +#define execlp _execlp +#define execv _execv +#define execve _execve +#define execvp _execvp +#define execvpe _execvpe +#define fcloseall _fcloseall +#define fcvt _fcvt +#define fdopen _fdopen +#define fileno _fileno +#define gcvt _gcvt +#define getcwd _getcwd +#define getpid _getpid +#define getw _getw +#define isatty _isatty +#define j0 _j0 +#define j1 _j1 +#define jn _jn +#define lfind _lfind +#define lsearch _lsearch +#define lseek _lseek +#define memccpy _memccpy +#define mkdir _mkdir +#define mktemp _mktemp +#define open _open +#define putenv _putenv +#define putw _putw +#define read _read +#define rmdir _rmdir +#define strdup _strdup +#define swab _swab +#define tempnam _tempnam +#define tzset _tzset +#define umask _umask +#define unlink _unlink +#define utime _utime +#define wcsdup _wcsdup +#define write _write +#define y0 _y0 +#define y1 _y1 +#define yn _yn +#endif +' + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the preprocessor supports include_next" >&5 +printf %s "checking whether the preprocessor supports include_next... " >&6; } +if test ${gl_cv_have_include_next+y} +then : + printf %s "(cached) " >&6 +else $as_nop + rm -rf conftestd1a conftestd1b conftestd2 + mkdir conftestd1a conftestd1b conftestd2 + cat < conftestd1a/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < conftestd1b/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < conftestd2/conftest.h +#ifndef DEFINED_IN_CONFTESTD1 +#error "include_next test doesn't work" +#endif +#define DEFINED_IN_CONFTESTD2 +EOF + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_have_include_next=yes +else $as_nop + CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_have_include_next=buggy +else $as_nop + gl_cv_have_include_next=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + CPPFLAGS="$gl_save_CPPFLAGS" + rm -rf conftestd1a conftestd1b conftestd2 + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_include_next" >&5 +printf "%s\n" "$gl_cv_have_include_next" >&6; } + PRAGMA_SYSTEM_HEADER= + if test $gl_cv_have_include_next = yes; then + INCLUDE_NEXT=include_next + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + if test -n "$GCC"; then + PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' + fi + else + if test $gl_cv_have_include_next = buggy; then + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + else + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include + fi + fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether source code line length is unlimited" >&5 +printf %s "checking whether source code line length is unlimited... " >&6; } +if test ${gl_cv_source_line_length_unlimited+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __TANDEM +choke me +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "choke me" >/dev/null 2>&1 +then : + gl_cv_source_line_length_unlimited=no +else $as_nop + gl_cv_source_line_length_unlimited=yes +fi +rm -rf conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_source_line_length_unlimited" >&5 +printf "%s\n" "$gl_cv_source_line_length_unlimited" >&6; } + if test $gl_cv_source_line_length_unlimited = no; then + PRAGMA_COLUMNS="#pragma COLUMNS 10000" + else + PRAGMA_COLUMNS= + fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for complete errno.h" >&5 +printf %s "checking for complete errno.h... " >&6; } +if test ${gl_cv_header_errno_h_complete+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#if !defined ETXTBSY +booboo +#endif +#if !defined ENOMSG +booboo +#endif +#if !defined EIDRM +booboo +#endif +#if !defined ENOLINK +booboo +#endif +#if !defined EPROTO +booboo +#endif +#if !defined EMULTIHOP +booboo +#endif +#if !defined EBADMSG +booboo +#endif +#if !defined EOVERFLOW +booboo +#endif +#if !defined ENOTSUP +booboo +#endif +#if !defined ENETRESET +booboo +#endif +#if !defined ECONNABORTED +booboo +#endif +#if !defined ESTALE +booboo +#endif +#if !defined EDQUOT +booboo +#endif +#if !defined ECANCELED +booboo +#endif +#if !defined EOWNERDEAD +booboo +#endif +#if !defined ENOTRECOVERABLE +booboo +#endif +#if !defined EILSEQ +booboo +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "booboo" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_complete=no +else $as_nop + gl_cv_header_errno_h_complete=yes +fi +rm -rf conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_complete" >&5 +printf "%s\n" "$gl_cv_header_errno_h_complete" >&6; } + if test $gl_cv_header_errno_h_complete = yes; then + ERRNO_H='' + else + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_errno_h='<'errno.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_errno_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'errno.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_errno_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_errno_h + gl_cv_next_errno_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_errno_h" >&5 +printf "%s\n" "$gl_cv_next_errno_h" >&6; } + fi + NEXT_ERRNO_H=$gl_cv_next_errno_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'errno.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_errno_h + fi + NEXT_AS_FIRST_DIRECTIVE_ERRNO_H=$gl_next_as_first_directive + + + + + ERRNO_H='errno.h' + fi + + if test -n "$ERRNO_H"; then + GL_GENERATE_ERRNO_H_TRUE= + GL_GENERATE_ERRNO_H_FALSE='#' +else + GL_GENERATE_ERRNO_H_TRUE='#' + GL_GENERATE_ERRNO_H_FALSE= +fi + + + if test -n "$ERRNO_H"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EMULTIHOP value" >&5 +printf %s "checking for EMULTIHOP value... " >&6; } +if test ${gl_cv_header_errno_h_EMULTIHOP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef EMULTIHOP +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_EMULTIHOP=yes +else $as_nop + gl_cv_header_errno_h_EMULTIHOP=no +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_EMULTIHOP = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef EMULTIHOP +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_EMULTIHOP=hidden +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_EMULTIHOP = hidden; then + if ac_fn_c_compute_int "$LINENO" "EMULTIHOP" "gl_cv_header_errno_h_EMULTIHOP" " +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include +" +then : + +fi + + fi + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_EMULTIHOP" >&5 +printf "%s\n" "$gl_cv_header_errno_h_EMULTIHOP" >&6; } + case $gl_cv_header_errno_h_EMULTIHOP in + yes | no) + EMULTIHOP_HIDDEN=0; EMULTIHOP_VALUE= + ;; + *) + EMULTIHOP_HIDDEN=1; EMULTIHOP_VALUE="$gl_cv_header_errno_h_EMULTIHOP" + ;; + esac + + + fi + + + if test -n "$ERRNO_H"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ENOLINK value" >&5 +printf %s "checking for ENOLINK value... " >&6; } +if test ${gl_cv_header_errno_h_ENOLINK+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef ENOLINK +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_ENOLINK=yes +else $as_nop + gl_cv_header_errno_h_ENOLINK=no +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_ENOLINK = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef ENOLINK +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_ENOLINK=hidden +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_ENOLINK = hidden; then + if ac_fn_c_compute_int "$LINENO" "ENOLINK" "gl_cv_header_errno_h_ENOLINK" " +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include +" +then : + +fi + + fi + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_ENOLINK" >&5 +printf "%s\n" "$gl_cv_header_errno_h_ENOLINK" >&6; } + case $gl_cv_header_errno_h_ENOLINK in + yes | no) + ENOLINK_HIDDEN=0; ENOLINK_VALUE= + ;; + *) + ENOLINK_HIDDEN=1; ENOLINK_VALUE="$gl_cv_header_errno_h_ENOLINK" + ;; + esac + + + fi + + + if test -n "$ERRNO_H"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for EOVERFLOW value" >&5 +printf %s "checking for EOVERFLOW value... " >&6; } +if test ${gl_cv_header_errno_h_EOVERFLOW+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#ifdef EOVERFLOW +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_EOVERFLOW=yes +else $as_nop + gl_cv_header_errno_h_EOVERFLOW=no +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_EOVERFLOW = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef EOVERFLOW +yes +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1 +then : + gl_cv_header_errno_h_EOVERFLOW=hidden +fi +rm -rf conftest* + + if test $gl_cv_header_errno_h_EOVERFLOW = hidden; then + if ac_fn_c_compute_int "$LINENO" "EOVERFLOW" "gl_cv_header_errno_h_EOVERFLOW" " +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include +" +then : + +fi + + fi + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_errno_h_EOVERFLOW" >&5 +printf "%s\n" "$gl_cv_header_errno_h_EOVERFLOW" >&6; } + case $gl_cv_header_errno_h_EOVERFLOW in + yes | no) + EOVERFLOW_HIDDEN=0; EOVERFLOW_VALUE= + ;; + *) + EOVERFLOW_HIDDEN=1; EOVERFLOW_VALUE="$gl_cv_header_errno_h_EOVERFLOW" + ;; + esac + + + fi + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CC options needed to detect all undeclared functions" >&5 +printf %s "checking for $CC options needed to detect all undeclared functions... " >&6; } +if test ${ac_cv_c_undeclared_builtin_options+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_save_CFLAGS=$CFLAGS + ac_cv_c_undeclared_builtin_options='cannot detect' + for ac_arg in '' -fno-builtin; do + CFLAGS="$ac_save_CFLAGS $ac_arg" + # This test program should *not* compile successfully. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main (void) +{ +(void) strchr; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +else $as_nop + # This test program should compile successfully. + # No library function is consistently available on + # freestanding implementations, so test against a dummy + # declaration. Include always-available headers on the + # off chance that they somehow elicit warnings. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +extern void ac_decl (int, char *); + +int +main (void) +{ +(void) ac_decl (0, (char *) 0); + (void) ac_decl; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test x"$ac_arg" = x +then : + ac_cv_c_undeclared_builtin_options='none needed' +else $as_nop + ac_cv_c_undeclared_builtin_options=$ac_arg +fi + break +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + done + CFLAGS=$ac_save_CFLAGS + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_undeclared_builtin_options" >&5 +printf "%s\n" "$ac_cv_c_undeclared_builtin_options" >&6; } + case $ac_cv_c_undeclared_builtin_options in #( + 'cannot detect') : + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot make $CC report undeclared builtins +See \`config.log' for more details" "$LINENO" 5; } ;; #( + 'none needed') : + ac_c_undeclared_builtin_options='' ;; #( + *) : + ac_c_undeclared_builtin_options=$ac_cv_c_undeclared_builtin_options ;; +esac + +ac_fn_check_decl "$LINENO" "strerror_r" "ac_cv_have_decl_strerror_r" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_strerror_r" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_STRERROR_R $ac_have_decl" >>confdefs.h + + +if test $ac_cv_have_decl_strerror_r = yes; then + # For backward compatibility's sake, define HAVE_STRERROR_R. + # (We used to run AC_CHECK_FUNCS_ONCE for strerror_r, as well + # as AC_CHECK_DECLS_ONCE.) + +printf "%s\n" "#define HAVE_STRERROR_R 1" >>confdefs.h + +fi + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strerror_r returns char *" >&5 +printf %s "checking whether strerror_r returns char *... " >&6; } +if test ${ac_cv_func_strerror_r_char_p+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + ac_cv_func_strerror_r_char_p=no + if test $ac_cv_have_decl_strerror_r = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ + + char buf[100]; + char x = *strerror_r (0, buf, sizeof buf); + char *p = strerror_r (0, buf, sizeof buf); + return !p || x; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_func_strerror_r_char_p=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_strerror_r_char_p" >&5 +printf "%s\n" "$ac_cv_func_strerror_r_char_p" >&6; } +if test $ac_cv_func_strerror_r_char_p = yes; then + +printf "%s\n" "#define STRERROR_R_CHAR_P 1" >>confdefs.h + +fi + + + + + + ac_fn_c_check_type "$LINENO" "sig_atomic_t" "ac_cv_type_sig_atomic_t" "#include +" +if test "x$ac_cv_type_sig_atomic_t" = xyes +then : + +printf "%s\n" "#define HAVE_SIG_ATOMIC_T 1" >>confdefs.h + + +else $as_nop + +printf "%s\n" "#define sig_atomic_t int" >>confdefs.h + +fi + + + + HAVE_FCNTL=1; + HAVE_OPENAT=1; + REPLACE_CREAT=0; + REPLACE_FCNTL=0; + REPLACE_OPEN=0; + REPLACE_OPENAT=0; + + + + + GL_GNULIB_CREAT=0 + + + + GL_GNULIB_FCNTL=0 + + + + GL_GNULIB_NONBLOCKING=0 + + + + GL_GNULIB_OPEN=0 + + + + GL_GNULIB_OPENAT=0 + + + + GL_GNULIB_MDA_CREAT=1 + + + + GL_GNULIB_MDA_OPEN=1 + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working fcntl.h" >&5 +printf %s "checking for working fcntl.h... " >&6; } +if test ${gl_cv_header_working_fcntl_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess 'no' on native Windows. + mingw*) gl_cv_header_working_fcntl_h='no' ;; + *) gl_cv_header_working_fcntl_h=cross-compiling ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #if HAVE_UNISTD_H + # include + #else /* on Windows with MSVC */ + # include + # include + # defined sleep(n) _sleep ((n) * 1000) + #endif + #include + + +$gl_mda_defines + + #ifndef O_NOATIME + #define O_NOATIME 0 + #endif + #ifndef O_NOFOLLOW + #define O_NOFOLLOW 0 + #endif + static int const constants[] = + { + O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, + O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY + }; + +int +main (void) +{ + + int result = !constants; + #if HAVE_SYMLINK + { + static char const sym[] = "conftest.sym"; + if (symlink ("/dev/null", sym) != 0) + result |= 2; + else + { + int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); + if (fd >= 0) + { + close (fd); + result |= 4; + } + } + if (unlink (sym) != 0 || symlink (".", sym) != 0) + result |= 2; + else + { + int fd = open (sym, O_RDONLY | O_NOFOLLOW); + if (fd >= 0) + { + close (fd); + result |= 4; + } + } + unlink (sym); + } + #endif + { + static char const file[] = "confdefs.h"; + int fd = open (file, O_RDONLY | O_NOATIME); + if (fd < 0) + result |= 8; + else + { + struct stat st0; + if (fstat (fd, &st0) != 0) + result |= 16; + else + { + char c; + sleep (1); + if (read (fd, &c, 1) != 1) + result |= 24; + else + { + if (close (fd) != 0) + result |= 32; + else + { + struct stat st1; + if (stat (file, &st1) != 0) + result |= 40; + else + if (st0.st_atime != st1.st_atime) + result |= 64; + } + } + } + } + } + return result; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_header_working_fcntl_h=yes +else $as_nop + case $? in #( + 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( + 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( + 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( + *) gl_cv_header_working_fcntl_h='no';; + esac +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_fcntl_h" >&5 +printf "%s\n" "$gl_cv_header_working_fcntl_h" >&6; } + + case $gl_cv_header_working_fcntl_h in #( + *O_NOATIME* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + +printf "%s\n" "#define HAVE_WORKING_O_NOATIME $ac_val" >>confdefs.h + + + case $gl_cv_header_working_fcntl_h in #( + *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + +printf "%s\n" "#define HAVE_WORKING_O_NOFOLLOW $ac_val" >>confdefs.h + + + + ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default +" +if test "x$ac_cv_type_pid_t" = xyes +then : + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if defined _WIN64 && !defined __CYGWIN__ + LLP64 + #endif + +int +main (void) +{ + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_pid_type='int' +else $as_nop + ac_pid_type='__int64' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +printf "%s\n" "#define pid_t $ac_pid_type" >>confdefs.h + + +fi + + +ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" +if test "x$ac_cv_type_mode_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define mode_t int" >>confdefs.h + +fi + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_fcntl_h='<'fcntl.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_fcntl_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'fcntl.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_fcntl_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_fcntl_h + gl_cv_next_fcntl_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_fcntl_h" >&5 +printf "%s\n" "$gl_cv_next_fcntl_h" >&6; } + fi + NEXT_FCNTL_H=$gl_cv_next_fcntl_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'fcntl.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_fcntl_h + fi + NEXT_AS_FIRST_DIRECTIVE_FCNTL_H=$gl_next_as_first_directive + + + + + + + + + + + + + + + HAVE_FCHMODAT=1; + HAVE_FSTATAT=1; + HAVE_FUTIMENS=1; + HAVE_GETUMASK=1; + HAVE_LCHMOD=1; + HAVE_LSTAT=1; + HAVE_MKDIRAT=1; + HAVE_MKFIFO=1; + HAVE_MKFIFOAT=1; + HAVE_MKNOD=1; + HAVE_MKNODAT=1; + HAVE_UTIMENSAT=1; + REPLACE_FCHMODAT=0; + REPLACE_FSTAT=0; + REPLACE_FSTATAT=0; + REPLACE_FUTIMENS=0; + REPLACE_LSTAT=0; + REPLACE_MKDIR=0; + REPLACE_MKFIFO=0; + REPLACE_MKFIFOAT=0; + REPLACE_MKNOD=0; + REPLACE_MKNODAT=0; + REPLACE_STAT=0; + REPLACE_UTIMENSAT=0; + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 +printf %s "checking whether stat file-mode macros are broken... " >&6; } +if test ${ac_cv_header_stat_broken+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + +#if defined S_ISBLK && defined S_IFDIR +extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; +#endif + +#if defined S_ISBLK && defined S_IFCHR +extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; +#endif + +#if defined S_ISLNK && defined S_IFREG +extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; +#endif + +#if defined S_ISSOCK && defined S_IFREG +extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_header_stat_broken=no +else $as_nop + ac_cv_header_stat_broken=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 +printf "%s\n" "$ac_cv_header_stat_broken" >&6; } +if test $ac_cv_header_stat_broken = yes; then + +printf "%s\n" "#define STAT_MACROS_BROKEN 1" >>confdefs.h + +fi + + + + case "$host_os" in + mingw*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit off_t" >&5 +printf %s "checking for 64-bit off_t... " >&6; } +if test ${gl_cv_type_off_t_64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1]; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_type_off_t_64=yes +else $as_nop + gl_cv_type_off_t_64=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_off_t_64" >&5 +printf "%s\n" "$gl_cv_type_off_t_64" >&6; } + if test $gl_cv_type_off_t_64 = no; then + WINDOWS_64_BIT_OFF_T=1 + else + WINDOWS_64_BIT_OFF_T=0 + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for 64-bit st_size" >&5 +printf %s "checking for 64-bit st_size... " >&6; } +if test ${gl_cv_member_st_size_64+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + struct stat buf; + int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_member_st_size_64=yes +else $as_nop + gl_cv_member_st_size_64=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_member_st_size_64" >&5 +printf "%s\n" "$gl_cv_member_st_size_64" >&6; } + if test $gl_cv_member_st_size_64 = no; then + WINDOWS_64_BIT_ST_SIZE=1 + else + WINDOWS_64_BIT_ST_SIZE=0 + fi + ;; + *) + WINDOWS_64_BIT_OFF_T=0 + WINDOWS_64_BIT_ST_SIZE=0 + ;; + esac + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 +printf %s "checking for C/C++ restrict keyword... " >&6; } +if test ${ac_cv_c_restrict+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_cv_c_restrict=no + # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see: + # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html + # Put 'restrict' last, because C++ lacks it. + for ac_kw in __restrict__ __restrict _Restrict restrict; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +typedef int *int_ptr; + int foo (int_ptr $ac_kw ip) { return ip[0]; } + int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ + int bar (int ip[$ac_kw]) { return ip[0]; } + +int +main (void) +{ +int s[1]; + int *$ac_kw t = s; + t[0] = 0; + return foo (t) + bar (t); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_c_restrict=$ac_kw +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + test "$ac_cv_c_restrict" != no && break + done + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 +printf "%s\n" "$ac_cv_c_restrict" >&6; } + + case $ac_cv_c_restrict in + restrict) ;; + no) printf "%s\n" "#define restrict /**/" >>confdefs.h + ;; + *) printf "%s\n" "#define restrict $ac_cv_c_restrict" >>confdefs.h + ;; + esac + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_stat_h='<'sys/stat.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_sys_stat_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_sys_stat_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'sys/stat.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_sys_stat_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_sys_stat_h + gl_cv_next_sys_stat_h='"'$gl_header'"' + else + gl_cv_next_sys_stat_h='<'sys/stat.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_stat_h" >&5 +printf "%s\n" "$gl_cv_next_sys_stat_h" >&6; } + fi + NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/stat.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_stat_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H=$gl_next_as_first_directive + + + + + + + + + WINDOWS_STAT_TIMESPEC=0 + + + + + + + + + ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include + #include +" +if test "x$ac_cv_type_nlink_t" = xyes +then : + +else $as_nop + +printf "%s\n" "#define nlink_t int" >>confdefs.h + +fi + + + + + + + + + + + case "$host_os" in + mingw*) + ac_fn_c_check_header_compile "$LINENO" "sdkddkver.h" "ac_cv_header_sdkddkver_h" "$ac_includes_default" +if test "x$ac_cv_header_sdkddkver_h" = xyes +then : + printf "%s\n" "#define HAVE_SDKDDKVER_H 1" >>confdefs.h + +fi + + ;; + esac + + + + + + + + GL_GNULIB_FCHMODAT=0 + + + + GL_GNULIB_FSTAT=0 + + + + GL_GNULIB_FSTATAT=0 + + + + GL_GNULIB_FUTIMENS=0 + + + + GL_GNULIB_GETUMASK=0 + + + + GL_GNULIB_LCHMOD=0 + + + + GL_GNULIB_LSTAT=0 + + + + GL_GNULIB_MKDIR=0 + + + + GL_GNULIB_MKDIRAT=0 + + + + GL_GNULIB_MKFIFO=0 + + + + GL_GNULIB_MKFIFOAT=0 + + + + GL_GNULIB_MKNOD=0 + + + + GL_GNULIB_MKNODAT=0 + + + + GL_GNULIB_STAT=0 + + + + GL_GNULIB_UTIMENSAT=0 + + + + GL_GNULIB_OVERRIDES_STRUCT_STAT=0 + + + + GL_GNULIB_MDA_CHMOD=1 + + + + GL_GNULIB_MDA_MKDIR=1 + + + + GL_GNULIB_MDA_UMASK=1 + + + + +ac_fn_check_decl "$LINENO" "getdtablesize" "ac_cv_have_decl_getdtablesize" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_getdtablesize" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_GETDTABLESIZE $ac_have_decl" >>confdefs.h + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_limits_h='<'limits.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_limits_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_limits_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'limits.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_limits_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_limits_h + gl_cv_next_limits_h='"'$gl_header'"' + else + gl_cv_next_limits_h='<'limits.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_limits_h" >&5 +printf "%s\n" "$gl_cv_next_limits_h" >&6; } + fi + NEXT_LIMITS_H=$gl_cv_next_limits_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'limits.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_limits_h + fi + NEXT_AS_FIRST_DIRECTIVE_LIMITS_H=$gl_next_as_first_directive + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc." >&5 +printf %s "checking whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.... " >&6; } +if test ${gl_cv_header_limits_width+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + long long llm = LLONG_MAX; + int wb = WORD_BIT; + int ullw = ULLONG_WIDTH; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_limits_width=yes +else $as_nop + gl_cv_header_limits_width=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_limits_width" >&5 +printf "%s\n" "$gl_cv_header_limits_width" >&6; } + if test "$gl_cv_header_limits_width" = yes; then + LIMITS_H= + else + LIMITS_H=limits.h + fi + + if test -n "$LIMITS_H"; then + GL_GENERATE_LIMITS_H_TRUE= + GL_GENERATE_LIMITS_H_FALSE='#' +else + GL_GENERATE_LIMITS_H_TRUE='#' + GL_GENERATE_LIMITS_H_FALSE= +fi + + + + + + gl_threads_api=none + LIBTHREAD= + LTLIBTHREAD= + LIBMULTITHREAD= + LTLIBMULTITHREAD= + if test "$gl_use_threads" != no; then + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether imported symbols can be declared weak" >&5 +printf %s "checking whether imported symbols can be declared weak... " >&6; } +if test ${gl_cv_have_weak+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_have_weak=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern void xyzzy (); +#pragma weak xyzzy +int +main (void) +{ +xyzzy(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_have_weak=maybe +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + if test $gl_cv_have_weak = maybe; then + if test "$cross_compiling" = yes +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __ELF__ + Extensible Linking Format + #endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Extensible Linking Format" >/dev/null 2>&1 +then : + gl_cv_have_weak="guessing yes" +else $as_nop + gl_cv_have_weak="guessing no" +fi +rm -rf conftest* + + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#pragma weak fputs +int main () +{ + return (fputs == NULL); +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_have_weak=yes +else $as_nop + gl_cv_have_weak=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&5 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&5 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_have_weak" >&5 +printf "%s\n" "$gl_cv_have_weak" >&6; } + case "$gl_cv_have_weak" in + *yes) + +printf "%s\n" "#define HAVE_WEAK_SYMBOLS 1" >>confdefs.h + + ;; + esac + + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + + : + fi + if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then + + gl_have_isoc_threads="$ac_cv_header_threads_h" + fi + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + + + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes +then : + gl_have_pthread_h=yes +else $as_nop + gl_have_pthread_h=no +fi + + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + pthread_mutex_t m; + pthread_mutexattr_t ma; + +int +main (void) +{ +pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +printf %s "checking for pthread_kill in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_kill=yes +else $as_nop + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes +then : + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) + +printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + + esac + +fi + + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +printf %s "checking for pthread_kill in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_kill=yes +else $as_nop + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes +then : + gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread +fi + + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 +printf %s "checking for pthread_kill in -lc_r... " >&6; } +if test ${ac_cv_lib_c_r_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_c_r_pthread_kill=yes +else $as_nop + ac_cv_lib_c_r_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_c_r_pthread_kill" >&6; } +if test "x$ac_cv_lib_c_r_pthread_kill" = xyes +then : + gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r +fi + + fi + fi + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 +printf %s "checking whether POSIX threads API is available... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 +printf "%s\n" "$gl_pthread_api" >&6; } + + + if test $gl_pthread_api = yes; then + +printf "%s\n" "#define HAVE_PTHREAD_API 1" >>confdefs.h + + fi + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + LIB_SCHED_YIELD= + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 +printf %s "checking for sched_yield in -lrt... " >&6; } +if test ${ac_cv_lib_rt_sched_yield+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char sched_yield (); +int +main (void) +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_rt_sched_yield=yes +else $as_nop + ac_cv_lib_rt_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 +printf "%s\n" "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = xyes +then : + LIB_SCHED_YIELD=-lrt +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 +printf %s "checking for sched_yield in -lposix4... " >&6; } +if test ${ac_cv_lib_posix4_sched_yield+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char sched_yield (); +int +main (void) +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_posix4_sched_yield=yes +else $as_nop + ac_cv_lib_posix4_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 +printf "%s\n" "$ac_cv_lib_posix4_sched_yield" >&6; } +if test "x$ac_cv_lib_posix4_sched_yield" = xyes +then : + LIB_SCHED_YIELD=-lposix4 +fi + +fi + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + + + gl_pthreadlib_body_done=done + fi + + LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD + LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD + if test $gl_pthread_api = yes; then + if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then + gl_threads_api='isoc+posix' + +printf "%s\n" "#define USE_ISOC_AND_POSIX_THREADS 1" >>confdefs.h + + LIBTHREAD= LTLIBTHREAD= + else + gl_threads_api=posix + +printf "%s\n" "#define USE_POSIX_THREADS 1" >>confdefs.h + + if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + +printf "%s\n" "#define USE_POSIX_THREADS_WEAK 1" >>confdefs.h + + LIBTHREAD= LTLIBTHREAD= + else + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then + +printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + + fi + ;; + esac + fi + fi + fi + fi + fi + if test $gl_threads_api = none; then + if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then + + + + if test -z "$gl_stdthreadlib_body_done"; then + + + case "$host_os" in + mingw*) + LIBSTDTHREAD= + ;; + *) + + + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + ac_fn_c_check_header_compile "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default" +if test "x$ac_cv_header_pthread_h" = xyes +then : + gl_have_pthread_h=yes +else $as_nop + gl_have_pthread_h=no +fi + + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + pthread_mutex_t m; + pthread_mutexattr_t ma; + +int +main (void) +{ +pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +printf %s "checking for pthread_kill in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_kill=yes +else $as_nop + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes +then : + LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.1-9 | solaris2.1-9.* | hpux*) + +printf "%s\n" "#define PTHREAD_IN_USE_DETECTION_HARD 1" >>confdefs.h + + esac + +fi + + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lpthread" >&5 +printf %s "checking for pthread_kill in -lpthread... " >&6; } +if test ${ac_cv_lib_pthread_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_pthread_pthread_kill=yes +else $as_nop + ac_cv_lib_pthread_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_pthread_pthread_kill" >&6; } +if test "x$ac_cv_lib_pthread_pthread_kill" = xyes +then : + gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread +fi + + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pthread_kill in -lc_r" >&5 +printf %s "checking for pthread_kill in -lc_r... " >&6; } +if test ${ac_cv_lib_c_r_pthread_kill+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char pthread_kill (); +int +main (void) +{ +return pthread_kill (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_c_r_pthread_kill=yes +else $as_nop + ac_cv_lib_c_r_pthread_kill=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_r_pthread_kill" >&5 +printf "%s\n" "$ac_cv_lib_c_r_pthread_kill" >&6; } +if test "x$ac_cv_lib_c_r_pthread_kill" = xyes +then : + gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r +fi + + fi + fi + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether POSIX threads API is available" >&5 +printf %s "checking whether POSIX threads API is available... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_pthread_api" >&5 +printf "%s\n" "$gl_pthread_api" >&6; } + + + if test $gl_pthread_api = yes; then + +printf "%s\n" "#define HAVE_PTHREAD_API 1" >>confdefs.h + + fi + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + LIB_SCHED_YIELD= + +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lrt" >&5 +printf %s "checking for sched_yield in -lrt... " >&6; } +if test ${ac_cv_lib_rt_sched_yield+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lrt $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char sched_yield (); +int +main (void) +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_rt_sched_yield=yes +else $as_nop + ac_cv_lib_rt_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sched_yield" >&5 +printf "%s\n" "$ac_cv_lib_rt_sched_yield" >&6; } +if test "x$ac_cv_lib_rt_sched_yield" = xyes +then : + LIB_SCHED_YIELD=-lrt +else $as_nop + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for sched_yield in -lposix4" >&5 +printf %s "checking for sched_yield in -lposix4... " >&6; } +if test ${ac_cv_lib_posix4_sched_yield+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char sched_yield (); +int +main (void) +{ +return sched_yield (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_posix4_sched_yield=yes +else $as_nop + ac_cv_lib_posix4_sched_yield=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_posix4_sched_yield" >&5 +printf "%s\n" "$ac_cv_lib_posix4_sched_yield" >&6; } +if test "x$ac_cv_lib_posix4_sched_yield" = xyes +then : + LIB_SCHED_YIELD=-lposix4 +fi + +fi + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + + + gl_pthreadlib_body_done=done + fi + + if test $ac_cv_header_threads_h = yes; then + ac_fn_c_check_func "$LINENO" "thrd_create" "ac_cv_func_thrd_create" +if test "x$ac_cv_func_thrd_create" = xyes +then : + printf "%s\n" "#define HAVE_THRD_CREATE 1" >>confdefs.h + +fi + + if test $ac_cv_func_thrd_create = yes; then + LIBSTDTHREAD= + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for thrd_create in -lstdthreads" >&5 +printf %s "checking for thrd_create in -lstdthreads... " >&6; } +if test ${ac_cv_lib_stdthreads_thrd_create+y} +then : + printf %s "(cached) " >&6 +else $as_nop + ac_check_lib_save_LIBS=$LIBS +LIBS="-lstdthreads $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +char thrd_create (); +int +main (void) +{ +return thrd_create (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_stdthreads_thrd_create=yes +else $as_nop + ac_cv_lib_stdthreads_thrd_create=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_stdthreads_thrd_create" >&5 +printf "%s\n" "$ac_cv_lib_stdthreads_thrd_create" >&6; } +if test "x$ac_cv_lib_stdthreads_thrd_create" = xyes +then : + + LIBSTDTHREAD='-lstdthreads -lpthread' + +else $as_nop + + LIBSTDTHREAD="$LIBPMULTITHREAD" + +fi + + fi + else + LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" + fi + ;; + esac + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether ISO C threads API is available" >&5 +printf %s "checking whether ISO C threads API is available... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_threads_h" >&5 +printf "%s\n" "$ac_cv_header_threads_h" >&6; } + gl_stdthreadlib_body_done=done + fi + + LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD + LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD + gl_threads_api=isoc + +printf "%s\n" "#define USE_ISOC_THREADS 1" >>confdefs.h + + fi + fi + if test $gl_threads_api = none; then + case "$gl_use_threads" in + yes | windows | win32) # The 'win32' is for backward compatibility. + if { case "$host_os" in + mingw*) true;; + *) false;; + esac + }; then + gl_threads_api=windows + +printf "%s\n" "#define USE_WINDOWS_THREADS 1" >>confdefs.h + + fi + ;; + esac + fi + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for multithread API to use" >&5 +printf %s "checking for multithread API to use... " >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_threads_api" >&5 +printf "%s\n" "$gl_threads_api" >&6; } + + + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 +printf %s "checking for GNU libc compatible malloc... " >&6; } +if test ${ac_cv_func_malloc_0_nonnull+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in # (( + # Guess yes on platforms where we know the result. + *-gnu* | freebsd* | netbsd* | openbsd* | bitrig* \ + | hpux* | solaris* | cygwin* | mingw* | msys* ) + ac_cv_func_malloc_0_nonnull=yes ;; + # If we don't know, assume the worst. + *) ac_cv_func_malloc_0_nonnull=no ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +void *p = malloc (0); + int result = !p; + free (p); + return result; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + ac_cv_func_malloc_0_nonnull=yes +else $as_nop + ac_cv_func_malloc_0_nonnull=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 +printf "%s\n" "$ac_cv_func_malloc_0_nonnull" >&6; } +if test $ac_cv_func_malloc_0_nonnull = yes +then : + gl_cv_func_malloc_0_nonnull=1 +else $as_nop + gl_cv_func_malloc_0_nonnull=0 +fi + + +printf "%s\n" "#define MALLOC_0_IS_NONNULL $gl_cv_func_malloc_0_nonnull" >>confdefs.h + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the compiler produces multi-arch binaries" >&5 +printf %s "checking whether the compiler produces multi-arch binaries... " >&6; } +if test ${gl_cv_c_multiarch+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_c_multiarch=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + + arch= + prev= + for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do + if test -n "$prev"; then + case $word in + i?86 | x86_64 | ppc | ppc64 | arm | arm64) + if test -z "$arch" || test "$arch" = "$word"; then + arch="$word" + else + gl_cv_c_multiarch=yes + fi + ;; + esac + prev= + else + if test "x$word" = "x-arch"; then + prev=arch + fi + fi + done + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_c_multiarch" >&5 +printf "%s\n" "$gl_cv_c_multiarch" >&6; } + if test $gl_cv_c_multiarch = yes; then + APPLE_UNIVERSAL_BUILD=1 + else + APPLE_UNIVERSAL_BUILD=0 + fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for O_CLOEXEC" >&5 +printf %s "checking for O_CLOEXEC... " >&6; } +if test ${gl_cv_macro_O_CLOEXEC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #ifndef O_CLOEXEC + choke me; + #endif + +int +main (void) +{ +return O_CLOEXEC; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_macro_O_CLOEXEC=yes +else $as_nop + gl_cv_macro_O_CLOEXEC=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_macro_O_CLOEXEC" >&5 +printf "%s\n" "$gl_cv_macro_O_CLOEXEC" >&6; } + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for promoted mode_t type" >&5 +printf %s "checking for promoted mode_t type... " >&6; } +if test ${gl_cv_promoted_mode_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1]; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_promoted_mode_t='int' +else $as_nop + gl_cv_promoted_mode_t='mode_t' +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_promoted_mode_t" >&5 +printf "%s\n" "$gl_cv_promoted_mode_t" >&6; } + +printf "%s\n" "#define PROMOTED_MODE_T $gl_cv_promoted_mode_t" >>confdefs.h + + + + + HAVE_POSIX_SIGNALBLOCKING=1; + HAVE_PTHREAD_SIGMASK=1; + HAVE_RAISE=1; + HAVE_SIGSET_T=1; + HAVE_SIGINFO_T=1; + HAVE_SIGACTION=1; + HAVE_STRUCT_SIGACTION_SA_SIGACTION=1; + + HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; + + HAVE_SIGHANDLER_T=1; + REPLACE_PTHREAD_SIGMASK=0; + REPLACE_RAISE=0; + + + ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" " + #include + /* Mingw defines sigset_t not in , but in . */ + #include + +" +if test "x$ac_cv_type_sigset_t" = xyes +then : + +printf "%s\n" "#define HAVE_SIGSET_T 1" >>confdefs.h + +gl_cv_type_sigset_t=yes +else $as_nop + gl_cv_type_sigset_t=no +fi + + if test $gl_cv_type_sigset_t != yes; then + HAVE_SIGSET_T=0 + fi + + + + GL_GNULIB_PTHREAD_SIGMASK=0 + + + + GL_GNULIB_RAISE=0 + + + + GL_GNULIB_SIGNAL_H_SIGPIPE=0 + + + + GL_GNULIB_SIGPROCMASK=0 + + + + GL_GNULIB_SIGACTION=0 + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 +printf %s "checking for uid_t in sys/types.h... " >&6; } +if test ${ac_cv_type_uid_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "uid_t" >/dev/null 2>&1 +then : + ac_cv_type_uid_t=yes +else $as_nop + ac_cv_type_uid_t=no +fi +rm -rf conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 +printf "%s\n" "$ac_cv_type_uid_t" >&6; } +if test $ac_cv_type_uid_t = no; then + +printf "%s\n" "#define uid_t int" >>confdefs.h + + +printf "%s\n" "#define gid_t int" >>confdefs.h + +fi + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_signal_h='<'signal.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_signal_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'signal.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_signal_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_signal_h + gl_cv_next_signal_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_signal_h" >&5 +printf "%s\n" "$gl_cv_next_signal_h" >&6; } + fi + NEXT_SIGNAL_H=$gl_cv_next_signal_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'signal.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_signal_h + fi + NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H=$gl_next_as_first_directive + + + + + +# AIX declares sig_atomic_t to already include volatile, and C89 compilers +# then choke on 'volatile sig_atomic_t'. C99 requires that it compile. + ac_fn_c_check_type "$LINENO" "volatile sig_atomic_t" "ac_cv_type_volatile_sig_atomic_t" " +#include + +" +if test "x$ac_cv_type_volatile_sig_atomic_t" = xyes +then : + +else $as_nop + HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0 +fi + + + + + + + + ac_fn_c_check_type "$LINENO" "sighandler_t" "ac_cv_type_sighandler_t" " +#include + +" +if test "x$ac_cv_type_sighandler_t" = xyes +then : + +else $as_nop + HAVE_SIGHANDLER_T=0 +fi + + + + + + + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5 +printf %s "checking for stdbool.h that conforms to C99... " >&6; } +if test ${ac_cv_header_stdbool_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + + #ifdef __cplusplus + typedef bool Bool; + #else + typedef _Bool Bool; + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #endif + + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + + struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + /* See body of main program for 'e'. */ + char f[(Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See + https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html + */ + Bool q = true; + Bool *pq = &q; + bool *qq = &q; + +int +main (void) +{ + + bool e = &s; + *pq |= q; *pq |= ! q; + *qq |= q; *qq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq + !qq); + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_header_stdbool_h=yes +else $as_nop + ac_cv_header_stdbool_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5 +printf "%s\n" "$ac_cv_header_stdbool_h" >&6; } + ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default" +if test "x$ac_cv_type__Bool" = xyes +then : + +printf "%s\n" "#define HAVE__BOOL 1" >>confdefs.h + + +fi + + + + REPLACE_NULL=0; + HAVE_MAX_ALIGN_T=1; + HAVE_WCHAR_T=1; + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wchar_t" >&5 +printf %s "checking for wchar_t... " >&6; } +if test ${gt_cv_c_wchar_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + wchar_t foo = (wchar_t)'\0'; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gt_cv_c_wchar_t=yes +else $as_nop + gt_cv_c_wchar_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wchar_t" >&5 +printf "%s\n" "$gt_cv_c_wchar_t" >&6; } + if test $gt_cv_c_wchar_t = yes; then + +printf "%s\n" "#define HAVE_WCHAR_T 1" >>confdefs.h + + fi + + + + + + + + STDDEF_H= + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for good max_align_t" >&5 +printf %s "checking for good max_align_t... " >&6; } +if test ${gl_cv_type_max_align_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + unsigned int s = sizeof (max_align_t); + #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ + int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; + int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; + #endif + typedef struct { char a; max_align_t b; } max_helper; + typedef struct { char a; long b; } long_helper; + typedef struct { char a; double b; } double_helper; + typedef struct { char a; long double b; } long_double_helper; + int check3[2 * (offsetof (long_helper, b) <= offsetof (max_helper, b)) - 1]; + int check4[2 * (offsetof (double_helper, b) <= offsetof (max_helper, b)) - 1]; + int check5[2 * (offsetof (long_double_helper, b) <= offsetof (max_helper, b)) - 1]; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_type_max_align_t=yes +else $as_nop + gl_cv_type_max_align_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_max_align_t" >&5 +printf "%s\n" "$gl_cv_type_max_align_t" >&6; } + if test $gl_cv_type_max_align_t = no; then + HAVE_MAX_ALIGN_T=0 + STDDEF_H=stddef.h + fi + + if test $gt_cv_c_wchar_t = no; then + HAVE_WCHAR_T=0 + STDDEF_H=stddef.h + fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether NULL can be used in arbitrary expressions" >&5 +printf %s "checking whether NULL can be used in arbitrary expressions... " >&6; } +if test ${gl_cv_decl_null_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int test[2 * (sizeof NULL == sizeof (void *)) -1]; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_decl_null_works=yes +else $as_nop + gl_cv_decl_null_works=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_decl_null_works" >&5 +printf "%s\n" "$gl_cv_decl_null_works" >&6; } + if test $gl_cv_decl_null_works = no; then + REPLACE_NULL=1 + STDDEF_H=stddef.h + fi + + + if test -n "$STDDEF_H"; then + GL_GENERATE_STDDEF_H_TRUE= + GL_GENERATE_STDDEF_H_FALSE='#' +else + GL_GENERATE_STDDEF_H_TRUE='#' + GL_GENERATE_STDDEF_H_FALSE= +fi + + if test -n "$STDDEF_H"; then + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stddef_h='<'stddef.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_stddef_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'stddef.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_stddef_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_stddef_h + gl_cv_next_stddef_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stddef_h" >&5 +printf "%s\n" "$gl_cv_next_stddef_h" >&6; } + fi + NEXT_STDDEF_H=$gl_cv_next_stddef_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'stddef.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_stddef_h + fi + NEXT_AS_FIRST_DIRECTIVE_STDDEF_H=$gl_next_as_first_directive + + + + + fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for wint_t" >&5 +printf %s "checking for wint_t... " >&6; } +if test ${gt_cv_c_wint_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + wint_t foo = (wchar_t)'\0'; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gt_cv_c_wint_t=yes +else $as_nop + gt_cv_c_wint_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_c_wint_t" >&5 +printf "%s\n" "$gt_cv_c_wint_t" >&6; } + if test $gt_cv_c_wint_t = yes; then + +printf "%s\n" "#define HAVE_WINT_T 1" >>confdefs.h + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether wint_t is large enough" >&5 +printf %s "checking whether wint_t is large enough... " >&6; } +if test ${gl_cv_type_wint_t_large_enough+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_type_wint_t_large_enough=yes +else $as_nop + gl_cv_type_wint_t_large_enough=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_type_wint_t_large_enough" >&5 +printf "%s\n" "$gl_cv_type_wint_t_large_enough" >&6; } + if test $gl_cv_type_wint_t_large_enough = no; then + GNULIBHEADERS_OVERRIDE_WINT_T=1 + else + GNULIBHEADERS_OVERRIDE_WINT_T=0 + fi + else + GNULIBHEADERS_OVERRIDE_WINT_T=0 + fi + + + + + + + + +printf "%s\n" "#define HAVE_LONG_LONG_INT 1" >>confdefs.h + + +printf "%s\n" "#define HAVE_UNSIGNED_LONG_LONG_INT 1" >>confdefs.h + + + + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + + + + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + + + + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdint_h='<'stdint.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_stdint_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_stdint_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'stdint.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_stdint_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_stdint_h + gl_cv_next_stdint_h='"'$gl_header'"' + else + gl_cv_next_stdint_h='<'stdint.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdint_h" >&5 +printf "%s\n" "$gl_cv_next_stdint_h" >&6; } + fi + NEXT_STDINT_H=$gl_cv_next_stdint_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'stdint.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_stdint_h + fi + NEXT_AS_FIRST_DIRECTIVE_STDINT_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_stdint_h = yes; then + HAVE_STDINT_H=1 + else + HAVE_STDINT_H=0 + fi + + + if test $ac_cv_header_stdint_h = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stdint.h conforms to C99" >&5 +printf %s "checking whether stdint.h conforms to C99... " >&6; } +if test ${gl_cv_header_working_stdint_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_header_working_stdint_h=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 +#include +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in " +#endif + + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; + +/* Check that SIZE_MAX has the correct type, if possible. */ +#if 201112 <= __STDC_VERSION__ +int k = _Generic (SIZE_MAX, size_t: 0); +#elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) +extern size_t k; +extern __typeof__ (SIZE_MAX) k; +#endif + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) +struct s { + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; + # In general, assume it works. + *) gl_cv_header_working_stdint_h="guessing yes" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 +#include + + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + +#include +#include +#define MVAL(macro) MVAL1(macro) +#define MVAL1(expression) #expression +static const char *macro_values[] = + { +#ifdef INT8_MAX + MVAL (INT8_MAX), +#endif +#ifdef INT16_MAX + MVAL (INT16_MAX), +#endif +#ifdef INT32_MAX + MVAL (INT32_MAX), +#endif +#ifdef INT64_MAX + MVAL (INT64_MAX), +#endif +#ifdef UINT8_MAX + MVAL (UINT8_MAX), +#endif +#ifdef UINT16_MAX + MVAL (UINT16_MAX), +#endif +#ifdef UINT32_MAX + MVAL (UINT32_MAX), +#endif +#ifdef UINT64_MAX + MVAL (UINT64_MAX), +#endif + NULL + }; + +int +main (void) +{ + + const char **mv; + for (mv = macro_values; *mv != NULL; mv++) + { + const char *value = *mv; + /* Test whether it looks like a cast expression. */ + if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 + || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 + || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 + || strncmp (value, "((int)"/*)*/, 6) == 0 + || strncmp (value, "((signed short)"/*)*/, 15) == 0 + || strncmp (value, "((signed char)"/*)*/, 14) == 0) + return mv - macro_values + 1; + } + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_header_working_stdint_h=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdint_h" >&5 +printf "%s\n" "$gl_cv_header_working_stdint_h" >&6; } + fi + + HAVE_C99_STDINT_H=0 + HAVE_SYS_BITYPES_H=0 + HAVE_SYS_INTTYPES_H=0 + STDINT_H=stdint.h + case "$gl_cv_header_working_stdint_h" in + *yes) + HAVE_C99_STDINT_H=1 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stdint.h works without ISO C predefines" >&5 +printf %s "checking whether stdint.h works without ISO C predefines... " >&6; } +if test ${gl_cv_header_stdint_without_STDC_macros+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_header_stdint_without_STDC_macros=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include + + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + +intmax_t im = INTMAX_MAX; +int32_t i32 = INT32_C (0x7fffffff); + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_stdint_without_STDC_macros=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_without_STDC_macros" >&5 +printf "%s\n" "$gl_cv_header_stdint_without_STDC_macros" >&6; } + + if test $gl_cv_header_stdint_without_STDC_macros = no; then + +printf "%s\n" "#define __STDC_CONSTANT_MACROS 1" >>confdefs.h + + +printf "%s\n" "#define __STDC_LIMIT_MACROS 1" >>confdefs.h + + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stdint.h has UINTMAX_WIDTH etc." >&5 +printf %s "checking whether stdint.h has UINTMAX_WIDTH etc.... " >&6; } +if test ${gl_cv_header_stdint_width+y} +then : + printf %s "(cached) " >&6 +else $as_nop + gl_cv_header_stdint_width=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 + #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + int iw = UINTMAX_WIDTH; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_stdint_width=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_stdint_width" >&5 +printf "%s\n" "$gl_cv_header_stdint_width" >&6; } + if test "$gl_cv_header_stdint_width" = yes; then + STDINT_H= + fi + ;; + *) + ac_fn_c_check_header_compile "$LINENO" "sys/inttypes.h" "ac_cv_header_sys_inttypes_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_inttypes_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_INTTYPES_H 1" >>confdefs.h + +fi +ac_fn_c_check_header_compile "$LINENO" "sys/bitypes.h" "ac_cv_header_sys_bitypes_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_bitypes_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_BITYPES_H 1" >>confdefs.h + +fi + + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + fi + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + fi + + + if test $APPLE_UNIVERSAL_BUILD = 0; then + + + for gltype in ptrdiff_t size_t ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 +printf %s "checking for bit size of $gltype... " >&6; } +if eval test \${gl_cv_bitsizeof_${gltype}+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " + #include + #include + #if HAVE_WCHAR_H + # include + #endif + +#include " +then : + +else $as_nop + result=unknown +fi + + eval gl_cv_bitsizeof_${gltype}=\$result + +fi +eval ac_res=\$gl_cv_bitsizeof_${gltype} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + printf "%s\n" "#define BITSIZEOF_${GLTYPE} $result" >>confdefs.h + + eval BITSIZEOF_${GLTYPE}=\$result + done + + + fi + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bit size of $gltype" >&5 +printf %s "checking for bit size of $gltype... " >&6; } +if eval test \${gl_cv_bitsizeof_${gltype}+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if ac_fn_c_compute_int "$LINENO" "sizeof ($gltype) * CHAR_BIT" "result" " + #include + #include + #if HAVE_WCHAR_H + # include + #endif + +#include " +then : + +else $as_nop + result=unknown +fi + + eval gl_cv_bitsizeof_${gltype}=\$result + +fi +eval ac_res=\$gl_cv_bitsizeof_${gltype} + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + printf "%s\n" "#define BITSIZEOF_${GLTYPE} $result" >>confdefs.h + + eval BITSIZEOF_${GLTYPE}=\$result + done + + + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether $gltype is signed" >&5 +printf %s "checking whether $gltype is signed... " >&6; } +if eval test \${gl_cv_type_${gltype}_signed+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1]; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + result=yes +else $as_nop + result=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval gl_cv_type_${gltype}_signed=\$result + +fi +eval ac_res=\$gl_cv_type_${gltype}_signed + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + printf "%s\n" "#define HAVE_SIGNED_${GLTYPE} 1" >>confdefs.h + + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + + + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + if test $APPLE_UNIVERSAL_BUILD = 0; then + + + for gltype in ptrdiff_t size_t ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 +printf %s "checking for $gltype integer literal suffix... " >&6; } +if eval test \${gl_cv_type_${gltype}_suffix+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval gl_cv_type_${gltype}_suffix=\$glsuf +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done +fi +eval ac_res=\$gl_cv_type_${gltype}_suffix + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + printf "%s\n" "#define ${GLTYPE}_SUFFIX $result" >>confdefs.h + + done + + + fi + + + for gltype in sig_atomic_t wchar_t wint_t ; do + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $gltype integer literal suffix" >&5 +printf %s "checking for $gltype integer literal suffix... " >&6; } +if eval test \${gl_cv_type_${gltype}_suffix+y} +then : + printf %s "(cached) " >&6 +else $as_nop + eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #if HAVE_WCHAR_H + # include + #endif + + extern $gltype foo; + extern $gltype1 foo; +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + eval gl_cv_type_${gltype}_suffix=\$glsuf +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done +fi +eval ac_res=\$gl_cv_type_${gltype}_suffix + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +printf "%s\n" "$ac_res" >&6; } + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + printf "%s\n" "#define ${GLTYPE}_SUFFIX $result" >>confdefs.h + + done + + + + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then + BITSIZEOF_WINT_T=32 + fi + + ;; + esac + + + + LIMITS_H='limits.h' + if test -n "$LIMITS_H"; then + GL_GENERATE_LIMITS_H_TRUE= + GL_GENERATE_LIMITS_H_FALSE='#' +else + GL_GENERATE_LIMITS_H_TRUE='#' + GL_GENERATE_LIMITS_H_FALSE= +fi + + + + + + + + if test -n "$STDINT_H"; then + GL_GENERATE_STDINT_H_TRUE= + GL_GENERATE_STDINT_H_FALSE='#' +else + GL_GENERATE_STDINT_H_TRUE='#' + GL_GENERATE_STDINT_H_FALSE= +fi + + + + HAVE_DECL_FCLOSEALL=1; + HAVE_DECL_FPURGE=1; + HAVE_DECL_FSEEKO=1; + HAVE_DECL_FTELLO=1; + HAVE_DECL_GETDELIM=1; + HAVE_DECL_GETLINE=1; + HAVE_DECL_OBSTACK_PRINTF=1; + HAVE_DECL_SNPRINTF=1; + HAVE_DECL_VSNPRINTF=1; + HAVE_DPRINTF=1; + HAVE_FSEEKO=1; + HAVE_FTELLO=1; + HAVE_PCLOSE=1; + HAVE_POPEN=1; + HAVE_RENAMEAT=1; + HAVE_VASPRINTF=1; + HAVE_VDPRINTF=1; + REPLACE_DPRINTF=0; + REPLACE_FCLOSE=0; + REPLACE_FDOPEN=0; + REPLACE_FFLUSH=0; + REPLACE_FOPEN=0; + REPLACE_FPRINTF=0; + REPLACE_FPURGE=0; + REPLACE_FREOPEN=0; + REPLACE_FSEEK=0; + REPLACE_FSEEKO=0; + REPLACE_FTELL=0; + REPLACE_FTELLO=0; + REPLACE_GETDELIM=0; + REPLACE_GETLINE=0; + REPLACE_OBSTACK_PRINTF=0; + REPLACE_PERROR=0; + REPLACE_POPEN=0; + REPLACE_PRINTF=0; + REPLACE_REMOVE=0; + REPLACE_RENAME=0; + REPLACE_RENAMEAT=0; + REPLACE_SNPRINTF=0; + REPLACE_SPRINTF=0; + REPLACE_STDIO_READ_FUNCS=0; + REPLACE_STDIO_WRITE_FUNCS=0; + REPLACE_TMPFILE=0; + REPLACE_VASPRINTF=0; + REPLACE_VDPRINTF=0; + REPLACE_VFPRINTF=0; + REPLACE_VPRINTF=0; + REPLACE_VSNPRINTF=0; + REPLACE_VSPRINTF=0; + +ac_fn_check_decl "$LINENO" "fcloseall" "ac_cv_have_decl_fcloseall" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_fcloseall" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_FCLOSEALL $ac_have_decl" >>confdefs.h + + + + + printf "%s\n" "#define __USE_MINGW_ANSI_STDIO 1" >>confdefs.h + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_stdio_h='<'stdio.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_stdio_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'stdio.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_stdio_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_stdio_h + gl_cv_next_stdio_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_stdio_h" >&5 +printf "%s\n" "$gl_cv_next_stdio_h" >&6; } + fi + NEXT_STDIO_H=$gl_cv_next_stdio_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'stdio.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_stdio_h + fi + NEXT_AS_FIRST_DIRECTIVE_STDIO_H=$gl_next_as_first_directive + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking which flavor of printf attribute matches inttypes macros" >&5 +printf %s "checking which flavor of printf attribute matches inttypes macros... " >&6; } +if test ${gl_cv_func_printf_attribute_flavor+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #define __STDC_FORMAT_MACROS 1 + #include + #include + /* For non-mingw systems, compilation will trivially succeed. + For mingw, compilation will succeed for older mingw (system + printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */ + #if (defined _WIN32 && ! defined __CYGWIN__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1]; + #endif + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_printf_attribute_flavor=system +else $as_nop + gl_cv_func_printf_attribute_flavor=gnu +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_printf_attribute_flavor" >&5 +printf "%s\n" "$gl_cv_func_printf_attribute_flavor" >&6; } + if test "$gl_cv_func_printf_attribute_flavor" = gnu; then + +printf "%s\n" "#define GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU 1" >>confdefs.h + + fi + + + + + + + + + + + + + + if test $ac_cv_have_decl_fcloseall = no; then + HAVE_DECL_FCLOSEALL=0 + fi + + + + GL_GNULIB_DPRINTF=0 + + + + GL_GNULIB_FCLOSE=0 + + + + GL_GNULIB_FDOPEN=0 + + + + GL_GNULIB_FFLUSH=0 + + + + GL_GNULIB_FGETC=0 + + + + GL_GNULIB_FGETS=0 + + + + GL_GNULIB_FOPEN=0 + + + + GL_GNULIB_FPRINTF=0 + + + + GL_GNULIB_FPRINTF_POSIX=0 + + + + GL_GNULIB_FPURGE=0 + + + + GL_GNULIB_FPUTC=0 + + + + GL_GNULIB_FPUTS=0 + + + + GL_GNULIB_FREAD=0 + + + + GL_GNULIB_FREOPEN=0 + + + + GL_GNULIB_FSCANF=0 + + + + GL_GNULIB_FSEEK=0 + + + + GL_GNULIB_FSEEKO=0 + + + + GL_GNULIB_FTELL=0 + + + + GL_GNULIB_FTELLO=0 + + + + GL_GNULIB_FWRITE=0 + + + + GL_GNULIB_GETC=0 + + + + GL_GNULIB_GETCHAR=0 + + + + GL_GNULIB_GETDELIM=0 + + + + GL_GNULIB_GETLINE=0 + + + + GL_GNULIB_OBSTACK_PRINTF=0 + + + + GL_GNULIB_OBSTACK_PRINTF_POSIX=0 + + + + GL_GNULIB_PCLOSE=0 + + + + GL_GNULIB_PERROR=0 + + + + GL_GNULIB_POPEN=0 + + + + GL_GNULIB_PRINTF=0 + + + + GL_GNULIB_PRINTF_POSIX=0 + + + + GL_GNULIB_PUTC=0 + + + + GL_GNULIB_PUTCHAR=0 + + + + GL_GNULIB_PUTS=0 + + + + GL_GNULIB_REMOVE=0 + + + + GL_GNULIB_RENAME=0 + + + + GL_GNULIB_RENAMEAT=0 + + + + GL_GNULIB_SCANF=0 + + + + GL_GNULIB_SNPRINTF=0 + + + + GL_GNULIB_SPRINTF_POSIX=0 + + + + GL_GNULIB_STDIO_H_NONBLOCKING=0 + + + + GL_GNULIB_STDIO_H_SIGPIPE=0 + + + + GL_GNULIB_TMPFILE=0 + + + + GL_GNULIB_VASPRINTF=0 + + + + GL_GNULIB_VFSCANF=0 + + + + GL_GNULIB_VSCANF=0 + + + + GL_GNULIB_VDPRINTF=0 + + + + GL_GNULIB_VFPRINTF=0 + + + + GL_GNULIB_VFPRINTF_POSIX=0 + + + + GL_GNULIB_VPRINTF=0 + + + + GL_GNULIB_VPRINTF_POSIX=0 + + + + GL_GNULIB_VSNPRINTF=0 + + + + GL_GNULIB_VSPRINTF_POSIX=0 + + + + GL_GNULIB_MDA_FCLOSEALL=1 + + + + GL_GNULIB_MDA_FDOPEN=1 + + + + GL_GNULIB_MDA_FILENO=1 + + + + GL_GNULIB_MDA_GETW=1 + + + + GL_GNULIB_MDA_PUTW=1 + + + + GL_GNULIB_MDA_TEMPNAM=1 + + + + + HAVE_MBSLEN=0; + HAVE_EXPLICIT_BZERO=1; + HAVE_FFSL=1; + HAVE_FFSLL=1; + HAVE_DECL_MEMMEM=1; + HAVE_MEMPCPY=1; + HAVE_DECL_MEMRCHR=1; + HAVE_RAWMEMCHR=1; + HAVE_STPCPY=1; + HAVE_STPNCPY=1; + HAVE_STRCHRNUL=1; + HAVE_DECL_STRDUP=1; + HAVE_DECL_STRNDUP=1; + HAVE_DECL_STRNLEN=1; + HAVE_STRPBRK=1; + HAVE_STRSEP=1; + HAVE_STRCASESTR=1; + HAVE_DECL_STRTOK_R=1; + HAVE_DECL_STRERROR_R=1; + HAVE_STRERRORNAME_NP=1; + HAVE_SIGABBREV_NP=1; + HAVE_SIGDESCR_NP=1; + HAVE_DECL_STRSIGNAL=1; + HAVE_STRVERSCMP=1; + REPLACE_FFSLL=0; + REPLACE_MEMCHR=0; + REPLACE_MEMMEM=0; + REPLACE_STPNCPY=0; + REPLACE_STRCHRNUL=0; + REPLACE_STRDUP=0; + REPLACE_STRNCAT=0; + REPLACE_STRNDUP=0; + REPLACE_STRNLEN=0; + REPLACE_STRSTR=0; + REPLACE_STRCASESTR=0; + REPLACE_STRTOK_R=0; + REPLACE_STRERROR=0; + REPLACE_STRERROR_R=0; + REPLACE_STRERRORNAME_NP=0; + REPLACE_STRSIGNAL=0; + UNDEFINE_STRTOK_R=0; + + + REPLACE_STRERROR_0=0 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether strerror(0) succeeds" >&5 +printf %s "checking whether strerror(0) succeeds... " >&6; } +if test ${gl_cv_func_strerror_0_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main (void) +{ +int result = 0; + char *str; + errno = 0; + str = strerror (0); + if (!*str) result |= 1; + if (errno) result |= 2; + if (strstr (str, "nknown") || strstr (str, "ndefined")) + result |= 4; + return result; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_strerror_0_works=yes +else $as_nop + gl_cv_func_strerror_0_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_strerror_0_works" >&5 +printf "%s\n" "$gl_cv_func_strerror_0_works" >&6; } + case "$gl_cv_func_strerror_0_works" in + *yes) ;; + *) + REPLACE_STRERROR_0=1 + +printf "%s\n" "#define REPLACE_STRERROR_0 1" >>confdefs.h + + ;; + esac + + + + GL_GNULIB_EXPLICIT_BZERO=0 + + + + GL_GNULIB_FFSL=0 + + + + GL_GNULIB_FFSLL=0 + + + + GL_GNULIB_MEMCHR=0 + + + + GL_GNULIB_MEMMEM=0 + + + + GL_GNULIB_MEMPCPY=0 + + + + GL_GNULIB_MEMRCHR=0 + + + + GL_GNULIB_RAWMEMCHR=0 + + + + GL_GNULIB_STPCPY=0 + + + + GL_GNULIB_STPNCPY=0 + + + + GL_GNULIB_STRCHRNUL=0 + + + + GL_GNULIB_STRDUP=0 + + + + GL_GNULIB_STRNCAT=0 + + + + GL_GNULIB_STRNDUP=0 + + + + GL_GNULIB_STRNLEN=0 + + + + GL_GNULIB_STRPBRK=0 + + + + GL_GNULIB_STRSEP=0 + + + + GL_GNULIB_STRSTR=0 + + + + GL_GNULIB_STRCASESTR=0 + + + + GL_GNULIB_STRTOK_R=0 + + + + GL_GNULIB_MBSLEN=0 + + + + GL_GNULIB_MBSNLEN=0 + + + + GL_GNULIB_MBSCHR=0 + + + + GL_GNULIB_MBSRCHR=0 + + + + GL_GNULIB_MBSSTR=0 + + + + GL_GNULIB_MBSCASECMP=0 + + + + GL_GNULIB_MBSNCASECMP=0 + + + + GL_GNULIB_MBSPCASECMP=0 + + + + GL_GNULIB_MBSCASESTR=0 + + + + GL_GNULIB_MBSCSPN=0 + + + + GL_GNULIB_MBSPBRK=0 + + + + GL_GNULIB_MBSSPN=0 + + + + GL_GNULIB_MBSSEP=0 + + + + GL_GNULIB_MBSTOK_R=0 + + + + GL_GNULIB_STRERROR=0 + + + + GL_GNULIB_STRERROR_R=0 + + + + GL_GNULIB_STRERRORNAME_NP=0 + + + + GL_GNULIB_SIGABBREV_NP=0 + + + + GL_GNULIB_SIGDESCR_NP=0 + + + + GL_GNULIB_STRSIGNAL=0 + + + + GL_GNULIB_STRVERSCMP=0 + + + + GL_GNULIB_MDA_MEMCCPY=1 + + + + GL_GNULIB_MDA_STRDUP=1 + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_string_h='<'string.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_string_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'string.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_string_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_string_h + gl_cv_next_string_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_string_h" >&5 +printf "%s\n" "$gl_cv_next_string_h" >&6; } + fi + NEXT_STRING_H=$gl_cv_next_string_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'string.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_string_h + fi + NEXT_AS_FIRST_DIRECTIVE_STRING_H=$gl_next_as_first_directive + + + + + + + + + + + + + + + + + + + + + + + +printf "%s\n" "#define _USE_STD_STAT 1" >>confdefs.h + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_types_h='<'sys/types.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_sys_types_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'sys/types.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_sys_types_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_sys_types_h + gl_cv_next_sys_types_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_types_h" >&5 +printf "%s\n" "$gl_cv_next_sys_types_h" >&6; } + fi + NEXT_SYS_TYPES_H=$gl_cv_next_sys_types_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/types.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_types_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H=$gl_next_as_first_directive + + + + + + + + + + + + + WINDOWS_STAT_INODES=0 + + + + + + + HAVE_DECL_LOCALTIME_R=1; + HAVE_NANOSLEEP=1; + HAVE_STRPTIME=1; + HAVE_TIMEGM=1; + HAVE_TIMESPEC_GET=1; + HAVE_TIMEZONE_T=0; + REPLACE_CTIME=GNULIB_PORTCHECK; + REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; + REPLACE_MKTIME=GNULIB_PORTCHECK; + REPLACE_NANOSLEEP=GNULIB_PORTCHECK; + REPLACE_STRFTIME=GNULIB_PORTCHECK; + REPLACE_TIMEGM=GNULIB_PORTCHECK; + REPLACE_TZSET=GNULIB_PORTCHECK; + + : ${GNULIB_GETTIMEOFDAY=0}; + REPLACE_GMTIME=0; + REPLACE_LOCALTIME=0; + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 +printf %s "checking for struct timespec in ... " >&6; } +if test ${gl_cv_sys_struct_timespec_in_time_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +static struct timespec x; x.tv_sec = x.tv_nsec; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_timespec_in_time_h=yes +else $as_nop + gl_cv_sys_struct_timespec_in_time_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_time_h" >&5 +printf "%s\n" "$gl_cv_sys_struct_timespec_in_time_h" >&6; } + + TIME_H_DEFINES_STRUCT_TIMESPEC=0 + SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 + PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 + UNISTD_H_DEFINES_STRUCT_TIMESPEC=0 + if test $gl_cv_sys_struct_timespec_in_time_h = yes; then + TIME_H_DEFINES_STRUCT_TIMESPEC=1 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 +printf %s "checking for struct timespec in ... " >&6; } +if test ${gl_cv_sys_struct_timespec_in_sys_time_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +static struct timespec x; x.tv_sec = x.tv_nsec; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_timespec_in_sys_time_h=yes +else $as_nop + gl_cv_sys_struct_timespec_in_sys_time_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_sys_time_h" >&5 +printf "%s\n" "$gl_cv_sys_struct_timespec_in_sys_time_h" >&6; } + if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then + SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 +printf %s "checking for struct timespec in ... " >&6; } +if test ${gl_cv_sys_struct_timespec_in_pthread_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +static struct timespec x; x.tv_sec = x.tv_nsec; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_timespec_in_pthread_h=yes +else $as_nop + gl_cv_sys_struct_timespec_in_pthread_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_pthread_h" >&5 +printf "%s\n" "$gl_cv_sys_struct_timespec_in_pthread_h" >&6; } + if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then + PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 +printf %s "checking for struct timespec in ... " >&6; } +if test ${gl_cv_sys_struct_timespec_in_unistd_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +static struct timespec x; x.tv_sec = x.tv_nsec; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_sys_struct_timespec_in_unistd_h=yes +else $as_nop + gl_cv_sys_struct_timespec_in_unistd_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_timespec_in_unistd_h" >&5 +printf "%s\n" "$gl_cv_sys_struct_timespec_in_unistd_h" >&6; } + if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then + UNISTD_H_DEFINES_STRUCT_TIMESPEC=1 + fi + fi + fi + fi + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_time_h='<'time.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_time_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'time.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_time_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_time_h + gl_cv_next_time_h='"'$gl_header'"' + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_time_h" >&5 +printf "%s\n" "$gl_cv_next_time_h" >&6; } + fi + NEXT_TIME_H=$gl_cv_next_time_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'time.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_time_h + fi + NEXT_AS_FIRST_DIRECTIVE_TIME_H=$gl_next_as_first_directive + + + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TIME_UTC in " >&5 +printf %s "checking for TIME_UTC in ... " >&6; } +if test ${gl_cv_time_h_has_TIME_UTC+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +static int x = TIME_UTC; x++; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_time_h_has_TIME_UTC=yes +else $as_nop + gl_cv_time_h_has_TIME_UTC=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_time_h_has_TIME_UTC" >&5 +printf "%s\n" "$gl_cv_time_h_has_TIME_UTC" >&6; } + if test $gl_cv_time_h_has_TIME_UTC = yes; then + TIME_H_DEFINES_TIME_UTC=1 + else + TIME_H_DEFINES_TIME_UTC=0 + fi + + + + + GL_GNULIB_CTIME=0 + + + + GL_GNULIB_MKTIME=0 + + + + GL_GNULIB_LOCALTIME=0 + + + + GL_GNULIB_NANOSLEEP=0 + + + + GL_GNULIB_STRFTIME=0 + + + + GL_GNULIB_STRPTIME=0 + + + + GL_GNULIB_TIMEGM=0 + + + + GL_GNULIB_TIMESPEC_GET=0 + + + + GL_GNULIB_TIME_R=0 + + + + GL_GNULIB_TIME_RZ=0 + + + + GL_GNULIB_TZSET=0 + + + + GL_GNULIB_MDA_TZSET=1 + + + +ac_fn_check_decl "$LINENO" "execvpe" "ac_cv_have_decl_execvpe" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_execvpe" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_EXECVPE $ac_have_decl" >>confdefs.h + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_unistd_h='<'unistd.h'>' + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +printf %s "checking absolute name of ... " >&6; } +if test ${gl_cv_next_unistd_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + if test $ac_cv_header_unistd_h = yes; then + + + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo 'unistd.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + + gl_cv_absolute_unistd_h=`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"` + + gl_header=$gl_cv_absolute_unistd_h + gl_cv_next_unistd_h='"'$gl_header'"' + else + gl_cv_next_unistd_h='<'unistd.h'>' + fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_unistd_h" >&5 +printf "%s\n" "$gl_cv_next_unistd_h" >&6; } + fi + NEXT_UNISTD_H=$gl_cv_next_unistd_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'unistd.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_unistd_h + fi + NEXT_AS_FIRST_DIRECTIVE_UNISTD_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_unistd_h = yes; then + HAVE_UNISTD_H=1 + else + HAVE_UNISTD_H=0 + fi + + + + + + + + + + + + + + if test $ac_cv_have_decl_execvpe = no; then + HAVE_DECL_EXECVPE=0 + fi + + + if true; then + GL_COND_LIBTOOL_TRUE= + GL_COND_LIBTOOL_FALSE='#' +else + GL_COND_LIBTOOL_TRUE='#' + GL_COND_LIBTOOL_FALSE= +fi + + gl_cond_libtool=true + gl_m4_base='gnulib-m4' + + + + + + + + + + + + + gl_source_base='gnulib-lib' + + + if test $ac_cv_func_alloca_works = no; then + : + fi + + # Define an additional variable used in the Makefile substitution. + if test $ac_cv_working_alloca_h = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for alloca as a compiler built-in" >&5 +printf %s "checking for alloca as a compiler built-in... " >&6; } +if test ${gl_cv_rpl_alloca+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if defined __GNUC__ || defined _AIX || defined _MSC_VER + Need own alloca +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Need own alloca" >/dev/null 2>&1 +then : + gl_cv_rpl_alloca=yes +else $as_nop + gl_cv_rpl_alloca=no +fi +rm -rf conftest* + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_rpl_alloca" >&5 +printf "%s\n" "$gl_cv_rpl_alloca" >&6; } + if test $gl_cv_rpl_alloca = yes; then + +printf "%s\n" "#define HAVE_ALLOCA 1" >>confdefs.h + + ALLOCA_H=alloca.h + else + ALLOCA_H= + fi + else + ALLOCA_H=alloca.h + fi + + if test -n "$ALLOCA_H"; then + GL_GENERATE_ALLOCA_H_TRUE= + GL_GENERATE_ALLOCA_H_FALSE='#' +else + GL_GENERATE_ALLOCA_H_TRUE='#' + GL_GENERATE_ALLOCA_H_FALSE= +fi + + + if test $ac_cv_working_alloca_h = yes; then + HAVE_ALLOCA_H=1 + else + HAVE_ALLOCA_H=0 + fi + + + + + +printf "%s\n" "#define SIGNAL_SAFE_LIST 1" >>confdefs.h + + + +printf "%s\n" "#define GNULIB_TEST_CLOEXEC 1" >>confdefs.h + + + + + + + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_CLOSE=1 + fi + + + + + + + if test $ac_cv_header_sys_socket_h != yes; then + ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" +if test "x$ac_cv_header_winsock2_h" = xyes +then : + printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h + +fi + + fi + if test "$ac_cv_header_winsock2_h" = yes; then + HAVE_WINSOCK2_H=1 + UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + + + if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then + REPLACE_CLOSE=1 + fi + + + + if test $REPLACE_CLOSE = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS close.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_CLOSE=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_CLOSE 1" >>confdefs.h + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether // is distinct from /" >&5 +printf %s "checking whether // is distinct from /... " >&6; } +if test ${gl_cv_double_slash_root+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test x"$cross_compiling" = xyes ; then + # When cross-compiling, there is no way to tell whether // is special + # short of a list of hosts. However, the only known hosts to date + # that have a distinct // are Apollo DomainOS (too old to port to), + # Cygwin, and z/OS. If anyone knows of another system for which // has + # special semantics and is distinct from /, please report it to + # . + case $host in + *-cygwin | i370-ibm-openedition) + gl_cv_double_slash_root=yes ;; + *) + # Be optimistic and assume that / and // are the same when we + # don't know. + gl_cv_double_slash_root='unknown, assuming no' ;; + esac + else + set x `ls -di / // 2>/dev/null` + if test "$2" = "$4" && wc //dev/null >/dev/null 2>&1; then + gl_cv_double_slash_root=no + else + gl_cv_double_slash_root=yes + fi + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_double_slash_root" >&5 +printf "%s\n" "$gl_cv_double_slash_root" >&6; } + if test "$gl_cv_double_slash_root" = yes; then + +printf "%s\n" "#define DOUBLE_SLASH_IS_DISTINCT_ROOT 1" >>confdefs.h + + fi + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether dup2 works" >&5 +printf %s "checking whether dup2 works... " >&6; } +if test ${gl_cv_func_dup2_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + mingw*) # on this platform, dup2 always returns 0 for success + gl_cv_func_dup2_works="guessing no" ;; + cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 + gl_cv_func_dup2_works="guessing no" ;; + aix* | freebsd*) + # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, + # not EBADF. + gl_cv_func_dup2_works="guessing no" ;; + haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. + gl_cv_func_dup2_works="guessing no" ;; + *-android*) # implemented using dup3(), which fails if oldfd == newfd + gl_cv_func_dup2_works="guessing no" ;; + os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd. + gl_cv_func_dup2_works="guessing no" ;; + *) gl_cv_func_dup2_works="guessing yes" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #include + #include + #include + + +$gl_mda_defines + + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + +int +main (void) +{ +int result = 0; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + #ifdef FD_CLOEXEC + if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) + result |= 1; + #endif + if (dup2 (1, 1) != 1) + result |= 2; + #ifdef FD_CLOEXEC + if (fcntl (1, F_GETFD) != FD_CLOEXEC) + result |= 4; + #endif + close (0); + if (dup2 (0, 0) != -1) + result |= 8; + /* Many gnulib modules require POSIX conformance of EBADF. */ + if (dup2 (2, bad_fd) == -1 && errno != EBADF) + result |= 16; + /* Flush out some cygwin core dumps. */ + if (dup2 (2, -1) != -1 || errno != EBADF) + result |= 32; + dup2 (2, 255); + dup2 (2, 256); + /* On OS/2 kLIBC, dup2() does not work on a directory fd. */ + { + int fd = open (".", O_RDONLY); + if (fd == -1) + result |= 64; + else if (dup2 (fd, fd + 1) == -1) + result |= 128; + close (fd); + } + return result; + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_dup2_works=yes +else $as_nop + gl_cv_func_dup2_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_dup2_works" >&5 +printf "%s\n" "$gl_cv_func_dup2_works" >&6; } + case "$gl_cv_func_dup2_works" in + *yes) ;; + *) + REPLACE_DUP2=1 + ac_fn_c_check_func "$LINENO" "setdtablesize" "ac_cv_func_setdtablesize" +if test "x$ac_cv_func_setdtablesize" = xyes +then : + printf "%s\n" "#define HAVE_SETDTABLESIZE 1" >>confdefs.h + +fi + + ;; + esac + + + if test $REPLACE_DUP2 = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS dup2.$ac_objext" + + + fi + + + + + + + + + + GL_GNULIB_DUP2=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_DUP2 1" >>confdefs.h + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 +printf %s "checking for error_at_line... " >&6; } +if test ${ac_cv_lib_error_at_line+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +error_at_line (0, 0, "", 0, "an error occurred"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + ac_cv_lib_error_at_line=yes +else $as_nop + ac_cv_lib_error_at_line=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_error_at_line" >&5 +printf "%s\n" "$ac_cv_lib_error_at_line" >&6; } + + if test $ac_cv_lib_error_at_line = no; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS error.$ac_objext" + + + + : + + fi + + + + + + : + + + + + + + if test $ac_cv_func_fcntl = no; then + + + + if test $ac_cv_func_fcntl = no; then + HAVE_FCNTL=0 + else + REPLACE_FCNTL=1 + fi + + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fcntl handles F_DUPFD correctly" >&5 +printf %s "checking whether fcntl handles F_DUPFD correctly... " >&6; } +if test ${gl_cv_func_fcntl_f_dupfd_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case $host_os in + aix* | cygwin* | haiku*) + gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; + *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; + esac +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + #include + #include + + +$gl_mda_defines + + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + +int +main (void) +{ +int result = 0; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; + if (errno != EINVAL) result |= 2; + if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; + if (errno != EINVAL) result |= 8; + /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */ + { + int fd; + fd = open (".", O_RDONLY); + if (fd == -1) + result |= 16; + else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1) + result |= 32; + + close (fd); + } + return result; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_fcntl_f_dupfd_works=yes +else $as_nop + gl_cv_func_fcntl_f_dupfd_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fcntl_f_dupfd_works" >&5 +printf "%s\n" "$gl_cv_func_fcntl_f_dupfd_works" >&6; } + case $gl_cv_func_fcntl_f_dupfd_works in + *yes) ;; + *) + + + if test $ac_cv_func_fcntl = no; then + HAVE_FCNTL=0 + else + REPLACE_FCNTL=1 + fi + + +printf "%s\n" "#define FCNTL_DUPFD_BUGGY 1" >>confdefs.h + ;; + esac + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether fcntl understands F_DUPFD_CLOEXEC" >&5 +printf %s "checking whether fcntl understands F_DUPFD_CLOEXEC... " >&6; } +if test ${gl_cv_func_fcntl_f_dupfd_cloexec+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no on NetBSD. + netbsd*) gl_cv_func_fcntl_f_dupfd_cloexec="guessing no" ;; + *) gl_cv_func_fcntl_f_dupfd_cloexec="$gl_cross_guess_normal" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + int main (int argc, char *argv[]) + { + if (argc == 1) + /* parent process */ + { + if (fcntl (1, F_DUPFD_CLOEXEC, 10) < 0) + return 1; + return execl ("./conftest", "./conftest", "child", NULL); + } + else + /* child process */ + return (fcntl (10, F_GETFL) < 0 ? 0 : 42); + } + + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#ifdef __linux__ +/* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace + it to support the semantics on older kernels that failed with EINVAL. */ +choke me +#endif + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_func_fcntl_f_dupfd_cloexec=yes +else $as_nop + gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check" +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + +else $as_nop + gl_cv_func_fcntl_f_dupfd_cloexec=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_fcntl_f_dupfd_cloexec" >&5 +printf "%s\n" "$gl_cv_func_fcntl_f_dupfd_cloexec" >&6; } + case "$gl_cv_func_fcntl_f_dupfd_cloexec" in + *yes) ;; + *) + + + if test $ac_cv_func_fcntl = no; then + HAVE_FCNTL=0 + else + REPLACE_FCNTL=1 + fi + + ;; + esac + fi + + + if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS fcntl.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_FCNTL=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FCNTL 1" >>confdefs.h + + + + + + + + + + + + + + case "$host_os" in + mingw* | solaris*) + REPLACE_FSTAT=1 + ;; + esac + + + + if test $REPLACE_FSTAT = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS fstat.$ac_objext" + + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS stat-w32.$ac_objext" + + ;; + esac + + + + : + + fi + + + + + + + + + + GL_GNULIB_FSTAT=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FSTAT 1" >>confdefs.h + + + + + + + + + if test $ac_cv_func_getdtablesize = yes && + test $ac_cv_have_decl_getdtablesize = yes; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether getdtablesize works" >&5 +printf %s "checking whether getdtablesize works... " >&6; } +if test ${gl_cv_func_getdtablesize_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + case "$host_os" in + vms*) gl_cv_func_getdtablesize_works="no (limitation)" ;; + *) + if test "$cross_compiling" = yes +then : + case "$host_os" in + cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows + gl_cv_func_getdtablesize_works="guessing no" ;; + *) gl_cv_func_getdtablesize_works="guessing yes" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + + +$gl_mda_defines + + +int +main (void) +{ +int size = getdtablesize(); + if (dup2 (0, getdtablesize()) != -1) + return 1; + if (size != getdtablesize()) + return 2; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_getdtablesize_works=yes +else $as_nop + gl_cv_func_getdtablesize_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + ;; + esac + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getdtablesize_works" >&5 +printf "%s\n" "$gl_cv_func_getdtablesize_works" >&6; } + case "$gl_cv_func_getdtablesize_works" in + *yes | "no (limitation)") ;; + *) REPLACE_GETDTABLESIZE=1 ;; + esac + else + HAVE_GETDTABLESIZE=0 + fi + + if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS getdtablesize.$ac_objext" + + : + fi + + + + + + + + + + GL_GNULIB_GETDTABLESIZE=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_GETDTABLESIZE 1" >>confdefs.h + + + + + + + ac_found=0 + ac_fn_check_decl "$LINENO" "program_invocation_name" "ac_cv_have_decl_program_invocation_name" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_program_invocation_name" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_PROGRAM_INVOCATION_NAME $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : + ac_found=1 +fi + + ac_fn_check_decl "$LINENO" "program_invocation_short_name" "ac_cv_have_decl_program_invocation_short_name" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl_program_invocation_short_name" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : + ac_found=1 +fi + + ac_fn_check_decl "$LINENO" "__argv" "ac_cv_have_decl___argv" "#include +" "$ac_c_undeclared_builtin_options" "CFLAGS" +if test "x$ac_cv_have_decl___argv" = xyes +then : + ac_have_decl=1 +else $as_nop + ac_have_decl=0 +fi +printf "%s\n" "#define HAVE_DECL___ARGV $ac_have_decl" >>confdefs.h +if test $ac_have_decl = 1 +then : + ac_found=1 +fi + + + # Incur the cost of this test only if none of the above worked. + if test $ac_found = 0; then + # On OpenBSD 5.1, using the global __progname variable appears to be + # the only way to implement getprogname. + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether __progname is defined in default libraries" >&5 +printf %s "checking whether __progname is defined in default libraries... " >&6; } +if test ${gl_cv_var___progname+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_cv_var___progname= + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +extern char *__progname; +int +main (void) +{ +return *__progname; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO" +then : + gl_cv_var___progname=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam \ + conftest$ac_exeext conftest.$ac_ext + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_var___progname" >&5 +printf "%s\n" "$gl_cv_var___progname" >&6; } + if test "$gl_cv_var___progname" = yes; then + +printf "%s\n" "#define HAVE_VAR___PROGNAME 1" >>confdefs.h + + fi + fi + + + + + + + + + if test "$gl_threads_api" = posix; then + # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the + # pthread_rwlock_* functions. + has_rwlock=false + ac_fn_c_check_type "$LINENO" "pthread_rwlock_t" "ac_cv_type_pthread_rwlock_t" "#include +" +if test "x$ac_cv_type_pthread_rwlock_t" = xyes +then : + has_rwlock=true + +printf "%s\n" "#define HAVE_PTHREAD_RWLOCK 1" >>confdefs.h + +fi + + if $has_rwlock; then + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether pthread_rwlock_rdlock prefers a writer to a reader" >&5 +printf %s "checking whether pthread_rwlock_rdlock prefers a writer to a reader... " >&6; } +if test ${gl_cv_pthread_rwlock_rdlock_prefer_writer+y} +then : + printf %s "(cached) " >&6 +else $as_nop + save_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on musl systems. + *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on bionic systems. + *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess yes on native Windows with the mingw-w64 winpthreads library. + # Guess no on native Windows with the gnulib windows-rwlock module. + mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" + else + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" + fi + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#include + +#define SUCCEED() exit (0) +#define FAILURE() exit (1) +#define UNEXPECTED(n) (exit (10 + (n))) + +/* The main thread creates the waiting writer and the requesting reader threads + in the default way; this guarantees that they have the same priority. + We can reuse the main thread as first reader thread. */ + +static pthread_rwlock_t lock; +static pthread_t reader1; +static pthread_t writer; +static pthread_t reader2; +static pthread_t timer; +/* Used to pass control from writer to reader2 and from reader2 to timer, + as in a relay race. + Passing control from one running thread to another running thread + is most likely faster than to create the second thread. */ +static pthread_mutex_t baton; + +static void * +timer_func (void *ignored) +{ + /* Step 13 (can be before or after step 12): + The timer thread takes the baton, then waits a moment to make sure + it can tell whether the second reader thread is blocked at step 12. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (13); + usleep (100000); + /* By the time we get here, it's clear that the second reader thread is + blocked at step 12. This is the desired behaviour. */ + SUCCEED (); +} + +static void * +reader2_func (void *ignored) +{ + int err; + + /* Step 8 (can be before or after step 7): + The second reader thread takes the baton, then waits a moment to make sure + the writer thread has reached step 7. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (8); + usleep (100000); + /* Step 9: The second reader thread requests the lock. */ + err = pthread_rwlock_tryrdlock (&lock); + if (err == 0) + FAILURE (); + else if (err != EBUSY) + UNEXPECTED (9); + /* Step 10: Launch a timer, to test whether the next call blocks. */ + if (pthread_create (&timer, NULL, timer_func, NULL)) + UNEXPECTED (10); + /* Step 11: Release the baton. */ + if (pthread_mutex_unlock (&baton)) + UNEXPECTED (11); + /* Step 12: The second reader thread requests the lock. */ + err = pthread_rwlock_rdlock (&lock); + if (err == 0) + FAILURE (); + else + UNEXPECTED (12); +} + +static void * +writer_func (void *ignored) +{ + /* Step 4: Take the baton, so that the second reader thread does not go ahead + too early. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (4); + /* Step 5: Create the second reader thread. */ + if (pthread_create (&reader2, NULL, reader2_func, NULL)) + UNEXPECTED (5); + /* Step 6: Release the baton. */ + if (pthread_mutex_unlock (&baton)) + UNEXPECTED (6); + /* Step 7: The writer thread requests the lock. */ + if (pthread_rwlock_wrlock (&lock)) + UNEXPECTED (7); + return NULL; +} + +int +main () +{ + reader1 = pthread_self (); + + /* Step 1: The main thread initializes the lock and the baton. */ + if (pthread_rwlock_init (&lock, NULL)) + UNEXPECTED (1); + if (pthread_mutex_init (&baton, NULL)) + UNEXPECTED (1); + /* Step 2: The main thread acquires the lock as a reader. */ + if (pthread_rwlock_rdlock (&lock)) + UNEXPECTED (2); + /* Step 3: Create the writer thread. */ + if (pthread_create (&writer, NULL, writer_func, NULL)) + UNEXPECTED (3); + /* Job done. Go to sleep. */ + for (;;) + { + sleep (1); + } +} + +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_pthread_rwlock_rdlock_prefer_writer=yes +else $as_nop + gl_cv_pthread_rwlock_rdlock_prefer_writer=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + LIBS="$save_LIBS" + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_pthread_rwlock_rdlock_prefer_writer" >&5 +printf "%s\n" "$gl_cv_pthread_rwlock_rdlock_prefer_writer" >&6; } + case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in + *yes) + +printf "%s\n" "#define HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER 1" >>confdefs.h + + ;; + esac + + fi + # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include +int +main (void) +{ + +#if __FreeBSD__ == 4 +error "No, in FreeBSD 4.0 recursive mutexes actually don't work." +#elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \ + && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) +error "No, in Mac OS X < 10.7 recursive mutexes actually don't work." +#else +int x = (int)PTHREAD_MUTEX_RECURSIVE; +return !x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + +printf "%s\n" "#define HAVE_PTHREAD_MUTEX_RECURSIVE 1" >>confdefs.h + +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + : + + + +printf "%s\n" "#define GNULIB_LOCK 1" >>confdefs.h + + + + + + + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS msvc-inval.$ac_objext" + + fi + + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS msvc-nothrow.$ac_objext" + + fi + + +printf "%s\n" "#define GNULIB_MSVC_NOTHROW 1" >>confdefs.h + + + + + + + case "$host_os" in + mingw* | pw*) + REPLACE_OPEN=1 + ;; + *) + + if test "$gl_cv_macro_O_CLOEXEC" != yes; then + REPLACE_OPEN=1 + fi + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether open recognizes a trailing slash" >&5 +printf %s "checking whether open recognizes a trailing slash... " >&6; } +if test ${gl_cv_func_open_slash+y} +then : + printf %s "(cached) " >&6 +else $as_nop + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + touch conftest.tmp + ln -s conftest.tmp conftest.lnk + fi + if test "$cross_compiling" = yes +then : + + case "$host_os" in + freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) + gl_cv_func_open_slash="guessing no" ;; + *) + gl_cv_func_open_slash="guessing yes" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#if HAVE_UNISTD_H +# include +#endif + + +$gl_mda_defines + +int main () +{ + int result = 0; +#if HAVE_LSTAT + if (open ("conftest.lnk/", O_RDONLY) != -1) + result |= 1; +#endif + if (open ("conftest.sl/", O_CREAT, 0600) >= 0) + result |= 2; + return result; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_open_slash=yes +else $as_nop + gl_cv_func_open_slash=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f conftest.sl conftest.tmp conftest.lnk + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_open_slash" >&5 +printf "%s\n" "$gl_cv_func_open_slash" >&6; } + case "$gl_cv_func_open_slash" in + *no) + +printf "%s\n" "#define OPEN_TRAILING_SLASH_BUG 1" >>confdefs.h + + ;; + esac + + case "$gl_cv_func_open_slash" in + *no) + REPLACE_OPEN=1 + ;; + esac + ;; + esac + + + + if test $REPLACE_OPEN = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS open.$ac_objext" + + + + : + + fi + + + + + + + + + + GL_GNULIB_OPEN=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_OPEN 1" >>confdefs.h + + + + + + + + + + ac_fn_c_check_func "$LINENO" "raise" "ac_cv_func_raise" +if test "x$ac_cv_func_raise" = xyes +then : + printf "%s\n" "#define HAVE_RAISE 1" >>confdefs.h + +fi + + if test $ac_cv_func_raise = no; then + HAVE_RAISE=0 + else + + + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_RAISE=1 + fi + + + + + + HAVE_POSIX_SIGNALBLOCKING=0 + if test "$gl_cv_type_sigset_t" = yes; then + ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" +if test "x$ac_cv_func_sigprocmask" = xyes +then : + HAVE_POSIX_SIGNALBLOCKING=1 +fi + + fi + + if test $HAVE_POSIX_SIGNALBLOCKING = 0; then + : + fi + + fi + + if test $HAVE_RAISE = 0 || test $REPLACE_RAISE = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS raise.$ac_objext" + + : + fi + + + + + + + + + + GL_GNULIB_RAISE=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_RAISE 1" >>confdefs.h + + + + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether rmdir works" >&5 +printf %s "checking whether rmdir works... " >&6; } +if test ${gl_cv_func_rmdir_works+y} +then : + printf %s "(cached) " >&6 +else $as_nop + mkdir conftest.dir + touch conftest.file + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rmdir_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_rmdir_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_rmdir_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rmdir_works="$gl_cross_guess_normal" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #if HAVE_UNISTD_H + # include + #else /* on Windows with MSVC */ + # include + #endif + + +$gl_mda_defines + +int +main (void) +{ +int result = 0; + if (!rmdir ("conftest.file/")) + result |= 1; + else if (errno != ENOTDIR) + result |= 2; + if (!rmdir ("conftest.dir/./")) + result |= 4; + return result; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_rmdir_works=yes +else $as_nop + gl_cv_func_rmdir_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -rf conftest.dir conftest.file +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_rmdir_works" >&5 +printf "%s\n" "$gl_cv_func_rmdir_works" >&6; } + case "$gl_cv_func_rmdir_works" in + *yes) ;; + *) + REPLACE_RMDIR=1 + ;; + esac + + if test $REPLACE_RMDIR = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS rmdir.$ac_objext" + + fi + + + + + + + + + + GL_GNULIB_RMDIR=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_RMDIR 1" >>confdefs.h + + + + + + + if test $ac_cv_func_sigaction = yes; then + ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include +" +if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_SIGACTION_SA_SIGACTION 1" >>confdefs.h + + +fi + + if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then + HAVE_STRUCT_SIGACTION_SA_SIGACTION=0 + fi + else + HAVE_SIGACTION=0 + fi + + if test $HAVE_SIGACTION = 0; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS sigaction.$ac_objext" + + + + + + + + ac_fn_c_check_type "$LINENO" "siginfo_t" "ac_cv_type_siginfo_t" " +#include + +" +if test "x$ac_cv_type_siginfo_t" = xyes +then : + +printf "%s\n" "#define HAVE_SIGINFO_T 1" >>confdefs.h + + +fi + + if test $ac_cv_type_siginfo_t = no; then + HAVE_SIGINFO_T=0 + fi + + fi + + + + + + + + + + GL_GNULIB_SIGACTION=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_SIGACTION 1" >>confdefs.h + + + + + + + + + + + + + HAVE_POSIX_SIGNALBLOCKING=0 + if test "$gl_cv_type_sigset_t" = yes; then + ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" +if test "x$ac_cv_func_sigprocmask" = xyes +then : + HAVE_POSIX_SIGNALBLOCKING=1 +fi + + fi + + if test $HAVE_POSIX_SIGNALBLOCKING = 0; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS sigprocmask.$ac_objext" + + : + fi + + + + + + + + + + GL_GNULIB_SIGPROCMASK=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_SIGPROCMASK 1" >>confdefs.h + + + + + ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h + +fi + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for SIZE_MAX" >&5 +printf %s "checking for SIZE_MAX... " >&6; } +if test ${gl_cv_size_max+y} +then : + printf %s "(cached) " >&6 +else $as_nop + + gl_cv_size_max=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#if HAVE_STDINT_H +#include +#endif +#ifdef SIZE_MAX +Found it +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "Found it" >/dev/null 2>&1 +then : + gl_cv_size_max=yes +fi +rm -rf conftest* + + if test $gl_cv_size_max != yes; then + if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) * CHAR_BIT - 1" "size_t_bits_minus_1" "#include +#include " +then : + +else $as_nop + size_t_bits_minus_1= +fi + + if ac_fn_c_compute_int "$LINENO" "sizeof (size_t) <= sizeof (unsigned int)" "fits_in_uint" "#include " +then : + +else $as_nop + fits_in_uint= +fi + + if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then + if test $fits_in_uint = 1; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + extern size_t foo; + extern unsigned long foo; + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + fits_in_uint=0 +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext + fi + if test $fits_in_uint = 1; then + gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" + else + gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" + fi + else + gl_cv_size_max='((size_t)~(size_t)0)' + fi + fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_size_max" >&5 +printf "%s\n" "$gl_cv_size_max" >&6; } + if test "$gl_cv_size_max" != yes; then + +printf "%s\n" "#define SIZE_MAX $gl_cv_size_max" >>confdefs.h + + fi + + + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ssize_t" >&5 +printf %s "checking for ssize_t... " >&6; } +if test ${gt_cv_ssize_t+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main (void) +{ +int x = sizeof (ssize_t *) + sizeof (ssize_t); + return !x; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gt_cv_ssize_t=yes +else $as_nop + gt_cv_ssize_t=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gt_cv_ssize_t" >&5 +printf "%s\n" "$gt_cv_ssize_t" >&6; } + if test $gt_cv_ssize_t = no; then + +printf "%s\n" "#define ssize_t int" >>confdefs.h + + fi + + + + + + case "$host_os" in + mingw*) + REPLACE_STAT=1 + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether stat handles trailing slashes on files" >&5 +printf %s "checking whether stat handles trailing slashes on files... " >&6; } +if test ${gl_cv_func_stat_file_slash+y} +then : + printf %s "(cached) " >&6 +else $as_nop + touch conftest.tmp + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.tmp conftest.lnk + fi + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +int result = 0; + struct stat st; + if (!stat ("conftest.tmp/", &st)) + result |= 1; +#if HAVE_LSTAT + if (!stat ("conftest.lnk/", &st)) + result |= 2; +#endif + return result; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_stat_file_slash=yes +else $as_nop + gl_cv_func_stat_file_slash=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f conftest.tmp conftest.lnk +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_stat_file_slash" >&5 +printf "%s\n" "$gl_cv_func_stat_file_slash" >&6; } + case $gl_cv_func_stat_file_slash in + *no) + REPLACE_STAT=1 + +printf "%s\n" "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h +;; + esac + case $host_os in + solaris*) + REPLACE_FSTAT=1 ;; + esac + ;; + esac + + if test $REPLACE_STAT = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS stat.$ac_objext" + + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS stat-w32.$ac_objext" + + ;; + esac + + + + : + + fi + + + + + + + + + + GL_GNULIB_STAT=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_STAT 1" >>confdefs.h + + + + + + + + ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.tv_nsec" "ac_cv_member_struct_stat_st_atim_tv_nsec" "#include + #include +" +if test "x$ac_cv_member_struct_stat_st_atim_tv_nsec" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1" >>confdefs.h + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether struct stat.st_atim is of type struct timespec" >&5 +printf %s "checking whether struct stat.st_atim is of type struct timespec... " >&6; } +if test ${ac_cv_typeof_struct_stat_st_atim_is_struct_timespec+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #if HAVE_SYS_TIME_H + # include + #endif + #include + struct timespec ts; + struct stat st; + +int +main (void) +{ + + st.st_atim = ts; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes +else $as_nop + ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&5 +printf "%s\n" "$ac_cv_typeof_struct_stat_st_atim_is_struct_timespec" >&6; } + if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then + +printf "%s\n" "#define TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC 1" >>confdefs.h + + fi +else $as_nop + ac_fn_c_check_member "$LINENO" "struct stat" "st_atimespec.tv_nsec" "ac_cv_member_struct_stat_st_atimespec_tv_nsec" "#include + #include +" +if test "x$ac_cv_member_struct_stat_st_atimespec_tv_nsec" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1" >>confdefs.h + + +else $as_nop + ac_fn_c_check_member "$LINENO" "struct stat" "st_atimensec" "ac_cv_member_struct_stat_st_atimensec" "#include + #include +" +if test "x$ac_cv_member_struct_stat_st_atimensec" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1" >>confdefs.h + + +else $as_nop + ac_fn_c_check_member "$LINENO" "struct stat" "st_atim.st__tim.tv_nsec" "ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" "#include + #include +" +if test "x$ac_cv_member_struct_stat_st_atim_st__tim_tv_nsec" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC 1" >>confdefs.h + + +fi + +fi + +fi + +fi + + + + + + ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimespec.tv_nsec" "ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" "#include + #include +" +if test "x$ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1" >>confdefs.h + + +else $as_nop + ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtimensec" "ac_cv_member_struct_stat_st_birthtimensec" "#include + #include +" +if test "x$ac_cv_member_struct_stat_st_birthtimensec" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC 1" >>confdefs.h + + +else $as_nop + ac_fn_c_check_member "$LINENO" "struct stat" "st_birthtim.tv_nsec" "ac_cv_member_struct_stat_st_birthtim_tv_nsec" "#include + #include +" +if test "x$ac_cv_member_struct_stat_st_birthtim_tv_nsec" = xyes +then : + +printf "%s\n" "#define HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC 1" >>confdefs.h + + +fi + +fi + +fi + + + + + + + if test "$ac_cv_header_stdbool_h" = yes; then + case "$host_os" in + solaris*) + if test -z "$GCC"; then + STDBOOL_H='stdbool.h' + else + STDBOOL_H='' + fi + ;; + *) + STDBOOL_H='' + ;; + esac + else + STDBOOL_H='stdbool.h' + fi + + if test -n "$STDBOOL_H"; then + GL_GENERATE_STDBOOL_H_TRUE= + GL_GENERATE_STDBOOL_H_FALSE='#' +else + GL_GENERATE_STDBOOL_H_TRUE='#' + GL_GENERATE_STDBOOL_H_FALSE= +fi + + + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 + else + HAVE__BOOL=0 + fi + + + + + + + + + + + + + + + + + + + + + + + + + GL_GNULIB_FSCANF=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FSCANF 1" >>confdefs.h + + + + + +printf "%s\n" "#define GNULIB_FSCANF 1" >>confdefs.h + + + + + + + + + + + + GL_GNULIB_SCANF=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_SCANF 1" >>confdefs.h + + + + + +printf "%s\n" "#define GNULIB_SCANF 1" >>confdefs.h + + + + + + + + + + + + GL_GNULIB_FGETC=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FGETC 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_GETC=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_GETC 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_GETCHAR=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_GETCHAR 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_FGETS=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FGETS 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_FREAD=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FREAD 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_FPRINTF=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FPRINTF 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_PRINTF=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_PRINTF 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_VFPRINTF=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_VFPRINTF 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_VPRINTF=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_VPRINTF 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_FPUTC=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FPUTC 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_PUTC=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_PUTC 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_PUTCHAR=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_PUTCHAR 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_FPUTS=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FPUTS 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_PUTS=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_PUTS 1" >>confdefs.h + + + + + + + + + + + + + GL_GNULIB_FWRITE=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_FWRITE 1" >>confdefs.h + + + + + + case "$host_os" in + cygwin*) + STDNORETURN_H='stdnoreturn.h' + ;; + *) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working stdnoreturn.h" >&5 +printf %s "checking for working stdnoreturn.h... " >&6; } +if test ${gl_cv_header_working_stdnoreturn_h+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #if defined _WIN32 && !defined __CYGWIN__ + # include + #endif + /* Do not check for 'noreturn' after the return type. + C11 allows it, but it's rarely done that way + and circa-2012 bleeding-edge GCC rejects it when given + -Werror=old-style-declaration. */ + noreturn void foo1 (void) { exit (0); } + _Noreturn void foo2 (void) { exit (0); } + int testit (int argc, char **argv) + { + if (argc & 1) + return 0; + (argv[0][0] ? foo1 : foo2) (); + } + +int +main (void) +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO" +then : + gl_cv_header_working_stdnoreturn_h=yes +else $as_nop + gl_cv_header_working_stdnoreturn_h=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_working_stdnoreturn_h" >&5 +printf "%s\n" "$gl_cv_header_working_stdnoreturn_h" >&6; } + if test $gl_cv_header_working_stdnoreturn_h = yes; then + STDNORETURN_H='' + else + STDNORETURN_H='stdnoreturn.h' + fi + ;; + esac + + if test -n "$STDNORETURN_H"; then + GL_GENERATE_STDNORETURN_H_TRUE= + GL_GENERATE_STDNORETURN_H_FALSE='#' +else + GL_GENERATE_STDNORETURN_H_TRUE='#' + GL_GENERATE_STDNORETURN_H_FALSE= +fi + + + + + + + + if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for working strerror function" >&5 +printf %s "checking for working strerror function... " >&6; } +if test ${gl_cv_func_working_strerror+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test "$cross_compiling" = yes +then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_working_strerror="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; + esac + +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main (void) +{ +if (!*strerror (-2)) return 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO" +then : + gl_cv_func_working_strerror=yes +else $as_nop + gl_cv_func_working_strerror=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_strerror" >&5 +printf "%s\n" "$gl_cv_func_working_strerror" >&6; } + case "$gl_cv_func_working_strerror" in + *yes) ;; + *) + REPLACE_STRERROR=1 + ;; + esac + + else + REPLACE_STRERROR=1 + fi + + if test $REPLACE_STRERROR = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS strerror.$ac_objext" + + fi + + +printf "%s\n" "#define GNULIB_STRERROR 1" >>confdefs.h + + + + + + + + + + + + GL_GNULIB_STRERROR=1 + + + + + +printf "%s\n" "#define GNULIB_TEST_STRERROR 1" >>confdefs.h + + + + + + if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS strerror-override.$ac_objext" + + + + + + if test $ac_cv_header_sys_socket_h != yes; then + ac_fn_c_check_header_compile "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" +if test "x$ac_cv_header_winsock2_h" = xyes +then : + printf "%s\n" "#define HAVE_WINSOCK2_H 1" >>confdefs.h + +fi + + fi + if test "$ac_cv_header_winsock2_h" = yes; then + HAVE_WINSOCK2_H=1 + UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + + + fi + + + + + + + + + + + + + + + + + + + + + ac_fn_c_check_header_compile "$LINENO" "sys/single_threaded.h" "ac_cv_header_sys_single_threaded_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_single_threaded_h" = xyes +then : + printf "%s\n" "#define HAVE_SYS_SINGLE_THREADED_H 1" >>confdefs.h + +fi + + + + + + + + + + + + + + + + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS windows-mutex.$ac_objext" + + ;; + esac + + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS windows-once.$ac_objext" + + ;; + esac + + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS windows-recmutex.$ac_objext" + + ;; + esac + + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS windows-rwlock.$ac_objext" + + ;; + esac + + case "$host_os" in + mingw*) + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS windows-spin.$ac_objext" + + ;; + esac + + + ac_fn_c_check_header_compile "$LINENO" "stdint.h" "ac_cv_header_stdint_h" "$ac_includes_default" +if test "x$ac_cv_header_stdint_h" = xyes +then : + printf "%s\n" "#define HAVE_STDINT_H 1" >>confdefs.h + +fi + + + # End of code from modules + + + + + + + + + + + + gltests_libdeps= + gltests_ltlibdeps= + + + + + + + + + + + + + gl_source_base='tests' + gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS + + gl_module_indicator_condition=$gltests_WITNESS + + + + + + + + + + + + + +extrasub="$extrasub"' +/@subdir@/{ +h +g +s/@subdir@/gnulib-lib/g +p +g +s/@subdir@/avcall/g +p +g +s/@subdir@/vacall/g +p +g +s/@subdir@/trampoline/g +p +g +s/@subdir@/callback/g +p +d +} +' +extrasub="$extrasub"' +/@callback_subdir@/{ +h +g +s/@callback_subdir@/vacall_r/g +p +g +s/@callback_subdir@/trampoline_r/g +p +d +} +' + +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, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +printf "%s\n" "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test ${\1+y} || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +printf "%s\n" "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +printf "%s\n" "$as_me: not updating unwritable cache $cache_file" >&6;} + 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}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`printf "%s\n" "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 +printf %s "checking that generated files are newer than configure... " >&6; } + if test -n "$am_sleep_pid"; then + # Hide warnings about reused PIDs. + wait $am_sleep_pid 2>/dev/null + fi + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: done" >&5 +printf "%s\n" "done" >&6; } + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ANSICXX_TRUE}" && test -z "${ANSICXX_FALSE}"; then + as_fn_error $? "conditional \"ANSICXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ANSICXX_TRUE}" && test -z "${ANSICXX_FALSE}"; then + as_fn_error $? "conditional \"ANSICXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_COND_LIBTOOL_TRUE}" && test -z "${GL_COND_LIBTOOL_FALSE}"; then + as_fn_error $? "conditional \"GL_COND_LIBTOOL\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_ALLOCA_H_TRUE}" && test -z "${GL_GENERATE_ALLOCA_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_ALLOCA_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_ERRNO_H_TRUE}" && test -z "${GL_GENERATE_ERRNO_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_ERRNO_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_LIMITS_H_TRUE}" && test -z "${GL_GENERATE_LIMITS_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_LIMITS_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_STDBOOL_H_TRUE}" && test -z "${GL_GENERATE_STDBOOL_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_STDBOOL_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_STDDEF_H_TRUE}" && test -z "${GL_GENERATE_STDDEF_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_STDDEF_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_LIMITS_H_TRUE}" && test -z "${GL_GENERATE_LIMITS_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_LIMITS_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_STDINT_H_TRUE}" && test -z "${GL_GENERATE_STDINT_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_STDINT_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${GL_GENERATE_STDNORETURN_H_TRUE}" && test -z "${GL_GENERATE_STDNORETURN_H_FALSE}"; then + as_fn_error $? "conditional \"GL_GENERATE_STDNORETURN_H\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + + gl_libobjs= + gl_ltlibobjs= + if test -n "$gl_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do + gl_libobjs="$gl_libobjs $i.$ac_objext" + gl_ltlibobjs="$gl_ltlibobjs $i.lo" + done + fi + gl_LIBOBJS=$gl_libobjs + + gl_LTLIBOBJS=$gl_ltlibobjs + + + + gltests_libobjs= + gltests_ltlibobjs= + if test -n "$gltests_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do + gltests_libobjs="$gltests_libobjs $i.$ac_objext" + gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" + done + fi + gltests_LIBOBJS=$gltests_libobjs + + gltests_LTLIBOBJS=$gltests_ltlibobjs + + + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +printf "%s\n" "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $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} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +as_nop=: +if test ${ZSH_VERSION+y} && (emulate sh) >/dev/null 2>&1 +then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else $as_nop + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + + +# Reset variables that may have inherited troublesome values from +# the environment. + +# IFS needs to be set, to space, tab, and newline, in precisely that order. +# (If _AS_PATH_WALK were called with IFS unset, it would have the +# side effect of setting IFS to empty, thus disabling word splitting.) +# Quoting is to prevent editors from complaining about space-tab. +as_nl=' +' +export as_nl +IFS=" "" $as_nl" + +PS1='$ ' +PS2='> ' +PS4='+ ' + +# Ensure predictable behavior from utilities with locale-dependent output. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# We cannot yet rely on "unset" to work, but we need these variables +# to be unset--not just set to an empty or harmless value--now, to +# avoid bugs in old shells (e.g. pre-3.0 UWIN ksh). This construct +# also avoids known problems related to "unset" and subshell syntax +# in other old shells (e.g. bash 2.01 and pdksh 5.2.14). +for as_var in BASH_ENV ENV MAIL MAILPATH CDPATH +do eval test \${$as_var+y} \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done + +# Ensure that fds 0, 1, and 2 are open. +if (exec 3>&0) 2>/dev/null; then :; else exec 0&1) 2>/dev/null; then :; else exec 1>/dev/null; fi +if (exec 3>&2) ; then :; else exec 2>/dev/null; fi + +# The user is always right. +if ${PATH_SEPARATOR+false} :; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + test -r "$as_dir$0" && as_myself=$as_dir$0 && break + done +IFS=$as_save_IFS + + ;; +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 + printf "%s\n" "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + printf "%s\n" "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null +then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else $as_nop + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null +then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else $as_nop + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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 + + +# Determine whether it's possible to make 'echo' print without a newline. +# These variables are no longer used directly by Autoconf, but are AC_SUBSTed +# for compatibility with existing Makefiles. +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +# For backward compatibility with old third-party macros, we provide +# the shell variables $as_echo and $as_echo_n. New code should use +# AS_ECHO(["message"]) and AS_ECHO_N(["message"]), respectively. +as_echo='printf %s\n' +as_echo_n='printf %s' + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -pR'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -pR' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -pR' + fi +else + as_ln_s='cp -pR' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`printf "%s\n" "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + + +# as_fn_executable_p FILE +# ----------------------- +# Test if FILE is an executable regular file. +as_fn_executable_p () +{ + test -f "$1" && test -x "$1" +} # as_fn_executable_p +as_test_x='test -x' +as_executable_p=as_fn_executable_p + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval 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="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by GNU libffcall $as_me 2.4, which was +generated by GNU Autoconf 2.71. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + 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 + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to . +GNU libffcall home page: . +General help using GNU software: ." + +_ACEOF +ac_cs_config=`printf "%s\n" "$ac_configure_args" | sed "$ac_safe_unquote"` +ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\''/g"` +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config='$ac_cs_config_escaped' +ac_cs_version="\\ +GNU libffcall config.status 2.4 +configured by $0, generated by GNU Autoconf 2.71, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2021 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +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=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + printf "%s\n" "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + printf "%s\n" "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`printf "%s\n" "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + printf "%s\n" "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + 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 || ac_write_fail=1 +if \$ac_cs_recheck; then + set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \printf "%s\n" "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + printf "%s\n" "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' +configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' +predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' +postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' +predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' +postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' +LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' +reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' +reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' +GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' +with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' +inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' +link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' +always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' +exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' +prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' +file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' +hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' +predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' +postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' +predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' +postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' +compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in AS \ +DLLTOOL \ +OBJDUMP \ +SHELL \ +ECHO \ +PATH_SEPARATOR \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_import \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +lt_cv_nm_interface \ +nm_file_list_spec \ +lt_cv_truncate_bin \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib \ +compiler_lib_search_dirs \ +predep_objects \ +postdep_objects \ +predeps \ +postdeps \ +compiler_lib_search_path \ +LD_CXX \ +reload_flag_CXX \ +compiler_CXX \ +lt_prog_compiler_no_builtin_flag_CXX \ +lt_prog_compiler_pic_CXX \ +lt_prog_compiler_wl_CXX \ +lt_prog_compiler_static_CXX \ +lt_cv_prog_compiler_c_o_CXX \ +export_dynamic_flag_spec_CXX \ +whole_archive_flag_spec_CXX \ +compiler_needs_object_CXX \ +with_gnu_ld_CXX \ +allow_undefined_flag_CXX \ +no_undefined_flag_CXX \ +hardcode_libdir_flag_spec_CXX \ +hardcode_libdir_separator_CXX \ +exclude_expsyms_CXX \ +include_expsyms_CXX \ +file_list_spec_CXX \ +compiler_lib_search_dirs_CXX \ +predep_objects_CXX \ +postdep_objects_CXX \ +predeps_CXX \ +postdeps_CXX \ +compiler_lib_search_path_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +configure_time_dlsearch_path \ +configure_time_lt_sys_library_path \ +reload_cmds_CXX \ +old_archive_cmds_CXX \ +old_archive_from_new_cmds_CXX \ +old_archive_from_expsyms_cmds_CXX \ +archive_cmds_CXX \ +archive_expsym_cmds_CXX \ +module_cmds_CXX \ +module_expsym_cmds_CXX \ +export_symbols_cmds_CXX \ +prelink_cmds_CXX \ +postlink_cmds_CXX; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' + +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile' + + + + + + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + "ffcall-version.h") CONFIG_HEADERS="$CONFIG_HEADERS ffcall-version.h:ffcall-version.in.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "gnulib-lib/Makefile") CONFIG_FILES="$CONFIG_FILES gnulib-lib/Makefile" ;; + "avcall/Makefile") CONFIG_FILES="$CONFIG_FILES avcall/Makefile" ;; + "vacall/Makefile") CONFIG_FILES="$CONFIG_FILES vacall/Makefile" ;; + "trampoline/Makefile") CONFIG_FILES="$CONFIG_FILES trampoline/Makefile" ;; + "callback/Makefile") CONFIG_FILES="$CONFIG_FILES callback/Makefile" ;; + "callback/vacall_r/Makefile") CONFIG_FILES="$CONFIG_FILES callback/vacall_r/Makefile" ;; + "callback/trampoline_r/Makefile") CONFIG_FILES="$CONFIG_FILES callback/trampoline_r/Makefile" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + 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+y} || CONFIG_FILES=$config_files + test ${CONFIG_HEADERS+y} || CONFIG_HEADERS=$config_headers + test ${CONFIG_COMMANDS+y} || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`printf "%s\n" "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # 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. */ + configure_input='Generated from '` + printf "%s\n" "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +printf "%s\n" "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`printf "%s\n" "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`printf "%s\n" "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`printf "%s\n" "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +printf "%s\n" "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +printf "%s\n" "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + printf "%s\n" "/* $configure_input */" >&1 \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + + :C) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +printf "%s\n" "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Older Autoconf quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + # TODO: see whether this extra hack can be removed once we start + # requiring Autoconf 2.70 or later. + case $CONFIG_FILES in #( + *\'*) : + eval set x "$CONFIG_FILES" ;; #( + *) : + set x $CONFIG_FILES ;; #( + *) : + ;; +esac + shift + # Used to flag and report bootstrapping failures. + am_rc=0 + for am_mf + do + # Strip MF so we end up with the name of the file. + am_mf=`printf "%s\n" "$am_mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile which includes + # dependency-tracking related rules and includes. + # Grep'ing the whole file directly is not great: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ + || continue + am_dirpart=`$as_dirname -- "$am_mf" || +$as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$am_mf" : 'X\(//\)[^/]' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X"$am_mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + am_filepart=`$as_basename -- "$am_mf" || +$as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ + X"$am_mf" : 'X\(//\)$' \| \ + X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || +printf "%s\n" X/"$am_mf" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { echo "$as_me:$LINENO: cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles" >&5 + (cd "$am_dirpart" \ + && sed -e '/# am--include-marker/d' "$am_filepart" \ + | $MAKE -f - am--depfiles) >&5 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } || am_rc=$? + done + if test $am_rc -ne 0; then + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "Something went wrong bootstrapping makefile fragments + for automatic dependency tracking. If GNU make was not used, consider + re-running the configure script with MAKE=\"gmake\" (or whatever is + necessary). You can also try re-running configure with the + '--disable-dependency-tracking' option to at least be able to build + the package (albeit without support for automatic dependency tracking). +See \`config.log' for more details" "$LINENO" 5; } + fi + { am_dirpart=; unset am_dirpart;} + { am_filepart=; unset am_filepart;} + { am_mf=; unset am_mf;} + { am_rc=; unset am_rc;} + rm -f conftest-deps.mk +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +# Copyright (C) 2014 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. + +# GNU Libtool 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 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool 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, see . + + +# The names of the tagged configurations supported by this script. +available_tags='CXX ' + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Assembler program. +AS=$lt_AS + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Object dumper program. +OBJDUMP=$lt_OBJDUMP + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shared archive member basename,for filename based shared library versioning on AIX. +shared_archive_member_spec=$shared_archive_member_spec + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The PATH separator for the build system. +PATH_SEPARATOR=$lt_PATH_SEPARATOR + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm into a list of symbols to manually relocate. +global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# The name lister interface. +nm_interface=$lt_lt_cv_nm_interface + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and where our libraries should be installed. +lt_sysroot=$lt_sysroot + +# Command to truncate a binary pipe. +lt_truncate_bin=$lt_lt_cv_truncate_bin + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Detected run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path + +# Explicit LT_SYS_LIBRARY_PATH set during ./configure time. +configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects +postdep_objects=$lt_postdep_objects +predeps=$lt_predeps +postdeps=$lt_postdeps + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path + +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x$2 in + x) + ;; + *:) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" + ;; + x:*) + eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" + ;; + *) + eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" + ;; + esac +} + + +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in $*""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} + + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + + +ltmain=$ac_aux_dir/ltmain.sh + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + + cat <<_LT_EOF >> "$ofile" + +# ### BEGIN LIBTOOL TAG CONFIG: CXX + +# The linker used to build libraries. +LD=$lt_LD_CXX + +# How to create reloadable object files. +reload_flag=$lt_reload_flag_CXX +reload_cmds=$lt_reload_cmds_CXX + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds_CXX + +# A language specific compiler. +CC=$lt_compiler_CXX + +# Is the compiler the GNU compiler? +with_gcc=$GCC_CXX + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic_CXX + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl_CXX + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static_CXX + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc_CXX + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object_CXX + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds_CXX +archive_expsym_cmds=$lt_archive_expsym_cmds_CXX + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds_CXX +module_expsym_cmds=$lt_module_expsym_cmds_CXX + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld_CXX + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag_CXX + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag_CXX + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct_CXX + +# Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \$shlibpath_var if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute_CXX + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L_CXX + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic_CXX + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath_CXX + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs_CXX + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols_CXX + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds_CXX + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms_CXX + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms_CXX + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds_CXX + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds_CXX + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec_CXX + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action_CXX + +# The directories searched by this compiler when creating a shared library. +compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX + +# Dependencies to place before and after the objects being linked to +# create a shared library. +predep_objects=$lt_predep_objects_CXX +postdep_objects=$lt_postdep_objects_CXX +predeps=$lt_predeps_CXX +postdeps=$lt_postdeps_CXX + +# The library search path used internally by the compiler when linking +# a shared library. +compiler_lib_search_path=$lt_compiler_lib_search_path_CXX + +# ### END LIBTOOL TAG CONFIG: CXX +_LT_EOF + + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# 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 || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +printf "%s\n" "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + + diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..744aafd --- /dev/null +++ b/configure.ac @@ -0,0 +1,224 @@ +dnl AUTOCONF configuration for LIBFFCALL +dnl Copyright 1995-2020 Bruno Haible +dnl Copyright 2003-2010 Sam Steingold +dnl +dnl This program is free software: you can redistribute it and/or modify +dnl it under the terms of the GNU General Public License as published by +dnl the Free Software Foundation; either version 2 of the License, or +dnl (at your option) any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program. If not, see . +dnl + +AC_INIT([GNU libffcall],m4_normalize(m4_esyscmd([cat VERSION])),[https://savannah.gnu.org/projects/libffcall],[libffcall]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([]) + +AC_CONFIG_SRCDIR([trampoline/trampoline.h]) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_HEADERS([ffcall-version.h:ffcall-version.in.h]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([gnulib-lib/Makefile]) +AC_CONFIG_FILES([avcall/Makefile]) +AC_CONFIG_FILES([vacall/Makefile]) +AC_CONFIG_FILES([trampoline/Makefile]) +AC_CONFIG_FILES([callback/Makefile]) +AC_CONFIG_FILES([callback/vacall_r/Makefile]) +AC_CONFIG_FILES([callback/trampoline_r/Makefile]) + +dnl Substitutable version number. +changequote(,) +sed_extract_major='/^[0-9]/{s/^\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +sed_extract_minor='/^[0-9][0-9]*[.][0-9]/{s/^[0-9]*[.]\([0-9]*\).*/\1/p;q;} +i\ +0 +q +' +changequote([,]) +version_major=`echo "${PACKAGE_VERSION}" | sed -n -e "$sed_extract_major"` +version_minor=`echo "${PACKAGE_VERSION}" | sed -n -e "$sed_extract_minor"` +HEXVERSION=`printf '0x%02X%02X' $version_major $version_minor` +AC_DEFINE_UNQUOTED([LIBFFCALL_VERSION], [$HEXVERSION], [Version number: (major<<8) + minor]) + +AC_PROG_MAKE_SET + +dnl The libraries are built in C. +AC_PROG_CC +AC_PROG_CPP +AC_PROG_GCC_TRADITIONAL +CL_CC_GCC +CL_AS_UNDERSCORE +dnl But some tests use C++. +gl_PROG_ANSI_CXX([CXX], [ANSICXX]) +if test "$CXX" != no; then + IF_CXX='' +else + IF_CXX='# ' +fi +AC_SUBST([IF_CXX]) + +dnl For a 64-bit build on AIX, AC_PROG_RANLIB is not sufficient. +gl_PROG_AR_RANLIB + +dnl The Makefiles have a few special rules for MSVC. +AC_EGREP_CPP([MicrosoftCompiler], + [ +#ifdef _MSC_VER +MicrosoftCompiler +#endif + ], + [IF_MSVC='' + IFNOT_MSVC='# ' + ], + [IF_MSVC='# ' + IFNOT_MSVC='' + ]) +AC_SUBST([IF_MSVC]) +AC_SUBST([IFNOT_MSVC]) + +AC_PROG_INSTALL +CL_PROG_LN + +gl_EARLY + +gl_HOST_CPU_C_ABI +FFCALL_ENDIANNESS + +PACKAGE=libffcall +LT_INIT([win32-dll]) + +dnl Checks for trampoline, trampoline_r. +AC_CHECK_HEADERS([unistd.h]) +gl_FUNC_MMAP_ANON +FFCALL_CODEEXEC + +dnl List of object files for trampoline, trampoline_r. +CPU_OBJECTS='' +if test ${HOST_CPU_C_ABI} = hppa -o ${HOST_CPU_C_ABI} = hppa64 -o ${HOST_CPU_C_ABI} = powerpc64 -o ${HOST_CPU_C_ABI} = ia64; then + CPU_OBJECTS="$CPU_OBJECTS "'tramp-$(CPU).lo' +fi +if test ${HOST_CPU_C_ABI} = powerpc; then + case "${host_os}" in + aix*) CPU_OBJECTS="$CPU_OBJECTS "'tramp-$(CPU).lo' ;; + *) ;; + esac +fi +if test ${HOST_CPU_C_ABI} = alpha -o ${HOST_CPU_C_ABI} = hppa -o ${HOST_CPU_C_ABI} = hppa64 -o ${HOST_CPU_C_ABI} = powerpc64-elfv2; then + CPU_OBJECTS="$CPU_OBJECTS "'cache-$(CPU).lo' +fi +if test ${HOST_CPU_C_ABI} = sparc -o ${HOST_CPU_C_ABI} = sparc64; then + case "${host_os}" in + solaris*) ;; + *) CPU_OBJECTS="$CPU_OBJECTS "'cache-$(CPU).lo' ;; + esac +fi +if test ${HOST_CPU_C_ABI} = powerpc; then + case "${host_os}" in + aix*) ;; + *) CPU_OBJECTS="$CPU_OBJECTS "'cache-$(CPU).lo' ;; + esac +fi +AC_SUBST([CPU_OBJECTS]) +case "${HOST_CPU_C_ABI}" in + mips* | riscv*) + AC_CHECK_HEADERS([sys/cachectl.h]) + ;; +esac + +dnl Work around GCC bug : +dnl GCC, configured with --enable-default-pie on SPARC, miscompiles hand-written +dnl .s files that happen to access global variables. The recommended workaround +dnl is to use '#ifdef __PIC__' in the .s file; this works fine on 64-bit SPARC. +dnl On 32-bit SPARC, however, the resulting executable is still broken. The +dnl workaround here is to use -fno-pie. This option is available in gcc >= 3.4. +WORKAROUND_BUG_81653='' +if test ${HOST_CPU_C_ABI} = sparc && test -n "$GCC"; then + gcc_version=`LC_ALL=C ${CC} -v 2>&1 | grep version | sed -n -e '$p' | sed -e 's/.*version //g' -e 's/gcc //'` + case "$gcc_version" in + 2.* | 3.[0-3]*) ;; + *) WORKAROUND_BUG_81653='-fno-pie' ;; + esac +fi +AC_SUBST([WORKAROUND_BUG_81653]) + +dnl Some parts of avcall and vacall need to interpret memory words as 'float' +dnl or 'double' entities. This violates the strict type-based aliasing rules +dnl of C. In other words, we still use C as a portable assembler, but now the +dnl compilers want to outsmart us. There are two ways to tell them not to do +dnl this: to use union types, or specific compiler options. I prefer to do it +dnl through compiler options, because union types produce trouble with +dnl alignments. +if test -n "$GCC"; then + DISABLE_TYPE_BASED_ALIASING='-fno-strict-aliasing' +else + case "$host_os" in + aix*) dnl for xlc + DISABLE_TYPE_BASED_ALIASING='-qalias=noansi' + ;; + *) + AC_EGREP_CPP([yes], + [#ifdef __SUNPRO_C + yes + #endif + ], + [dnl for SUNWspro cc + DISABLE_TYPE_BASED_ALIASING='-xalias_level=weak' + ], + [DISABLE_TYPE_BASED_ALIASING='']) + ;; + esac +fi +AC_SUBST([DISABLE_TYPE_BASED_ALIASING]) + +gl_INIT + +dnl This piece of sed script replaces every line containing '@subdir@' +dnl by several consecutive lines, each referencing one subdir. +extrasub="$extrasub"' +/@subdir@/{ +h +g +s/@subdir@/gnulib-lib/g +p +g +s/@subdir@/avcall/g +p +g +s/@subdir@/vacall/g +p +g +s/@subdir@/trampoline/g +p +g +s/@subdir@/callback/g +p +d +} +' +dnl Likewise for the callback subdirectory. +extrasub="$extrasub"' +/@callback_subdir@/{ +h +g +s/@callback_subdir@/vacall_r/g +p +g +s/@callback_subdir@/trampoline_r/g +p +d +} +' + +AC_OUTPUT diff --git a/dummy/ffcall-version.h b/dummy/ffcall-version.h new file mode 100644 index 0000000..1635283 --- /dev/null +++ b/dummy/ffcall-version.h @@ -0,0 +1 @@ +/* This file is intentionally empty. */ diff --git a/ffcall-abi.h b/ffcall-abi.h new file mode 100644 index 0000000..117fd65 --- /dev/null +++ b/ffcall-abi.h @@ -0,0 +1,251 @@ +/* + * Copyright 2017-2019 Bruno Haible + * + * 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, see . + */ + +/* Define some canonical CPU and ABI indicators. + References: + - host-cpu-c-abi.m4 from gnulib + - https://sourceforge.net/p/predef/wiki/Architectures/ + - GCC source code: definitions of macro TARGET_CPU_CPP_BUILTINS + - clang source code: defineMacro invocations in Basic/Targets.cpp, + especially in getTargetDefines methods. + Limitation: Unlike host-cpu-c-abi.m4, this preprocessor-based approach + can not reliably distinguish __arm__ and __armhf__. + */ + +#ifndef __i386__ +#if defined(__i386__) /* GCC, clang */ || defined(__i386) /* Sun C */ || defined(_M_IX86) /* MSVC */ +#define __i386__ 1 +#endif +#endif + +#ifndef __m68k__ +#if defined(__m68k__) /* GCC */ +#define __m68k__ 1 +#endif +#endif + +/* On mips, there are three ABIs: + - 32 or o32: It defines _MIPS_SIM == _ABIO32 and _MIPS_SZLONG == 32. + - n32: It defines _MIPS_SIM == _ABIN32 and _MIPS_SZLONG == 32. + - 64: It defines _MIPS_SZLONG == 64. + */ +/* Note: When __mipsn32__ or __mips64__ is defined, __mips__ may or may not be + defined as well. To test for the MIPS o32 ABI, use + #if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) + */ +/* To distinguish little-endian and big-endian arm, use the preprocessor + defines _MIPSEB vs. _MIPSEL. */ +#ifndef __mips__ +#if defined(__mips) /* GCC, clang, IRIX cc */ /* Note: GCC, clang also define __mips__. */ +#define __mips__ 1 +#endif +#endif +#ifndef __mipsn32__ +#if defined(__mips__) && (_MIPS_SIM == _ABIN32) +#define __mipsn32__ 1 +#endif +#endif +#ifndef __mips64__ +#if defined(__mips__) && defined(_MIPS_SZLONG) && (_MIPS_SZLONG == 64) +#define __mips64__ 1 +#endif +#endif + +/* Note: When __sparc64__ is defined, __sparc__ may or may not be defined as + well. To test for the SPARC 32-bit ABI, use + #if defined(__sparc__) && !defined(__sparc64__) + */ +#ifndef __sparc__ +#if defined(__sparc) /* GCC, clang, Sun C */ /* Note: GCC, clang also define __sparc__. */ +#define __sparc__ 1 +#endif +#endif +#ifndef __sparc64__ +#if defined(__sparcv9) /* GCC/Solaris, Sun C */ || defined(__arch64__) /* GCC/Linux */ +#define __sparc64__ 1 +#endif +#endif + +#ifndef __alpha__ +#if defined(__alpha) /* GCC, DEC C */ /* Note: GCC also defines __alpha__. */ +#define __alpha__ 1 +#endif +#endif + +/* On hppa, the C compiler may be generating 32-bit code or 64-bit code. + In the latter case, it defines _LP64 and __LP64__. + */ +/* Note: When __hppa64__ is defined, __hppa__ may or may not be defined as well. + To test for the HP-PA 32-bit ABI, use + #if defined(__hppa__) && !defined(__hppa64__) + */ +#ifndef __hppa__ +#if defined(__hppa) /* GCC, HP C */ /* Note: GCC also defines __hppa__. */ +#define __hppa__ 1 +#endif +#endif +#ifndef __hppa64__ +#if defined(__hppa__) && defined(__LP64__) +#define __hppa64__ 1 +#endif +#endif + +/* Distinguish arm which passes floating-point arguments and return values + in integer registers (r0, r1, ...) - this is gcc -mfloat-abi=soft or + gcc -mfloat-abi=softfp - from arm which passes them in float registers + (s0, s1, ...) and double registers (d0, d1, ...) - this is + gcc -mfloat-abi=hard. GCC 4.6 or newer sets the preprocessor defines + __ARM_PCS (for the first case) and __ARM_PCS_VFP (for the second case), + but older GCC does not. */ +/* Note: When __armhf__ is defined, __arm__ may or may not be defined as well. + To test for the ARM ABI that does not use floating-point registers for + parameter passing, use + #if defined(__arm__) && !defined(__armhf__) + */ +/* To distinguish little-endian and big-endian arm, use the preprocessor + defines __ARMEL__ vs. __ARMEB__. */ +#ifndef __arm__ +#if defined(__arm__) /* GCC, clang */ || defined(_M_ARM) /* MSVC */ +#define __arm__ 1 +#endif +#endif +#ifndef __armhf__ +#if defined(__arm__) && defined(__ARM_PCS_VFP) /* GCC */ +#define __armhf__ 1 +#endif +#endif + +/* On arm64 systems, the C compiler may be generating code in one of these ABIs: + - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. + - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. + - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf + (see above). + */ +/* Note: When __arm64_ilp32__ is defined, __arm64__ may or may not be defined as + well. To test for the arm64 64-bit ABI, use + #if defined(__arm64__) && !defined(__arm64_ilp32__) + */ +/* To distinguish little-endian and big-endian arm64, use the preprocessor + defines __AARCH64EL__ vs. __AARCH64EB__. */ +#ifndef __arm64__ +#if defined(__aarch64__) /* GCC, clang */ || defined(_M_ARM64) /* MSVC */ +#define __arm64__ 1 +#endif +#endif +#ifndef __arm64_ilp32__ +#if defined(__arm64__) && (defined(__ILP32__) || defined (_ILP32)) +#define __arm64_ilp32__ 1 +#endif +#endif + +/* On powerpc and powerpc64, different ABIs are in use on AIX vs. Mac OS X vs. + Linux,*BSD. To distinguish them, use the OS dependent defines + #if defined(_AIX) + #if (defined(__MACH__) && defined(__APPLE__)) + #if !(defined(_AIX) || (defined(__MACH__) && defined(__APPLE__))) + */ +/* On powerpc64, there are two ABIs on Linux: The AIX compatible one and the + ELFv2 one. The latter defines _CALL_ELF=2. + */ +/* Note: When __powerpc64__ is defined, __powerpc__ may or may not be defined as + well. To test for the SPARC 32-bit ABI, use + #if defined(__powerpc__) && !defined(__powerpc64__) + Note: When __powerpc64_elfv2__ is defined, __powerpc64__ may or may not be + defined as well. To test for the SPARC 32-bit ABI, use + #if defined(__powerpc64__) && !defined(__powerpc64_elfv2__) + */ +#ifndef __powerpc__ +#if defined(_ARCH_PPC) /* GCC, XLC */ /* Note: On AIX, Linux also __powerpc__ is defined; whereas on Mac OS X also __ppc__ is defined. On AIX also _IBMR2 is defined. */ +#define __powerpc__ 1 +#endif +#endif +#ifndef __powerpc64__ +#if defined(_ARCH_PPC64) /* GCC, XLC */ /* Note: On Linux, also __powerpc64__ is defined. */ +#define __powerpc64__ 1 +#endif +#endif +#ifndef __powerpc64_elfv2__ +#if defined(__powerpc64__) && defined(_CALL_ELF) && _CALL_ELF == 2 +#define __powerpc64_elfv2__ 1 +#endif +#endif + +/* On ia64 on HP-UX, the C compiler may be generating 64-bit code or 32-bit + code. In the latter case, it defines _ILP32. + */ +/* Note: When __ia64_ilp32__ is defined, __ia64__ may or may not be defined as + well. To test for the ia64 64-bit ABI, use + #if defined(__ia64__) && !defined(__ia64_ilp32__) + */ +#ifndef __ia64__ +#if defined(__ia64__) /* GCC, HP C */ /* Note: GCC, HP C also define __ia64. */ +#define __ia64__ 1 +#endif +#endif +#ifndef __ia64_ilp32__ +#if defined(__ia64__) && defined(_ILP32) +#define __ia64_ilp32__ 1 +#endif +#endif + +/* On x86_64 systems, the C compiler may be generating code in one of these ABIs: + - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. + - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 + with native Windows (mingw, MSVC). + - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. + - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386 (see above). */ +/* Note: When __x86_64_x32__ is defined, __x86_64__ may or may not be defined as + well. To test for the x86_64 64-bit ABI, use + #if defined(__x86_64__) && !defined(__x86_64_x32__) + */ +#ifndef __x86_64__ +#if (defined(__x86_64__) || defined(__amd64__)) /* GCC, clang, Sun C */ || (defined(_M_X64) || defined(_M_AMD64)) /* MSVC */ +#define __x86_64__ 1 +#endif +#endif +#ifndef __x86_64_x32__ +#if defined(__x86_64__) && (defined(__ILP32__) || defined(_ILP32)) +#define __x86_64_x32__ 1 +#endif +#endif + +/* Note: When __s390x__ is defined, __s390__ may or may not be defined as well. + To test for the S/390 31-bit ABI, use + #if defined(__s390__) && !defined(__s390x__) + */ +#ifndef __s390__ +#if defined(__s390__) /* GCC, clang */ +#define __s390__ 1 +#endif +#endif +#ifndef __s390x__ +#if defined(__s390x__) /* GCC, clang */ +#define __s390x__ 1 +#endif +#endif + +#ifndef __riscv32__ +#if defined(__riscv) && __riscv_xlen == 32 && !defined(__LP64__) /* GCC */ +#define __riscv32__ 1 +#endif +#endif + +#ifndef __riscv64__ +#if defined(__riscv) && __riscv_xlen == 64 && defined(__LP64__) /* GCC */ +#define __riscv64__ 1 +#endif +#endif diff --git a/ffcall-stdint.h b/ffcall-stdint.h new file mode 100644 index 0000000..125815c --- /dev/null +++ b/ffcall-stdint.h @@ -0,0 +1,40 @@ +/* + * Copyright 2017-2018 Bruno Haible + * + * 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, see . + */ + +/* Replacement for a subset of . + We cannot use gnulib's portable replacement, because when + cross-compiling the various avcall-$(CPU).c and vacall-$(CPU).c files, + gnulib-generated files are not available. And the cross-compilers of + GCC version < 4.5 don't provide . */ + +/* Define integer types that are as large as a pointer, */ + +#if defined(__x86_64__) && defined(_WIN32) && !defined(__CYGWIN__) +/* An LLP64 platform. */ +typedef long long ff_intptr_t; +typedef unsigned long long ff_uintptr_t; +#else +/* An ILP32 or LP64 platform. */ +typedef long ff_intptr_t; +typedef unsigned long ff_uintptr_t; +#endif +#define intptr_t ff_intptr_t +#define uintptr_t ff_uintptr_t + +/* Verify at compile time that sizeof([u]intptr_t) == sizeof(void*). */ +typedef int intptr_verify[2*(sizeof(intptr_t) == sizeof(void*))-1]; +typedef int uintptr_verify[2*(sizeof(uintptr_t) == sizeof(void*))-1]; diff --git a/ffcall-version.c b/ffcall-version.c new file mode 100644 index 0000000..97484be --- /dev/null +++ b/ffcall-version.c @@ -0,0 +1,26 @@ +/* + * Copyright 2017 Bruno Haible + * + * 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, see . + */ + +#include "config.h" + +/* Specification. */ +#include "ffcall-version.h" + +int ffcall_get_version (void) +{ + return LIBFFCALL_VERSION; +} diff --git a/ffcall-version.in.h b/ffcall-version.in.h new file mode 100644 index 0000000..494ec15 --- /dev/null +++ b/ffcall-version.in.h @@ -0,0 +1,34 @@ +/* + * Copyright 2009-2017 Bruno Haible + * + * 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, see . + */ + +#if !defined(FFCALL_VERSION_H) + +/* Version number of libffcall (include files): (major<<8) + minor. */ +#define LIBFFCALL_VERSION 0 + +#ifdef __cplusplus +extern "C" { +#endif + +/* Version number of libffcall (library): (major<<8) + minor. */ +extern int ffcall_get_version (void); + +#ifdef __cplusplus +} +#endif + +#endif /* FFCALL_VERSION_H */ diff --git a/gnulib-lib/Makefile.am b/gnulib-lib/Makefile.am new file mode 100644 index 0000000..01441fe --- /dev/null +++ b/gnulib-lib/Makefile.am @@ -0,0 +1,1394 @@ +## DO NOT EDIT! GENERATED AUTOMATICALLY! +## Process this file with automake to produce Makefile.in. +# Copyright (C) 2002-2021 Free Software Foundation, Inc. +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This file 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 file. If not, see . +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. +# Reproduce by: +# gnulib-tool --import \ +# --lib=libgnu \ +# --source-base=gnulib-lib \ +# --m4-base=gnulib-m4 \ +# --doc-base=doc \ +# --tests-base=tests \ +# --aux-dir=build-aux \ +# --no-conditional-dependencies \ +# --libtool \ +# --macro-prefix=gl \ +# ansi-c++-opt \ +# clean-temp-simple \ +# host-cpu-c-abi \ +# lock \ +# nocrash \ +# stdint \ +# stdnoreturn + +AUTOMAKE_OPTIONS = 1.11 gnits subdir-objects + +SUBDIRS = +noinst_HEADERS = +noinst_LIBRARIES = +noinst_LTLIBRARIES = +EXTRA_DIST = +BUILT_SOURCES = +SUFFIXES = +MOSTLYCLEANFILES = core *.stackdump +MOSTLYCLEANDIRS = +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = +# No GNU Make output. + +AM_CPPFLAGS = +AM_CFLAGS = + +noinst_LTLIBRARIES += libgnu.la + +libgnu_la_SOURCES = +libgnu_la_LIBADD = $(gl_LTLIBOBJS) +libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS) +EXTRA_libgnu_la_SOURCES = +libgnu_la_LDFLAGS = $(AM_LDFLAGS) +libgnu_la_LDFLAGS += -no-undefined +libgnu_la_LDFLAGS += $(LIBTHREAD) +libgnu_la_LDFLAGS += $(LTLIBINTL) + +## begin gnulib module absolute-header + +# Use this preprocessor expression to decide whether #include_next works. +# Do not rely on a 'configure'-time test for this, since the expression +# might appear in an installed header, which is used by some other compiler. +HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER) + +## end gnulib module absolute-header + +## begin gnulib module alloca-opt + +BUILT_SOURCES += $(ALLOCA_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +if GL_GENERATE_ALLOCA_H +alloca.h: alloca.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < $(srcdir)/alloca.in.h; \ + } > $@-t && \ + mv -f $@-t $@ +else +alloca.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += alloca.h alloca.h-t + +EXTRA_DIST += alloca.in.h + +## end gnulib module alloca-opt + +## begin gnulib module asyncsafe-spin + +libgnu_la_SOURCES += asyncsafe-spin.c + +EXTRA_DIST += asyncsafe-spin.h + +## end gnulib module asyncsafe-spin + +## begin gnulib module attribute + + +EXTRA_DIST += attribute.h + +## end gnulib module attribute + +## begin gnulib module basename-lgpl + +libgnu_la_SOURCES += basename-lgpl.c + +EXTRA_DIST += basename-lgpl.h + +## end gnulib module basename-lgpl + +## begin gnulib module clean-temp-simple + +libgnu_la_SOURCES += clean-temp-simple.h clean-temp-simple.c + +EXTRA_DIST += clean-temp-private.h + +## end gnulib module clean-temp-simple + +## begin gnulib module cloexec + +libgnu_la_SOURCES += cloexec.c + +EXTRA_DIST += cloexec.h + +## end gnulib module cloexec + +## begin gnulib module close + + +EXTRA_DIST += close.c + +EXTRA_libgnu_la_SOURCES += close.c + +## end gnulib module close + +## begin gnulib module dup2 + + +EXTRA_DIST += dup2.c + +EXTRA_libgnu_la_SOURCES += dup2.c + +## end gnulib module dup2 + +## begin gnulib module errno + +BUILT_SOURCES += $(ERRNO_H) + +# We need the following in order to create when the system +# doesn't have one that is POSIX compliant. +if GL_GENERATE_ERRNO_H +errno.h: errno.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ + -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ + -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ + -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ + -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ + -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ + -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ + < $(srcdir)/errno.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +errno.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += errno.h errno.h-t + +EXTRA_DIST += errno.in.h + +## end gnulib module errno + +## begin gnulib module error + + +EXTRA_DIST += error.c error.h + +EXTRA_libgnu_la_SOURCES += error.c + +## end gnulib module error + +## begin gnulib module fatal-signal + +libgnu_la_SOURCES += fatal-signal.h fatal-signal.c + +## end gnulib module fatal-signal + +## begin gnulib module fcntl + + +EXTRA_DIST += fcntl.c + +EXTRA_libgnu_la_SOURCES += fcntl.c + +## end gnulib module fcntl + +## begin gnulib module fcntl-h + +BUILT_SOURCES += fcntl.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ + -e 's/@''GNULIB_CREAT''@/$(GL_GNULIB_CREAT)/g' \ + -e 's/@''GNULIB_FCNTL''@/$(GL_GNULIB_FCNTL)/g' \ + -e 's/@''GNULIB_NONBLOCKING''@/$(GL_GNULIB_NONBLOCKING)/g' \ + -e 's/@''GNULIB_OPEN''@/$(GL_GNULIB_OPEN)/g' \ + -e 's/@''GNULIB_OPENAT''@/$(GL_GNULIB_OPENAT)/g' \ + -e 's/@''GNULIB_MDA_CREAT''@/$(GL_GNULIB_MDA_CREAT)/g' \ + -e 's/@''GNULIB_MDA_OPEN''@/$(GL_GNULIB_MDA_OPEN)/g' \ + -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ + -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ + -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ + -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ + -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ + -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/fcntl.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += fcntl.h fcntl.h-t + +EXTRA_DIST += fcntl.in.h + +## end gnulib module fcntl-h + +## begin gnulib module fd-hook + +libgnu_la_SOURCES += fd-hook.c + +EXTRA_DIST += fd-hook.h + +## end gnulib module fd-hook + +## begin gnulib module filename + + +EXTRA_DIST += filename.h + +## end gnulib module filename + +## begin gnulib module fstat + + +EXTRA_DIST += fstat.c stat-w32.c stat-w32.h + +EXTRA_libgnu_la_SOURCES += fstat.c stat-w32.c + +## end gnulib module fstat + +## begin gnulib module getdtablesize + + +EXTRA_DIST += getdtablesize.c + +EXTRA_libgnu_la_SOURCES += getdtablesize.c + +## end gnulib module getdtablesize + +## begin gnulib module getprogname + +libgnu_la_SOURCES += getprogname.h getprogname.c + +## end gnulib module getprogname + +## begin gnulib module gettext-h + +libgnu_la_SOURCES += gettext.h + +## end gnulib module gettext-h + +## begin gnulib module idx + +libgnu_la_SOURCES += idx.h + +## end gnulib module idx + +## begin gnulib module intprops + + +EXTRA_DIST += intprops.h + +## end gnulib module intprops + +## begin gnulib module limits-h + +BUILT_SOURCES += $(LIMITS_H) + +# We need the following in order to create when the system +# doesn't have one that is compatible with GNU. +if GL_GENERATE_LIMITS_H +limits.h: limits.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ + < $(srcdir)/limits.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +limits.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += limits.h limits.h-t + +EXTRA_DIST += limits.in.h + +## end gnulib module limits-h + +## begin gnulib module linkedhash-list + +libgnu_la_SOURCES += gl_linkedhash_list.h gl_linkedhash_list.c gl_anyhash1.h gl_anyhash2.h gl_anyhash_primes.h gl_anylinked_list1.h gl_anylinked_list2.h + +## end gnulib module linkedhash-list + +## begin gnulib module list + +libgnu_la_SOURCES += gl_list.h gl_list.c + +## end gnulib module list + +## begin gnulib module lock + +libgnu_la_SOURCES += glthread/lock.h glthread/lock.c + +## end gnulib module lock + +## begin gnulib module malloca + +libgnu_la_SOURCES += malloca.c + +EXTRA_DIST += malloca.h + +## end gnulib module malloca + +## begin gnulib module msvc-inval + + +EXTRA_DIST += msvc-inval.c msvc-inval.h + +EXTRA_libgnu_la_SOURCES += msvc-inval.c + +## end gnulib module msvc-inval + +## begin gnulib module msvc-nothrow + + +EXTRA_DIST += msvc-nothrow.c msvc-nothrow.h + +EXTRA_libgnu_la_SOURCES += msvc-nothrow.c + +## end gnulib module msvc-nothrow + +## begin gnulib module open + + +EXTRA_DIST += open.c + +EXTRA_libgnu_la_SOURCES += open.c + +## end gnulib module open + +## begin gnulib module pathmax + + +EXTRA_DIST += pathmax.h + +## end gnulib module pathmax + +## begin gnulib module raise + + +EXTRA_DIST += raise.c + +EXTRA_libgnu_la_SOURCES += raise.c + +## end gnulib module raise + +## begin gnulib module rmdir + + +EXTRA_DIST += rmdir.c + +EXTRA_libgnu_la_SOURCES += rmdir.c + +## end gnulib module rmdir + +## begin gnulib module sigaction + +libgnu_la_SOURCES += sig-handler.c + +EXTRA_DIST += sig-handler.h sigaction.c + +EXTRA_libgnu_la_SOURCES += sigaction.c + +## end gnulib module sigaction + +## begin gnulib module signal-h + +BUILT_SOURCES += signal.h + +# We need the following in order to create when the system +# doesn't have a complete one. +signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ + -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GL_GNULIB_PTHREAD_SIGMASK)/g' \ + -e 's/@''GNULIB_RAISE''@/$(GL_GNULIB_RAISE)/g' \ + -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GL_GNULIB_SIGNAL_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_SIGPROCMASK''@/$(GL_GNULIB_SIGPROCMASK)/g' \ + -e 's/@''GNULIB_SIGACTION''@/$(GL_GNULIB_SIGACTION)/g' \ + -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ + -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \ + -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \ + -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ + -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \ + -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ + -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \ + -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ + -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \ + -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \ + -e 's|@''REPLACE_RAISE''@|$(REPLACE_RAISE)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/signal.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += signal.h signal.h-t + +EXTRA_DIST += signal.in.h + +## end gnulib module signal-h + +## begin gnulib module sigprocmask + + +EXTRA_DIST += sigprocmask.c + +EXTRA_libgnu_la_SOURCES += sigprocmask.c + +## end gnulib module sigprocmask + +## begin gnulib module size_max + +libgnu_la_SOURCES += size_max.h + +## end gnulib module size_max + +## begin gnulib module snippet/_Noreturn + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. + +_NORETURN_H=$(srcdir)/_Noreturn.h + +EXTRA_DIST += _Noreturn.h + +## end gnulib module snippet/_Noreturn + +## begin gnulib module snippet/arg-nonnull + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. + +ARG_NONNULL_H=$(srcdir)/arg-nonnull.h + +EXTRA_DIST += arg-nonnull.h + +## end gnulib module snippet/arg-nonnull + +## begin gnulib module snippet/c++defs + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. + +CXXDEFS_H=$(srcdir)/c++defs.h + +EXTRA_DIST += c++defs.h + +## end gnulib module snippet/c++defs + +## begin gnulib module snippet/warn-on-use + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. + +WARN_ON_USE_H=$(srcdir)/warn-on-use.h + +EXTRA_DIST += warn-on-use.h + +## end gnulib module snippet/warn-on-use + +## begin gnulib module stat + + +EXTRA_DIST += stat-w32.c stat-w32.h stat.c + +EXTRA_libgnu_la_SOURCES += stat-w32.c stat.c + +## end gnulib module stat + +## begin gnulib module stat-time + +libgnu_la_SOURCES += stat-time.c + +EXTRA_DIST += stat-time.h + +## end gnulib module stat-time + +## begin gnulib module stdbool + +BUILT_SOURCES += $(STDBOOL_H) + +# We need the following in order to create when the system +# doesn't have one that works. +if GL_GENERATE_STDBOOL_H +stdbool.h: stdbool.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +stdbool.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += stdbool.h stdbool.h-t + +EXTRA_DIST += stdbool.in.h + +## end gnulib module stdbool + +## begin gnulib module stddef + +BUILT_SOURCES += $(STDDEF_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +if GL_GENERATE_STDDEF_H +stddef.h: stddef.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ + -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ + -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ + -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ + < $(srcdir)/stddef.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +stddef.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += stddef.h stddef.h-t + +EXTRA_DIST += stddef.in.h + +## end gnulib module stddef + +## begin gnulib module stdint + +BUILT_SOURCES += $(STDINT_H) + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +if GL_GENERATE_STDINT_H +stdint.h: stdint.in.h $(top_builddir)/config.status + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ + -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ + -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ + -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ + -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ + -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ + -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ + -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ + -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ + -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ + -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ + -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ + -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ + -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ + -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ + -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ + -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ + -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ + < $(srcdir)/stdint.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +stdint.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += stdint.h stdint.h-t + +EXTRA_DIST += stdint.in.h + +## end gnulib module stdint + +## begin gnulib module stdio + +BUILT_SOURCES += stdio.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ + -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \ + -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \ + -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \ + -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \ + -e 's/@''GNULIB_FGETC''@/$(GL_GNULIB_FGETC)/g' \ + -e 's/@''GNULIB_FGETS''@/$(GL_GNULIB_FGETS)/g' \ + -e 's/@''GNULIB_FOPEN''@/$(GL_GNULIB_FOPEN)/g' \ + -e 's/@''GNULIB_FPRINTF''@/$(GL_GNULIB_FPRINTF)/g' \ + -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GL_GNULIB_FPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_FPURGE''@/$(GL_GNULIB_FPURGE)/g' \ + -e 's/@''GNULIB_FPUTC''@/$(GL_GNULIB_FPUTC)/g' \ + -e 's/@''GNULIB_FPUTS''@/$(GL_GNULIB_FPUTS)/g' \ + -e 's/@''GNULIB_FREAD''@/$(GL_GNULIB_FREAD)/g' \ + -e 's/@''GNULIB_FREOPEN''@/$(GL_GNULIB_FREOPEN)/g' \ + -e 's/@''GNULIB_FSCANF''@/$(GL_GNULIB_FSCANF)/g' \ + -e 's/@''GNULIB_FSEEK''@/$(GL_GNULIB_FSEEK)/g' \ + -e 's/@''GNULIB_FSEEKO''@/$(GL_GNULIB_FSEEKO)/g' \ + -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \ + -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \ + -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \ + -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \ + -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \ + -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \ + -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \ + -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \ + -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \ + -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \ + -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \ + -e 's/@''GNULIB_PRINTF''@/$(GL_GNULIB_PRINTF)/g' \ + -e 's/@''GNULIB_PRINTF_POSIX''@/$(GL_GNULIB_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_PUTC''@/$(GL_GNULIB_PUTC)/g' \ + -e 's/@''GNULIB_PUTCHAR''@/$(GL_GNULIB_PUTCHAR)/g' \ + -e 's/@''GNULIB_PUTS''@/$(GL_GNULIB_PUTS)/g' \ + -e 's/@''GNULIB_REMOVE''@/$(GL_GNULIB_REMOVE)/g' \ + -e 's/@''GNULIB_RENAME''@/$(GL_GNULIB_RENAME)/g' \ + -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \ + -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \ + -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \ + -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \ + -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \ + -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \ + -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \ + -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \ + -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \ + -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \ + -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \ + -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \ + -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \ + -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \ + -e 's/@''GNULIB_MDA_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \ + -e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \ + -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/g' \ + < $(srcdir)/stdio.in.h | \ + sed -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \ + -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ + -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ + -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \ + -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ + -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ + -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ + -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ + -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ + -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ + -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ + -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ + -e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \ + -e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \ + -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ + -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ + -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ + -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ + -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ + -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \ + -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ + -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ + -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ + -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \ + -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ + -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ + -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ + -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ + -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ + -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \ + -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ + -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ + -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ + -e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \ + -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ + -e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \ + -e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \ + -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \ + -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ + -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ + -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \ + -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ + -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \ + -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ + -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \ + -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ + -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ + -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ + -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ + -e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += stdio.h stdio.h-t + +EXTRA_DIST += stdio.in.h + +## end gnulib module stdio + +## begin gnulib module stdnoreturn + +BUILT_SOURCES += $(STDNORETURN_H) + +# We need the following in order to create when the system +# doesn't have one that works. +if GL_GENERATE_STDNORETURN_H +stdnoreturn.h: stdnoreturn.in.h $(top_builddir)/config.status $(_NORETURN_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e '/definition of _Noreturn/r $(_NORETURN_H)' \ + < $(srcdir)/stdnoreturn.in.h; \ + } > $@-t && \ + mv $@-t $@ +else +stdnoreturn.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += stdnoreturn.h stdnoreturn.h-t + +EXTRA_DIST += stdnoreturn.in.h + +## end gnulib module stdnoreturn + +## begin gnulib module strerror + + +EXTRA_DIST += strerror.c + +EXTRA_libgnu_la_SOURCES += strerror.c + +## end gnulib module strerror + +## begin gnulib module strerror-override + + +EXTRA_DIST += strerror-override.c strerror-override.h + +EXTRA_libgnu_la_SOURCES += strerror-override.c + +## end gnulib module strerror-override + +## begin gnulib module string + +BUILT_SOURCES += string.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GL_GNULIB_EXPLICIT_BZERO)/g' \ + -e 's/@''GNULIB_FFSL''@/$(GL_GNULIB_FFSL)/g' \ + -e 's/@''GNULIB_FFSLL''@/$(GL_GNULIB_FFSLL)/g' \ + -e 's/@''GNULIB_MBSLEN''@/$(GL_GNULIB_MBSLEN)/g' \ + -e 's/@''GNULIB_MBSNLEN''@/$(GL_GNULIB_MBSNLEN)/g' \ + -e 's/@''GNULIB_MBSCHR''@/$(GL_GNULIB_MBSCHR)/g' \ + -e 's/@''GNULIB_MBSRCHR''@/$(GL_GNULIB_MBSRCHR)/g' \ + -e 's/@''GNULIB_MBSSTR''@/$(GL_GNULIB_MBSSTR)/g' \ + -e 's/@''GNULIB_MBSCASECMP''@/$(GL_GNULIB_MBSCASECMP)/g' \ + -e 's/@''GNULIB_MBSNCASECMP''@/$(GL_GNULIB_MBSNCASECMP)/g' \ + -e 's/@''GNULIB_MBSPCASECMP''@/$(GL_GNULIB_MBSPCASECMP)/g' \ + -e 's/@''GNULIB_MBSCASESTR''@/$(GL_GNULIB_MBSCASESTR)/g' \ + -e 's/@''GNULIB_MBSCSPN''@/$(GL_GNULIB_MBSCSPN)/g' \ + -e 's/@''GNULIB_MBSPBRK''@/$(GL_GNULIB_MBSPBRK)/g' \ + -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \ + -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \ + -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \ + -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \ + -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ + -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \ + -e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \ + -e 's/@''GNULIB_RAWMEMCHR''@/$(GL_GNULIB_RAWMEMCHR)/g' \ + -e 's/@''GNULIB_STPCPY''@/$(GL_GNULIB_STPCPY)/g' \ + -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \ + -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \ + -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \ + -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \ + -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \ + -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \ + -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \ + -e 's/@''GNULIB_STRSEP''@/$(GL_GNULIB_STRSEP)/g' \ + -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \ + -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \ + -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \ + -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ + -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ + -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ + -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ + -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \ + -e 's/@''GNULIB_STRSIGNAL''@/$(GL_GNULIB_STRSIGNAL)/g' \ + -e 's/@''GNULIB_STRVERSCMP''@/$(GL_GNULIB_STRVERSCMP)/g' \ + -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GL_GNULIB_MDA_MEMCCPY)/g' \ + -e 's/@''GNULIB_MDA_STRDUP''@/$(GL_GNULIB_MDA_STRDUP)/g' \ + < $(srcdir)/string.in.h | \ + sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ + -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ + -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ + -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ + -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ + -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ + -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ + -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ + -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ + -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ + -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ + -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ + -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ + -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ + -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ + -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ + -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ + -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ + -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \ + -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \ + -e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \ + -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ + -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ + -e 's|@''REPLACE_FFSLL''@|$(REPLACE_FFSLL)|g' \ + -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ + -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ + -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ + -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ + -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ + -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ + -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ + -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ + < $(srcdir)/string.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += string.h string.h-t + +EXTRA_DIST += string.in.h + +## end gnulib module string + +## begin gnulib module sys_stat + +BUILT_SOURCES += sys/stat.h + +# We need the following in order to create when the system +# has one that is incomplete. +sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ + -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ + -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ + -e 's/@''GNULIB_FCHMODAT''@/$(GL_GNULIB_FCHMODAT)/g' \ + -e 's/@''GNULIB_FSTAT''@/$(GL_GNULIB_FSTAT)/g' \ + -e 's/@''GNULIB_FSTATAT''@/$(GL_GNULIB_FSTATAT)/g' \ + -e 's/@''GNULIB_FUTIMENS''@/$(GL_GNULIB_FUTIMENS)/g' \ + -e 's/@''GNULIB_GETUMASK''@/$(GL_GNULIB_GETUMASK)/g' \ + -e 's/@''GNULIB_LCHMOD''@/$(GL_GNULIB_LCHMOD)/g' \ + -e 's/@''GNULIB_LSTAT''@/$(GL_GNULIB_LSTAT)/g' \ + -e 's/@''GNULIB_MKDIR''@/$(GL_GNULIB_MKDIR)/g' \ + -e 's/@''GNULIB_MKDIRAT''@/$(GL_GNULIB_MKDIRAT)/g' \ + -e 's/@''GNULIB_MKFIFO''@/$(GL_GNULIB_MKFIFO)/g' \ + -e 's/@''GNULIB_MKFIFOAT''@/$(GL_GNULIB_MKFIFOAT)/g' \ + -e 's/@''GNULIB_MKNOD''@/$(GL_GNULIB_MKNOD)/g' \ + -e 's/@''GNULIB_MKNODAT''@/$(GL_GNULIB_MKNODAT)/g' \ + -e 's/@''GNULIB_STAT''@/$(GL_GNULIB_STAT)/g' \ + -e 's/@''GNULIB_UTIMENSAT''@/$(GL_GNULIB_UTIMENSAT)/g' \ + -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GL_GNULIB_OVERRIDES_STRUCT_STAT)/g' \ + -e 's/@''GNULIB_MDA_CHMOD''@/$(GL_GNULIB_MDA_CHMOD)/g' \ + -e 's/@''GNULIB_MDA_MKDIR''@/$(GL_GNULIB_MDA_MKDIR)/g' \ + -e 's/@''GNULIB_MDA_UMASK''@/$(GL_GNULIB_MDA_UMASK)/g' \ + -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ + -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ + -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ + -e 's|@''HAVE_GETUMASK''@|$(HAVE_GETUMASK)|g' \ + -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ + -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ + -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ + -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ + -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ + -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ + -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ + -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ + -e 's|@''REPLACE_FCHMODAT''@|$(REPLACE_FCHMODAT)|g' \ + -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ + -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ + -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ + -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ + -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ + -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ + -e 's|@''REPLACE_MKFIFOAT''@|$(REPLACE_MKFIFOAT)|g' \ + -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ + -e 's|@''REPLACE_MKNODAT''@|$(REPLACE_MKNODAT)|g' \ + -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ + -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/sys_stat.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t +MOSTLYCLEANDIRS += sys + +EXTRA_DIST += sys_stat.in.h + +## end gnulib module sys_stat + +## begin gnulib module sys_types + +BUILT_SOURCES += sys/types.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +sys/types.h: sys_types.in.h $(top_builddir)/config.status + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ + -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ + < $(srcdir)/sys_types.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += sys/types.h sys/types.h-t + +EXTRA_DIST += sys_types.in.h + +## end gnulib module sys_types + +## begin gnulib module thread-optim + + +EXTRA_DIST += thread-optim.h + +## end gnulib module thread-optim + +## begin gnulib module threadlib + +libgnu_la_SOURCES += glthread/threadlib.c + +## end gnulib module threadlib + +## begin gnulib module time + +BUILT_SOURCES += time.h + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ + -e 's/@''GNULIB_CTIME''@/$(GL_GNULIB_CTIME)/g' \ + -e 's/@''GNULIB_LOCALTIME''@/$(GL_GNULIB_LOCALTIME)/g' \ + -e 's/@''GNULIB_MKTIME''@/$(GL_GNULIB_MKTIME)/g' \ + -e 's/@''GNULIB_NANOSLEEP''@/$(GL_GNULIB_NANOSLEEP)/g' \ + -e 's/@''GNULIB_STRFTIME''@/$(GL_GNULIB_STRFTIME)/g' \ + -e 's/@''GNULIB_STRPTIME''@/$(GL_GNULIB_STRPTIME)/g' \ + -e 's/@''GNULIB_TIMEGM''@/$(GL_GNULIB_TIMEGM)/g' \ + -e 's/@''GNULIB_TIMESPEC_GET''@/$(GL_GNULIB_TIMESPEC_GET)/g' \ + -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \ + -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \ + -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \ + -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \ + -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ + -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ + -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ + -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ + -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \ + -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ + -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ + -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ + -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ + -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ + -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ + -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ + -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ + -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ + -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ + -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''TIME_H_DEFINES_TIME_UTC''@|$(TIME_H_DEFINES_TIME_UTC)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/time.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += time.h time.h-t + +EXTRA_DIST += time.in.h + +## end gnulib module time + +## begin gnulib module unistd + +BUILT_SOURCES += unistd.h +libgnu_la_SOURCES += unistd.c + +# We need the following in order to create an empty placeholder for +# when the system doesn't have one. +unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ + -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's/@''GNULIB_ACCESS''@/$(GL_GNULIB_ACCESS)/g' \ + -e 's/@''GNULIB_CHDIR''@/$(GL_GNULIB_CHDIR)/g' \ + -e 's/@''GNULIB_CHOWN''@/$(GL_GNULIB_CHOWN)/g' \ + -e 's/@''GNULIB_CLOSE''@/$(GL_GNULIB_CLOSE)/g' \ + -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GL_GNULIB_COPY_FILE_RANGE)/g' \ + -e 's/@''GNULIB_DUP''@/$(GL_GNULIB_DUP)/g' \ + -e 's/@''GNULIB_DUP2''@/$(GL_GNULIB_DUP2)/g' \ + -e 's/@''GNULIB_DUP3''@/$(GL_GNULIB_DUP3)/g' \ + -e 's/@''GNULIB_ENVIRON''@/$(GL_GNULIB_ENVIRON)/g' \ + -e 's/@''GNULIB_EUIDACCESS''@/$(GL_GNULIB_EUIDACCESS)/g' \ + -e 's/@''GNULIB_EXECL''@/$(GL_GNULIB_EXECL)/g' \ + -e 's/@''GNULIB_EXECLE''@/$(GL_GNULIB_EXECLE)/g' \ + -e 's/@''GNULIB_EXECLP''@/$(GL_GNULIB_EXECLP)/g' \ + -e 's/@''GNULIB_EXECV''@/$(GL_GNULIB_EXECV)/g' \ + -e 's/@''GNULIB_EXECVE''@/$(GL_GNULIB_EXECVE)/g' \ + -e 's/@''GNULIB_EXECVP''@/$(GL_GNULIB_EXECVP)/g' \ + -e 's/@''GNULIB_EXECVPE''@/$(GL_GNULIB_EXECVPE)/g' \ + -e 's/@''GNULIB_FACCESSAT''@/$(GL_GNULIB_FACCESSAT)/g' \ + -e 's/@''GNULIB_FCHDIR''@/$(GL_GNULIB_FCHDIR)/g' \ + -e 's/@''GNULIB_FCHOWNAT''@/$(GL_GNULIB_FCHOWNAT)/g' \ + -e 's/@''GNULIB_FDATASYNC''@/$(GL_GNULIB_FDATASYNC)/g' \ + -e 's/@''GNULIB_FSYNC''@/$(GL_GNULIB_FSYNC)/g' \ + -e 's/@''GNULIB_FTRUNCATE''@/$(GL_GNULIB_FTRUNCATE)/g' \ + -e 's/@''GNULIB_GETCWD''@/$(GL_GNULIB_GETCWD)/g' \ + -e 's/@''GNULIB_GETDOMAINNAME''@/$(GL_GNULIB_GETDOMAINNAME)/g' \ + -e 's/@''GNULIB_GETDTABLESIZE''@/$(GL_GNULIB_GETDTABLESIZE)/g' \ + -e 's/@''GNULIB_GETENTROPY''@/$(GL_GNULIB_GETENTROPY)/g' \ + -e 's/@''GNULIB_GETGROUPS''@/$(GL_GNULIB_GETGROUPS)/g' \ + -e 's/@''GNULIB_GETHOSTNAME''@/$(GL_GNULIB_GETHOSTNAME)/g' \ + -e 's/@''GNULIB_GETLOGIN''@/$(GL_GNULIB_GETLOGIN)/g' \ + -e 's/@''GNULIB_GETLOGIN_R''@/$(GL_GNULIB_GETLOGIN_R)/g' \ + -e 's/@''GNULIB_GETOPT_POSIX''@/$(GL_GNULIB_GETOPT_POSIX)/g' \ + -e 's/@''GNULIB_GETPAGESIZE''@/$(GL_GNULIB_GETPAGESIZE)/g' \ + -e 's/@''GNULIB_GETPASS''@/$(GL_GNULIB_GETPASS)/g' \ + -e 's/@''GNULIB_GETUSERSHELL''@/$(GL_GNULIB_GETUSERSHELL)/g' \ + -e 's/@''GNULIB_GROUP_MEMBER''@/$(GL_GNULIB_GROUP_MEMBER)/g' \ + -e 's/@''GNULIB_ISATTY''@/$(GL_GNULIB_ISATTY)/g' \ + -e 's/@''GNULIB_LCHOWN''@/$(GL_GNULIB_LCHOWN)/g' \ + -e 's/@''GNULIB_LINK''@/$(GL_GNULIB_LINK)/g' \ + -e 's/@''GNULIB_LINKAT''@/$(GL_GNULIB_LINKAT)/g' \ + -e 's/@''GNULIB_LSEEK''@/$(GL_GNULIB_LSEEK)/g' \ + -e 's/@''GNULIB_PIPE''@/$(GL_GNULIB_PIPE)/g' \ + -e 's/@''GNULIB_PIPE2''@/$(GL_GNULIB_PIPE2)/g' \ + -e 's/@''GNULIB_PREAD''@/$(GL_GNULIB_PREAD)/g' \ + -e 's/@''GNULIB_PWRITE''@/$(GL_GNULIB_PWRITE)/g' \ + -e 's/@''GNULIB_READ''@/$(GL_GNULIB_READ)/g' \ + -e 's/@''GNULIB_READLINK''@/$(GL_GNULIB_READLINK)/g' \ + -e 's/@''GNULIB_READLINKAT''@/$(GL_GNULIB_READLINKAT)/g' \ + -e 's/@''GNULIB_RMDIR''@/$(GL_GNULIB_RMDIR)/g' \ + -e 's/@''GNULIB_SETHOSTNAME''@/$(GL_GNULIB_SETHOSTNAME)/g' \ + -e 's/@''GNULIB_SLEEP''@/$(GL_GNULIB_SLEEP)/g' \ + -e 's/@''GNULIB_SYMLINK''@/$(GL_GNULIB_SYMLINK)/g' \ + -e 's/@''GNULIB_SYMLINKAT''@/$(GL_GNULIB_SYMLINKAT)/g' \ + -e 's/@''GNULIB_TRUNCATE''@/$(GL_GNULIB_TRUNCATE)/g' \ + -e 's/@''GNULIB_TTYNAME_R''@/$(GL_GNULIB_TTYNAME_R)/g' \ + -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GL_GNULIB_GL_UNISTD_H_GETOPT)/g' \ + -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GL_GNULIB_UNISTD_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GL_GNULIB_UNISTD_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_UNLINK''@/$(GL_GNULIB_UNLINK)/g' \ + -e 's/@''GNULIB_UNLINKAT''@/$(GL_GNULIB_UNLINKAT)/g' \ + -e 's/@''GNULIB_USLEEP''@/$(GL_GNULIB_USLEEP)/g' \ + -e 's/@''GNULIB_WRITE''@/$(GL_GNULIB_WRITE)/g' \ + -e 's/@''GNULIB_MDA_ACCESS''@/$(GL_GNULIB_MDA_ACCESS)/g' \ + -e 's/@''GNULIB_MDA_CHDIR''@/$(GL_GNULIB_MDA_CHDIR)/g' \ + -e 's/@''GNULIB_MDA_CLOSE''@/$(GL_GNULIB_MDA_CLOSE)/g' \ + -e 's/@''GNULIB_MDA_DUP''@/$(GL_GNULIB_MDA_DUP)/g' \ + -e 's/@''GNULIB_MDA_DUP2''@/$(GL_GNULIB_MDA_DUP2)/g' \ + -e 's/@''GNULIB_MDA_EXECL''@/$(GL_GNULIB_MDA_EXECL)/g' \ + -e 's/@''GNULIB_MDA_EXECLE''@/$(GL_GNULIB_MDA_EXECLE)/g' \ + -e 's/@''GNULIB_MDA_EXECLP''@/$(GL_GNULIB_MDA_EXECLP)/g' \ + -e 's/@''GNULIB_MDA_EXECV''@/$(GL_GNULIB_MDA_EXECV)/g' \ + -e 's/@''GNULIB_MDA_EXECVE''@/$(GL_GNULIB_MDA_EXECVE)/g' \ + -e 's/@''GNULIB_MDA_EXECVP''@/$(GL_GNULIB_MDA_EXECVP)/g' \ + -e 's/@''GNULIB_MDA_EXECVPE''@/$(GL_GNULIB_MDA_EXECVPE)/g' \ + -e 's/@''GNULIB_MDA_GETCWD''@/$(GL_GNULIB_MDA_GETCWD)/g' \ + -e 's/@''GNULIB_MDA_GETPID''@/$(GL_GNULIB_MDA_GETPID)/g' \ + -e 's/@''GNULIB_MDA_ISATTY''@/$(GL_GNULIB_MDA_ISATTY)/g' \ + -e 's/@''GNULIB_MDA_LSEEK''@/$(GL_GNULIB_MDA_LSEEK)/g' \ + -e 's/@''GNULIB_MDA_READ''@/$(GL_GNULIB_MDA_READ)/g' \ + -e 's/@''GNULIB_MDA_RMDIR''@/$(GL_GNULIB_MDA_RMDIR)/g' \ + -e 's/@''GNULIB_MDA_SWAB''@/$(GL_GNULIB_MDA_SWAB)/g' \ + -e 's/@''GNULIB_MDA_UNLINK''@/$(GL_GNULIB_MDA_UNLINK)/g' \ + -e 's/@''GNULIB_MDA_WRITE''@/$(GL_GNULIB_MDA_WRITE)/g' \ + < $(srcdir)/unistd.in.h | \ + sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ + -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ + -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ + -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ + -e 's|@''HAVE_EXECVPE''@|$(HAVE_EXECVPE)|g' \ + -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ + -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ + -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ + -e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \ + -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ + -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ + -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ + -e 's|@''HAVE_GETENTROPY''@|$(HAVE_GETENTROPY)|g' \ + -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ + -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ + -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GETPASS''@|$(HAVE_GETPASS)|g' \ + -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ + -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ + -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ + -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ + -e 's|@''HAVE_PIPE''@|$(HAVE_PIPE)|g' \ + -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ + -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ + -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ + -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ + -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ + -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \ + -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ + -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ + -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ + -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ + -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ + -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ + -e 's|@''HAVE_DECL_EXECVPE''@|$(HAVE_DECL_EXECVPE)|g' \ + -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ + -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ + -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ + -e 's|@''HAVE_DECL_GETLOGIN''@|$(HAVE_DECL_GETLOGIN)|g' \ + -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ + -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ + -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ + -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \ + -e 's|@''HAVE_DECL_TRUNCATE''@|$(HAVE_DECL_TRUNCATE)|g' \ + -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ + -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ + -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ + | \ + sed -e 's|@''REPLACE_ACCESS''@|$(REPLACE_ACCESS)|g' \ + -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ + -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ + -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ + -e 's|@''REPLACE_EXECL''@|$(REPLACE_EXECL)|g' \ + -e 's|@''REPLACE_EXECLE''@|$(REPLACE_EXECLE)|g' \ + -e 's|@''REPLACE_EXECLP''@|$(REPLACE_EXECLP)|g' \ + -e 's|@''REPLACE_EXECV''@|$(REPLACE_EXECV)|g' \ + -e 's|@''REPLACE_EXECVE''@|$(REPLACE_EXECVE)|g' \ + -e 's|@''REPLACE_EXECVP''@|$(REPLACE_EXECVP)|g' \ + -e 's|@''REPLACE_EXECVPE''@|$(REPLACE_EXECVPE)|g' \ + -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ + -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ + -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ + -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ + -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ + -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ + -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ + -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ + -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \ + -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \ + -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ + -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ + -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ + -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ + -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ + -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ + -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ + -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ + -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \ + -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ + -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ + -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ + -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ + -e 's|@''REPLACE_TRUNCATE''@|$(REPLACE_TRUNCATE)|g' \ + -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ + -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ + -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ + -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \ + -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ + -e 's|@''UNISTD_H_HAVE_SYS_RANDOM_H''@|$(UNISTD_H_HAVE_SYS_RANDOM_H)|g' \ + -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ + -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += unistd.h unistd.h-t + +EXTRA_DIST += unistd.in.h + +## end gnulib module unistd + +## begin gnulib module verify + + +EXTRA_DIST += verify.h + +## end gnulib module verify + +## begin gnulib module windows-mutex + + +EXTRA_DIST += windows-initguard.h windows-mutex.c windows-mutex.h + +EXTRA_libgnu_la_SOURCES += windows-mutex.c + +## end gnulib module windows-mutex + +## begin gnulib module windows-once + + +EXTRA_DIST += windows-once.c windows-once.h + +EXTRA_libgnu_la_SOURCES += windows-once.c + +## end gnulib module windows-once + +## begin gnulib module windows-recmutex + + +EXTRA_DIST += windows-initguard.h windows-recmutex.c windows-recmutex.h + +EXTRA_libgnu_la_SOURCES += windows-recmutex.c + +## end gnulib module windows-recmutex + +## begin gnulib module windows-rwlock + + +EXTRA_DIST += windows-initguard.h windows-rwlock.c windows-rwlock.h + +EXTRA_libgnu_la_SOURCES += windows-rwlock.c + +## end gnulib module windows-rwlock + +## begin gnulib module windows-spin + + +EXTRA_DIST += windows-spin.c windows-spin.h + +EXTRA_libgnu_la_SOURCES += windows-spin.c + +## end gnulib module windows-spin + +## begin gnulib module xalloc-oversized + + +EXTRA_DIST += xalloc-oversized.h + +## end gnulib module xalloc-oversized + +## begin gnulib module xsize + +libgnu_la_SOURCES += xsize.h xsize.c + +## end gnulib module xsize + + +mostlyclean-local: mostlyclean-generic + @for dir in '' $(MOSTLYCLEANDIRS); do \ + if test -n "$$dir" && test -d $$dir; then \ + echo "rmdir $$dir"; rmdir $$dir; \ + fi; \ + done; \ + : diff --git a/gnulib-lib/Makefile.in b/gnulib-lib/Makefile.in new file mode 100644 index 0000000..a93d9d5 --- /dev/null +++ b/gnulib-lib/Makefile.in @@ -0,0 +1,2413 @@ +# Makefile.in generated by automake 1.16.3 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2020 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +# Copyright (C) 2002-2021 Free Software Foundation, Inc. +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This file 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 file. If not, see . +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. +# Reproduce by: +# gnulib-tool --import \ +# --lib=libgnu \ +# --source-base=gnulib-lib \ +# --m4-base=gnulib-m4 \ +# --doc-base=doc \ +# --tests-base=tests \ +# --aux-dir=build-aux \ +# --no-conditional-dependencies \ +# --libtool \ +# --macro-prefix=gl \ +# ansi-c++-opt \ +# clean-temp-simple \ +# host-cpu-c-abi \ +# lock \ +# nocrash \ +# stdint \ +# stdnoreturn + + + +VPATH = @srcdir@ +am__is_gnu_make = { \ + if test -z '$(MAKELEVEL)'; then \ + false; \ + elif test -n '$(MAKE_HOST)'; then \ + true; \ + elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ + true; \ + else \ + false; \ + fi; \ +} +am__make_running_with_option = \ + case $${target_option-} in \ + ?) ;; \ + *) echo "am__make_running_with_option: internal error: invalid" \ + "target option '$${target_option-}' specified" >&2; \ + exit 1;; \ + esac; \ + has_opt=no; \ + sane_makeflags=$$MAKEFLAGS; \ + if $(am__is_gnu_make); then \ + sane_makeflags=$$MFLAGS; \ + else \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + bs=\\; \ + sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ + | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ + esac; \ + fi; \ + skip_next=no; \ + strip_trailopt () \ + { \ + flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ + }; \ + for flg in $$sane_makeflags; do \ + test $$skip_next = yes && { skip_next=no; continue; }; \ + case $$flg in \ + *=*|--*) continue;; \ + -*I) strip_trailopt 'I'; skip_next=yes;; \ + -*I?*) strip_trailopt 'I';; \ + -*O) strip_trailopt 'O'; skip_next=yes;; \ + -*O?*) strip_trailopt 'O';; \ + -*l) strip_trailopt 'l'; skip_next=yes;; \ + -*l?*) strip_trailopt 'l';; \ + -[dEDm]) skip_next=yes;; \ + -[JT]) skip_next=yes;; \ + esac; \ + case $$flg in \ + *$$target_option*) has_opt=yes; break;; \ + esac; \ + done; \ + test $$has_opt = yes +am__make_dryrun = (target_option=n; $(am__make_running_with_option)) +am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = gnulib-lib +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/gnulib-m4/00gnulib.m4 \ + $(top_srcdir)/gnulib-m4/absolute-header.m4 \ + $(top_srcdir)/gnulib-m4/alloca.m4 \ + $(top_srcdir)/gnulib-m4/ansi-c++.m4 \ + $(top_srcdir)/gnulib-m4/asm-underscore.m4 \ + $(top_srcdir)/gnulib-m4/close.m4 \ + $(top_srcdir)/gnulib-m4/double-slash-root.m4 \ + $(top_srcdir)/gnulib-m4/dup2.m4 \ + $(top_srcdir)/gnulib-m4/eealloc.m4 \ + $(top_srcdir)/gnulib-m4/errno_h.m4 \ + $(top_srcdir)/gnulib-m4/error.m4 \ + $(top_srcdir)/gnulib-m4/extensions.m4 \ + $(top_srcdir)/gnulib-m4/extern-inline.m4 \ + $(top_srcdir)/gnulib-m4/fatal-signal.m4 \ + $(top_srcdir)/gnulib-m4/fcntl-o.m4 \ + $(top_srcdir)/gnulib-m4/fcntl.m4 \ + $(top_srcdir)/gnulib-m4/fcntl_h.m4 \ + $(top_srcdir)/gnulib-m4/fstat.m4 \ + $(top_srcdir)/gnulib-m4/getdtablesize.m4 \ + $(top_srcdir)/gnulib-m4/getprogname.m4 \ + $(top_srcdir)/gnulib-m4/gnulib-common.m4 \ + $(top_srcdir)/gnulib-m4/gnulib-comp.m4 \ + $(top_srcdir)/gnulib-m4/host-cpu-c-abi.m4 \ + $(top_srcdir)/gnulib-m4/include_next.m4 \ + $(top_srcdir)/gnulib-m4/largefile.m4 \ + $(top_srcdir)/gnulib-m4/limits-h.m4 \ + $(top_srcdir)/gnulib-m4/lock.m4 \ + $(top_srcdir)/gnulib-m4/malloca.m4 \ + $(top_srcdir)/gnulib-m4/mode_t.m4 \ + $(top_srcdir)/gnulib-m4/msvc-inval.m4 \ + $(top_srcdir)/gnulib-m4/msvc-nothrow.m4 \ + $(top_srcdir)/gnulib-m4/multiarch.m4 \ + $(top_srcdir)/gnulib-m4/nocrash.m4 \ + $(top_srcdir)/gnulib-m4/off_t.m4 \ + $(top_srcdir)/gnulib-m4/open-cloexec.m4 \ + $(top_srcdir)/gnulib-m4/open-slash.m4 \ + $(top_srcdir)/gnulib-m4/open.m4 \ + $(top_srcdir)/gnulib-m4/pathmax.m4 \ + $(top_srcdir)/gnulib-m4/pthread_rwlock_rdlock.m4 \ + $(top_srcdir)/gnulib-m4/raise.m4 \ + $(top_srcdir)/gnulib-m4/rmdir.m4 \ + $(top_srcdir)/gnulib-m4/sig_atomic_t.m4 \ + $(top_srcdir)/gnulib-m4/sigaction.m4 \ + $(top_srcdir)/gnulib-m4/signal_h.m4 \ + $(top_srcdir)/gnulib-m4/signalblocking.m4 \ + $(top_srcdir)/gnulib-m4/size_max.m4 \ + $(top_srcdir)/gnulib-m4/sparcv8+.m4 \ + $(top_srcdir)/gnulib-m4/ssize_t.m4 \ + $(top_srcdir)/gnulib-m4/stat-time.m4 \ + $(top_srcdir)/gnulib-m4/stat.m4 \ + $(top_srcdir)/gnulib-m4/stdbool.m4 \ + $(top_srcdir)/gnulib-m4/stddef_h.m4 \ + $(top_srcdir)/gnulib-m4/stdint.m4 \ + $(top_srcdir)/gnulib-m4/stdio_h.m4 \ + $(top_srcdir)/gnulib-m4/stdnoreturn.m4 \ + $(top_srcdir)/gnulib-m4/strerror.m4 \ + $(top_srcdir)/gnulib-m4/string_h.m4 \ + $(top_srcdir)/gnulib-m4/sys_socket_h.m4 \ + $(top_srcdir)/gnulib-m4/sys_stat_h.m4 \ + $(top_srcdir)/gnulib-m4/sys_types_h.m4 \ + $(top_srcdir)/gnulib-m4/threadlib.m4 \ + $(top_srcdir)/gnulib-m4/time_h.m4 \ + $(top_srcdir)/gnulib-m4/unistd_h.m4 \ + $(top_srcdir)/gnulib-m4/warn-on-use.m4 \ + $(top_srcdir)/gnulib-m4/wchar_t.m4 \ + $(top_srcdir)/gnulib-m4/wint_t.m4 \ + $(top_srcdir)/gnulib-m4/xsize.m4 \ + $(top_srcdir)/gnulib-m4/zzgnulib.m4 \ + $(top_srcdir)/m4/as-underscore.m4 $(top_srcdir)/m4/cc-gcc.m4 \ + $(top_srcdir)/m4/codeexec.m4 $(top_srcdir)/m4/endianness.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ln.m4 \ + $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ + $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ + $(top_srcdir)/m4/mmap-anon.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ + $(am__DIST_COMMON) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/config.h \ + $(top_builddir)/ffcall-version.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +am__dirstamp = $(am__leading_dot)dirstamp +am_libgnu_la_OBJECTS = asyncsafe-spin.lo basename-lgpl.lo \ + clean-temp-simple.lo cloexec.lo fatal-signal.lo fd-hook.lo \ + getprogname.lo gl_linkedhash_list.lo gl_list.lo \ + glthread/lock.lo malloca.lo sig-handler.lo stat-time.lo \ + glthread/threadlib.lo unistd.lo xsize.lo +libgnu_la_OBJECTS = $(am_libgnu_la_OBJECTS) +AM_V_lt = $(am__v_lt_@AM_V@) +am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) +am__v_lt_0 = --silent +am__v_lt_1 = +libgnu_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libgnu_la_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_P = $(am__v_P_@AM_V@) +am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) +am__v_P_0 = false +am__v_P_1 = : +AM_V_GEN = $(am__v_GEN_@AM_V@) +am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) +am__v_GEN_0 = @echo " GEN " $@; +am__v_GEN_1 = +AM_V_at = $(am__v_at_@AM_V@) +am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) +am__v_at_0 = @ +am__v_at_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp +am__maybe_remake_depfiles = depfiles +am__depfiles_remade = ./$(DEPDIR)/asyncsafe-spin.Plo \ + ./$(DEPDIR)/basename-lgpl.Plo \ + ./$(DEPDIR)/clean-temp-simple.Plo ./$(DEPDIR)/cloexec.Plo \ + ./$(DEPDIR)/close.Plo ./$(DEPDIR)/dup2.Plo \ + ./$(DEPDIR)/error.Plo ./$(DEPDIR)/fatal-signal.Plo \ + ./$(DEPDIR)/fcntl.Plo ./$(DEPDIR)/fd-hook.Plo \ + ./$(DEPDIR)/fstat.Plo ./$(DEPDIR)/getdtablesize.Plo \ + ./$(DEPDIR)/getprogname.Plo ./$(DEPDIR)/gl_linkedhash_list.Plo \ + ./$(DEPDIR)/gl_list.Plo ./$(DEPDIR)/malloca.Plo \ + ./$(DEPDIR)/msvc-inval.Plo ./$(DEPDIR)/msvc-nothrow.Plo \ + ./$(DEPDIR)/open.Plo ./$(DEPDIR)/raise.Plo \ + ./$(DEPDIR)/rmdir.Plo ./$(DEPDIR)/sig-handler.Plo \ + ./$(DEPDIR)/sigaction.Plo ./$(DEPDIR)/sigprocmask.Plo \ + ./$(DEPDIR)/stat-time.Plo ./$(DEPDIR)/stat-w32.Plo \ + ./$(DEPDIR)/stat.Plo ./$(DEPDIR)/strerror-override.Plo \ + ./$(DEPDIR)/strerror.Plo ./$(DEPDIR)/unistd.Plo \ + ./$(DEPDIR)/windows-mutex.Plo ./$(DEPDIR)/windows-once.Plo \ + ./$(DEPDIR)/windows-recmutex.Plo \ + ./$(DEPDIR)/windows-rwlock.Plo ./$(DEPDIR)/windows-spin.Plo \ + ./$(DEPDIR)/xsize.Plo glthread/$(DEPDIR)/lock.Plo \ + glthread/$(DEPDIR)/threadlib.Plo +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_@AM_V@) +am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) +am__v_CC_0 = @echo " CC " $@; +am__v_CC_1 = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_@AM_V@) +am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) +am__v_CCLD_0 = @echo " CCLD " $@; +am__v_CCLD_1 = +SOURCES = $(libgnu_la_SOURCES) $(EXTRA_libgnu_la_SOURCES) +DIST_SOURCES = $(libgnu_la_SOURCES) $(EXTRA_libgnu_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ + ctags-recursive dvi-recursive html-recursive info-recursive \ + install-data-recursive install-dvi-recursive \ + install-exec-recursive install-html-recursive \ + install-info-recursive install-pdf-recursive \ + install-ps-recursive install-recursive installcheck-recursive \ + installdirs-recursive pdf-recursive ps-recursive \ + tags-recursive uninstall-recursive +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +HEADERS = $(noinst_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +am__recursive_targets = \ + $(RECURSIVE_TARGETS) \ + $(RECURSIVE_CLEAN_TARGETS) \ + $(am__extra_recursive_targets) +AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ + distdir distdir-am +am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) +# Read a list of newline-separated strings from the standard input, +# and print each of them once, without duplicates. Input order is +# *not* preserved. +am__uniquify_input = $(AWK) '\ + BEGIN { nonempty = 0; } \ + { items[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in items) print i; }; } \ +' +# Make sure the list of sources is unique. This is necessary because, +# e.g., the same source file might be shared among _SOURCES variables +# for different programs/libraries. +am__define_uniq_tagged_files = \ + list='$(am__tagged_files)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | $(am__uniquify_input)` +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +am__DIST_COMMON = $(srcdir)/Makefile.in \ + $(top_srcdir)/build-aux/depcomp +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +ALLOCA_H = @ALLOCA_H@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@ +AR = @AR@ +ARFLAGS = @ARFLAGS@ +AS = @AS@ +ASM_SYMBOL_PREFIX = @ASM_SYMBOL_PREFIX@ +AS_UNDERSCORE = @AS_UNDERSCORE@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BITSIZEOF_PTRDIFF_T = @BITSIZEOF_PTRDIFF_T@ +BITSIZEOF_SIG_ATOMIC_T = @BITSIZEOF_SIG_ATOMIC_T@ +BITSIZEOF_SIZE_T = @BITSIZEOF_SIZE_T@ +BITSIZEOF_WCHAR_T = @BITSIZEOF_WCHAR_T@ +BITSIZEOF_WINT_T = @BITSIZEOF_WINT_T@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CC_GCC = @CC_GCC@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPU_OBJECTS = @CPU_OBJECTS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CXX_CHOICE = @CXX_CHOICE@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DISABLE_TYPE_BASED_ALIASING = @DISABLE_TYPE_BASED_ALIASING@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@ +EMULTIHOP_VALUE = @EMULTIHOP_VALUE@ +ENDIANNESS = @ENDIANNESS@ +ENOLINK_HIDDEN = @ENOLINK_HIDDEN@ +ENOLINK_VALUE = @ENOLINK_VALUE@ +EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@ +EOVERFLOW_VALUE = @EOVERFLOW_VALUE@ +ERRNO_H = @ERRNO_H@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GCC_X_NONE = @GCC_X_NONE@ +GL_GNULIB_ACCESS = @GL_GNULIB_ACCESS@ +GL_GNULIB_CHDIR = @GL_GNULIB_CHDIR@ +GL_GNULIB_CHOWN = @GL_GNULIB_CHOWN@ +GL_GNULIB_CLOSE = @GL_GNULIB_CLOSE@ +GL_GNULIB_COPY_FILE_RANGE = @GL_GNULIB_COPY_FILE_RANGE@ +GL_GNULIB_CREAT = @GL_GNULIB_CREAT@ +GL_GNULIB_CTIME = @GL_GNULIB_CTIME@ +GL_GNULIB_DPRINTF = @GL_GNULIB_DPRINTF@ +GL_GNULIB_DUP = @GL_GNULIB_DUP@ +GL_GNULIB_DUP2 = @GL_GNULIB_DUP2@ +GL_GNULIB_DUP3 = @GL_GNULIB_DUP3@ +GL_GNULIB_ENVIRON = @GL_GNULIB_ENVIRON@ +GL_GNULIB_EUIDACCESS = @GL_GNULIB_EUIDACCESS@ +GL_GNULIB_EXECL = @GL_GNULIB_EXECL@ +GL_GNULIB_EXECLE = @GL_GNULIB_EXECLE@ +GL_GNULIB_EXECLP = @GL_GNULIB_EXECLP@ +GL_GNULIB_EXECV = @GL_GNULIB_EXECV@ +GL_GNULIB_EXECVE = @GL_GNULIB_EXECVE@ +GL_GNULIB_EXECVP = @GL_GNULIB_EXECVP@ +GL_GNULIB_EXECVPE = @GL_GNULIB_EXECVPE@ +GL_GNULIB_EXPLICIT_BZERO = @GL_GNULIB_EXPLICIT_BZERO@ +GL_GNULIB_FACCESSAT = @GL_GNULIB_FACCESSAT@ +GL_GNULIB_FCHDIR = @GL_GNULIB_FCHDIR@ +GL_GNULIB_FCHMODAT = @GL_GNULIB_FCHMODAT@ +GL_GNULIB_FCHOWNAT = @GL_GNULIB_FCHOWNAT@ +GL_GNULIB_FCLOSE = @GL_GNULIB_FCLOSE@ +GL_GNULIB_FCNTL = @GL_GNULIB_FCNTL@ +GL_GNULIB_FDATASYNC = @GL_GNULIB_FDATASYNC@ +GL_GNULIB_FDOPEN = @GL_GNULIB_FDOPEN@ +GL_GNULIB_FFLUSH = @GL_GNULIB_FFLUSH@ +GL_GNULIB_FFSL = @GL_GNULIB_FFSL@ +GL_GNULIB_FFSLL = @GL_GNULIB_FFSLL@ +GL_GNULIB_FGETC = @GL_GNULIB_FGETC@ +GL_GNULIB_FGETS = @GL_GNULIB_FGETS@ +GL_GNULIB_FOPEN = @GL_GNULIB_FOPEN@ +GL_GNULIB_FPRINTF = @GL_GNULIB_FPRINTF@ +GL_GNULIB_FPRINTF_POSIX = @GL_GNULIB_FPRINTF_POSIX@ +GL_GNULIB_FPURGE = @GL_GNULIB_FPURGE@ +GL_GNULIB_FPUTC = @GL_GNULIB_FPUTC@ +GL_GNULIB_FPUTS = @GL_GNULIB_FPUTS@ +GL_GNULIB_FREAD = @GL_GNULIB_FREAD@ +GL_GNULIB_FREOPEN = @GL_GNULIB_FREOPEN@ +GL_GNULIB_FSCANF = @GL_GNULIB_FSCANF@ +GL_GNULIB_FSEEK = @GL_GNULIB_FSEEK@ +GL_GNULIB_FSEEKO = @GL_GNULIB_FSEEKO@ +GL_GNULIB_FSTAT = @GL_GNULIB_FSTAT@ +GL_GNULIB_FSTATAT = @GL_GNULIB_FSTATAT@ +GL_GNULIB_FSYNC = @GL_GNULIB_FSYNC@ +GL_GNULIB_FTELL = @GL_GNULIB_FTELL@ +GL_GNULIB_FTELLO = @GL_GNULIB_FTELLO@ +GL_GNULIB_FTRUNCATE = @GL_GNULIB_FTRUNCATE@ +GL_GNULIB_FUTIMENS = @GL_GNULIB_FUTIMENS@ +GL_GNULIB_FWRITE = @GL_GNULIB_FWRITE@ +GL_GNULIB_GETC = @GL_GNULIB_GETC@ +GL_GNULIB_GETCHAR = @GL_GNULIB_GETCHAR@ +GL_GNULIB_GETCWD = @GL_GNULIB_GETCWD@ +GL_GNULIB_GETDELIM = @GL_GNULIB_GETDELIM@ +GL_GNULIB_GETDOMAINNAME = @GL_GNULIB_GETDOMAINNAME@ +GL_GNULIB_GETDTABLESIZE = @GL_GNULIB_GETDTABLESIZE@ +GL_GNULIB_GETENTROPY = @GL_GNULIB_GETENTROPY@ +GL_GNULIB_GETGROUPS = @GL_GNULIB_GETGROUPS@ +GL_GNULIB_GETHOSTNAME = @GL_GNULIB_GETHOSTNAME@ +GL_GNULIB_GETLINE = @GL_GNULIB_GETLINE@ +GL_GNULIB_GETLOGIN = @GL_GNULIB_GETLOGIN@ +GL_GNULIB_GETLOGIN_R = @GL_GNULIB_GETLOGIN_R@ +GL_GNULIB_GETOPT_POSIX = @GL_GNULIB_GETOPT_POSIX@ +GL_GNULIB_GETPAGESIZE = @GL_GNULIB_GETPAGESIZE@ +GL_GNULIB_GETPASS = @GL_GNULIB_GETPASS@ +GL_GNULIB_GETUMASK = @GL_GNULIB_GETUMASK@ +GL_GNULIB_GETUSERSHELL = @GL_GNULIB_GETUSERSHELL@ +GL_GNULIB_GROUP_MEMBER = @GL_GNULIB_GROUP_MEMBER@ +GL_GNULIB_ISATTY = @GL_GNULIB_ISATTY@ +GL_GNULIB_LCHMOD = @GL_GNULIB_LCHMOD@ +GL_GNULIB_LCHOWN = @GL_GNULIB_LCHOWN@ +GL_GNULIB_LINK = @GL_GNULIB_LINK@ +GL_GNULIB_LINKAT = @GL_GNULIB_LINKAT@ +GL_GNULIB_LOCALTIME = @GL_GNULIB_LOCALTIME@ +GL_GNULIB_LSEEK = @GL_GNULIB_LSEEK@ +GL_GNULIB_LSTAT = @GL_GNULIB_LSTAT@ +GL_GNULIB_MBSCASECMP = @GL_GNULIB_MBSCASECMP@ +GL_GNULIB_MBSCASESTR = @GL_GNULIB_MBSCASESTR@ +GL_GNULIB_MBSCHR = @GL_GNULIB_MBSCHR@ +GL_GNULIB_MBSCSPN = @GL_GNULIB_MBSCSPN@ +GL_GNULIB_MBSLEN = @GL_GNULIB_MBSLEN@ +GL_GNULIB_MBSNCASECMP = @GL_GNULIB_MBSNCASECMP@ +GL_GNULIB_MBSNLEN = @GL_GNULIB_MBSNLEN@ +GL_GNULIB_MBSPBRK = @GL_GNULIB_MBSPBRK@ +GL_GNULIB_MBSPCASECMP = @GL_GNULIB_MBSPCASECMP@ +GL_GNULIB_MBSRCHR = @GL_GNULIB_MBSRCHR@ +GL_GNULIB_MBSSEP = @GL_GNULIB_MBSSEP@ +GL_GNULIB_MBSSPN = @GL_GNULIB_MBSSPN@ +GL_GNULIB_MBSSTR = @GL_GNULIB_MBSSTR@ +GL_GNULIB_MBSTOK_R = @GL_GNULIB_MBSTOK_R@ +GL_GNULIB_MDA_ACCESS = @GL_GNULIB_MDA_ACCESS@ +GL_GNULIB_MDA_CHDIR = @GL_GNULIB_MDA_CHDIR@ +GL_GNULIB_MDA_CHMOD = @GL_GNULIB_MDA_CHMOD@ +GL_GNULIB_MDA_CLOSE = @GL_GNULIB_MDA_CLOSE@ +GL_GNULIB_MDA_CREAT = @GL_GNULIB_MDA_CREAT@ +GL_GNULIB_MDA_DUP = @GL_GNULIB_MDA_DUP@ +GL_GNULIB_MDA_DUP2 = @GL_GNULIB_MDA_DUP2@ +GL_GNULIB_MDA_EXECL = @GL_GNULIB_MDA_EXECL@ +GL_GNULIB_MDA_EXECLE = @GL_GNULIB_MDA_EXECLE@ +GL_GNULIB_MDA_EXECLP = @GL_GNULIB_MDA_EXECLP@ +GL_GNULIB_MDA_EXECV = @GL_GNULIB_MDA_EXECV@ +GL_GNULIB_MDA_EXECVE = @GL_GNULIB_MDA_EXECVE@ +GL_GNULIB_MDA_EXECVP = @GL_GNULIB_MDA_EXECVP@ +GL_GNULIB_MDA_EXECVPE = @GL_GNULIB_MDA_EXECVPE@ +GL_GNULIB_MDA_FCLOSEALL = @GL_GNULIB_MDA_FCLOSEALL@ +GL_GNULIB_MDA_FDOPEN = @GL_GNULIB_MDA_FDOPEN@ +GL_GNULIB_MDA_FILENO = @GL_GNULIB_MDA_FILENO@ +GL_GNULIB_MDA_GETCWD = @GL_GNULIB_MDA_GETCWD@ +GL_GNULIB_MDA_GETPID = @GL_GNULIB_MDA_GETPID@ +GL_GNULIB_MDA_GETW = @GL_GNULIB_MDA_GETW@ +GL_GNULIB_MDA_ISATTY = @GL_GNULIB_MDA_ISATTY@ +GL_GNULIB_MDA_LSEEK = @GL_GNULIB_MDA_LSEEK@ +GL_GNULIB_MDA_MEMCCPY = @GL_GNULIB_MDA_MEMCCPY@ +GL_GNULIB_MDA_MKDIR = @GL_GNULIB_MDA_MKDIR@ +GL_GNULIB_MDA_OPEN = @GL_GNULIB_MDA_OPEN@ +GL_GNULIB_MDA_PUTW = @GL_GNULIB_MDA_PUTW@ +GL_GNULIB_MDA_READ = @GL_GNULIB_MDA_READ@ +GL_GNULIB_MDA_RMDIR = @GL_GNULIB_MDA_RMDIR@ +GL_GNULIB_MDA_STRDUP = @GL_GNULIB_MDA_STRDUP@ +GL_GNULIB_MDA_SWAB = @GL_GNULIB_MDA_SWAB@ +GL_GNULIB_MDA_TEMPNAM = @GL_GNULIB_MDA_TEMPNAM@ +GL_GNULIB_MDA_TZSET = @GL_GNULIB_MDA_TZSET@ +GL_GNULIB_MDA_UMASK = @GL_GNULIB_MDA_UMASK@ +GL_GNULIB_MDA_UNLINK = @GL_GNULIB_MDA_UNLINK@ +GL_GNULIB_MDA_WRITE = @GL_GNULIB_MDA_WRITE@ +GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@ +GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@ +GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@ +GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@ +GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@ +GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@ +GL_GNULIB_MKFIFO = @GL_GNULIB_MKFIFO@ +GL_GNULIB_MKFIFOAT = @GL_GNULIB_MKFIFOAT@ +GL_GNULIB_MKNOD = @GL_GNULIB_MKNOD@ +GL_GNULIB_MKNODAT = @GL_GNULIB_MKNODAT@ +GL_GNULIB_MKTIME = @GL_GNULIB_MKTIME@ +GL_GNULIB_NANOSLEEP = @GL_GNULIB_NANOSLEEP@ +GL_GNULIB_NONBLOCKING = @GL_GNULIB_NONBLOCKING@ +GL_GNULIB_OBSTACK_PRINTF = @GL_GNULIB_OBSTACK_PRINTF@ +GL_GNULIB_OBSTACK_PRINTF_POSIX = @GL_GNULIB_OBSTACK_PRINTF_POSIX@ +GL_GNULIB_OPEN = @GL_GNULIB_OPEN@ +GL_GNULIB_OPENAT = @GL_GNULIB_OPENAT@ +GL_GNULIB_OVERRIDES_STRUCT_STAT = @GL_GNULIB_OVERRIDES_STRUCT_STAT@ +GL_GNULIB_PCLOSE = @GL_GNULIB_PCLOSE@ +GL_GNULIB_PERROR = @GL_GNULIB_PERROR@ +GL_GNULIB_PIPE = @GL_GNULIB_PIPE@ +GL_GNULIB_PIPE2 = @GL_GNULIB_PIPE2@ +GL_GNULIB_POPEN = @GL_GNULIB_POPEN@ +GL_GNULIB_PREAD = @GL_GNULIB_PREAD@ +GL_GNULIB_PRINTF = @GL_GNULIB_PRINTF@ +GL_GNULIB_PRINTF_POSIX = @GL_GNULIB_PRINTF_POSIX@ +GL_GNULIB_PTHREAD_SIGMASK = @GL_GNULIB_PTHREAD_SIGMASK@ +GL_GNULIB_PUTC = @GL_GNULIB_PUTC@ +GL_GNULIB_PUTCHAR = @GL_GNULIB_PUTCHAR@ +GL_GNULIB_PUTS = @GL_GNULIB_PUTS@ +GL_GNULIB_PWRITE = @GL_GNULIB_PWRITE@ +GL_GNULIB_RAISE = @GL_GNULIB_RAISE@ +GL_GNULIB_RAWMEMCHR = @GL_GNULIB_RAWMEMCHR@ +GL_GNULIB_READ = @GL_GNULIB_READ@ +GL_GNULIB_READLINK = @GL_GNULIB_READLINK@ +GL_GNULIB_READLINKAT = @GL_GNULIB_READLINKAT@ +GL_GNULIB_REMOVE = @GL_GNULIB_REMOVE@ +GL_GNULIB_RENAME = @GL_GNULIB_RENAME@ +GL_GNULIB_RENAMEAT = @GL_GNULIB_RENAMEAT@ +GL_GNULIB_RMDIR = @GL_GNULIB_RMDIR@ +GL_GNULIB_SCANF = @GL_GNULIB_SCANF@ +GL_GNULIB_SETHOSTNAME = @GL_GNULIB_SETHOSTNAME@ +GL_GNULIB_SIGABBREV_NP = @GL_GNULIB_SIGABBREV_NP@ +GL_GNULIB_SIGACTION = @GL_GNULIB_SIGACTION@ +GL_GNULIB_SIGDESCR_NP = @GL_GNULIB_SIGDESCR_NP@ +GL_GNULIB_SIGNAL_H_SIGPIPE = @GL_GNULIB_SIGNAL_H_SIGPIPE@ +GL_GNULIB_SIGPROCMASK = @GL_GNULIB_SIGPROCMASK@ +GL_GNULIB_SLEEP = @GL_GNULIB_SLEEP@ +GL_GNULIB_SNPRINTF = @GL_GNULIB_SNPRINTF@ +GL_GNULIB_SPRINTF_POSIX = @GL_GNULIB_SPRINTF_POSIX@ +GL_GNULIB_STAT = @GL_GNULIB_STAT@ +GL_GNULIB_STDIO_H_NONBLOCKING = @GL_GNULIB_STDIO_H_NONBLOCKING@ +GL_GNULIB_STDIO_H_SIGPIPE = @GL_GNULIB_STDIO_H_SIGPIPE@ +GL_GNULIB_STPCPY = @GL_GNULIB_STPCPY@ +GL_GNULIB_STPNCPY = @GL_GNULIB_STPNCPY@ +GL_GNULIB_STRCASESTR = @GL_GNULIB_STRCASESTR@ +GL_GNULIB_STRCHRNUL = @GL_GNULIB_STRCHRNUL@ +GL_GNULIB_STRDUP = @GL_GNULIB_STRDUP@ +GL_GNULIB_STRERROR = @GL_GNULIB_STRERROR@ +GL_GNULIB_STRERRORNAME_NP = @GL_GNULIB_STRERRORNAME_NP@ +GL_GNULIB_STRERROR_R = @GL_GNULIB_STRERROR_R@ +GL_GNULIB_STRFTIME = @GL_GNULIB_STRFTIME@ +GL_GNULIB_STRNCAT = @GL_GNULIB_STRNCAT@ +GL_GNULIB_STRNDUP = @GL_GNULIB_STRNDUP@ +GL_GNULIB_STRNLEN = @GL_GNULIB_STRNLEN@ +GL_GNULIB_STRPBRK = @GL_GNULIB_STRPBRK@ +GL_GNULIB_STRPTIME = @GL_GNULIB_STRPTIME@ +GL_GNULIB_STRSEP = @GL_GNULIB_STRSEP@ +GL_GNULIB_STRSIGNAL = @GL_GNULIB_STRSIGNAL@ +GL_GNULIB_STRSTR = @GL_GNULIB_STRSTR@ +GL_GNULIB_STRTOK_R = @GL_GNULIB_STRTOK_R@ +GL_GNULIB_STRVERSCMP = @GL_GNULIB_STRVERSCMP@ +GL_GNULIB_SYMLINK = @GL_GNULIB_SYMLINK@ +GL_GNULIB_SYMLINKAT = @GL_GNULIB_SYMLINKAT@ +GL_GNULIB_TIMEGM = @GL_GNULIB_TIMEGM@ +GL_GNULIB_TIMESPEC_GET = @GL_GNULIB_TIMESPEC_GET@ +GL_GNULIB_TIME_R = @GL_GNULIB_TIME_R@ +GL_GNULIB_TIME_RZ = @GL_GNULIB_TIME_RZ@ +GL_GNULIB_TMPFILE = @GL_GNULIB_TMPFILE@ +GL_GNULIB_TRUNCATE = @GL_GNULIB_TRUNCATE@ +GL_GNULIB_TTYNAME_R = @GL_GNULIB_TTYNAME_R@ +GL_GNULIB_TZSET = @GL_GNULIB_TZSET@ +GL_GNULIB_UNISTD_H_NONBLOCKING = @GL_GNULIB_UNISTD_H_NONBLOCKING@ +GL_GNULIB_UNISTD_H_SIGPIPE = @GL_GNULIB_UNISTD_H_SIGPIPE@ +GL_GNULIB_UNLINK = @GL_GNULIB_UNLINK@ +GL_GNULIB_UNLINKAT = @GL_GNULIB_UNLINKAT@ +GL_GNULIB_USLEEP = @GL_GNULIB_USLEEP@ +GL_GNULIB_UTIMENSAT = @GL_GNULIB_UTIMENSAT@ +GL_GNULIB_VASPRINTF = @GL_GNULIB_VASPRINTF@ +GL_GNULIB_VDPRINTF = @GL_GNULIB_VDPRINTF@ +GL_GNULIB_VFPRINTF = @GL_GNULIB_VFPRINTF@ +GL_GNULIB_VFPRINTF_POSIX = @GL_GNULIB_VFPRINTF_POSIX@ +GL_GNULIB_VFSCANF = @GL_GNULIB_VFSCANF@ +GL_GNULIB_VPRINTF = @GL_GNULIB_VPRINTF@ +GL_GNULIB_VPRINTF_POSIX = @GL_GNULIB_VPRINTF_POSIX@ +GL_GNULIB_VSCANF = @GL_GNULIB_VSCANF@ +GL_GNULIB_VSNPRINTF = @GL_GNULIB_VSNPRINTF@ +GL_GNULIB_VSPRINTF_POSIX = @GL_GNULIB_VSPRINTF_POSIX@ +GL_GNULIB_WRITE = @GL_GNULIB_WRITE@ +GNULIBHEADERS_OVERRIDE_WINT_T = @GNULIBHEADERS_OVERRIDE_WINT_T@ +GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@ +GREP = @GREP@ +HAVE_ALLOCA_H = @HAVE_ALLOCA_H@ +HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@ +HAVE_CHOWN = @HAVE_CHOWN@ +HAVE_COPY_FILE_RANGE = @HAVE_COPY_FILE_RANGE@ +HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@ +HAVE_DECL_EXECVPE = @HAVE_DECL_EXECVPE@ +HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@ +HAVE_DECL_FCLOSEALL = @HAVE_DECL_FCLOSEALL@ +HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@ +HAVE_DECL_FPURGE = @HAVE_DECL_FPURGE@ +HAVE_DECL_FSEEKO = @HAVE_DECL_FSEEKO@ +HAVE_DECL_FTELLO = @HAVE_DECL_FTELLO@ +HAVE_DECL_GETDELIM = @HAVE_DECL_GETDELIM@ +HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@ +HAVE_DECL_GETLINE = @HAVE_DECL_GETLINE@ +HAVE_DECL_GETLOGIN = @HAVE_DECL_GETLOGIN@ +HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@ +HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@ +HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@ +HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@ +HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@ +HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@ +HAVE_DECL_OBSTACK_PRINTF = @HAVE_DECL_OBSTACK_PRINTF@ +HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@ +HAVE_DECL_SNPRINTF = @HAVE_DECL_SNPRINTF@ +HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@ +HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@ +HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@ +HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@ +HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@ +HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@ +HAVE_DECL_TRUNCATE = @HAVE_DECL_TRUNCATE@ +HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@ +HAVE_DECL_VSNPRINTF = @HAVE_DECL_VSNPRINTF@ +HAVE_DPRINTF = @HAVE_DPRINTF@ +HAVE_DUP3 = @HAVE_DUP3@ +HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ +HAVE_EXECVPE = @HAVE_EXECVPE@ +HAVE_EXPLICIT_BZERO = @HAVE_EXPLICIT_BZERO@ +HAVE_FACCESSAT = @HAVE_FACCESSAT@ +HAVE_FCHDIR = @HAVE_FCHDIR@ +HAVE_FCHMODAT = @HAVE_FCHMODAT@ +HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ +HAVE_FCNTL = @HAVE_FCNTL@ +HAVE_FDATASYNC = @HAVE_FDATASYNC@ +HAVE_FFSL = @HAVE_FFSL@ +HAVE_FFSLL = @HAVE_FFSLL@ +HAVE_FSEEKO = @HAVE_FSEEKO@ +HAVE_FSTATAT = @HAVE_FSTATAT@ +HAVE_FSYNC = @HAVE_FSYNC@ +HAVE_FTELLO = @HAVE_FTELLO@ +HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_FUTIMENS = @HAVE_FUTIMENS@ +HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ +HAVE_GETENTROPY = @HAVE_GETENTROPY@ +HAVE_GETGROUPS = @HAVE_GETGROUPS@ +HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ +HAVE_GETLOGIN = @HAVE_GETLOGIN@ +HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@ +HAVE_GETPASS = @HAVE_GETPASS@ +HAVE_GETUMASK = @HAVE_GETUMASK@ +HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@ +HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_LCHMOD = @HAVE_LCHMOD@ +HAVE_LCHOWN = @HAVE_LCHOWN@ +HAVE_LINK = @HAVE_LINK@ +HAVE_LINKAT = @HAVE_LINKAT@ +HAVE_LSTAT = @HAVE_LSTAT@ +HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@ +HAVE_MBSLEN = @HAVE_MBSLEN@ +HAVE_MEMPCPY = @HAVE_MEMPCPY@ +HAVE_MKDIRAT = @HAVE_MKDIRAT@ +HAVE_MKFIFO = @HAVE_MKFIFO@ +HAVE_MKFIFOAT = @HAVE_MKFIFOAT@ +HAVE_MKNOD = @HAVE_MKNOD@ +HAVE_MKNODAT = @HAVE_MKNODAT@ +HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@ +HAVE_NANOSLEEP = @HAVE_NANOSLEEP@ +HAVE_OPENAT = @HAVE_OPENAT@ +HAVE_OS_H = @HAVE_OS_H@ +HAVE_PCLOSE = @HAVE_PCLOSE@ +HAVE_PIPE = @HAVE_PIPE@ +HAVE_PIPE2 = @HAVE_PIPE2@ +HAVE_POPEN = @HAVE_POPEN@ +HAVE_POSIX_SIGNALBLOCKING = @HAVE_POSIX_SIGNALBLOCKING@ +HAVE_PREAD = @HAVE_PREAD@ +HAVE_PTHREAD_SIGMASK = @HAVE_PTHREAD_SIGMASK@ +HAVE_PWRITE = @HAVE_PWRITE@ +HAVE_RAISE = @HAVE_RAISE@ +HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@ +HAVE_READLINK = @HAVE_READLINK@ +HAVE_READLINKAT = @HAVE_READLINKAT@ +HAVE_RENAMEAT = @HAVE_RENAMEAT@ +HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@ +HAVE_SIGABBREV_NP = @HAVE_SIGABBREV_NP@ +HAVE_SIGACTION = @HAVE_SIGACTION@ +HAVE_SIGDESCR_NP = @HAVE_SIGDESCR_NP@ +HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@ +HAVE_SIGINFO_T = @HAVE_SIGINFO_T@ +HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@ +HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@ +HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@ +HAVE_SIGSET_T = @HAVE_SIGSET_T@ +HAVE_SLEEP = @HAVE_SLEEP@ +HAVE_STDINT_H = @HAVE_STDINT_H@ +HAVE_STPCPY = @HAVE_STPCPY@ +HAVE_STPNCPY = @HAVE_STPNCPY@ +HAVE_STRCASESTR = @HAVE_STRCASESTR@ +HAVE_STRCHRNUL = @HAVE_STRCHRNUL@ +HAVE_STRERRORNAME_NP = @HAVE_STRERRORNAME_NP@ +HAVE_STRPBRK = @HAVE_STRPBRK@ +HAVE_STRPTIME = @HAVE_STRPTIME@ +HAVE_STRSEP = @HAVE_STRSEP@ +HAVE_STRUCT_SIGACTION_SA_SIGACTION = @HAVE_STRUCT_SIGACTION_SA_SIGACTION@ +HAVE_STRVERSCMP = @HAVE_STRVERSCMP@ +HAVE_SYMLINK = @HAVE_SYMLINK@ +HAVE_SYMLINKAT = @HAVE_SYMLINKAT@ +HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@ +HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@ +HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@ +HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@ +HAVE_TIMEGM = @HAVE_TIMEGM@ +HAVE_TIMESPEC_GET = @HAVE_TIMESPEC_GET@ +HAVE_TIMEZONE_T = @HAVE_TIMEZONE_T@ +HAVE_TYPE_VOLATILE_SIG_ATOMIC_T = @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ +HAVE_UNISTD_H = @HAVE_UNISTD_H@ +HAVE_UNLINKAT = @HAVE_UNLINKAT@ +HAVE_USLEEP = @HAVE_USLEEP@ +HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ +HAVE_VASPRINTF = @HAVE_VASPRINTF@ +HAVE_VDPRINTF = @HAVE_VDPRINTF@ +HAVE_WCHAR_H = @HAVE_WCHAR_H@ +HAVE_WCHAR_T = @HAVE_WCHAR_T@ +HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@ +HAVE__BOOL = @HAVE__BOOL@ +HOST_CPU = @HOST_CPU@ +HOST_CPU_C_ABI = @HOST_CPU_C_ABI@ +IFNOT_MSVC = @IFNOT_MSVC@ +IF_CXX = @IF_CXX@ +IF_MSVC = @IF_MSVC@ +INCLUDE_NEXT = @INCLUDE_NEXT@ +INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBINTL = @LIBINTL@ +LIBMULTITHREAD = @LIBMULTITHREAD@ +LIBOBJS = @LIBOBJS@ +LIBPMULTITHREAD = @LIBPMULTITHREAD@ +LIBPTHREAD = @LIBPTHREAD@ +LIBS = @LIBS@ +LIBSTDTHREAD = @LIBSTDTHREAD@ +LIBTHREAD = @LIBTHREAD@ +LIBTOOL = @LIBTOOL@ +LIB_SCHED_YIELD = @LIB_SCHED_YIELD@ +LIMITS_H = @LIMITS_H@ +LIPO = @LIPO@ +LN = @LN@ +LN_S = @LN_S@ +LTLIBINTL = @LTLIBINTL@ +LTLIBMULTITHREAD = @LTLIBMULTITHREAD@ +LTLIBOBJS = @LTLIBOBJS@ +LTLIBTHREAD = @LTLIBTHREAD@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@ +NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@ +NEXT_AS_FIRST_DIRECTIVE_LIMITS_H = @NEXT_AS_FIRST_DIRECTIVE_LIMITS_H@ +NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H = @NEXT_AS_FIRST_DIRECTIVE_SIGNAL_H@ +NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ +NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ +NEXT_AS_FIRST_DIRECTIVE_STDIO_H = @NEXT_AS_FIRST_DIRECTIVE_STDIO_H@ +NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@ +NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ +NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@ +NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ +NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ +NEXT_ERRNO_H = @NEXT_ERRNO_H@ +NEXT_FCNTL_H = @NEXT_FCNTL_H@ +NEXT_LIMITS_H = @NEXT_LIMITS_H@ +NEXT_SIGNAL_H = @NEXT_SIGNAL_H@ +NEXT_STDDEF_H = @NEXT_STDDEF_H@ +NEXT_STDINT_H = @NEXT_STDINT_H@ +NEXT_STDIO_H = @NEXT_STDIO_H@ +NEXT_STRING_H = @NEXT_STRING_H@ +NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ +NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@ +NEXT_TIME_H = @NEXT_TIME_H@ +NEXT_UNISTD_H = @NEXT_UNISTD_H@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PRAGMA_COLUMNS = @PRAGMA_COLUMNS@ +PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@ +PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ +PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@ +RANLIB = @RANLIB@ +REPLACE_ACCESS = @REPLACE_ACCESS@ +REPLACE_CHOWN = @REPLACE_CHOWN@ +REPLACE_CLOSE = @REPLACE_CLOSE@ +REPLACE_CREAT = @REPLACE_CREAT@ +REPLACE_CTIME = @REPLACE_CTIME@ +REPLACE_DPRINTF = @REPLACE_DPRINTF@ +REPLACE_DUP = @REPLACE_DUP@ +REPLACE_DUP2 = @REPLACE_DUP2@ +REPLACE_EXECL = @REPLACE_EXECL@ +REPLACE_EXECLE = @REPLACE_EXECLE@ +REPLACE_EXECLP = @REPLACE_EXECLP@ +REPLACE_EXECV = @REPLACE_EXECV@ +REPLACE_EXECVE = @REPLACE_EXECVE@ +REPLACE_EXECVP = @REPLACE_EXECVP@ +REPLACE_EXECVPE = @REPLACE_EXECVPE@ +REPLACE_FACCESSAT = @REPLACE_FACCESSAT@ +REPLACE_FCHMODAT = @REPLACE_FCHMODAT@ +REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ +REPLACE_FCLOSE = @REPLACE_FCLOSE@ +REPLACE_FCNTL = @REPLACE_FCNTL@ +REPLACE_FDOPEN = @REPLACE_FDOPEN@ +REPLACE_FFLUSH = @REPLACE_FFLUSH@ +REPLACE_FFSLL = @REPLACE_FFSLL@ +REPLACE_FOPEN = @REPLACE_FOPEN@ +REPLACE_FPRINTF = @REPLACE_FPRINTF@ +REPLACE_FPURGE = @REPLACE_FPURGE@ +REPLACE_FREOPEN = @REPLACE_FREOPEN@ +REPLACE_FSEEK = @REPLACE_FSEEK@ +REPLACE_FSEEKO = @REPLACE_FSEEKO@ +REPLACE_FSTAT = @REPLACE_FSTAT@ +REPLACE_FSTATAT = @REPLACE_FSTATAT@ +REPLACE_FTELL = @REPLACE_FTELL@ +REPLACE_FTELLO = @REPLACE_FTELLO@ +REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@ +REPLACE_FUTIMENS = @REPLACE_FUTIMENS@ +REPLACE_GETCWD = @REPLACE_GETCWD@ +REPLACE_GETDELIM = @REPLACE_GETDELIM@ +REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ +REPLACE_GETDTABLESIZE = @REPLACE_GETDTABLESIZE@ +REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ +REPLACE_GETLINE = @REPLACE_GETLINE@ +REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@ +REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@ +REPLACE_GETPASS = @REPLACE_GETPASS@ +REPLACE_GMTIME = @REPLACE_GMTIME@ +REPLACE_ISATTY = @REPLACE_ISATTY@ +REPLACE_LCHOWN = @REPLACE_LCHOWN@ +REPLACE_LINK = @REPLACE_LINK@ +REPLACE_LINKAT = @REPLACE_LINKAT@ +REPLACE_LOCALTIME = @REPLACE_LOCALTIME@ +REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ +REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_LSTAT = @REPLACE_LSTAT@ +REPLACE_MEMCHR = @REPLACE_MEMCHR@ +REPLACE_MEMMEM = @REPLACE_MEMMEM@ +REPLACE_MKDIR = @REPLACE_MKDIR@ +REPLACE_MKFIFO = @REPLACE_MKFIFO@ +REPLACE_MKFIFOAT = @REPLACE_MKFIFOAT@ +REPLACE_MKNOD = @REPLACE_MKNOD@ +REPLACE_MKNODAT = @REPLACE_MKNODAT@ +REPLACE_MKTIME = @REPLACE_MKTIME@ +REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ +REPLACE_NULL = @REPLACE_NULL@ +REPLACE_OBSTACK_PRINTF = @REPLACE_OBSTACK_PRINTF@ +REPLACE_OPEN = @REPLACE_OPEN@ +REPLACE_OPENAT = @REPLACE_OPENAT@ +REPLACE_PERROR = @REPLACE_PERROR@ +REPLACE_POPEN = @REPLACE_POPEN@ +REPLACE_PREAD = @REPLACE_PREAD@ +REPLACE_PRINTF = @REPLACE_PRINTF@ +REPLACE_PTHREAD_SIGMASK = @REPLACE_PTHREAD_SIGMASK@ +REPLACE_PWRITE = @REPLACE_PWRITE@ +REPLACE_RAISE = @REPLACE_RAISE@ +REPLACE_READ = @REPLACE_READ@ +REPLACE_READLINK = @REPLACE_READLINK@ +REPLACE_READLINKAT = @REPLACE_READLINKAT@ +REPLACE_REMOVE = @REPLACE_REMOVE@ +REPLACE_RENAME = @REPLACE_RENAME@ +REPLACE_RENAMEAT = @REPLACE_RENAMEAT@ +REPLACE_RMDIR = @REPLACE_RMDIR@ +REPLACE_SLEEP = @REPLACE_SLEEP@ +REPLACE_SNPRINTF = @REPLACE_SNPRINTF@ +REPLACE_SPRINTF = @REPLACE_SPRINTF@ +REPLACE_STAT = @REPLACE_STAT@ +REPLACE_STDIO_READ_FUNCS = @REPLACE_STDIO_READ_FUNCS@ +REPLACE_STDIO_WRITE_FUNCS = @REPLACE_STDIO_WRITE_FUNCS@ +REPLACE_STPNCPY = @REPLACE_STPNCPY@ +REPLACE_STRCASESTR = @REPLACE_STRCASESTR@ +REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@ +REPLACE_STRDUP = @REPLACE_STRDUP@ +REPLACE_STRERROR = @REPLACE_STRERROR@ +REPLACE_STRERRORNAME_NP = @REPLACE_STRERRORNAME_NP@ +REPLACE_STRERROR_R = @REPLACE_STRERROR_R@ +REPLACE_STRFTIME = @REPLACE_STRFTIME@ +REPLACE_STRNCAT = @REPLACE_STRNCAT@ +REPLACE_STRNDUP = @REPLACE_STRNDUP@ +REPLACE_STRNLEN = @REPLACE_STRNLEN@ +REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@ +REPLACE_STRSTR = @REPLACE_STRSTR@ +REPLACE_STRTOK_R = @REPLACE_STRTOK_R@ +REPLACE_SYMLINK = @REPLACE_SYMLINK@ +REPLACE_SYMLINKAT = @REPLACE_SYMLINKAT@ +REPLACE_TIMEGM = @REPLACE_TIMEGM@ +REPLACE_TMPFILE = @REPLACE_TMPFILE@ +REPLACE_TRUNCATE = @REPLACE_TRUNCATE@ +REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@ +REPLACE_TZSET = @REPLACE_TZSET@ +REPLACE_UNLINK = @REPLACE_UNLINK@ +REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ +REPLACE_USLEEP = @REPLACE_USLEEP@ +REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ +REPLACE_VASPRINTF = @REPLACE_VASPRINTF@ +REPLACE_VDPRINTF = @REPLACE_VDPRINTF@ +REPLACE_VFPRINTF = @REPLACE_VFPRINTF@ +REPLACE_VPRINTF = @REPLACE_VPRINTF@ +REPLACE_VSNPRINTF = @REPLACE_VSNPRINTF@ +REPLACE_VSPRINTF = @REPLACE_VSPRINTF@ +REPLACE_WRITE = @REPLACE_WRITE@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@ +SIZE_T_SUFFIX = @SIZE_T_SUFFIX@ +STDBOOL_H = @STDBOOL_H@ +STDDEF_H = @STDDEF_H@ +STDINT_H = @STDINT_H@ +STDNORETURN_H = @STDNORETURN_H@ +STRIP = @STRIP@ +SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ +TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@ +TIME_H_DEFINES_TIME_UTC = @TIME_H_DEFINES_TIME_UTC@ +UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@ +UNISTD_H_DEFINES_STRUCT_TIMESPEC = @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ +UNISTD_H_HAVE_SYS_RANDOM_H = @UNISTD_H_HAVE_SYS_RANDOM_H@ +UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@ +UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@ +VERSION = @VERSION@ +WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@ +WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ +WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ +WINDOWS_STAT_INODES = @WINDOWS_STAT_INODES@ +WINDOWS_STAT_TIMESPEC = @WINDOWS_STAT_TIMESPEC@ +WINT_T_SUFFIX = @WINT_T_SUFFIX@ +WORKAROUND_BUG_81653 = @WORKAROUND_BUG_81653@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +gl_LIBOBJS = @gl_LIBOBJS@ +gl_LTLIBOBJS = @gl_LTLIBOBJS@ +gltests_LIBOBJS = @gltests_LIBOBJS@ +gltests_LTLIBOBJS = @gltests_LTLIBOBJS@ +gltests_WITNESS = @gltests_WITNESS@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +runstatedir = @runstatedir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = 1.11 gnits subdir-objects +SUBDIRS = +noinst_HEADERS = +noinst_LIBRARIES = +noinst_LTLIBRARIES = libgnu.la +EXTRA_DIST = alloca.in.h asyncsafe-spin.h attribute.h basename-lgpl.h \ + clean-temp-private.h cloexec.h close.c dup2.c errno.in.h \ + error.c error.h fcntl.c fcntl.in.h fd-hook.h filename.h \ + fstat.c stat-w32.c stat-w32.h getdtablesize.c intprops.h \ + limits.in.h malloca.h msvc-inval.c msvc-inval.h msvc-nothrow.c \ + msvc-nothrow.h open.c pathmax.h raise.c rmdir.c sig-handler.h \ + sigaction.c signal.in.h sigprocmask.c _Noreturn.h \ + arg-nonnull.h c++defs.h warn-on-use.h stat-w32.c stat-w32.h \ + stat.c stat-time.h stdbool.in.h stddef.in.h stdint.in.h \ + stdio.in.h stdnoreturn.in.h strerror.c strerror-override.c \ + strerror-override.h string.in.h sys_stat.in.h sys_types.in.h \ + thread-optim.h time.in.h unistd.in.h verify.h \ + windows-initguard.h windows-mutex.c windows-mutex.h \ + windows-once.c windows-once.h windows-initguard.h \ + windows-recmutex.c windows-recmutex.h windows-initguard.h \ + windows-rwlock.c windows-rwlock.h windows-spin.c \ + windows-spin.h xalloc-oversized.h +BUILT_SOURCES = $(ALLOCA_H) $(ERRNO_H) fcntl.h $(LIMITS_H) signal.h \ + $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h $(STDNORETURN_H) \ + string.h sys/stat.h sys/types.h time.h unistd.h +SUFFIXES = +MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t errno.h \ + errno.h-t fcntl.h fcntl.h-t limits.h limits.h-t signal.h \ + signal.h-t stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h \ + stdint.h-t stdio.h stdio.h-t stdnoreturn.h stdnoreturn.h-t \ + string.h string.h-t sys/stat.h sys/stat.h-t sys/types.h \ + sys/types.h-t time.h time.h-t unistd.h unistd.h-t +MOSTLYCLEANDIRS = sys +CLEANFILES = +DISTCLEANFILES = +MAINTAINERCLEANFILES = +# No GNU Make output. +AM_CPPFLAGS = +AM_CFLAGS = +libgnu_la_SOURCES = asyncsafe-spin.c basename-lgpl.c \ + clean-temp-simple.h clean-temp-simple.c cloexec.c \ + fatal-signal.h fatal-signal.c fd-hook.c getprogname.h \ + getprogname.c gettext.h idx.h gl_linkedhash_list.h \ + gl_linkedhash_list.c gl_anyhash1.h gl_anyhash2.h \ + gl_anyhash_primes.h gl_anylinked_list1.h gl_anylinked_list2.h \ + gl_list.h gl_list.c glthread/lock.h glthread/lock.c malloca.c \ + sig-handler.c size_max.h stat-time.c glthread/threadlib.c \ + unistd.c xsize.h xsize.c +libgnu_la_LIBADD = $(gl_LTLIBOBJS) +libgnu_la_DEPENDENCIES = $(gl_LTLIBOBJS) +EXTRA_libgnu_la_SOURCES = close.c dup2.c error.c fcntl.c fstat.c \ + stat-w32.c getdtablesize.c msvc-inval.c msvc-nothrow.c open.c \ + raise.c rmdir.c sigaction.c sigprocmask.c stat-w32.c stat.c \ + strerror.c strerror-override.c windows-mutex.c windows-once.c \ + windows-recmutex.c windows-rwlock.c windows-spin.c +libgnu_la_LDFLAGS = $(AM_LDFLAGS) -no-undefined $(LIBTHREAD) \ + $(LTLIBINTL) + +# Use this preprocessor expression to decide whether #include_next works. +# Do not rely on a 'configure'-time test for this, since the expression +# might appear in an installed header, which is used by some other compiler. +HAVE_INCLUDE_NEXT = (__GNUC__ || __clang__ || 60000000 <= __DECC_VER) + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +_NORETURN_H = $(srcdir)/_Noreturn.h + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +ARG_NONNULL_H = $(srcdir)/arg-nonnull.h + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +CXXDEFS_H = $(srcdir)/c++defs.h + +# Because this Makefile snippet defines a variable used by other +# gnulib Makefile snippets, it must be present in all makefiles that +# need it. This is ensured by the applicability 'all' defined above. +WARN_ON_USE_H = $(srcdir)/warn-on-use.h +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnits gnulib-lib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnits gnulib-lib/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } +glthread/$(am__dirstamp): + @$(MKDIR_P) glthread + @: > glthread/$(am__dirstamp) +glthread/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) glthread/$(DEPDIR) + @: > glthread/$(DEPDIR)/$(am__dirstamp) +glthread/lock.lo: glthread/$(am__dirstamp) \ + glthread/$(DEPDIR)/$(am__dirstamp) +glthread/threadlib.lo: glthread/$(am__dirstamp) \ + glthread/$(DEPDIR)/$(am__dirstamp) + +libgnu.la: $(libgnu_la_OBJECTS) $(libgnu_la_DEPENDENCIES) $(EXTRA_libgnu_la_DEPENDENCIES) + $(AM_V_CCLD)$(libgnu_la_LINK) $(libgnu_la_OBJECTS) $(libgnu_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f glthread/*.$(OBJEXT) + -rm -f glthread/*.lo + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asyncsafe-spin.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/basename-lgpl.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clean-temp-simple.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cloexec.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/close.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup2.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fatal-signal.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcntl.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fd-hook.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fstat.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdtablesize.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getprogname.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_linkedhash_list.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gl_list.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/malloca.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msvc-inval.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msvc-nothrow.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/raise.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rmdir.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sig-handler.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigaction.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigprocmask.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-time.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat-w32.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror-override.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strerror.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unistd.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-mutex.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-once.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-recmutex.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-rwlock.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/windows-spin.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsize.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/lock.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@glthread/$(DEPDIR)/threadlib.Plo@am__quote@ # am--include-marker + +$(am__depfiles_remade): + @$(MKDIR_P) $(@D) + @echo '# dummy' >$@-t && $(am__mv) $@-t $@ + +am--depfiles: $(am__depfiles_remade) + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf glthread/.libs glthread/_libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run 'make' without going through this Makefile. +# To change the values of 'make' variables: instead of editing Makefiles, +# (1) if the variable is set in 'config.status', edit 'config.status' +# (which will cause the Makefiles to be regenerated when you run 'make'); +# (2) otherwise, pass the desired values on the 'make' command line. +$(am__recursive_targets): + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +ID: $(am__tagged_files) + $(am__define_uniq_tagged_files); mkid -fID $$unique +tags: tags-recursive +TAGS: tags + +tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + $(am__define_uniq_tagged_files); \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: ctags-recursive + +CTAGS: ctags +ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) + $(am__define_uniq_tagged_files); \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: cscopelist-recursive + +cscopelist-am: $(am__tagged_files) + list='$(am__tagged_files)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) distdir-am + +distdir-am: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + $(am__make_dryrun) \ + || test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f glthread/$(DEPDIR)/$(am__dirstamp) + -rm -f glthread/$(am__dirstamp) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -f ./$(DEPDIR)/asyncsafe-spin.Plo + -rm -f ./$(DEPDIR)/basename-lgpl.Plo + -rm -f ./$(DEPDIR)/clean-temp-simple.Plo + -rm -f ./$(DEPDIR)/cloexec.Plo + -rm -f ./$(DEPDIR)/close.Plo + -rm -f ./$(DEPDIR)/dup2.Plo + -rm -f ./$(DEPDIR)/error.Plo + -rm -f ./$(DEPDIR)/fatal-signal.Plo + -rm -f ./$(DEPDIR)/fcntl.Plo + -rm -f ./$(DEPDIR)/fd-hook.Plo + -rm -f ./$(DEPDIR)/fstat.Plo + -rm -f ./$(DEPDIR)/getdtablesize.Plo + -rm -f ./$(DEPDIR)/getprogname.Plo + -rm -f ./$(DEPDIR)/gl_linkedhash_list.Plo + -rm -f ./$(DEPDIR)/gl_list.Plo + -rm -f ./$(DEPDIR)/malloca.Plo + -rm -f ./$(DEPDIR)/msvc-inval.Plo + -rm -f ./$(DEPDIR)/msvc-nothrow.Plo + -rm -f ./$(DEPDIR)/open.Plo + -rm -f ./$(DEPDIR)/raise.Plo + -rm -f ./$(DEPDIR)/rmdir.Plo + -rm -f ./$(DEPDIR)/sig-handler.Plo + -rm -f ./$(DEPDIR)/sigaction.Plo + -rm -f ./$(DEPDIR)/sigprocmask.Plo + -rm -f ./$(DEPDIR)/stat-time.Plo + -rm -f ./$(DEPDIR)/stat-w32.Plo + -rm -f ./$(DEPDIR)/stat.Plo + -rm -f ./$(DEPDIR)/strerror-override.Plo + -rm -f ./$(DEPDIR)/strerror.Plo + -rm -f ./$(DEPDIR)/unistd.Plo + -rm -f ./$(DEPDIR)/windows-mutex.Plo + -rm -f ./$(DEPDIR)/windows-once.Plo + -rm -f ./$(DEPDIR)/windows-recmutex.Plo + -rm -f ./$(DEPDIR)/windows-rwlock.Plo + -rm -f ./$(DEPDIR)/windows-spin.Plo + -rm -f ./$(DEPDIR)/xsize.Plo + -rm -f glthread/$(DEPDIR)/lock.Plo + -rm -f glthread/$(DEPDIR)/threadlib.Plo + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f ./$(DEPDIR)/asyncsafe-spin.Plo + -rm -f ./$(DEPDIR)/basename-lgpl.Plo + -rm -f ./$(DEPDIR)/clean-temp-simple.Plo + -rm -f ./$(DEPDIR)/cloexec.Plo + -rm -f ./$(DEPDIR)/close.Plo + -rm -f ./$(DEPDIR)/dup2.Plo + -rm -f ./$(DEPDIR)/error.Plo + -rm -f ./$(DEPDIR)/fatal-signal.Plo + -rm -f ./$(DEPDIR)/fcntl.Plo + -rm -f ./$(DEPDIR)/fd-hook.Plo + -rm -f ./$(DEPDIR)/fstat.Plo + -rm -f ./$(DEPDIR)/getdtablesize.Plo + -rm -f ./$(DEPDIR)/getprogname.Plo + -rm -f ./$(DEPDIR)/gl_linkedhash_list.Plo + -rm -f ./$(DEPDIR)/gl_list.Plo + -rm -f ./$(DEPDIR)/malloca.Plo + -rm -f ./$(DEPDIR)/msvc-inval.Plo + -rm -f ./$(DEPDIR)/msvc-nothrow.Plo + -rm -f ./$(DEPDIR)/open.Plo + -rm -f ./$(DEPDIR)/raise.Plo + -rm -f ./$(DEPDIR)/rmdir.Plo + -rm -f ./$(DEPDIR)/sig-handler.Plo + -rm -f ./$(DEPDIR)/sigaction.Plo + -rm -f ./$(DEPDIR)/sigprocmask.Plo + -rm -f ./$(DEPDIR)/stat-time.Plo + -rm -f ./$(DEPDIR)/stat-w32.Plo + -rm -f ./$(DEPDIR)/stat.Plo + -rm -f ./$(DEPDIR)/strerror-override.Plo + -rm -f ./$(DEPDIR)/strerror.Plo + -rm -f ./$(DEPDIR)/unistd.Plo + -rm -f ./$(DEPDIR)/windows-mutex.Plo + -rm -f ./$(DEPDIR)/windows-once.Plo + -rm -f ./$(DEPDIR)/windows-recmutex.Plo + -rm -f ./$(DEPDIR)/windows-rwlock.Plo + -rm -f ./$(DEPDIR)/windows-spin.Plo + -rm -f ./$(DEPDIR)/xsize.Plo + -rm -f glthread/$(DEPDIR)/lock.Plo + -rm -f glthread/$(DEPDIR)/threadlib.Plo + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool mostlyclean-local + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(am__recursive_targets) all check install install-am \ + install-exec install-strip + +.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ + am--depfiles check check-am clean clean-generic clean-libtool \ + clean-noinstLIBRARIES clean-noinstLTLIBRARIES cscopelist-am \ + ctags ctags-am distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-local pdf \ + pdf-am ps ps-am tags tags-am uninstall uninstall-am + +.PRECIOUS: Makefile + + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +@GL_GENERATE_ALLOCA_H_TRUE@alloca.h: alloca.in.h $(top_builddir)/config.status +@GL_GENERATE_ALLOCA_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_ALLOCA_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ +@GL_GENERATE_ALLOCA_H_TRUE@ sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < $(srcdir)/alloca.in.h; \ +@GL_GENERATE_ALLOCA_H_TRUE@ } > $@-t && \ +@GL_GENERATE_ALLOCA_H_TRUE@ mv -f $@-t $@ +@GL_GENERATE_ALLOCA_H_FALSE@alloca.h: $(top_builddir)/config.status +@GL_GENERATE_ALLOCA_H_FALSE@ rm -f $@ + +# We need the following in order to create when the system +# doesn't have one that is POSIX compliant. +@GL_GENERATE_ERRNO_H_TRUE@errno.h: errno.in.h $(top_builddir)/config.status +@GL_GENERATE_ERRNO_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_ERRNO_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ +@GL_GENERATE_ERRNO_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''NEXT_ERRNO_H''@|$(NEXT_ERRNO_H)|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''EMULTIHOP_HIDDEN''@|$(EMULTIHOP_HIDDEN)|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''EMULTIHOP_VALUE''@|$(EMULTIHOP_VALUE)|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''ENOLINK_HIDDEN''@|$(ENOLINK_HIDDEN)|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''ENOLINK_VALUE''@|$(ENOLINK_VALUE)|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''EOVERFLOW_HIDDEN''@|$(EOVERFLOW_HIDDEN)|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ -e 's|@''EOVERFLOW_VALUE''@|$(EOVERFLOW_VALUE)|g' \ +@GL_GENERATE_ERRNO_H_TRUE@ < $(srcdir)/errno.in.h; \ +@GL_GENERATE_ERRNO_H_TRUE@ } > $@-t && \ +@GL_GENERATE_ERRNO_H_TRUE@ mv $@-t $@ +@GL_GENERATE_ERRNO_H_FALSE@errno.h: $(top_builddir)/config.status +@GL_GENERATE_ERRNO_H_FALSE@ rm -f $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +fcntl.h: fcntl.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_FCNTL_H''@|$(NEXT_FCNTL_H)|g' \ + -e 's/@''GNULIB_CREAT''@/$(GL_GNULIB_CREAT)/g' \ + -e 's/@''GNULIB_FCNTL''@/$(GL_GNULIB_FCNTL)/g' \ + -e 's/@''GNULIB_NONBLOCKING''@/$(GL_GNULIB_NONBLOCKING)/g' \ + -e 's/@''GNULIB_OPEN''@/$(GL_GNULIB_OPEN)/g' \ + -e 's/@''GNULIB_OPENAT''@/$(GL_GNULIB_OPENAT)/g' \ + -e 's/@''GNULIB_MDA_CREAT''@/$(GL_GNULIB_MDA_CREAT)/g' \ + -e 's/@''GNULIB_MDA_OPEN''@/$(GL_GNULIB_MDA_OPEN)/g' \ + -e 's|@''HAVE_FCNTL''@|$(HAVE_FCNTL)|g' \ + -e 's|@''HAVE_OPENAT''@|$(HAVE_OPENAT)|g' \ + -e 's|@''REPLACE_CREAT''@|$(REPLACE_CREAT)|g' \ + -e 's|@''REPLACE_FCNTL''@|$(REPLACE_FCNTL)|g' \ + -e 's|@''REPLACE_OPEN''@|$(REPLACE_OPEN)|g' \ + -e 's|@''REPLACE_OPENAT''@|$(REPLACE_OPENAT)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/fcntl.in.h; \ + } > $@-t && \ + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that is compatible with GNU. +@GL_GENERATE_LIMITS_H_TRUE@limits.h: limits.in.h $(top_builddir)/config.status +@GL_GENERATE_LIMITS_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_LIMITS_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ +@GL_GENERATE_LIMITS_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ -e 's|@''NEXT_LIMITS_H''@|$(NEXT_LIMITS_H)|g' \ +@GL_GENERATE_LIMITS_H_TRUE@ < $(srcdir)/limits.in.h; \ +@GL_GENERATE_LIMITS_H_TRUE@ } > $@-t && \ +@GL_GENERATE_LIMITS_H_TRUE@ mv $@-t $@ +@GL_GENERATE_LIMITS_H_FALSE@limits.h: $(top_builddir)/config.status +@GL_GENERATE_LIMITS_H_FALSE@ rm -f $@ + +# We need the following in order to create when the system +# doesn't have a complete one. +signal.h: signal.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SIGNAL_H''@|$(NEXT_SIGNAL_H)|g' \ + -e 's/@''GNULIB_PTHREAD_SIGMASK''@/$(GL_GNULIB_PTHREAD_SIGMASK)/g' \ + -e 's/@''GNULIB_RAISE''@/$(GL_GNULIB_RAISE)/g' \ + -e 's/@''GNULIB_SIGNAL_H_SIGPIPE''@/$(GL_GNULIB_SIGNAL_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_SIGPROCMASK''@/$(GL_GNULIB_SIGPROCMASK)/g' \ + -e 's/@''GNULIB_SIGACTION''@/$(GL_GNULIB_SIGACTION)/g' \ + -e 's|@''HAVE_POSIX_SIGNALBLOCKING''@|$(HAVE_POSIX_SIGNALBLOCKING)|g' \ + -e 's|@''HAVE_PTHREAD_SIGMASK''@|$(HAVE_PTHREAD_SIGMASK)|g' \ + -e 's|@''HAVE_RAISE''@|$(HAVE_RAISE)|g' \ + -e 's|@''HAVE_SIGSET_T''@|$(HAVE_SIGSET_T)|g' \ + -e 's|@''HAVE_SIGINFO_T''@|$(HAVE_SIGINFO_T)|g' \ + -e 's|@''HAVE_SIGACTION''@|$(HAVE_SIGACTION)|g' \ + -e 's|@''HAVE_STRUCT_SIGACTION_SA_SIGACTION''@|$(HAVE_STRUCT_SIGACTION_SA_SIGACTION)|g' \ + -e 's|@''HAVE_TYPE_VOLATILE_SIG_ATOMIC_T''@|$(HAVE_TYPE_VOLATILE_SIG_ATOMIC_T)|g' \ + -e 's|@''HAVE_SIGHANDLER_T''@|$(HAVE_SIGHANDLER_T)|g' \ + -e 's|@''REPLACE_PTHREAD_SIGMASK''@|$(REPLACE_PTHREAD_SIGMASK)|g' \ + -e 's|@''REPLACE_RAISE''@|$(REPLACE_RAISE)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/signal.in.h; \ + } > $@-t && \ + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that works. +@GL_GENERATE_STDBOOL_H_TRUE@stdbool.h: stdbool.in.h $(top_builddir)/config.status +@GL_GENERATE_STDBOOL_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_STDBOOL_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ +@GL_GENERATE_STDBOOL_H_TRUE@ sed -e 's/@''HAVE__BOOL''@/$(HAVE__BOOL)/g' < $(srcdir)/stdbool.in.h; \ +@GL_GENERATE_STDBOOL_H_TRUE@ } > $@-t && \ +@GL_GENERATE_STDBOOL_H_TRUE@ mv $@-t $@ +@GL_GENERATE_STDBOOL_H_FALSE@stdbool.h: $(top_builddir)/config.status +@GL_GENERATE_STDBOOL_H_FALSE@ rm -f $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +@GL_GENERATE_STDDEF_H_TRUE@stddef.h: stddef.in.h $(top_builddir)/config.status +@GL_GENERATE_STDDEF_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_STDDEF_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ +@GL_GENERATE_STDDEF_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ +@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ +@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ +@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ +@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''NEXT_STDDEF_H''@|$(NEXT_STDDEF_H)|g' \ +@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''HAVE_MAX_ALIGN_T''@|$(HAVE_MAX_ALIGN_T)|g' \ +@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''HAVE_WCHAR_T''@|$(HAVE_WCHAR_T)|g' \ +@GL_GENERATE_STDDEF_H_TRUE@ -e 's|@''REPLACE_NULL''@|$(REPLACE_NULL)|g' \ +@GL_GENERATE_STDDEF_H_TRUE@ < $(srcdir)/stddef.in.h; \ +@GL_GENERATE_STDDEF_H_TRUE@ } > $@-t && \ +@GL_GENERATE_STDDEF_H_TRUE@ mv $@-t $@ +@GL_GENERATE_STDDEF_H_FALSE@stddef.h: $(top_builddir)/config.status +@GL_GENERATE_STDDEF_H_FALSE@ rm -f $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +@GL_GENERATE_STDINT_H_TRUE@stdint.h: stdint.in.h $(top_builddir)/config.status +@GL_GENERATE_STDINT_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_STDINT_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ +@GL_GENERATE_STDINT_H_TRUE@ sed -e 's|@''GUARD_PREFIX''@|GL|g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_STDINT_H''@/$(HAVE_STDINT_H)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's|@''NEXT_STDINT_H''@|$(NEXT_STDINT_H)|g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_C99_STDINT_H''@/$(HAVE_C99_STDINT_H)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SYS_TYPES_H''@/$(HAVE_SYS_TYPES_H)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_INTTYPES_H''@/$(HAVE_INTTYPES_H)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SYS_INTTYPES_H''@/$(HAVE_SYS_INTTYPES_H)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SYS_BITYPES_H''@/$(HAVE_SYS_BITYPES_H)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_WCHAR_H''@/$(HAVE_WCHAR_H)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''APPLE_UNIVERSAL_BUILD''@/$(APPLE_UNIVERSAL_BUILD)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_PTRDIFF_T''@/$(BITSIZEOF_PTRDIFF_T)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''PTRDIFF_T_SUFFIX''@/$(PTRDIFF_T_SUFFIX)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_SIG_ATOMIC_T''@/$(BITSIZEOF_SIG_ATOMIC_T)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SIGNED_SIG_ATOMIC_T''@/$(HAVE_SIGNED_SIG_ATOMIC_T)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''SIG_ATOMIC_T_SUFFIX''@/$(SIG_ATOMIC_T_SUFFIX)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_SIZE_T''@/$(BITSIZEOF_SIZE_T)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''SIZE_T_SUFFIX''@/$(SIZE_T_SUFFIX)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_WCHAR_T''@/$(BITSIZEOF_WCHAR_T)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SIGNED_WCHAR_T''@/$(HAVE_SIGNED_WCHAR_T)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''WCHAR_T_SUFFIX''@/$(WCHAR_T_SUFFIX)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''BITSIZEOF_WINT_T''@/$(BITSIZEOF_WINT_T)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''HAVE_SIGNED_WINT_T''@/$(HAVE_SIGNED_WINT_T)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''WINT_T_SUFFIX''@/$(WINT_T_SUFFIX)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ -e 's/@''GNULIBHEADERS_OVERRIDE_WINT_T''@/$(GNULIBHEADERS_OVERRIDE_WINT_T)/g' \ +@GL_GENERATE_STDINT_H_TRUE@ < $(srcdir)/stdint.in.h; \ +@GL_GENERATE_STDINT_H_TRUE@ } > $@-t && \ +@GL_GENERATE_STDINT_H_TRUE@ mv $@-t $@ +@GL_GENERATE_STDINT_H_FALSE@stdint.h: $(top_builddir)/config.status +@GL_GENERATE_STDINT_H_FALSE@ rm -f $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +stdio.h: stdio.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STDIO_H''@|$(NEXT_STDIO_H)|g' \ + -e 's/@''GNULIB_DPRINTF''@/$(GL_GNULIB_DPRINTF)/g' \ + -e 's/@''GNULIB_FCLOSE''@/$(GL_GNULIB_FCLOSE)/g' \ + -e 's/@''GNULIB_FDOPEN''@/$(GL_GNULIB_FDOPEN)/g' \ + -e 's/@''GNULIB_FFLUSH''@/$(GL_GNULIB_FFLUSH)/g' \ + -e 's/@''GNULIB_FGETC''@/$(GL_GNULIB_FGETC)/g' \ + -e 's/@''GNULIB_FGETS''@/$(GL_GNULIB_FGETS)/g' \ + -e 's/@''GNULIB_FOPEN''@/$(GL_GNULIB_FOPEN)/g' \ + -e 's/@''GNULIB_FPRINTF''@/$(GL_GNULIB_FPRINTF)/g' \ + -e 's/@''GNULIB_FPRINTF_POSIX''@/$(GL_GNULIB_FPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_FPURGE''@/$(GL_GNULIB_FPURGE)/g' \ + -e 's/@''GNULIB_FPUTC''@/$(GL_GNULIB_FPUTC)/g' \ + -e 's/@''GNULIB_FPUTS''@/$(GL_GNULIB_FPUTS)/g' \ + -e 's/@''GNULIB_FREAD''@/$(GL_GNULIB_FREAD)/g' \ + -e 's/@''GNULIB_FREOPEN''@/$(GL_GNULIB_FREOPEN)/g' \ + -e 's/@''GNULIB_FSCANF''@/$(GL_GNULIB_FSCANF)/g' \ + -e 's/@''GNULIB_FSEEK''@/$(GL_GNULIB_FSEEK)/g' \ + -e 's/@''GNULIB_FSEEKO''@/$(GL_GNULIB_FSEEKO)/g' \ + -e 's/@''GNULIB_FTELL''@/$(GL_GNULIB_FTELL)/g' \ + -e 's/@''GNULIB_FTELLO''@/$(GL_GNULIB_FTELLO)/g' \ + -e 's/@''GNULIB_FWRITE''@/$(GL_GNULIB_FWRITE)/g' \ + -e 's/@''GNULIB_GETC''@/$(GL_GNULIB_GETC)/g' \ + -e 's/@''GNULIB_GETCHAR''@/$(GL_GNULIB_GETCHAR)/g' \ + -e 's/@''GNULIB_GETDELIM''@/$(GL_GNULIB_GETDELIM)/g' \ + -e 's/@''GNULIB_GETLINE''@/$(GL_GNULIB_GETLINE)/g' \ + -e 's/@''GNULIB_OBSTACK_PRINTF''@/$(GL_GNULIB_OBSTACK_PRINTF)/g' \ + -e 's/@''GNULIB_OBSTACK_PRINTF_POSIX''@/$(GL_GNULIB_OBSTACK_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_PCLOSE''@/$(GL_GNULIB_PCLOSE)/g' \ + -e 's/@''GNULIB_PERROR''@/$(GL_GNULIB_PERROR)/g' \ + -e 's/@''GNULIB_POPEN''@/$(GL_GNULIB_POPEN)/g' \ + -e 's/@''GNULIB_PRINTF''@/$(GL_GNULIB_PRINTF)/g' \ + -e 's/@''GNULIB_PRINTF_POSIX''@/$(GL_GNULIB_PRINTF_POSIX)/g' \ + -e 's/@''GNULIB_PUTC''@/$(GL_GNULIB_PUTC)/g' \ + -e 's/@''GNULIB_PUTCHAR''@/$(GL_GNULIB_PUTCHAR)/g' \ + -e 's/@''GNULIB_PUTS''@/$(GL_GNULIB_PUTS)/g' \ + -e 's/@''GNULIB_REMOVE''@/$(GL_GNULIB_REMOVE)/g' \ + -e 's/@''GNULIB_RENAME''@/$(GL_GNULIB_RENAME)/g' \ + -e 's/@''GNULIB_RENAMEAT''@/$(GL_GNULIB_RENAMEAT)/g' \ + -e 's/@''GNULIB_SCANF''@/$(GL_GNULIB_SCANF)/g' \ + -e 's/@''GNULIB_SNPRINTF''@/$(GL_GNULIB_SNPRINTF)/g' \ + -e 's/@''GNULIB_SPRINTF_POSIX''@/$(GL_GNULIB_SPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_STDIO_H_NONBLOCKING''@/$(GL_GNULIB_STDIO_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_STDIO_H_SIGPIPE''@/$(GL_GNULIB_STDIO_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_TMPFILE''@/$(GL_GNULIB_TMPFILE)/g' \ + -e 's/@''GNULIB_VASPRINTF''@/$(GL_GNULIB_VASPRINTF)/g' \ + -e 's/@''GNULIB_VDPRINTF''@/$(GL_GNULIB_VDPRINTF)/g' \ + -e 's/@''GNULIB_VFPRINTF''@/$(GL_GNULIB_VFPRINTF)/g' \ + -e 's/@''GNULIB_VFPRINTF_POSIX''@/$(GL_GNULIB_VFPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VFSCANF''@/$(GL_GNULIB_VFSCANF)/g' \ + -e 's/@''GNULIB_VSCANF''@/$(GL_GNULIB_VSCANF)/g' \ + -e 's/@''GNULIB_VPRINTF''@/$(GL_GNULIB_VPRINTF)/g' \ + -e 's/@''GNULIB_VPRINTF_POSIX''@/$(GL_GNULIB_VPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_VSNPRINTF''@/$(GL_GNULIB_VSNPRINTF)/g' \ + -e 's/@''GNULIB_VSPRINTF_POSIX''@/$(GL_GNULIB_VSPRINTF_POSIX)/g' \ + -e 's/@''GNULIB_MDA_FCLOSEALL''@/$(GL_GNULIB_MDA_FCLOSEALL)/g' \ + -e 's/@''GNULIB_MDA_FDOPEN''@/$(GL_GNULIB_MDA_FDOPEN)/g' \ + -e 's/@''GNULIB_MDA_FILENO''@/$(GL_GNULIB_MDA_FILENO)/g' \ + -e 's/@''GNULIB_MDA_GETW''@/$(GL_GNULIB_MDA_GETW)/g' \ + -e 's/@''GNULIB_MDA_PUTW''@/$(GL_GNULIB_MDA_PUTW)/g' \ + -e 's/@''GNULIB_MDA_TEMPNAM''@/$(GL_GNULIB_MDA_TEMPNAM)/g' \ + < $(srcdir)/stdio.in.h | \ + sed -e 's|@''HAVE_DECL_FCLOSEALL''@|$(HAVE_DECL_FCLOSEALL)|g' \ + -e 's|@''HAVE_DECL_FPURGE''@|$(HAVE_DECL_FPURGE)|g' \ + -e 's|@''HAVE_DECL_FSEEKO''@|$(HAVE_DECL_FSEEKO)|g' \ + -e 's|@''HAVE_DECL_FTELLO''@|$(HAVE_DECL_FTELLO)|g' \ + -e 's|@''HAVE_DECL_GETDELIM''@|$(HAVE_DECL_GETDELIM)|g' \ + -e 's|@''HAVE_DECL_GETLINE''@|$(HAVE_DECL_GETLINE)|g' \ + -e 's|@''HAVE_DECL_OBSTACK_PRINTF''@|$(HAVE_DECL_OBSTACK_PRINTF)|g' \ + -e 's|@''HAVE_DECL_SNPRINTF''@|$(HAVE_DECL_SNPRINTF)|g' \ + -e 's|@''HAVE_DECL_VSNPRINTF''@|$(HAVE_DECL_VSNPRINTF)|g' \ + -e 's|@''HAVE_DPRINTF''@|$(HAVE_DPRINTF)|g' \ + -e 's|@''HAVE_FSEEKO''@|$(HAVE_FSEEKO)|g' \ + -e 's|@''HAVE_FTELLO''@|$(HAVE_FTELLO)|g' \ + -e 's|@''HAVE_PCLOSE''@|$(HAVE_PCLOSE)|g' \ + -e 's|@''HAVE_POPEN''@|$(HAVE_POPEN)|g' \ + -e 's|@''HAVE_RENAMEAT''@|$(HAVE_RENAMEAT)|g' \ + -e 's|@''HAVE_VASPRINTF''@|$(HAVE_VASPRINTF)|g' \ + -e 's|@''HAVE_VDPRINTF''@|$(HAVE_VDPRINTF)|g' \ + -e 's|@''REPLACE_DPRINTF''@|$(REPLACE_DPRINTF)|g' \ + -e 's|@''REPLACE_FCLOSE''@|$(REPLACE_FCLOSE)|g' \ + -e 's|@''REPLACE_FDOPEN''@|$(REPLACE_FDOPEN)|g' \ + -e 's|@''REPLACE_FFLUSH''@|$(REPLACE_FFLUSH)|g' \ + -e 's|@''REPLACE_FOPEN''@|$(REPLACE_FOPEN)|g' \ + -e 's|@''REPLACE_FPRINTF''@|$(REPLACE_FPRINTF)|g' \ + -e 's|@''REPLACE_FPURGE''@|$(REPLACE_FPURGE)|g' \ + -e 's|@''REPLACE_FREOPEN''@|$(REPLACE_FREOPEN)|g' \ + -e 's|@''REPLACE_FSEEK''@|$(REPLACE_FSEEK)|g' \ + -e 's|@''REPLACE_FSEEKO''@|$(REPLACE_FSEEKO)|g' \ + -e 's|@''REPLACE_FTELL''@|$(REPLACE_FTELL)|g' \ + -e 's|@''REPLACE_FTELLO''@|$(REPLACE_FTELLO)|g' \ + -e 's|@''REPLACE_GETDELIM''@|$(REPLACE_GETDELIM)|g' \ + -e 's|@''REPLACE_GETLINE''@|$(REPLACE_GETLINE)|g' \ + -e 's|@''REPLACE_OBSTACK_PRINTF''@|$(REPLACE_OBSTACK_PRINTF)|g' \ + -e 's|@''REPLACE_PERROR''@|$(REPLACE_PERROR)|g' \ + -e 's|@''REPLACE_POPEN''@|$(REPLACE_POPEN)|g' \ + -e 's|@''REPLACE_PRINTF''@|$(REPLACE_PRINTF)|g' \ + -e 's|@''REPLACE_REMOVE''@|$(REPLACE_REMOVE)|g' \ + -e 's|@''REPLACE_RENAME''@|$(REPLACE_RENAME)|g' \ + -e 's|@''REPLACE_RENAMEAT''@|$(REPLACE_RENAMEAT)|g' \ + -e 's|@''REPLACE_SNPRINTF''@|$(REPLACE_SNPRINTF)|g' \ + -e 's|@''REPLACE_SPRINTF''@|$(REPLACE_SPRINTF)|g' \ + -e 's|@''REPLACE_STDIO_READ_FUNCS''@|$(REPLACE_STDIO_READ_FUNCS)|g' \ + -e 's|@''REPLACE_STDIO_WRITE_FUNCS''@|$(REPLACE_STDIO_WRITE_FUNCS)|g' \ + -e 's|@''REPLACE_TMPFILE''@|$(REPLACE_TMPFILE)|g' \ + -e 's|@''REPLACE_VASPRINTF''@|$(REPLACE_VASPRINTF)|g' \ + -e 's|@''REPLACE_VDPRINTF''@|$(REPLACE_VDPRINTF)|g' \ + -e 's|@''REPLACE_VFPRINTF''@|$(REPLACE_VFPRINTF)|g' \ + -e 's|@''REPLACE_VPRINTF''@|$(REPLACE_VPRINTF)|g' \ + -e 's|@''REPLACE_VSNPRINTF''@|$(REPLACE_VSNPRINTF)|g' \ + -e 's|@''REPLACE_VSPRINTF''@|$(REPLACE_VSPRINTF)|g' \ + -e 's|@''ASM_SYMBOL_PREFIX''@|$(ASM_SYMBOL_PREFIX)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ + } > $@-t && \ + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that works. +@GL_GENERATE_STDNORETURN_H_TRUE@stdnoreturn.h: stdnoreturn.in.h $(top_builddir)/config.status $(_NORETURN_H) +@GL_GENERATE_STDNORETURN_H_TRUE@ $(AM_V_GEN)rm -f $@-t $@ && \ +@GL_GENERATE_STDNORETURN_H_TRUE@ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ +@GL_GENERATE_STDNORETURN_H_TRUE@ sed -e '/definition of _Noreturn/r $(_NORETURN_H)' \ +@GL_GENERATE_STDNORETURN_H_TRUE@ < $(srcdir)/stdnoreturn.in.h; \ +@GL_GENERATE_STDNORETURN_H_TRUE@ } > $@-t && \ +@GL_GENERATE_STDNORETURN_H_TRUE@ mv $@-t $@ +@GL_GENERATE_STDNORETURN_H_FALSE@stdnoreturn.h: $(top_builddir)/config.status +@GL_GENERATE_STDNORETURN_H_FALSE@ rm -f $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STRING_H''@|$(NEXT_STRING_H)|g' \ + -e 's/@''GNULIB_EXPLICIT_BZERO''@/$(GL_GNULIB_EXPLICIT_BZERO)/g' \ + -e 's/@''GNULIB_FFSL''@/$(GL_GNULIB_FFSL)/g' \ + -e 's/@''GNULIB_FFSLL''@/$(GL_GNULIB_FFSLL)/g' \ + -e 's/@''GNULIB_MBSLEN''@/$(GL_GNULIB_MBSLEN)/g' \ + -e 's/@''GNULIB_MBSNLEN''@/$(GL_GNULIB_MBSNLEN)/g' \ + -e 's/@''GNULIB_MBSCHR''@/$(GL_GNULIB_MBSCHR)/g' \ + -e 's/@''GNULIB_MBSRCHR''@/$(GL_GNULIB_MBSRCHR)/g' \ + -e 's/@''GNULIB_MBSSTR''@/$(GL_GNULIB_MBSSTR)/g' \ + -e 's/@''GNULIB_MBSCASECMP''@/$(GL_GNULIB_MBSCASECMP)/g' \ + -e 's/@''GNULIB_MBSNCASECMP''@/$(GL_GNULIB_MBSNCASECMP)/g' \ + -e 's/@''GNULIB_MBSPCASECMP''@/$(GL_GNULIB_MBSPCASECMP)/g' \ + -e 's/@''GNULIB_MBSCASESTR''@/$(GL_GNULIB_MBSCASESTR)/g' \ + -e 's/@''GNULIB_MBSCSPN''@/$(GL_GNULIB_MBSCSPN)/g' \ + -e 's/@''GNULIB_MBSPBRK''@/$(GL_GNULIB_MBSPBRK)/g' \ + -e 's/@''GNULIB_MBSSPN''@/$(GL_GNULIB_MBSSPN)/g' \ + -e 's/@''GNULIB_MBSSEP''@/$(GL_GNULIB_MBSSEP)/g' \ + -e 's/@''GNULIB_MBSTOK_R''@/$(GL_GNULIB_MBSTOK_R)/g' \ + -e 's/@''GNULIB_MEMCHR''@/$(GL_GNULIB_MEMCHR)/g' \ + -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ + -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \ + -e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \ + -e 's/@''GNULIB_RAWMEMCHR''@/$(GL_GNULIB_RAWMEMCHR)/g' \ + -e 's/@''GNULIB_STPCPY''@/$(GL_GNULIB_STPCPY)/g' \ + -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \ + -e 's/@''GNULIB_STRCHRNUL''@/$(GL_GNULIB_STRCHRNUL)/g' \ + -e 's/@''GNULIB_STRDUP''@/$(GL_GNULIB_STRDUP)/g' \ + -e 's/@''GNULIB_STRNCAT''@/$(GL_GNULIB_STRNCAT)/g' \ + -e 's/@''GNULIB_STRNDUP''@/$(GL_GNULIB_STRNDUP)/g' \ + -e 's/@''GNULIB_STRNLEN''@/$(GL_GNULIB_STRNLEN)/g' \ + -e 's/@''GNULIB_STRPBRK''@/$(GL_GNULIB_STRPBRK)/g' \ + -e 's/@''GNULIB_STRSEP''@/$(GL_GNULIB_STRSEP)/g' \ + -e 's/@''GNULIB_STRSTR''@/$(GL_GNULIB_STRSTR)/g' \ + -e 's/@''GNULIB_STRCASESTR''@/$(GL_GNULIB_STRCASESTR)/g' \ + -e 's/@''GNULIB_STRTOK_R''@/$(GL_GNULIB_STRTOK_R)/g' \ + -e 's/@''GNULIB_STRERROR''@/$(GL_GNULIB_STRERROR)/g' \ + -e 's/@''GNULIB_STRERROR_R''@/$(GL_GNULIB_STRERROR_R)/g' \ + -e 's/@''GNULIB_STRERRORNAME_NP''@/$(GL_GNULIB_STRERRORNAME_NP)/g' \ + -e 's/@''GNULIB_SIGABBREV_NP''@/$(GL_GNULIB_SIGABBREV_NP)/g' \ + -e 's/@''GNULIB_SIGDESCR_NP''@/$(GL_GNULIB_SIGDESCR_NP)/g' \ + -e 's/@''GNULIB_STRSIGNAL''@/$(GL_GNULIB_STRSIGNAL)/g' \ + -e 's/@''GNULIB_STRVERSCMP''@/$(GL_GNULIB_STRVERSCMP)/g' \ + -e 's/@''GNULIB_MDA_MEMCCPY''@/$(GL_GNULIB_MDA_MEMCCPY)/g' \ + -e 's/@''GNULIB_MDA_STRDUP''@/$(GL_GNULIB_MDA_STRDUP)/g' \ + < $(srcdir)/string.in.h | \ + sed -e 's|@''HAVE_EXPLICIT_BZERO''@|$(HAVE_EXPLICIT_BZERO)|g' \ + -e 's|@''HAVE_FFSL''@|$(HAVE_FFSL)|g' \ + -e 's|@''HAVE_FFSLL''@|$(HAVE_FFSLL)|g' \ + -e 's|@''HAVE_MBSLEN''@|$(HAVE_MBSLEN)|g' \ + -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ + -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ + -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ + -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ + -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ + -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ + -e 's|@''HAVE_STRCHRNUL''@|$(HAVE_STRCHRNUL)|g' \ + -e 's|@''HAVE_DECL_STRDUP''@|$(HAVE_DECL_STRDUP)|g' \ + -e 's|@''HAVE_DECL_STRNDUP''@|$(HAVE_DECL_STRNDUP)|g' \ + -e 's|@''HAVE_DECL_STRNLEN''@|$(HAVE_DECL_STRNLEN)|g' \ + -e 's|@''HAVE_STRPBRK''@|$(HAVE_STRPBRK)|g' \ + -e 's|@''HAVE_STRSEP''@|$(HAVE_STRSEP)|g' \ + -e 's|@''HAVE_STRCASESTR''@|$(HAVE_STRCASESTR)|g' \ + -e 's|@''HAVE_DECL_STRTOK_R''@|$(HAVE_DECL_STRTOK_R)|g' \ + -e 's|@''HAVE_DECL_STRERROR_R''@|$(HAVE_DECL_STRERROR_R)|g' \ + -e 's|@''HAVE_STRERRORNAME_NP''@|$(HAVE_STRERRORNAME_NP)|g' \ + -e 's|@''HAVE_SIGABBREV_NP''@|$(HAVE_SIGABBREV_NP)|g' \ + -e 's|@''HAVE_SIGDESCR_NP''@|$(HAVE_SIGDESCR_NP)|g' \ + -e 's|@''HAVE_DECL_STRSIGNAL''@|$(HAVE_DECL_STRSIGNAL)|g' \ + -e 's|@''HAVE_STRVERSCMP''@|$(HAVE_STRVERSCMP)|g' \ + -e 's|@''REPLACE_FFSLL''@|$(REPLACE_FFSLL)|g' \ + -e 's|@''REPLACE_MEMCHR''@|$(REPLACE_MEMCHR)|g' \ + -e 's|@''REPLACE_MEMMEM''@|$(REPLACE_MEMMEM)|g' \ + -e 's|@''REPLACE_STPNCPY''@|$(REPLACE_STPNCPY)|g' \ + -e 's|@''REPLACE_STRCHRNUL''@|$(REPLACE_STRCHRNUL)|g' \ + -e 's|@''REPLACE_STRDUP''@|$(REPLACE_STRDUP)|g' \ + -e 's|@''REPLACE_STRNCAT''@|$(REPLACE_STRNCAT)|g' \ + -e 's|@''REPLACE_STRNDUP''@|$(REPLACE_STRNDUP)|g' \ + -e 's|@''REPLACE_STRNLEN''@|$(REPLACE_STRNLEN)|g' \ + -e 's|@''REPLACE_STRSTR''@|$(REPLACE_STRSTR)|g' \ + -e 's|@''REPLACE_STRCASESTR''@|$(REPLACE_STRCASESTR)|g' \ + -e 's|@''REPLACE_STRTOK_R''@|$(REPLACE_STRTOK_R)|g' \ + -e 's|@''REPLACE_STRERROR''@|$(REPLACE_STRERROR)|g' \ + -e 's|@''REPLACE_STRERROR_R''@|$(REPLACE_STRERROR_R)|g' \ + -e 's|@''REPLACE_STRERRORNAME_NP''@|$(REPLACE_STRERRORNAME_NP)|g' \ + -e 's|@''REPLACE_STRSIGNAL''@|$(REPLACE_STRSIGNAL)|g' \ + -e 's|@''UNDEFINE_STRTOK_R''@|$(UNDEFINE_STRTOK_R)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ + < $(srcdir)/string.in.h; \ + } > $@-t && \ + mv $@-t $@ + +# We need the following in order to create when the system +# has one that is incomplete. +sys/stat.h: sys_stat.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ + -e 's|@''WINDOWS_64_BIT_ST_SIZE''@|$(WINDOWS_64_BIT_ST_SIZE)|g' \ + -e 's|@''WINDOWS_STAT_TIMESPEC''@|$(WINDOWS_STAT_TIMESPEC)|g' \ + -e 's/@''GNULIB_FCHMODAT''@/$(GL_GNULIB_FCHMODAT)/g' \ + -e 's/@''GNULIB_FSTAT''@/$(GL_GNULIB_FSTAT)/g' \ + -e 's/@''GNULIB_FSTATAT''@/$(GL_GNULIB_FSTATAT)/g' \ + -e 's/@''GNULIB_FUTIMENS''@/$(GL_GNULIB_FUTIMENS)/g' \ + -e 's/@''GNULIB_GETUMASK''@/$(GL_GNULIB_GETUMASK)/g' \ + -e 's/@''GNULIB_LCHMOD''@/$(GL_GNULIB_LCHMOD)/g' \ + -e 's/@''GNULIB_LSTAT''@/$(GL_GNULIB_LSTAT)/g' \ + -e 's/@''GNULIB_MKDIR''@/$(GL_GNULIB_MKDIR)/g' \ + -e 's/@''GNULIB_MKDIRAT''@/$(GL_GNULIB_MKDIRAT)/g' \ + -e 's/@''GNULIB_MKFIFO''@/$(GL_GNULIB_MKFIFO)/g' \ + -e 's/@''GNULIB_MKFIFOAT''@/$(GL_GNULIB_MKFIFOAT)/g' \ + -e 's/@''GNULIB_MKNOD''@/$(GL_GNULIB_MKNOD)/g' \ + -e 's/@''GNULIB_MKNODAT''@/$(GL_GNULIB_MKNODAT)/g' \ + -e 's/@''GNULIB_STAT''@/$(GL_GNULIB_STAT)/g' \ + -e 's/@''GNULIB_UTIMENSAT''@/$(GL_GNULIB_UTIMENSAT)/g' \ + -e 's/@''GNULIB_OVERRIDES_STRUCT_STAT''@/$(GL_GNULIB_OVERRIDES_STRUCT_STAT)/g' \ + -e 's/@''GNULIB_MDA_CHMOD''@/$(GL_GNULIB_MDA_CHMOD)/g' \ + -e 's/@''GNULIB_MDA_MKDIR''@/$(GL_GNULIB_MDA_MKDIR)/g' \ + -e 's/@''GNULIB_MDA_UMASK''@/$(GL_GNULIB_MDA_UMASK)/g' \ + -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ + -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ + -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ + -e 's|@''HAVE_GETUMASK''@|$(HAVE_GETUMASK)|g' \ + -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ + -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ + -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ + -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ + -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ + -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ + -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ + -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ + -e 's|@''REPLACE_FCHMODAT''@|$(REPLACE_FCHMODAT)|g' \ + -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ + -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ + -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ + -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ + -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ + -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ + -e 's|@''REPLACE_MKFIFOAT''@|$(REPLACE_MKFIFOAT)|g' \ + -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ + -e 's|@''REPLACE_MKNODAT''@|$(REPLACE_MKNODAT)|g' \ + -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ + -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/sys_stat.in.h; \ + } > $@-t && \ + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +sys/types.h: sys_types.in.h $(top_builddir)/config.status + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \ + -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \ + < $(srcdir)/sys_types.in.h; \ + } > $@-t && \ + mv $@-t $@ + +# We need the following in order to create when the system +# doesn't have one that works with the given compiler. +time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \ + -e 's/@''GNULIB_CTIME''@/$(GL_GNULIB_CTIME)/g' \ + -e 's/@''GNULIB_LOCALTIME''@/$(GL_GNULIB_LOCALTIME)/g' \ + -e 's/@''GNULIB_MKTIME''@/$(GL_GNULIB_MKTIME)/g' \ + -e 's/@''GNULIB_NANOSLEEP''@/$(GL_GNULIB_NANOSLEEP)/g' \ + -e 's/@''GNULIB_STRFTIME''@/$(GL_GNULIB_STRFTIME)/g' \ + -e 's/@''GNULIB_STRPTIME''@/$(GL_GNULIB_STRPTIME)/g' \ + -e 's/@''GNULIB_TIMEGM''@/$(GL_GNULIB_TIMEGM)/g' \ + -e 's/@''GNULIB_TIMESPEC_GET''@/$(GL_GNULIB_TIMESPEC_GET)/g' \ + -e 's/@''GNULIB_TIME_R''@/$(GL_GNULIB_TIME_R)/g' \ + -e 's/@''GNULIB_TIME_RZ''@/$(GL_GNULIB_TIME_RZ)/g' \ + -e 's/@''GNULIB_TZSET''@/$(GL_GNULIB_TZSET)/g' \ + -e 's/@''GNULIB_MDA_TZSET''@/$(GL_GNULIB_MDA_TZSET)/g' \ + -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \ + -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \ + -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \ + -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \ + -e 's|@''HAVE_TIMESPEC_GET''@|$(HAVE_TIMESPEC_GET)|g' \ + -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \ + -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \ + -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \ + -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \ + -e 's|@''REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \ + -e 's|@''REPLACE_MKTIME''@|$(REPLACE_MKTIME)|g' \ + -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \ + -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \ + -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \ + -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \ + -e 's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''UNISTD_H_DEFINES_STRUCT_TIMESPEC''@|$(UNISTD_H_DEFINES_STRUCT_TIMESPEC)|g' \ + -e 's|@''TIME_H_DEFINES_TIME_UTC''@|$(TIME_H_DEFINES_TIME_UTC)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/time.in.h; \ + } > $@-t && \ + mv $@-t $@ + +# We need the following in order to create an empty placeholder for +# when the system doesn't have one. +unistd.h: unistd.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''GUARD_PREFIX''@|GL|g' \ + -e 's|@''HAVE_UNISTD_H''@|$(HAVE_UNISTD_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_UNISTD_H''@|$(NEXT_UNISTD_H)|g' \ + -e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \ + -e 's/@''GNULIB_ACCESS''@/$(GL_GNULIB_ACCESS)/g' \ + -e 's/@''GNULIB_CHDIR''@/$(GL_GNULIB_CHDIR)/g' \ + -e 's/@''GNULIB_CHOWN''@/$(GL_GNULIB_CHOWN)/g' \ + -e 's/@''GNULIB_CLOSE''@/$(GL_GNULIB_CLOSE)/g' \ + -e 's/@''GNULIB_COPY_FILE_RANGE''@/$(GL_GNULIB_COPY_FILE_RANGE)/g' \ + -e 's/@''GNULIB_DUP''@/$(GL_GNULIB_DUP)/g' \ + -e 's/@''GNULIB_DUP2''@/$(GL_GNULIB_DUP2)/g' \ + -e 's/@''GNULIB_DUP3''@/$(GL_GNULIB_DUP3)/g' \ + -e 's/@''GNULIB_ENVIRON''@/$(GL_GNULIB_ENVIRON)/g' \ + -e 's/@''GNULIB_EUIDACCESS''@/$(GL_GNULIB_EUIDACCESS)/g' \ + -e 's/@''GNULIB_EXECL''@/$(GL_GNULIB_EXECL)/g' \ + -e 's/@''GNULIB_EXECLE''@/$(GL_GNULIB_EXECLE)/g' \ + -e 's/@''GNULIB_EXECLP''@/$(GL_GNULIB_EXECLP)/g' \ + -e 's/@''GNULIB_EXECV''@/$(GL_GNULIB_EXECV)/g' \ + -e 's/@''GNULIB_EXECVE''@/$(GL_GNULIB_EXECVE)/g' \ + -e 's/@''GNULIB_EXECVP''@/$(GL_GNULIB_EXECVP)/g' \ + -e 's/@''GNULIB_EXECVPE''@/$(GL_GNULIB_EXECVPE)/g' \ + -e 's/@''GNULIB_FACCESSAT''@/$(GL_GNULIB_FACCESSAT)/g' \ + -e 's/@''GNULIB_FCHDIR''@/$(GL_GNULIB_FCHDIR)/g' \ + -e 's/@''GNULIB_FCHOWNAT''@/$(GL_GNULIB_FCHOWNAT)/g' \ + -e 's/@''GNULIB_FDATASYNC''@/$(GL_GNULIB_FDATASYNC)/g' \ + -e 's/@''GNULIB_FSYNC''@/$(GL_GNULIB_FSYNC)/g' \ + -e 's/@''GNULIB_FTRUNCATE''@/$(GL_GNULIB_FTRUNCATE)/g' \ + -e 's/@''GNULIB_GETCWD''@/$(GL_GNULIB_GETCWD)/g' \ + -e 's/@''GNULIB_GETDOMAINNAME''@/$(GL_GNULIB_GETDOMAINNAME)/g' \ + -e 's/@''GNULIB_GETDTABLESIZE''@/$(GL_GNULIB_GETDTABLESIZE)/g' \ + -e 's/@''GNULIB_GETENTROPY''@/$(GL_GNULIB_GETENTROPY)/g' \ + -e 's/@''GNULIB_GETGROUPS''@/$(GL_GNULIB_GETGROUPS)/g' \ + -e 's/@''GNULIB_GETHOSTNAME''@/$(GL_GNULIB_GETHOSTNAME)/g' \ + -e 's/@''GNULIB_GETLOGIN''@/$(GL_GNULIB_GETLOGIN)/g' \ + -e 's/@''GNULIB_GETLOGIN_R''@/$(GL_GNULIB_GETLOGIN_R)/g' \ + -e 's/@''GNULIB_GETOPT_POSIX''@/$(GL_GNULIB_GETOPT_POSIX)/g' \ + -e 's/@''GNULIB_GETPAGESIZE''@/$(GL_GNULIB_GETPAGESIZE)/g' \ + -e 's/@''GNULIB_GETPASS''@/$(GL_GNULIB_GETPASS)/g' \ + -e 's/@''GNULIB_GETUSERSHELL''@/$(GL_GNULIB_GETUSERSHELL)/g' \ + -e 's/@''GNULIB_GROUP_MEMBER''@/$(GL_GNULIB_GROUP_MEMBER)/g' \ + -e 's/@''GNULIB_ISATTY''@/$(GL_GNULIB_ISATTY)/g' \ + -e 's/@''GNULIB_LCHOWN''@/$(GL_GNULIB_LCHOWN)/g' \ + -e 's/@''GNULIB_LINK''@/$(GL_GNULIB_LINK)/g' \ + -e 's/@''GNULIB_LINKAT''@/$(GL_GNULIB_LINKAT)/g' \ + -e 's/@''GNULIB_LSEEK''@/$(GL_GNULIB_LSEEK)/g' \ + -e 's/@''GNULIB_PIPE''@/$(GL_GNULIB_PIPE)/g' \ + -e 's/@''GNULIB_PIPE2''@/$(GL_GNULIB_PIPE2)/g' \ + -e 's/@''GNULIB_PREAD''@/$(GL_GNULIB_PREAD)/g' \ + -e 's/@''GNULIB_PWRITE''@/$(GL_GNULIB_PWRITE)/g' \ + -e 's/@''GNULIB_READ''@/$(GL_GNULIB_READ)/g' \ + -e 's/@''GNULIB_READLINK''@/$(GL_GNULIB_READLINK)/g' \ + -e 's/@''GNULIB_READLINKAT''@/$(GL_GNULIB_READLINKAT)/g' \ + -e 's/@''GNULIB_RMDIR''@/$(GL_GNULIB_RMDIR)/g' \ + -e 's/@''GNULIB_SETHOSTNAME''@/$(GL_GNULIB_SETHOSTNAME)/g' \ + -e 's/@''GNULIB_SLEEP''@/$(GL_GNULIB_SLEEP)/g' \ + -e 's/@''GNULIB_SYMLINK''@/$(GL_GNULIB_SYMLINK)/g' \ + -e 's/@''GNULIB_SYMLINKAT''@/$(GL_GNULIB_SYMLINKAT)/g' \ + -e 's/@''GNULIB_TRUNCATE''@/$(GL_GNULIB_TRUNCATE)/g' \ + -e 's/@''GNULIB_TTYNAME_R''@/$(GL_GNULIB_TTYNAME_R)/g' \ + -e 's/@''GNULIB_UNISTD_H_GETOPT''@/0$(GL_GNULIB_GL_UNISTD_H_GETOPT)/g' \ + -e 's/@''GNULIB_UNISTD_H_NONBLOCKING''@/$(GL_GNULIB_UNISTD_H_NONBLOCKING)/g' \ + -e 's/@''GNULIB_UNISTD_H_SIGPIPE''@/$(GL_GNULIB_UNISTD_H_SIGPIPE)/g' \ + -e 's/@''GNULIB_UNLINK''@/$(GL_GNULIB_UNLINK)/g' \ + -e 's/@''GNULIB_UNLINKAT''@/$(GL_GNULIB_UNLINKAT)/g' \ + -e 's/@''GNULIB_USLEEP''@/$(GL_GNULIB_USLEEP)/g' \ + -e 's/@''GNULIB_WRITE''@/$(GL_GNULIB_WRITE)/g' \ + -e 's/@''GNULIB_MDA_ACCESS''@/$(GL_GNULIB_MDA_ACCESS)/g' \ + -e 's/@''GNULIB_MDA_CHDIR''@/$(GL_GNULIB_MDA_CHDIR)/g' \ + -e 's/@''GNULIB_MDA_CLOSE''@/$(GL_GNULIB_MDA_CLOSE)/g' \ + -e 's/@''GNULIB_MDA_DUP''@/$(GL_GNULIB_MDA_DUP)/g' \ + -e 's/@''GNULIB_MDA_DUP2''@/$(GL_GNULIB_MDA_DUP2)/g' \ + -e 's/@''GNULIB_MDA_EXECL''@/$(GL_GNULIB_MDA_EXECL)/g' \ + -e 's/@''GNULIB_MDA_EXECLE''@/$(GL_GNULIB_MDA_EXECLE)/g' \ + -e 's/@''GNULIB_MDA_EXECLP''@/$(GL_GNULIB_MDA_EXECLP)/g' \ + -e 's/@''GNULIB_MDA_EXECV''@/$(GL_GNULIB_MDA_EXECV)/g' \ + -e 's/@''GNULIB_MDA_EXECVE''@/$(GL_GNULIB_MDA_EXECVE)/g' \ + -e 's/@''GNULIB_MDA_EXECVP''@/$(GL_GNULIB_MDA_EXECVP)/g' \ + -e 's/@''GNULIB_MDA_EXECVPE''@/$(GL_GNULIB_MDA_EXECVPE)/g' \ + -e 's/@''GNULIB_MDA_GETCWD''@/$(GL_GNULIB_MDA_GETCWD)/g' \ + -e 's/@''GNULIB_MDA_GETPID''@/$(GL_GNULIB_MDA_GETPID)/g' \ + -e 's/@''GNULIB_MDA_ISATTY''@/$(GL_GNULIB_MDA_ISATTY)/g' \ + -e 's/@''GNULIB_MDA_LSEEK''@/$(GL_GNULIB_MDA_LSEEK)/g' \ + -e 's/@''GNULIB_MDA_READ''@/$(GL_GNULIB_MDA_READ)/g' \ + -e 's/@''GNULIB_MDA_RMDIR''@/$(GL_GNULIB_MDA_RMDIR)/g' \ + -e 's/@''GNULIB_MDA_SWAB''@/$(GL_GNULIB_MDA_SWAB)/g' \ + -e 's/@''GNULIB_MDA_UNLINK''@/$(GL_GNULIB_MDA_UNLINK)/g' \ + -e 's/@''GNULIB_MDA_WRITE''@/$(GL_GNULIB_MDA_WRITE)/g' \ + < $(srcdir)/unistd.in.h | \ + sed -e 's|@''HAVE_CHOWN''@|$(HAVE_CHOWN)|g' \ + -e 's|@''HAVE_COPY_FILE_RANGE''@|$(HAVE_COPY_FILE_RANGE)|g' \ + -e 's|@''HAVE_DUP3''@|$(HAVE_DUP3)|g' \ + -e 's|@''HAVE_EUIDACCESS''@|$(HAVE_EUIDACCESS)|g' \ + -e 's|@''HAVE_EXECVPE''@|$(HAVE_EXECVPE)|g' \ + -e 's|@''HAVE_FACCESSAT''@|$(HAVE_FACCESSAT)|g' \ + -e 's|@''HAVE_FCHDIR''@|$(HAVE_FCHDIR)|g' \ + -e 's|@''HAVE_FCHOWNAT''@|$(HAVE_FCHOWNAT)|g' \ + -e 's|@''HAVE_FDATASYNC''@|$(HAVE_FDATASYNC)|g' \ + -e 's|@''HAVE_FSYNC''@|$(HAVE_FSYNC)|g' \ + -e 's|@''HAVE_FTRUNCATE''@|$(HAVE_FTRUNCATE)|g' \ + -e 's|@''HAVE_GETDTABLESIZE''@|$(HAVE_GETDTABLESIZE)|g' \ + -e 's|@''HAVE_GETENTROPY''@|$(HAVE_GETENTROPY)|g' \ + -e 's|@''HAVE_GETGROUPS''@|$(HAVE_GETGROUPS)|g' \ + -e 's|@''HAVE_GETHOSTNAME''@|$(HAVE_GETHOSTNAME)|g' \ + -e 's|@''HAVE_GETPAGESIZE''@|$(HAVE_GETPAGESIZE)|g' \ + -e 's|@''HAVE_GETPASS''@|$(HAVE_GETPASS)|g' \ + -e 's|@''HAVE_GROUP_MEMBER''@|$(HAVE_GROUP_MEMBER)|g' \ + -e 's|@''HAVE_LCHOWN''@|$(HAVE_LCHOWN)|g' \ + -e 's|@''HAVE_LINK''@|$(HAVE_LINK)|g' \ + -e 's|@''HAVE_LINKAT''@|$(HAVE_LINKAT)|g' \ + -e 's|@''HAVE_PIPE''@|$(HAVE_PIPE)|g' \ + -e 's|@''HAVE_PIPE2''@|$(HAVE_PIPE2)|g' \ + -e 's|@''HAVE_PREAD''@|$(HAVE_PREAD)|g' \ + -e 's|@''HAVE_PWRITE''@|$(HAVE_PWRITE)|g' \ + -e 's|@''HAVE_READLINK''@|$(HAVE_READLINK)|g' \ + -e 's|@''HAVE_READLINKAT''@|$(HAVE_READLINKAT)|g' \ + -e 's|@''HAVE_SETHOSTNAME''@|$(HAVE_SETHOSTNAME)|g' \ + -e 's|@''HAVE_SLEEP''@|$(HAVE_SLEEP)|g' \ + -e 's|@''HAVE_SYMLINK''@|$(HAVE_SYMLINK)|g' \ + -e 's|@''HAVE_SYMLINKAT''@|$(HAVE_SYMLINKAT)|g' \ + -e 's|@''HAVE_UNLINKAT''@|$(HAVE_UNLINKAT)|g' \ + -e 's|@''HAVE_USLEEP''@|$(HAVE_USLEEP)|g' \ + -e 's|@''HAVE_DECL_ENVIRON''@|$(HAVE_DECL_ENVIRON)|g' \ + -e 's|@''HAVE_DECL_EXECVPE''@|$(HAVE_DECL_EXECVPE)|g' \ + -e 's|@''HAVE_DECL_FCHDIR''@|$(HAVE_DECL_FCHDIR)|g' \ + -e 's|@''HAVE_DECL_FDATASYNC''@|$(HAVE_DECL_FDATASYNC)|g' \ + -e 's|@''HAVE_DECL_GETDOMAINNAME''@|$(HAVE_DECL_GETDOMAINNAME)|g' \ + -e 's|@''HAVE_DECL_GETLOGIN''@|$(HAVE_DECL_GETLOGIN)|g' \ + -e 's|@''HAVE_DECL_GETLOGIN_R''@|$(HAVE_DECL_GETLOGIN_R)|g' \ + -e 's|@''HAVE_DECL_GETPAGESIZE''@|$(HAVE_DECL_GETPAGESIZE)|g' \ + -e 's|@''HAVE_DECL_GETUSERSHELL''@|$(HAVE_DECL_GETUSERSHELL)|g' \ + -e 's|@''HAVE_DECL_SETHOSTNAME''@|$(HAVE_DECL_SETHOSTNAME)|g' \ + -e 's|@''HAVE_DECL_TRUNCATE''@|$(HAVE_DECL_TRUNCATE)|g' \ + -e 's|@''HAVE_DECL_TTYNAME_R''@|$(HAVE_DECL_TTYNAME_R)|g' \ + -e 's|@''HAVE_OS_H''@|$(HAVE_OS_H)|g' \ + -e 's|@''HAVE_SYS_PARAM_H''@|$(HAVE_SYS_PARAM_H)|g' \ + | \ + sed -e 's|@''REPLACE_ACCESS''@|$(REPLACE_ACCESS)|g' \ + -e 's|@''REPLACE_CHOWN''@|$(REPLACE_CHOWN)|g' \ + -e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \ + -e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \ + -e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \ + -e 's|@''REPLACE_EXECL''@|$(REPLACE_EXECL)|g' \ + -e 's|@''REPLACE_EXECLE''@|$(REPLACE_EXECLE)|g' \ + -e 's|@''REPLACE_EXECLP''@|$(REPLACE_EXECLP)|g' \ + -e 's|@''REPLACE_EXECV''@|$(REPLACE_EXECV)|g' \ + -e 's|@''REPLACE_EXECVE''@|$(REPLACE_EXECVE)|g' \ + -e 's|@''REPLACE_EXECVP''@|$(REPLACE_EXECVP)|g' \ + -e 's|@''REPLACE_EXECVPE''@|$(REPLACE_EXECVPE)|g' \ + -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \ + -e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \ + -e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \ + -e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \ + -e 's|@''REPLACE_GETDOMAINNAME''@|$(REPLACE_GETDOMAINNAME)|g' \ + -e 's|@''REPLACE_GETDTABLESIZE''@|$(REPLACE_GETDTABLESIZE)|g' \ + -e 's|@''REPLACE_GETLOGIN_R''@|$(REPLACE_GETLOGIN_R)|g' \ + -e 's|@''REPLACE_GETGROUPS''@|$(REPLACE_GETGROUPS)|g' \ + -e 's|@''REPLACE_GETPAGESIZE''@|$(REPLACE_GETPAGESIZE)|g' \ + -e 's|@''REPLACE_GETPASS''@|$(REPLACE_GETPASS)|g' \ + -e 's|@''REPLACE_ISATTY''@|$(REPLACE_ISATTY)|g' \ + -e 's|@''REPLACE_LCHOWN''@|$(REPLACE_LCHOWN)|g' \ + -e 's|@''REPLACE_LINK''@|$(REPLACE_LINK)|g' \ + -e 's|@''REPLACE_LINKAT''@|$(REPLACE_LINKAT)|g' \ + -e 's|@''REPLACE_LSEEK''@|$(REPLACE_LSEEK)|g' \ + -e 's|@''REPLACE_PREAD''@|$(REPLACE_PREAD)|g' \ + -e 's|@''REPLACE_PWRITE''@|$(REPLACE_PWRITE)|g' \ + -e 's|@''REPLACE_READ''@|$(REPLACE_READ)|g' \ + -e 's|@''REPLACE_READLINK''@|$(REPLACE_READLINK)|g' \ + -e 's|@''REPLACE_READLINKAT''@|$(REPLACE_READLINKAT)|g' \ + -e 's|@''REPLACE_RMDIR''@|$(REPLACE_RMDIR)|g' \ + -e 's|@''REPLACE_SLEEP''@|$(REPLACE_SLEEP)|g' \ + -e 's|@''REPLACE_SYMLINK''@|$(REPLACE_SYMLINK)|g' \ + -e 's|@''REPLACE_SYMLINKAT''@|$(REPLACE_SYMLINKAT)|g' \ + -e 's|@''REPLACE_TRUNCATE''@|$(REPLACE_TRUNCATE)|g' \ + -e 's|@''REPLACE_TTYNAME_R''@|$(REPLACE_TTYNAME_R)|g' \ + -e 's|@''REPLACE_UNLINK''@|$(REPLACE_UNLINK)|g' \ + -e 's|@''REPLACE_UNLINKAT''@|$(REPLACE_UNLINKAT)|g' \ + -e 's|@''REPLACE_USLEEP''@|$(REPLACE_USLEEP)|g' \ + -e 's|@''REPLACE_WRITE''@|$(REPLACE_WRITE)|g' \ + -e 's|@''UNISTD_H_HAVE_SYS_RANDOM_H''@|$(UNISTD_H_HAVE_SYS_RANDOM_H)|g' \ + -e 's|@''UNISTD_H_HAVE_WINSOCK2_H''@|$(UNISTD_H_HAVE_WINSOCK2_H)|g' \ + -e 's|@''UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS''@|$(UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ + } > $@-t && \ + mv $@-t $@ + +mostlyclean-local: mostlyclean-generic + @for dir in '' $(MOSTLYCLEANDIRS); do \ + if test -n "$$dir" && test -d $$dir; then \ + echo "rmdir $$dir"; rmdir $$dir; \ + fi; \ + done; \ + : + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/gnulib-lib/_Noreturn.h b/gnulib-lib/_Noreturn.h new file mode 100644 index 0000000..cb72f26 --- /dev/null +++ b/gnulib-lib/_Noreturn.h @@ -0,0 +1,45 @@ +/* A C macro for declaring that a function does not return. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + + This program 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 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _Noreturn +# if (defined __cplusplus \ + && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ + || (defined _MSC_VER && 1900 <= _MSC_VER)) \ + && 0) + /* [[noreturn]] is not practically usable, because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would only be valid with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. */ +# define _Noreturn [[noreturn]] +# elif ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || (!defined __STRICT_ANSI__ \ + && (__4 < __GNUC__ + (7 <= __GNUC_MINOR__) \ + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 3 < __clang_major__ + (5 <= __clang_minor__)))))) + /* _Noreturn works as-is. */ +# elif (2 < __GNUC__ + (8 <= __GNUC_MINOR__) || defined __clang__ \ + || 0x5110 <= __SUNPRO_C) +# define _Noreturn __attribute__ ((__noreturn__)) +# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif diff --git a/gnulib-lib/alloca.in.h b/gnulib-lib/alloca.in.h new file mode 100644 index 0000000..65c2d4d --- /dev/null +++ b/gnulib-lib/alloca.in.h @@ -0,0 +1,72 @@ +/* Memory allocation on the stack. + + Copyright (C) 1995, 1999, 2001-2004, 2006-2021 Free Software Foundation, + Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H + means there is a real alloca function. */ +#ifndef _GL_ALLOCA_H +#define _GL_ALLOCA_H + +/* alloca (N) returns a pointer to N bytes of memory + allocated on the stack, which will last until the function returns. + Use of alloca should be avoided: + - inside arguments of function calls - undefined behaviour, + - in inline functions - the allocation may actually last until the + calling function returns, + - for huge N (say, N >= 65536) - you never know how large (or small) + the stack is, and when the stack cannot fulfill the memory allocation + request, the program just crashes. + */ + +#ifndef alloca + /* Some version of mingw have an that causes trouble when + included after 'alloca' gets defined as a macro. As a workaround, + include this first and define 'alloca' as a macro afterwards + if needed. */ +# if defined __GNUC__ && (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@ +# include_next +# endif +#endif +#ifndef alloca +# if defined __GNUC__ || (__clang_major__ >= 4) +# define alloca __builtin_alloca +# elif defined _AIX +# define alloca __alloca +# elif defined _MSC_VER +# include +# define alloca _alloca +# elif defined __DECC && defined __VMS +# define alloca __ALLOCA +# elif defined __TANDEM && defined _TNS_E_TARGET +# ifdef __cplusplus +extern "C" +# endif +void *_alloca (unsigned short); +# pragma intrinsic (_alloca) +# define alloca _alloca +# elif defined __MVS__ +# include +# else +# include +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +# endif +#endif + +#endif /* _GL_ALLOCA_H */ diff --git a/gnulib-lib/arg-nonnull.h b/gnulib-lib/arg-nonnull.h new file mode 100644 index 0000000..b4de241 --- /dev/null +++ b/gnulib-lib/arg-nonnull.h @@ -0,0 +1,26 @@ +/* A C macro for declaring that specific arguments must not be NULL. + Copyright (C) 2009-2021 Free Software Foundation, Inc. + + This program 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 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools + that the values passed as arguments n, ..., m must be non-NULL pointers. + n = 1 stands for the first argument, n = 2 for the second argument etc. */ +#ifndef _GL_ARG_NONNULL +# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || defined __clang__ +# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params)) +# else +# define _GL_ARG_NONNULL(params) +# endif +#endif diff --git a/gnulib-lib/asyncsafe-spin.c b/gnulib-lib/asyncsafe-spin.c new file mode 100644 index 0000000..870b7a2 --- /dev/null +++ b/gnulib-lib/asyncsafe-spin.c @@ -0,0 +1,352 @@ +/* Spin locks for communication between threads and signal handlers. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2020. */ + +#include + +/* Specification. */ +#include "asyncsafe-spin.h" + +#include +#include +#if defined _AIX +# include +#endif + +#if defined _WIN32 && ! defined __CYGWIN__ +/* Use Windows threads. */ + +void +asyncsafe_spin_init (asyncsafe_spinlock_t *lock) +{ + glwthread_spin_init (lock); +} + +static inline void +do_lock (asyncsafe_spinlock_t *lock) +{ + glwthread_spin_lock (lock); +} + +static inline void +do_unlock (asyncsafe_spinlock_t *lock) +{ + if (glwthread_spin_unlock (lock)) + abort (); +} + +void +asyncsafe_spin_destroy (asyncsafe_spinlock_t *lock) +{ + glwthread_spin_destroy (lock); +} + +#else + +# if HAVE_PTHREAD_H +/* Use POSIX threads. */ + +/* We don't use semaphores (although sem_post() is allowed in signal handlers), + because it would require to link with -lrt on HP-UX 11, OSF/1, Solaris 10, + and also because on macOS only named semaphores work. + + We don't use the C11 (available in GCC >= 4.9) because it would + require to link with -latomic. */ + +# if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7) \ + || __clang_major > 3 || (__clang_major__ == 3 && __clang_minor__ >= 1)) \ + && !defined __ibmxl__ +/* Use GCC built-ins (available in GCC >= 4.7 and clang >= 3.1) that operate on + the first byte of the lock. + Documentation: + + */ + +# if 1 +/* An implementation that verifies the unlocks. */ + +void +asyncsafe_spin_init (asyncsafe_spinlock_t *lock) +{ + __atomic_store_n (lock, 0, __ATOMIC_SEQ_CST); +} + +static inline void +do_lock (asyncsafe_spinlock_t *lock) +{ + /* Wait until *lock becomes 0, then replace it with 1. */ + asyncsafe_spinlock_t zero; + while (!(zero = 0, + __atomic_compare_exchange_n (lock, &zero, 1, false, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST))) + ; +} + +static inline void +do_unlock (asyncsafe_spinlock_t *lock) +{ + /* If *lock is 1, then replace it with 0. */ + asyncsafe_spinlock_t one = 1; + if (!__atomic_compare_exchange_n (lock, &one, 0, false, + __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST)) + abort (); +} + +# else +/* An implementation that is a little bit more optimized, but does not verify + the unlocks. */ + +void +asyncsafe_spin_init (asyncsafe_spinlock_t *lock) +{ + __atomic_clear (lock, __ATOMIC_SEQ_CST); +} + +static inline void +do_lock (asyncsafe_spinlock_t *lock) +{ + while (__atomic_test_and_set (lock, __ATOMIC_SEQ_CST)) + ; +} + +static inline void +do_unlock (asyncsafe_spinlock_t *lock) +{ + __atomic_clear (lock, __ATOMIC_SEQ_CST); +} + +# endif + +# elif (((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) \ + && !defined __sparc__) \ + || __clang_major__ >= 3) \ + && !defined __ibmxl__ +/* Use GCC built-ins (available in GCC >= 4.1, except on SPARC, and + clang >= 3.0). + Documentation: + */ + +void +asyncsafe_spin_init (asyncsafe_spinlock_t *lock) +{ + volatile unsigned int *vp = lock; + *vp = 0; + __sync_synchronize (); +} + +static inline void +do_lock (asyncsafe_spinlock_t *lock) +{ + /* Wait until *lock becomes 0, then replace it with 1. */ + while (__sync_val_compare_and_swap (lock, 0, 1) != 0) + ; +} + +static inline void +do_unlock (asyncsafe_spinlock_t *lock) +{ + /* If *lock is 1, then replace it with 0. */ + if (__sync_val_compare_and_swap (lock, 1, 0) != 1) + abort (); +} + +# elif defined _AIX +/* AIX */ + +void +asyncsafe_spin_init (asyncsafe_spinlock_t *lock) +{ + atomic_p vp = (int *) lock; + _clear_lock (vp, 0); +} + +static inline void +do_lock (asyncsafe_spinlock_t *lock) +{ + atomic_p vp = (int *) lock; + while (_check_lock (vp, 0, 1)) + ; +} + +static inline void +do_unlock (asyncsafe_spinlock_t *lock) +{ + atomic_p vp = (int *) lock; + if (_check_lock (vp, 1, 0)) + abort (); +} + +# elif ((defined __GNUC__ || defined __clang__ || defined __SUNPRO_C) && (defined __sparc || defined __i386 || defined __x86_64__)) || (defined __TINYC__ && (defined __i386 || defined __x86_64__)) +/* For older versions of GCC or clang, use inline assembly. + GCC, clang, and the Oracle Studio C 12 compiler understand GCC's extended + asm syntax, but the plain Oracle Studio C 11 compiler understands only + simple asm. */ +/* An implementation that verifies the unlocks. */ + +static void +memory_barrier (void) +{ +# if defined __GNUC__ || defined __clang__ || __SUNPRO_C >= 0x590 || defined __TINYC__ +# if defined __i386 || defined __x86_64__ +# if defined __TINYC__ && defined __i386 + /* Cannot use the SSE instruction "mfence" with this compiler. */ + asm volatile ("lock orl $0,(%esp)"); +# else + asm volatile ("mfence"); +# endif +# endif +# if defined __sparc + asm volatile ("membar 2"); +# endif +# else +# if defined __i386 || defined __x86_64__ + asm ("mfence"); +# endif +# if defined __sparc + asm ("membar 2"); +# endif +# endif +} + +/* Store NEWVAL in *VP if the old value *VP is == CMP. + Return the old value. */ +static unsigned int +atomic_compare_and_swap (volatile unsigned int *vp, unsigned int cmp, + unsigned int newval) +{ +# if defined __GNUC__ || defined __clang__ || __SUNPRO_C >= 0x590 || defined __TINYC__ + unsigned int oldval; +# if defined __i386 || defined __x86_64__ + asm volatile (" lock\n cmpxchgl %3,(%1)" + : "=a" (oldval) : "r" (vp), "a" (cmp), "r" (newval) : "memory"); +# endif +# if defined __sparc + asm volatile (" cas [%1],%2,%3\n" + " mov %3,%0" + : "=r" (oldval) : "r" (vp), "r" (cmp), "r" (newval) : "memory"); +# endif + return oldval; +# else /* __SUNPRO_C */ +# if defined __x86_64__ + asm (" movl %esi,%eax\n" + " lock\n cmpxchgl %edx,(%rdi)"); +# elif defined __i386 + asm (" movl 16(%ebp),%ecx\n" + " movl 12(%ebp),%eax\n" + " movl 8(%ebp),%edx\n" + " lock\n cmpxchgl %ecx,(%edx)"); +# endif +# if defined __sparc + asm (" cas [%i0],%i1,%i2\n" + " mov %i2,%i0"); +# endif +# endif +} + +void +asyncsafe_spin_init (asyncsafe_spinlock_t *lock) +{ + volatile unsigned int *vp = lock; + *vp = 0; + memory_barrier (); +} + +static inline void +do_lock (asyncsafe_spinlock_t *lock) +{ + volatile unsigned int *vp = lock; + while (atomic_compare_and_swap (vp, 0, 1) != 0) + ; +} + +static inline void +do_unlock (asyncsafe_spinlock_t *lock) +{ + volatile unsigned int *vp = lock; + if (atomic_compare_and_swap (vp, 1, 0) != 1) + abort (); +} + +# else +/* Fallback code. It has some race conditions. */ + +void +asyncsafe_spin_init (asyncsafe_spinlock_t *lock) +{ + volatile unsigned int *vp = lock; + *vp = 0; +} + +static inline void +do_lock (asyncsafe_spinlock_t *lock) +{ + volatile unsigned int *vp = lock; + while (*vp) + ; + *vp = 1; +} + +static inline void +do_unlock (asyncsafe_spinlock_t *lock) +{ + volatile unsigned int *vp = lock; + *vp = 0; +} + +# endif + +# else +/* Provide a dummy implementation for single-threaded applications. */ + +void +asyncsafe_spin_init (asyncsafe_spinlock_t *lock) +{ +} + +static inline void +do_lock (asyncsafe_spinlock_t *lock) +{ +} + +static inline void +do_unlock (asyncsafe_spinlock_t *lock) +{ +} + +# endif + +void +asyncsafe_spin_destroy (asyncsafe_spinlock_t *lock) +{ +} + +#endif + +void +asyncsafe_spin_lock (asyncsafe_spinlock_t *lock, + const sigset_t *mask, sigset_t *saved_mask) +{ + sigprocmask (SIG_BLOCK, mask, saved_mask); /* equivalent to pthread_sigmask */ + do_lock (lock); +} + +void +asyncsafe_spin_unlock (asyncsafe_spinlock_t *lock, const sigset_t *saved_mask) +{ + do_unlock (lock); + sigprocmask (SIG_SETMASK, saved_mask, NULL); /* equivalent to pthread_sigmask */ +} diff --git a/gnulib-lib/asyncsafe-spin.h b/gnulib-lib/asyncsafe-spin.h new file mode 100644 index 0000000..ecf103a --- /dev/null +++ b/gnulib-lib/asyncsafe-spin.h @@ -0,0 +1,69 @@ +/* Spin locks for communication between threads and signal handlers. + Copyright (C) 2020-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2020. */ + +#ifndef _ASYNCSAFE_SPIN_H +#define _ASYNCSAFE_SPIN_H + +/* Usual spin locks are not allowed for communication between threads and signal + handlers, because the pthread_spin_* functions are not async-safe; see + + section 2.4.3 Signal Actions. + + This module provides spin locks with a similar API. It can be used like this, + both in regular multithreaded code and in signal handlers: + + sigset_t saved_mask; + asyncsafe_spin_lock (&lock, &mask, &saved_mask); + do_something_contentious (); + asyncsafe_spin_unlock (&lock, &saved_mask); + + The mask you specify here is the set of signals whose handlers might want to + take the same lock. + + asyncsafe_spin_lock/unlock use pthread_sigmask, to ensure that while a thread + is executing such code, no signal handler will start such code for the same + lock *in the same thread* (because if this happened, the signal handler would + hang!). */ + +#include + +#if defined _WIN32 && ! defined __CYGWIN__ +# include "windows-spin.h" +typedef glwthread_spinlock_t asyncsafe_spinlock_t; +# define ASYNCSAFE_SPIN_INIT GLWTHREAD_SPIN_INIT +#else +typedef unsigned int asyncsafe_spinlock_t; +# define ASYNCSAFE_SPIN_INIT 0 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern void asyncsafe_spin_init (asyncsafe_spinlock_t *lock); +extern void asyncsafe_spin_lock (asyncsafe_spinlock_t *lock, + const sigset_t *mask, sigset_t *saved_mask); +extern void asyncsafe_spin_unlock (asyncsafe_spinlock_t *lock, + const sigset_t *saved_mask); +extern void asyncsafe_spin_destroy (asyncsafe_spinlock_t *lock); + +#ifdef __cplusplus +} +#endif + +#endif /* _ASYNCSAFE_SPIN_H */ diff --git a/gnulib-lib/attribute.h b/gnulib-lib/attribute.h new file mode 100644 index 0000000..6d3c04c --- /dev/null +++ b/gnulib-lib/attribute.h @@ -0,0 +1,218 @@ +/* ATTRIBUTE_* macros for using attributes in GCC and similar compilers + + Copyright 2020-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Paul Eggert. */ + +/* Provide public ATTRIBUTE_* names for the private _GL_ATTRIBUTE_* + macros used within Gnulib. */ + +/* These attributes can be placed in two ways: + - At the start of a declaration (i.e. even before storage-class + specifiers!); then they apply to all entities that are declared + by the declaration. + - Immediately after the name of an entity being declared by the + declaration; then they apply to that entity only. */ + +#ifndef _GL_ATTRIBUTE_H +#define _GL_ATTRIBUTE_H + + +/* This file defines two types of attributes: + * C2X standard attributes. These have macro names that do not begin with + 'ATTRIBUTE_'. + * Selected GCC attributes; see: + https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html + https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html + https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html + These names begin with 'ATTRIBUTE_' to avoid name clashes. */ + + +/* =============== Attributes for specific kinds of functions =============== */ + +/* Attributes for functions that should not be used. */ + +/* Warn if the entity is used. */ +/* Applies to: + - function, variable, + - struct, union, struct/union member, + - enumeration, enumeration item, + - typedef, + in C++ also: namespace, class, template specialization. */ +#define DEPRECATED _GL_ATTRIBUTE_DEPRECATED + +/* If a function call is not optimized way, warn with MSG. */ +/* Applies to: functions. */ +#define ATTRIBUTE_WARNING(msg) _GL_ATTRIBUTE_WARNING (msg) + +/* If a function call is not optimized way, report an error with MSG. */ +/* Applies to: functions. */ +#define ATTRIBUTE_ERROR(msg) _GL_ATTRIBUTE_ERROR (msg) + + +/* Attributes for memory-allocating functions. */ + +/* The function returns a pointer to freshly allocated memory. */ +/* Applies to: functions. */ +#define ATTRIBUTE_MALLOC _GL_ATTRIBUTE_MALLOC + +/* ATTRIBUTE_ALLOC_SIZE ((N)) - The Nth argument of the function + is the size of the returned memory block. + ATTRIBUTE_ALLOC_SIZE ((M, N)) - Multiply the Mth and Nth arguments + to determine the size of the returned memory block. */ +/* Applies to: function, pointer to function, function types. */ +#define ATTRIBUTE_ALLOC_SIZE(args) _GL_ATTRIBUTE_ALLOC_SIZE (args) + + +/* Attributes for variadic functions. */ + +/* The variadic function expects a trailing NULL argument. + ATTRIBUTE_SENTINEL () - The last argument is NULL (requires C99). + ATTRIBUTE_SENTINEL ((N)) - The (N+1)st argument from the end is NULL. */ +/* Applies to: functions. */ +#define ATTRIBUTE_SENTINEL(pos) _GL_ATTRIBUTE_SENTINEL (pos) + + +/* ================== Attributes for compiler diagnostics ================== */ + +/* Attributes that help the compiler diagnose programmer mistakes. + Some of them may also help for some compiler optimizations. */ + +/* ATTRIBUTE_FORMAT ((ARCHETYPE, STRING-INDEX, FIRST-TO-CHECK)) - + The STRING-INDEXth function argument is a format string of style + ARCHETYPE, which is one of: + printf, gnu_printf + scanf, gnu_scanf, + strftime, gnu_strftime, + strfmon, + or the same thing prefixed and suffixed with '__'. + If FIRST-TO-CHECK is not 0, arguments starting at FIRST-TO_CHECK + are suitable for the format string. */ +/* Applies to: functions. */ +#define ATTRIBUTE_FORMAT(spec) _GL_ATTRIBUTE_FORMAT (spec) + +/* ATTRIBUTE_NONNULL ((N1, N2,...)) - Arguments N1, N2,... must not be NULL. + ATTRIBUTE_NONNULL () - All pointer arguments must not be null. */ +/* Applies to: functions. */ +#define ATTRIBUTE_NONNULL(args) _GL_ATTRIBUTE_NONNULL (args) + +/* The function's return value is a non-NULL pointer. */ +/* Applies to: functions. */ +#define ATTRIBUTE_RETURNS_NONNULL _GL_ATTRIBUTE_RETURNS_NONNULL + +/* Warn if the caller does not use the return value, + unless the caller uses something like ignore_value. */ +/* Applies to: function, enumeration, class. */ +#define NODISCARD _GL_ATTRIBUTE_NODISCARD + + +/* Attributes that disable false alarms when the compiler diagnoses + programmer "mistakes". */ + +/* Do not warn if the entity is not used. */ +/* Applies to: + - function, variable, + - struct, union, struct/union member, + - enumeration, enumeration item, + - typedef, + in C++ also: class. */ +#define MAYBE_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED + +/* The contents of a character array is not meant to be NUL-terminated. */ +/* Applies to: struct/union members and variables that are arrays of element + type '[[un]signed] char'. */ +#define ATTRIBUTE_NONSTRING _GL_ATTRIBUTE_NONSTRING + +/* Do not warn if control flow falls through to the immediately + following 'case' or 'default' label. */ +/* Applies to: Empty statement (;), inside a 'switch' statement. */ +#define FALLTHROUGH _GL_ATTRIBUTE_FALLTHROUGH + + +/* ================== Attributes for debugging information ================== */ + +/* Attributes regarding debugging information emitted by the compiler. */ + +/* Omit the function from stack traces when debugging. */ +/* Applies to: function. */ +#define ATTRIBUTE_ARTIFICIAL _GL_ATTRIBUTE_ARTIFICIAL + +/* Make the entity visible to debuggers etc., even with '-fwhole-program'. */ +/* Applies to: functions, variables. */ +#define ATTRIBUTE_EXTERNALLY_VISIBLE _GL_ATTRIBUTE_EXTERNALLY_VISIBLE + + +/* ========== Attributes that mainly direct compiler optimizations ========== */ + +/* The function does not throw exceptions. */ +/* Applies to: functions. */ +#define ATTRIBUTE_NOTHROW _GL_ATTRIBUTE_NOTHROW + +/* Do not inline the function. */ +/* Applies to: functions. */ +#define ATTRIBUTE_NOINLINE _GL_ATTRIBUTE_NOINLINE + +/* Always inline the function, and report an error if the compiler + cannot inline. */ +/* Applies to: function. */ +#define ATTRIBUTE_ALWAYS_INLINE _GL_ATTRIBUTE_ALWAYS_INLINE + +/* It is OK for a compiler to omit duplicate calls with the same arguments. + This attribute is safe for a function that neither depends on + nor affects observable state, and always returns exactly once - + e.g., does not loop forever, and does not call longjmp. + (This attribute is stricter than ATTRIBUTE_PURE.) */ +/* Applies to: functions. */ +#define ATTRIBUTE_CONST _GL_ATTRIBUTE_CONST + +/* It is OK for a compiler to omit duplicate calls with the same + arguments if observable state is not changed between calls. + This attribute is safe for a function that does not affect + observable state, and always returns exactly once. + (This attribute is looser than ATTRIBUTE_CONST.) */ +/* Applies to: functions. */ +#define ATTRIBUTE_PURE _GL_ATTRIBUTE_PURE + +/* The function is rarely executed. */ +/* Applies to: functions. */ +#define ATTRIBUTE_COLD _GL_ATTRIBUTE_COLD + +/* If called from some other compilation unit, the function executes + code from that unit only by return or by exception handling, + letting the compiler optimize that unit more aggressively. */ +/* Applies to: functions. */ +#define ATTRIBUTE_LEAF _GL_ATTRIBUTE_LEAF + +/* For struct members: The member has the smallest possible alignment. + For struct, union, class: All members have the smallest possible alignment, + minimizing the memory required. */ +/* Applies to: struct members, struct, union, + in C++ also: class. */ +#define ATTRIBUTE_PACKED _GL_ATTRIBUTE_PACKED + + +/* ================ Attributes that make invalid code valid ================ */ + +/* Attributes that prevent fatal compiler optimizations for code that is not + fully ISO C compliant. */ + +/* Pointers to the type may point to the same storage as pointers to + other types, thus disabling strict aliasing optimization. */ +/* Applies to: types. */ +#define ATTRIBUTE_MAY_ALIAS _GL_ATTRIBUTE_MAY_ALIAS + + +#endif /* _GL_ATTRIBUTE_H */ diff --git a/gnulib-lib/basename-lgpl.c b/gnulib-lib/basename-lgpl.c new file mode 100644 index 0000000..5dbd157 --- /dev/null +++ b/gnulib-lib/basename-lgpl.c @@ -0,0 +1,71 @@ +/* basename.c -- return the last element in a file name + + Copyright (C) 1990, 1998-2001, 2003-2006, 2009-2021 Free Software + Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include "basename-lgpl.h" + +#include +#include + +#include "filename.h" + +char * +last_component (char const *name) +{ + char const *base = name + FILE_SYSTEM_PREFIX_LEN (name); + char const *p; + bool last_was_slash = false; + + while (ISSLASH (*base)) + base++; + + for (p = base; *p; p++) + { + if (ISSLASH (*p)) + last_was_slash = true; + else if (last_was_slash) + { + base = p; + last_was_slash = false; + } + } + + return (char *) base; +} + +size_t +base_len (char const *name) +{ + size_t len; + size_t prefix_len = FILE_SYSTEM_PREFIX_LEN (name); + + for (len = strlen (name); 1 < len && ISSLASH (name[len - 1]); len--) + continue; + + if (DOUBLE_SLASH_IS_DISTINCT_ROOT && len == 1 + && ISSLASH (name[0]) && ISSLASH (name[1]) && ! name[2]) + return 2; + + if (FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE && prefix_len + && len == prefix_len && ISSLASH (name[prefix_len])) + return prefix_len + 1; + + return len; +} diff --git a/gnulib-lib/basename-lgpl.h b/gnulib-lib/basename-lgpl.h new file mode 100644 index 0000000..d520c09 --- /dev/null +++ b/gnulib-lib/basename-lgpl.h @@ -0,0 +1,78 @@ +/* Extract the last component (base name) of a file name. + + Copyright (C) 1998, 2001, 2003-2006, 2009-2021 Free Software Foundation, + Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _BASENAME_LGPL_H +#define _BASENAME_LGPL_H + +#include + +#ifndef DOUBLE_SLASH_IS_DISTINCT_ROOT +# define DOUBLE_SLASH_IS_DISTINCT_ROOT 0 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Return the address of the last file name component of FILENAME. + If FILENAME has some trailing slash(es), they are considered to be + part of the last component. + If FILENAME has no relative file name components because it is a file + system root, return the empty string. + Examples: + FILENAME RESULT + "foo.c" "foo.c" + "foo/bar.c" "bar.c" + "/foo/bar.c" "bar.c" + "foo/bar/" "bar/" + "foo/bar//" "bar//" + "/" "" + "//" "" + "" "" + The return value is a tail of the given FILENAME; do NOT free() it! */ + +/* This function was traditionally called 'basename', but we avoid this + function name because + * Various platforms have different functions in their libc. + In particular, the glibc basename(), defined in , does + not consider trailing slashes to be part of the component: + FILENAME RESULT + "foo/bar/" "" + "foo/bar//" "" + * The 'basename' command eliminates trailing slashes and for a root + produces a non-empty result: + FILENAME RESULT + "foo/bar/" "bar" + "foo/bar//" "bar" + "/" "/" + "//" "/" + */ +extern char *last_component (char const *filename) _GL_ATTRIBUTE_PURE; + +/* Return the length of the basename FILENAME. + Typically FILENAME is the value returned by base_name or last_component. + Act like strlen (FILENAME), except omit all trailing slashes. */ +extern size_t base_len (char const *filename) _GL_ATTRIBUTE_PURE; + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* _BASENAME_LGPL_H */ diff --git a/gnulib-lib/c++defs.h b/gnulib-lib/c++defs.h new file mode 100644 index 0000000..a47b61a --- /dev/null +++ b/gnulib-lib/c++defs.h @@ -0,0 +1,331 @@ +/* C++ compatible function declaration macros. + Copyright (C) 2010-2021 Free Software Foundation, Inc. + + This program 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 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _GL_CXXDEFS_H +#define _GL_CXXDEFS_H + +/* Begin/end the GNULIB_NAMESPACE namespace. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_BEGIN_NAMESPACE namespace GNULIB_NAMESPACE { +# define _GL_END_NAMESPACE } +#else +# define _GL_BEGIN_NAMESPACE +# define _GL_END_NAMESPACE +#endif + +/* The three most frequent use cases of these macros are: + + * For providing a substitute for a function that is missing on some + platforms, but is declared and works fine on the platforms on which + it exists: + + #if @GNULIB_FOO@ + # if !@HAVE_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on all platforms, + but is broken/insufficient and needs to be replaced on some platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif + + * For providing a replacement for a function that exists on some platforms + but is broken/insufficient and needs to be replaced on some of them and + is additionally either missing or undeclared on some other platforms: + + #if @GNULIB_FOO@ + # if @REPLACE_FOO@ + # if !(defined __cplusplus && defined GNULIB_NAMESPACE) + # undef foo + # define foo rpl_foo + # endif + _GL_FUNCDECL_RPL (foo, ...); + _GL_CXXALIAS_RPL (foo, ...); + # else + # if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@ + _GL_FUNCDECL_SYS (foo, ...); + # endif + _GL_CXXALIAS_SYS (foo, ...); + # endif + _GL_CXXALIASWARN (foo); + #elif defined GNULIB_POSIXCHECK + ... + #endif +*/ + +/* _GL_EXTERN_C declaration; + performs the declaration with C linkage. */ +#if defined __cplusplus +# define _GL_EXTERN_C extern "C" +#else +# define _GL_EXTERN_C extern +#endif + +/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes); + declares a replacement function, named rpl_func, with the given prototype, + consisting of return type, parameters, and attributes. + Example: + _GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); + */ +#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \ + _GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes) +#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C rettype rpl_func parameters_and_attributes + +/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes); + declares the system function, named func, with the given prototype, + consisting of return type, parameters, and attributes. + Example: + _GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); + */ +#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C rettype func parameters_and_attributes + +/* _GL_CXXALIAS_RPL (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to rpl_func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); + + Wrapping rpl_func in an object with an inline conversion operator + avoids a reference to rpl_func unless GNULIB_NAMESPACE::func is + actually used in the program. */ +#define _GL_CXXALIAS_RPL(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters) +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::rpl_func; \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_MDA (func, rettype, parameters); + is to be used when func is a Microsoft deprecated alias, on native Windows. + It declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to _func, if GNULIB_NAMESPACE is defined. + Example: + _GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); + */ +#define _GL_CXXALIAS_MDA(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_1 (func, _##func, rettype, parameters) + +/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters); + is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters); + except that the C function rpl_func may have a slightly different + declaration. A cast is used to silence the "invalid conversion" error + that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::rpl_func); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_MDA_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_MDA (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#define _GL_CXXALIAS_MDA_CAST(func,rettype,parameters) \ + _GL_CXXALIAS_RPL_CAST_1 (func, _##func, rettype, parameters) + +/* _GL_CXXALIAS_SYS (func, rettype, parameters); + declares a C++ alias called GNULIB_NAMESPACE::func + that redirects to the system provided function func, if GNULIB_NAMESPACE + is defined. + Example: + _GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); + + Wrapping func in an object with an inline conversion operator + avoids a reference to func unless GNULIB_NAMESPACE::func is + actually used in the program. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return ::func; \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function func may have a slightly different declaration. + A cast is used to silence the "invalid conversion" error that would + otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast(::func); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2); + is like _GL_CXXALIAS_SYS (func, rettype, parameters); + except that the C function is picked among a set of overloaded functions, + namely the one with rettype2 and parameters2. Two consecutive casts + are used to silence the "cannot find a match" and "invalid conversion" + errors that would otherwise occur. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE + /* The outer cast must be a reinterpret_cast. + The inner cast: When the function is defined as a set of overloaded + functions, it works as a static_cast<>, choosing the designated variant. + When the function is defined as a single variant, it works as a + reinterpret_cast<>. The parenthesized cast syntax works both ways. */ +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + namespace GNULIB_NAMESPACE \ + { \ + static const struct _gl_ ## func ## _wrapper \ + { \ + typedef rettype (*type) parameters; \ + \ + inline operator type () const \ + { \ + return reinterpret_cast((rettype2 (*) parameters2)(::func)); \ + } \ + } func = {}; \ + } \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#else +# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN (func); + causes a warning to be emitted when ::func is used but not when + GNULIB_NAMESPACE::func is used. func must be defined without overloaded + variants. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN(func) \ + _GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN_1(func,namespace) \ + _GL_CXXALIASWARN_2 (func, namespace) +/* To work around GCC bug , + we enable the warning only when not optimizing. */ +# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_WARN_ON_USE (func, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +# define _GL_CXXALIASWARN_2(func,namespace) \ + extern __typeof__ (func) func +# else +# define _GL_CXXALIASWARN_2(func,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN(func) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes); + causes a warning to be emitted when the given overloaded variant of ::func + is used but not when GNULIB_NAMESPACE::func is used. */ +#if defined __cplusplus && defined GNULIB_NAMESPACE +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \ + GNULIB_NAMESPACE) +# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \ + _GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace) +/* To work around GCC bug , + we enable the warning only when not optimizing. */ +# if !(defined __GNUC__ && !defined __clang__ && __OPTIMIZE__) +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_WARN_ON_USE_CXX (func, rettype, rettype, parameters_and_attributes, \ + "The symbol ::" #func " refers to the system function. " \ + "Use " #namespace "::" #func " instead.") +# else +# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +# endif +#else +# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \ + _GL_EXTERN_C int _gl_cxxalias_dummy +#endif + +#endif /* _GL_CXXDEFS_H */ diff --git a/gnulib-lib/clean-temp-private.h b/gnulib-lib/clean-temp-private.h new file mode 100644 index 0000000..8a34e46 --- /dev/null +++ b/gnulib-lib/clean-temp-private.h @@ -0,0 +1,82 @@ +/* Private interface between modules 'clean-temp-simple' and 'clean-temp'. + Copyright (C) 2006-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _CLEAN_TEMP_PRIVATE_H +#define _CLEAN_TEMP_PRIVATE_H + +#include +#include +#include "gl_list.h" +#include "asyncsafe-spin.h" + +/* The use of 'volatile' in the types below (and ISO C 99 section 5.1.2.3.(5)) + ensure that while constructing or modifying the data structures, the field + values are written to memory in the order of the C statements. So the + signal handler can rely on these field values to be up to date. */ + +/* Registry for a single temporary directory. + 'struct temp_dir' from the public header file overlaps with this. */ +struct tempdir +{ + /* The absolute pathname of the directory. */ + char * volatile dirname; + /* Whether errors during explicit cleanup are reported to standard error. */ + bool cleanup_verbose; + /* Absolute pathnames of subdirectories. */ + gl_list_t /* */ volatile subdirs; + /* Absolute pathnames of files. */ + gl_list_t /* */ volatile files; +}; + +/* List of all temporary directories. */ +struct all_tempdirs +{ + struct tempdir * volatile * volatile tempdir_list; + size_t volatile tempdir_count; + size_t tempdir_allocated; +}; +#define dir_cleanup_list clean_temp_dir_cleanup_list +extern struct all_tempdirs dir_cleanup_list; + +/* A file descriptor to be closed. + In multithreaded programs, it is forbidden to close the same fd twice, + because you never know what unrelated open() calls are being executed in + other threads. So, the 'close (fd)' must be guarded by a once-only guard. */ +struct closeable_fd +{ + /* The file descriptor to close. */ + int volatile fd; + /* Set to true when it has been closed. */ + bool volatile closed; + /* Lock that protects the fd from being closed twice. */ + asyncsafe_spinlock_t lock; + /* Tells whether this list element has been done and can be freed. */ + bool volatile done; +}; +#define descriptors clean_temp_descriptors +extern gl_list_t /* */ volatile descriptors; + +extern bool clean_temp_string_equals (const void *x1, const void *x2); +extern size_t clean_temp_string_hash (const void *x); + +extern _GL_ASYNC_SAFE int clean_temp_asyncsafe_close (struct closeable_fd *element); +extern void clean_temp_init_asyncsafe_close (void); + +extern int clean_temp_init (void); + +extern int clean_temp_unlink (const char *absolute_file_name, bool cleanup_verbose); + +#endif /* _CLEAN_TEMP_PRIVATE_H */ diff --git a/gnulib-lib/clean-temp-simple.c b/gnulib-lib/clean-temp-simple.c new file mode 100644 index 0000000..4a9c427 --- /dev/null +++ b/gnulib-lib/clean-temp-simple.c @@ -0,0 +1,401 @@ +/* Temporary files with automatic cleanup. + Copyright (C) 2006-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include "clean-temp-simple.h" +#include "clean-temp-private.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "error.h" +#include "fatal-signal.h" +#include "asyncsafe-spin.h" +#include "glthread/lock.h" +#include "thread-optim.h" +#include "gl_list.h" +#include "gl_linkedhash_list.h" +#include "gettext.h" + +#define _(str) gettext (str) + + +/* Lock that protects the file_cleanup_list from concurrent modification in + different threads. */ +gl_lock_define_initialized (static, file_cleanup_list_lock) + +/* List of all temporary files without temporary directories. */ +static gl_list_t /* */ volatile file_cleanup_list; + + +/* List of all temporary directories. */ +struct all_tempdirs dir_cleanup_list /* = { NULL, 0, 0 } */; + + +/* List of all open file descriptors to temporary files. */ +gl_list_t /* */ volatile descriptors; + + +/* For the subdirs and for the files, we use a gl_list_t of type LINKEDHASH. + Why? We need a data structure that + + 1) Can contain an arbitrary number of 'char *' values. The strings + are compared via strcmp, not pointer comparison. + 2) Has insertion and deletion operations that are fast: ideally O(1), + or possibly O(log n). This is important for GNU sort, which may + create a large number of temporary files. + 3) Allows iteration through all elements from within a signal handler. + 4) May or may not allow duplicates. It doesn't matter here, since + any file or subdir can only be removed once. + + Criterion 1) would allow any gl_list_t or gl_oset_t implementation. + + Criterion 2) leaves only GL_LINKEDHASH_LIST, GL_TREEHASH_LIST, or + GL_TREE_OSET. + + Criterion 3) puts at disadvantage GL_TREEHASH_LIST and GL_TREE_OSET. + Namely, iteration through the elements of a binary tree requires access + to many ->left, ->right, ->parent pointers. However, the rebalancing + code for insertion and deletion in an AVL or red-black tree is so + complicated that we cannot assume that >left, ->right, ->parent pointers + are in a consistent state throughout these operations. Therefore, to + avoid a crash in the signal handler, all destructive operations to the + lists would have to be protected by a + block_fatal_signals (); + ... + unblock_fatal_signals (); + pair. Which causes extra system calls. + + Criterion 3) would also discourage GL_ARRAY_LIST and GL_CARRAY_LIST, + if they were not already excluded. Namely, these implementations use + xrealloc(), leaving a time window in which in the list->elements pointer + points to already deallocated memory. To avoid a crash in the signal + handler at such a moment, all destructive operations would have to + protected by block/unblock_fatal_signals (), in this case too. + + A list of type GL_LINKEDHASH_LIST without duplicates fulfills all + requirements: + 2) Insertion and deletion are O(1) on average. + 3) The gl_list_iterator, gl_list_iterator_next implementations do + not trigger memory allocations, nor other system calls, and are + therefore safe to be called from a signal handler. + Furthermore, since SIGNAL_SAFE_LIST is defined, the implementation + of the destructive functions ensures that the list structure is + safe to be traversed at any moment, even when interrupted by an + asynchronous signal. + */ + +/* String equality and hash code functions used by the lists. */ + +bool +clean_temp_string_equals (const void *x1, const void *x2) +{ + const char *s1 = (const char *) x1; + const char *s2 = (const char *) x2; + return strcmp (s1, s2) == 0; +} + +#define SIZE_BITS (sizeof (size_t) * CHAR_BIT) + +/* A hash function for NUL-terminated char* strings using + the method described by Bruno Haible. + See https://www.haible.de/bruno/hashfunc.html. */ +size_t +clean_temp_string_hash (const void *x) +{ + const char *s = (const char *) x; + size_t h = 0; + + for (; *s; s++) + h = *s + ((h << 9) | (h >> (SIZE_BITS - 9))); + + return h; +} + + +/* The set of fatal signal handlers. + Cached here because we are not allowed to call get_fatal_signal_set () + from a signal handler. */ +static const sigset_t *fatal_signal_set /* = NULL */; + +static void +init_fatal_signal_set (void) +{ + if (fatal_signal_set == NULL) + fatal_signal_set = get_fatal_signal_set (); +} + + +/* Close a file descriptor. + Avoids race conditions with normal thread code or signal-handler code that + might want to close the same file descriptor. */ +_GL_ASYNC_SAFE int +clean_temp_asyncsafe_close (struct closeable_fd *element) +{ + sigset_t saved_mask; + int ret; + int saved_errno; + + asyncsafe_spin_lock (&element->lock, fatal_signal_set, &saved_mask); + if (!element->closed) + { + ret = close (element->fd); + saved_errno = errno; + element->closed = true; + } + else + { + ret = 0; + saved_errno = 0; + } + asyncsafe_spin_unlock (&element->lock, &saved_mask); + element->done = true; + + errno = saved_errno; + return ret; +} +/* Initializations for use of this function. */ +void +clean_temp_init_asyncsafe_close (void) +{ + init_fatal_signal_set (); +} + +/* The signal handler. It gets called asynchronously. */ +static _GL_ASYNC_SAFE void +cleanup_action (int sig _GL_UNUSED) +{ + size_t i; + + /* First close all file descriptors to temporary files. */ + { + gl_list_t fds = descriptors; + + if (fds != NULL) + { + gl_list_iterator_t iter; + const void *element; + + iter = gl_list_iterator (fds); + while (gl_list_iterator_next (&iter, &element, NULL)) + { + clean_temp_asyncsafe_close ((struct closeable_fd *) element); + } + gl_list_iterator_free (&iter); + } + } + + { + gl_list_t files = file_cleanup_list; + + if (files != NULL) + { + gl_list_iterator_t iter; + const void *element; + + iter = gl_list_iterator (files); + while (gl_list_iterator_next (&iter, &element, NULL)) + { + const char *file = (const char *) element; + unlink (file); + } + gl_list_iterator_free (&iter); + } + } + + for (i = 0; i < dir_cleanup_list.tempdir_count; i++) + { + struct tempdir *dir = dir_cleanup_list.tempdir_list[i]; + + if (dir != NULL) + { + gl_list_iterator_t iter; + const void *element; + + /* First cleanup the files in the subdirectories. */ + iter = gl_list_iterator (dir->files); + while (gl_list_iterator_next (&iter, &element, NULL)) + { + const char *file = (const char *) element; + unlink (file); + } + gl_list_iterator_free (&iter); + + /* Then cleanup the subdirectories. */ + iter = gl_list_iterator (dir->subdirs); + while (gl_list_iterator_next (&iter, &element, NULL)) + { + const char *subdir = (const char *) element; + rmdir (subdir); + } + gl_list_iterator_free (&iter); + + /* Then cleanup the temporary directory itself. */ + rmdir (dir->dirname); + } + } +} + + +/* Set to -1 if initialization of this facility failed. */ +static int volatile init_failed /* = 0 */; + +/* Initializes this facility. */ +static void +do_clean_temp_init (void) +{ + /* Initialize the data used by the cleanup handler. */ + init_fatal_signal_set (); + /* Register the cleanup handler. */ + if (at_fatal_signal (&cleanup_action) < 0) + init_failed = -1; +} + +/* Ensure that do_clean_temp_init is called once only. */ +gl_once_define(static, clean_temp_once) + +/* Initializes this facility upon first use. + Return 0 upon success, or -1 if there was a memory allocation problem. */ +int +clean_temp_init (void) +{ + gl_once (clean_temp_once, do_clean_temp_init); + return init_failed; +} + + +/* Remove a file, with optional error message. + Return 0 upon success, or -1 if there was some problem. */ +int +clean_temp_unlink (const char *absolute_file_name, bool cleanup_verbose) +{ + if (unlink (absolute_file_name) < 0 && cleanup_verbose + && errno != ENOENT) + { + error (0, errno, + _("cannot remove temporary file %s"), absolute_file_name); + return -1; + } + return 0; +} + + +/* ============= Temporary files without temporary directories ============= */ + +/* Register the given ABSOLUTE_FILE_NAME as being a file that needs to be + removed. + Should be called before the file ABSOLUTE_FILE_NAME is created. + Return 0 upon success, or -1 if there was a memory allocation problem. */ +int +register_temporary_file (const char *absolute_file_name) +{ + bool mt = gl_multithreaded (); + + if (mt) gl_lock_lock (file_cleanup_list_lock); + + int ret = 0; + + /* Make sure that this facility and the file_cleanup_list are initialized. */ + if (file_cleanup_list == NULL) + { + if (clean_temp_init () < 0) + { + ret = -1; + goto done; + } + file_cleanup_list = + gl_list_nx_create_empty (GL_LINKEDHASH_LIST, + clean_temp_string_equals, + clean_temp_string_hash, + NULL, false); + if (file_cleanup_list == NULL) + { + ret = -1; + goto done; + } + } + + /* Add absolute_file_name to file_cleanup_list, without duplicates. */ + if (gl_list_search (file_cleanup_list, absolute_file_name) == NULL) + { + char *absolute_file_name_copy = strdup (absolute_file_name); + if (absolute_file_name_copy == NULL) + { + ret = -1; + goto done; + } + if (gl_list_nx_add_first (file_cleanup_list, absolute_file_name_copy) + == NULL) + { + free (absolute_file_name_copy); + ret = -1; + goto done; + } + } + + done: + if (mt) gl_lock_unlock (file_cleanup_list_lock); + + return ret; +} + +/* Unregister the given ABSOLUTE_FILE_NAME as being a file that needs to be + removed. + Should be called when the file ABSOLUTE_FILE_NAME could not be created. */ +void +unregister_temporary_file (const char *absolute_file_name) +{ + bool mt = gl_multithreaded (); + + if (mt) gl_lock_lock (file_cleanup_list_lock); + + gl_list_t list = file_cleanup_list; + if (list != NULL) + { + gl_list_node_t node = gl_list_search (list, absolute_file_name); + if (node != NULL) + { + char *old_string = (char *) gl_list_node_value (list, node); + + gl_list_remove_node (list, node); + free (old_string); + } + } + + if (mt) gl_lock_unlock (file_cleanup_list_lock); +} + +/* Remove the given ABSOLUTE_FILE_NAME and unregister it. + CLEANUP_VERBOSE determines whether errors are reported to standard error. + Return 0 upon success, or -1 if there was some problem. */ +int +cleanup_temporary_file (const char *absolute_file_name, bool cleanup_verbose) +{ + int err; + + err = clean_temp_unlink (absolute_file_name, cleanup_verbose); + unregister_temporary_file (absolute_file_name); + + return err; +} diff --git a/gnulib-lib/clean-temp-simple.h b/gnulib-lib/clean-temp-simple.h new file mode 100644 index 0000000..95c8175 --- /dev/null +++ b/gnulib-lib/clean-temp-simple.h @@ -0,0 +1,52 @@ +/* Temporary files with automatic cleanup. + Copyright (C) 2006-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _CLEAN_TEMP_SIMPLE_H +#define _CLEAN_TEMP_SIMPLE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* See clean-temp.h for a general discussion of this module. */ + +/* Register the given ABSOLUTE_FILE_NAME as being a file that needs to be + removed. + Should be called before the file ABSOLUTE_FILE_NAME is created. + Return 0 upon success, or -1 if there was a memory allocation problem. */ +extern int register_temporary_file (const char *absolute_file_name); + +/* Unregister the given ABSOLUTE_FILE_NAME as being a file that needs to be + removed. + Should be called when the file ABSOLUTE_FILE_NAME could not be created. */ +extern void unregister_temporary_file (const char *absolute_file_name); + +/* Remove the given ABSOLUTE_FILE_NAME and unregister it. + CLEANUP_VERBOSE determines whether errors are reported to standard error. + Return 0 upon success, or -1 if there was some problem. */ +extern int cleanup_temporary_file (const char *absolute_file_name, + bool cleanup_verbose); + + +#ifdef __cplusplus +} +#endif + +#endif /* _CLEAN_TEMP_SIMPLE_H */ diff --git a/gnulib-lib/cloexec.c b/gnulib-lib/cloexec.c new file mode 100644 index 0000000..7defa93 --- /dev/null +++ b/gnulib-lib/cloexec.c @@ -0,0 +1,83 @@ +/* cloexec.c - set or clear the close-on-exec descriptor flag + + Copyright (C) 1991, 2004-2006, 2009-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* The code is taken from glibc/manual/llio.texi */ + +#include + +#include "cloexec.h" + +#include +#include +#include + +/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, + or clear the flag if VALUE is false. + Return 0 on success, or -1 on error with 'errno' set. + + Note that on MingW, this function does NOT protect DESC from being + inherited into spawned children. Instead, either use dup_cloexec + followed by closing the original DESC, or use interfaces such as + open or pipe2 that accept flags like O_CLOEXEC to create DESC + non-inheritable in the first place. */ + +int +set_cloexec_flag (int desc, bool value) +{ +#ifdef F_SETFD + + int flags = fcntl (desc, F_GETFD, 0); + + if (0 <= flags) + { + int newflags = (value ? flags | FD_CLOEXEC : flags & ~FD_CLOEXEC); + + if (flags == newflags + || fcntl (desc, F_SETFD, newflags) != -1) + return 0; + } + + return -1; + +#else /* !F_SETFD */ + + /* Use dup2 to reject invalid file descriptors; the cloexec flag + will be unaffected. */ + if (desc < 0) + { + errno = EBADF; + return -1; + } + if (dup2 (desc, desc) < 0) + /* errno is EBADF here. */ + return -1; + + /* There is nothing we can do on this kind of platform. Punt. */ + return 0; +#endif /* !F_SETFD */ +} + + +/* Duplicates a file handle FD, while marking the copy to be closed + prior to exec or spawn. Returns -1 and sets errno if FD could not + be duplicated. */ + +int +dup_cloexec (int fd) +{ + return fcntl (fd, F_DUPFD_CLOEXEC, 0); +} diff --git a/gnulib-lib/cloexec.h b/gnulib-lib/cloexec.h new file mode 100644 index 0000000..97a3659 --- /dev/null +++ b/gnulib-lib/cloexec.h @@ -0,0 +1,36 @@ +/* cloexec.c - set or clear the close-on-exec descriptor flag + + Copyright (C) 2004, 2009-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Set the 'FD_CLOEXEC' flag of DESC if VALUE is true, + or clear the flag if VALUE is false. + Return 0 on success, or -1 on error with 'errno' set. + + Note that on MingW, this function does NOT protect DESC from being + inherited into spawned children. Instead, either use dup_cloexec + followed by closing the original DESC, or use interfaces such as + open or pipe2 that accept flags like O_CLOEXEC to create DESC + non-inheritable in the first place. */ + +int set_cloexec_flag (int desc, bool value); + +/* Duplicates a file handle FD, while marking the copy to be closed + prior to exec or spawn. Returns -1 and sets errno if FD could not + be duplicated. */ + +int dup_cloexec (int fd); diff --git a/gnulib-lib/close.c b/gnulib-lib/close.c new file mode 100644 index 0000000..5b9ab6c --- /dev/null +++ b/gnulib-lib/close.c @@ -0,0 +1,75 @@ +/* close replacement. + Copyright (C) 2008-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include + +#include + +#include "fd-hook.h" +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +#endif + +#undef close + +#if defined _WIN32 && !defined __CYGWIN__ +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +static int +close_nothrow (int fd) +{ + int result; + + TRY_MSVC_INVAL + { + result = _close (fd); + } + CATCH_MSVC_INVAL + { + result = -1; + errno = EBADF; + } + DONE_MSVC_INVAL; + + return result; +} +# else +# define close_nothrow _close +# endif +#else +# define close_nothrow close +#endif + +/* Override close() to call into other gnulib modules. */ + +int +rpl_close (int fd) +{ +#if WINDOWS_SOCKETS + int retval = execute_all_close_hooks (close_nothrow, fd); +#else + int retval = close_nothrow (fd); +#endif + +#if REPLACE_FCHDIR + if (retval >= 0) + _gl_unregister_fd (fd); +#endif + + return retval; +} diff --git a/gnulib-lib/dup2.c b/gnulib-lib/dup2.c new file mode 100644 index 0000000..53e5552 --- /dev/null +++ b/gnulib-lib/dup2.c @@ -0,0 +1,189 @@ +/* Duplicate an open file descriptor to a specified file descriptor. + + Copyright (C) 1999, 2004-2007, 2009-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* written by Paul Eggert */ + +#include + +/* Specification. */ +#include + +#include +#include + +#undef dup2 + +#if defined _WIN32 && ! defined __CYGWIN__ + +/* Get declarations of the native Windows API functions. */ +# define WIN32_LEAN_AND_MEAN +# include + +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +# endif + +/* Get _get_osfhandle. */ +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include +# endif + +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +static int +dup2_nothrow (int fd, int desired_fd) +{ + int result; + + TRY_MSVC_INVAL + { + result = _dup2 (fd, desired_fd); + } + CATCH_MSVC_INVAL + { + errno = EBADF; + result = -1; + } + DONE_MSVC_INVAL; + + return result; +} +# else +# define dup2_nothrow _dup2 +# endif + +static int +ms_windows_dup2 (int fd, int desired_fd) +{ + int result; + + /* If fd is closed, mingw hangs on dup2 (fd, fd). If fd is open, + dup2 (fd, fd) returns 0, but all further attempts to use fd in + future dup2 calls will hang. */ + if (fd == desired_fd) + { + if ((HANDLE) _get_osfhandle (fd) == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + return fd; + } + + /* Wine 1.0.1 return 0 when desired_fd is negative but not -1: + https://bugs.winehq.org/show_bug.cgi?id=21289 */ + if (desired_fd < 0) + { + errno = EBADF; + return -1; + } + + result = dup2_nothrow (fd, desired_fd); + + if (result == 0) + result = desired_fd; + + return result; +} + +# define dup2 ms_windows_dup2 + +#elif defined __KLIBC__ + +# include + +static int +klibc_dup2dirfd (int fd, int desired_fd) +{ + int tempfd; + int dupfd; + + tempfd = open ("NUL", O_RDONLY); + if (tempfd == -1) + return -1; + + if (tempfd == desired_fd) + { + close (tempfd); + + char path[_MAX_PATH]; + if (__libc_Back_ioFHToPath (fd, path, sizeof (path))) + return -1; + + return open(path, O_RDONLY); + } + + dupfd = klibc_dup2dirfd (fd, desired_fd); + + close (tempfd); + + return dupfd; +} + +static int +klibc_dup2 (int fd, int desired_fd) +{ + int dupfd; + struct stat sbuf; + + dupfd = dup2 (fd, desired_fd); + if (dupfd == -1 && errno == ENOTSUP \ + && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + close (desired_fd); + + return klibc_dup2dirfd (fd, desired_fd); + } + + return dupfd; +} + +# define dup2 klibc_dup2 +#endif + +int +rpl_dup2 (int fd, int desired_fd) +{ + int result; + +#ifdef F_GETFL + /* On Linux kernels 2.6.26-2.6.29, dup2 (fd, fd) returns -EBADF. + On Cygwin 1.5.x, dup2 (1, 1) returns 0. + On Cygwin 1.7.17, dup2 (1, -1) dumps core. + On Cygwin 1.7.25, dup2 (1, 256) can dump core. + On Haiku, dup2 (fd, fd) mistakenly clears FD_CLOEXEC. */ +# if HAVE_SETDTABLESIZE + setdtablesize (desired_fd + 1); +# endif + if (desired_fd < 0) + fd = desired_fd; + if (fd == desired_fd) + return fcntl (fd, F_GETFL) == -1 ? -1 : fd; +#endif + + result = dup2 (fd, desired_fd); + + /* Correct an errno value on FreeBSD 6.1 and Cygwin 1.5.x. */ + if (result == -1 && errno == EMFILE) + errno = EBADF; +#if REPLACE_FCHDIR + if (fd != desired_fd && result != -1) + result = _gl_register_dup (fd, result); +#endif + return result; +} diff --git a/gnulib-lib/errno.in.h b/gnulib-lib/errno.in.h new file mode 100644 index 0000000..3cad9e2 --- /dev/null +++ b/gnulib-lib/errno.in.h @@ -0,0 +1,279 @@ +/* A POSIX-like . + + Copyright (C) 2008-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _@GUARD_PREFIX@_ERRNO_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_ERRNO_H@ + +#ifndef _@GUARD_PREFIX@_ERRNO_H +#define _@GUARD_PREFIX@_ERRNO_H + + +/* On native Windows platforms, many macros are not defined. */ +# if defined _WIN32 && ! defined __CYGWIN__ + +/* These are the same values as defined by MSVC 10, for interoperability. */ + +# ifndef ENOMSG +# define ENOMSG 122 +# define GNULIB_defined_ENOMSG 1 +# endif + +# ifndef EIDRM +# define EIDRM 111 +# define GNULIB_defined_EIDRM 1 +# endif + +# ifndef ENOLINK +# define ENOLINK 121 +# define GNULIB_defined_ENOLINK 1 +# endif + +# ifndef EPROTO +# define EPROTO 134 +# define GNULIB_defined_EPROTO 1 +# endif + +# ifndef EBADMSG +# define EBADMSG 104 +# define GNULIB_defined_EBADMSG 1 +# endif + +# ifndef EOVERFLOW +# define EOVERFLOW 132 +# define GNULIB_defined_EOVERFLOW 1 +# endif + +# ifndef ENOTSUP +# define ENOTSUP 129 +# define GNULIB_defined_ENOTSUP 1 +# endif + +# ifndef ENETRESET +# define ENETRESET 117 +# define GNULIB_defined_ENETRESET 1 +# endif + +# ifndef ECONNABORTED +# define ECONNABORTED 106 +# define GNULIB_defined_ECONNABORTED 1 +# endif + +# ifndef ECANCELED +# define ECANCELED 105 +# define GNULIB_defined_ECANCELED 1 +# endif + +# ifndef EOWNERDEAD +# define EOWNERDEAD 133 +# define GNULIB_defined_EOWNERDEAD 1 +# endif + +# ifndef ENOTRECOVERABLE +# define ENOTRECOVERABLE 127 +# define GNULIB_defined_ENOTRECOVERABLE 1 +# endif + +# ifndef EINPROGRESS +# define EINPROGRESS 112 +# define EALREADY 103 +# define ENOTSOCK 128 +# define EDESTADDRREQ 109 +# define EMSGSIZE 115 +# define EPROTOTYPE 136 +# define ENOPROTOOPT 123 +# define EPROTONOSUPPORT 135 +# define EOPNOTSUPP 130 +# define EAFNOSUPPORT 102 +# define EADDRINUSE 100 +# define EADDRNOTAVAIL 101 +# define ENETDOWN 116 +# define ENETUNREACH 118 +# define ECONNRESET 108 +# define ENOBUFS 119 +# define EISCONN 113 +# define ENOTCONN 126 +# define ETIMEDOUT 138 +# define ECONNREFUSED 107 +# define ELOOP 114 +# define EHOSTUNREACH 110 +# define EWOULDBLOCK 140 +# define GNULIB_defined_ESOCK 1 +# endif + +# ifndef ETXTBSY +# define ETXTBSY 139 +# define ENODATA 120 /* not required by POSIX */ +# define ENOSR 124 /* not required by POSIX */ +# define ENOSTR 125 /* not required by POSIX */ +# define ETIME 137 /* not required by POSIX */ +# define EOTHER 131 /* not required by POSIX */ +# define GNULIB_defined_ESTREAMS 1 +# endif + +/* These are intentionally the same values as the WSA* error numbers, defined + in . */ +# define ESOCKTNOSUPPORT 10044 /* not required by POSIX */ +# define EPFNOSUPPORT 10046 /* not required by POSIX */ +# define ESHUTDOWN 10058 /* not required by POSIX */ +# define ETOOMANYREFS 10059 /* not required by POSIX */ +# define EHOSTDOWN 10064 /* not required by POSIX */ +# define EPROCLIM 10067 /* not required by POSIX */ +# define EUSERS 10068 /* not required by POSIX */ +# define EDQUOT 10069 +# define ESTALE 10070 +# define EREMOTE 10071 /* not required by POSIX */ +# define GNULIB_defined_EWINSOCK 1 + +# endif + + +/* On OSF/1 5.1, when _XOPEN_SOURCE_EXTENDED is not defined, the macros + EMULTIHOP, ENOLINK, EOVERFLOW are not defined. */ +# if @EMULTIHOP_HIDDEN@ +# define EMULTIHOP @EMULTIHOP_VALUE@ +# define GNULIB_defined_EMULTIHOP 1 +# endif +# if @ENOLINK_HIDDEN@ +# define ENOLINK @ENOLINK_VALUE@ +# define GNULIB_defined_ENOLINK 1 +# endif +# if @EOVERFLOW_HIDDEN@ +# define EOVERFLOW @EOVERFLOW_VALUE@ +# define GNULIB_defined_EOVERFLOW 1 +# endif + + +/* On OpenBSD 4.0 and on native Windows, the macros ENOMSG, EIDRM, ENOLINK, + EPROTO, EMULTIHOP, EBADMSG, EOVERFLOW, ENOTSUP, ECANCELED are not defined. + Likewise, on NonStop Kernel, EDQUOT is not defined. + Define them here. Values >= 2000 seem safe to use: Solaris ESTALE = 151, + HP-UX EWOULDBLOCK = 246, IRIX EDQUOT = 1133. + + Note: When one of these systems defines some of these macros some day, + binaries will have to be recompiled so that they recognizes the new + errno values from the system. */ + +# ifndef ENOMSG +# define ENOMSG 2000 +# define GNULIB_defined_ENOMSG 1 +# endif + +# ifndef EIDRM +# define EIDRM 2001 +# define GNULIB_defined_EIDRM 1 +# endif + +# ifndef ENOLINK +# define ENOLINK 2002 +# define GNULIB_defined_ENOLINK 1 +# endif + +# ifndef EPROTO +# define EPROTO 2003 +# define GNULIB_defined_EPROTO 1 +# endif + +# ifndef EMULTIHOP +# define EMULTIHOP 2004 +# define GNULIB_defined_EMULTIHOP 1 +# endif + +# ifndef EBADMSG +# define EBADMSG 2005 +# define GNULIB_defined_EBADMSG 1 +# endif + +# ifndef EOVERFLOW +# define EOVERFLOW 2006 +# define GNULIB_defined_EOVERFLOW 1 +# endif + +# ifndef ENOTSUP +# define ENOTSUP 2007 +# define GNULIB_defined_ENOTSUP 1 +# endif + +# ifndef ENETRESET +# define ENETRESET 2011 +# define GNULIB_defined_ENETRESET 1 +# endif + +# ifndef ECONNABORTED +# define ECONNABORTED 2012 +# define GNULIB_defined_ECONNABORTED 1 +# endif + +# ifndef ESTALE +# define ESTALE 2009 +# define GNULIB_defined_ESTALE 1 +# endif + +# ifndef EDQUOT +# define EDQUOT 2010 +# define GNULIB_defined_EDQUOT 1 +# endif + +# ifndef ECANCELED +# define ECANCELED 2008 +# define GNULIB_defined_ECANCELED 1 +# endif + +/* On many platforms, the macros EOWNERDEAD and ENOTRECOVERABLE are not + defined. */ + +# ifndef EOWNERDEAD +# if defined __sun + /* Use the same values as defined for Solaris >= 8, for + interoperability. */ +# define EOWNERDEAD 58 +# define ENOTRECOVERABLE 59 +# elif defined _WIN32 && ! defined __CYGWIN__ + /* We have a conflict here: pthreads-win32 defines these values + differently than MSVC 10. It's hairy to decide which one to use. */ +# if defined __MINGW32__ && !defined USE_WINDOWS_THREADS + /* Use the same values as defined by pthreads-win32, for + interoperability. */ +# define EOWNERDEAD 43 +# define ENOTRECOVERABLE 44 +# else + /* Use the same values as defined by MSVC 10, for + interoperability. */ +# define EOWNERDEAD 133 +# define ENOTRECOVERABLE 127 +# endif +# else +# define EOWNERDEAD 2013 +# define ENOTRECOVERABLE 2014 +# endif +# define GNULIB_defined_EOWNERDEAD 1 +# define GNULIB_defined_ENOTRECOVERABLE 1 +# endif + +# ifndef EILSEQ +# define EILSEQ 2015 +# define GNULIB_defined_EILSEQ 1 +# endif + +#endif /* _@GUARD_PREFIX@_ERRNO_H */ +#endif /* _@GUARD_PREFIX@_ERRNO_H */ diff --git a/gnulib-lib/error.c b/gnulib-lib/error.c new file mode 100644 index 0000000..f89dcc5 --- /dev/null +++ b/gnulib-lib/error.c @@ -0,0 +1,411 @@ +/* Error handler for noninteractive utilities + Copyright (C) 1990-1998, 2000-2007, 2009-2021 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by David MacKenzie . */ + +#if !_LIBC +# include +#endif + +#include "error.h" + +#include +#include +#include +#include + +#if !_LIBC && ENABLE_NLS +# include "gettext.h" +# define _(msgid) gettext (msgid) +#endif + +#ifdef _LIBC +# include +# include +# include +# include +# define mbsrtowcs __mbsrtowcs +# define USE_UNLOCKED_IO 0 +# define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(a, b) +# define _GL_ARG_NONNULL(a) +#else +# include "getprogname.h" +#endif + +#if USE_UNLOCKED_IO +# include "unlocked-io.h" +#endif + +#ifndef _ +# define _(String) String +#endif + +/* If NULL, error will flush stdout, then print on stderr the program + name, a colon and a space. Otherwise, error will call this + function without parameters instead. */ +void (*error_print_progname) (void); + +/* This variable is incremented each time 'error' is called. */ +unsigned int error_message_count; + +#ifdef _LIBC +/* In the GNU C library, there is a predefined variable for this. */ + +# define program_name program_invocation_name +# include +# include +# include + +/* In GNU libc we want do not want to use the common name 'error' directly. + Instead make it a weak alias. */ +extern void __error (int status, int errnum, const char *message, ...) + __attribute__ ((__format__ (__printf__, 3, 4))); +extern void __error_at_line (int status, int errnum, const char *file_name, + unsigned int line_number, const char *message, + ...) + __attribute__ ((__format__ (__printf__, 5, 6))); +# define error __error +# define error_at_line __error_at_line + +# include +# define fflush(s) _IO_fflush (s) +# undef putc +# define putc(c, fp) _IO_putc (c, fp) + +# include + +#else /* not _LIBC */ + +# include +# include + +# if defined _WIN32 && ! defined __CYGWIN__ +/* Get declarations of the native Windows API functions. */ +# define WIN32_LEAN_AND_MEAN +# include +/* Get _get_osfhandle. */ +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include +# endif +# endif + +/* The gnulib override of fcntl is not needed in this file. */ +# undef fcntl + +# if !(GNULIB_STRERROR_R_POSIX || HAVE_DECL_STRERROR_R) +# ifndef HAVE_DECL_STRERROR_R +"this configure-time declaration test was not run" +# endif +# if STRERROR_R_CHAR_P +char *strerror_r (int errnum, char *buf, size_t buflen); +# else +int strerror_r (int errnum, char *buf, size_t buflen); +# endif +# endif + +# define program_name getprogname () + +# if GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r +# define __strerror_r strerror_r +# endif /* GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r */ +#endif /* not _LIBC */ + +#if !_LIBC +/* Return non-zero if FD is open. */ +static int +is_open (int fd) +{ +# if defined _WIN32 && ! defined __CYGWIN__ + /* On native Windows: The initial state of unassigned standard file + descriptors is that they are open but point to an INVALID_HANDLE_VALUE. + There is no fcntl, and the gnulib replacement fcntl does not support + F_GETFL. */ + return (HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE; +# else +# ifndef F_GETFL +# error Please port fcntl to your platform +# endif + return 0 <= fcntl (fd, F_GETFL); +# endif +} +#endif + +static void +flush_stdout (void) +{ +#if !_LIBC + int stdout_fd; + +# if GNULIB_FREOPEN_SAFER + /* Use of gnulib's freopen-safer module normally ensures that + fileno (stdout) == 1 + whenever stdout is open. */ + stdout_fd = STDOUT_FILENO; +# else + /* POSIX states that fileno (stdout) after fclose is unspecified. But in + practice it is not a problem, because stdout is statically allocated and + the fd of a FILE stream is stored as a field in its allocated memory. */ + stdout_fd = fileno (stdout); +# endif + /* POSIX states that fflush (stdout) after fclose is unspecified; it + is safe in glibc, but not on all other platforms. fflush (NULL) + is always defined, but too draconian. */ + if (0 <= stdout_fd && is_open (stdout_fd)) +#endif + fflush (stdout); +} + +static void +print_errno_message (int errnum) +{ + char const *s; + +#if _LIBC || GNULIB_STRERROR_R_POSIX || defined HAVE_STRERROR_R + char errbuf[1024]; +# if _LIBC || (!GNULIB_STRERROR_R_POSIX && STRERROR_R_CHAR_P) + s = __strerror_r (errnum, errbuf, sizeof errbuf); +# else + if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0) + s = errbuf; + else + s = 0; +# endif +#else + s = strerror (errnum); +#endif + +#if !_LIBC + if (! s) + s = _("Unknown system error"); +#endif + +#if _LIBC + __fxprintf (NULL, ": %s", s); +#else + fprintf (stderr, ": %s", s); +#endif +} + +static void _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) _GL_ARG_NONNULL ((3)) +error_tail (int status, int errnum, const char *message, va_list args) +{ +#if _LIBC + if (_IO_fwide (stderr, 0) > 0) + { + size_t len = strlen (message) + 1; + wchar_t *wmessage = NULL; + mbstate_t st; + size_t res; + const char *tmp; + bool use_malloc = false; + + while (1) + { + if (__libc_use_alloca (len * sizeof (wchar_t))) + wmessage = (wchar_t *) alloca (len * sizeof (wchar_t)); + else + { + if (!use_malloc) + wmessage = NULL; + + wchar_t *p = (wchar_t *) realloc (wmessage, + len * sizeof (wchar_t)); + if (p == NULL) + { + free (wmessage); + fputws_unlocked (L"out of memory\n", stderr); + return; + } + wmessage = p; + use_malloc = true; + } + + memset (&st, '\0', sizeof (st)); + tmp = message; + + res = mbsrtowcs (wmessage, &tmp, len, &st); + if (res != len) + break; + + if (__builtin_expect (len >= SIZE_MAX / sizeof (wchar_t) / 2, 0)) + { + /* This really should not happen if everything is fine. */ + res = (size_t) -1; + break; + } + + len *= 2; + } + + if (res == (size_t) -1) + { + /* The string cannot be converted. */ + if (use_malloc) + { + free (wmessage); + use_malloc = false; + } + wmessage = (wchar_t *) L"???"; + } + + __vfwprintf (stderr, wmessage, args); + + if (use_malloc) + free (wmessage); + } + else +#endif + vfprintf (stderr, message, args); + + ++error_message_count; + if (errnum) + print_errno_message (errnum); +#if _LIBC + __fxprintf (NULL, "\n"); +#else + putc ('\n', stderr); +#endif + fflush (stderr); + if (status) + exit (status); +} + + +/* Print the program name and error message MESSAGE, which is a printf-style + format string with optional args. + If ERRNUM is nonzero, print its corresponding system error message. + Exit with status STATUS if it is nonzero. */ +void +error (int status, int errnum, const char *message, ...) +{ + va_list args; + +#if defined _LIBC && defined __libc_ptf_call + /* We do not want this call to be cut short by a thread + cancellation. Therefore disable cancellation for now. */ + int state = PTHREAD_CANCEL_ENABLE; + __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), + 0); +#endif + + flush_stdout (); +#ifdef _LIBC + _IO_flockfile (stderr); +#endif + if (error_print_progname) + (*error_print_progname) (); + else + { +#if _LIBC + __fxprintf (NULL, "%s: ", program_name); +#else + fprintf (stderr, "%s: ", program_name); +#endif + } + + va_start (args, message); + error_tail (status, errnum, message, args); + va_end (args); + +#ifdef _LIBC + _IO_funlockfile (stderr); +# ifdef __libc_ptf_call + __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); +# endif +#endif +} + +/* Sometimes we want to have at most one error per line. This + variable controls whether this mode is selected or not. */ +int error_one_per_line; + +void +error_at_line (int status, int errnum, const char *file_name, + unsigned int line_number, const char *message, ...) +{ + va_list args; + + if (error_one_per_line) + { + static const char *old_file_name; + static unsigned int old_line_number; + + if (old_line_number == line_number + && (file_name == old_file_name + || (old_file_name != NULL + && file_name != NULL + && strcmp (old_file_name, file_name) == 0))) + + /* Simply return and print nothing. */ + return; + + old_file_name = file_name; + old_line_number = line_number; + } + +#if defined _LIBC && defined __libc_ptf_call + /* We do not want this call to be cut short by a thread + cancellation. Therefore disable cancellation for now. */ + int state = PTHREAD_CANCEL_ENABLE; + __libc_ptf_call (pthread_setcancelstate, (PTHREAD_CANCEL_DISABLE, &state), + 0); +#endif + + flush_stdout (); +#ifdef _LIBC + _IO_flockfile (stderr); +#endif + if (error_print_progname) + (*error_print_progname) (); + else + { +#if _LIBC + __fxprintf (NULL, "%s:", program_name); +#else + fprintf (stderr, "%s:", program_name); +#endif + } + +#if _LIBC + __fxprintf (NULL, file_name != NULL ? "%s:%u: " : " ", + file_name, line_number); +#else + fprintf (stderr, file_name != NULL ? "%s:%u: " : " ", + file_name, line_number); +#endif + + va_start (args, message); + error_tail (status, errnum, message, args); + va_end (args); + +#ifdef _LIBC + _IO_funlockfile (stderr); +# ifdef __libc_ptf_call + __libc_ptf_call (pthread_setcancelstate, (state, NULL), 0); +# endif +#endif +} + +#ifdef _LIBC +/* Make the weak alias. */ +# undef error +# undef error_at_line +weak_alias (__error, error) +weak_alias (__error_at_line, error_at_line) +#endif diff --git a/gnulib-lib/error.h b/gnulib-lib/error.h new file mode 100644 index 0000000..814715e --- /dev/null +++ b/gnulib-lib/error.h @@ -0,0 +1,66 @@ +/* Declaration for error-reporting function + Copyright (C) 1995-1997, 2003, 2006, 2008-2021 Free Software Foundation, + Inc. + This file is part of the GNU C Library. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _ERROR_H +#define _ERROR_H 1 + +/* Get _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM. */ +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Print a message with 'fprintf (stderr, FORMAT, ...)'; + if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM). + If STATUS is nonzero, terminate the program with 'exit (STATUS)'. */ + +extern void error (int __status, int __errnum, const char *__format, ...) +#if GNULIB_VFPRINTF_POSIX + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 3, 4)) +#else + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 3, 4)) +#endif + ; + +extern void error_at_line (int __status, int __errnum, const char *__fname, + unsigned int __lineno, const char *__format, ...) +#if GNULIB_VFPRINTF_POSIX + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, 5, 6)) +#else + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, 5, 6)) +#endif + ; + +/* If NULL, error will flush stdout, then print on stderr the program + name, a colon and a space. Otherwise, error will call this + function without parameters instead. */ +extern void (*error_print_progname) (void); + +/* This variable is incremented each time 'error' is called. */ +extern unsigned int error_message_count; + +/* Sometimes we want to have at most one error per line. This + variable controls whether this mode is selected or not. */ +extern int error_one_per_line; + +#ifdef __cplusplus +} +#endif + +#endif /* error.h */ diff --git a/gnulib-lib/fatal-signal.c b/gnulib-lib/fatal-signal.c new file mode 100644 index 0000000..93a81ee --- /dev/null +++ b/gnulib-lib/fatal-signal.c @@ -0,0 +1,372 @@ +/* Emergency actions in case of a fatal signal. + Copyright (C) 2003-2004, 2006-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This file 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. + + This file 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 this program. If not, see . */ + + +#include + +/* Specification. */ +#include "fatal-signal.h" + +#include +#include +#include +#include + +#include "glthread/lock.h" +#include "thread-optim.h" +#include "sig-handler.h" + +#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) + +/* ========================================================================= */ + + +/* The list of fatal signals. + These are those signals whose default action is to terminate the process + without a core dump, except + SIGKILL - because it cannot be caught, + SIGALRM SIGUSR1 SIGUSR2 SIGPOLL SIGIO SIGLOST - because applications + often use them for their own purpose, + SIGPROF SIGVTALRM - because they are used for profiling, + SIGSTKFLT - because it is more similar to SIGFPE, SIGSEGV, SIGBUS, + SIGSYS - because it is more similar to SIGABRT, SIGSEGV, + SIGPWR - because it of too special use, + SIGRTMIN...SIGRTMAX - because they are reserved for application use. + plus + SIGXCPU, SIGXFSZ - because they are quite similar to SIGTERM. */ + +static int fatal_signals[] = + { + /* ISO C 99 signals. */ +#ifdef SIGINT + SIGINT, +#endif +#ifdef SIGTERM + SIGTERM, +#endif + /* POSIX:2001 signals. */ +#ifdef SIGHUP + SIGHUP, +#endif +#ifdef SIGPIPE + SIGPIPE, +#endif + /* BSD signals. */ +#ifdef SIGXCPU + SIGXCPU, +#endif +#ifdef SIGXFSZ + SIGXFSZ, +#endif + /* Native Windows signals. */ +#ifdef SIGBREAK + SIGBREAK, +#endif + 0 + }; + +#define num_fatal_signals (SIZEOF (fatal_signals) - 1) + +/* Eliminate signals whose signal handler is SIG_IGN. */ + +static void +init_fatal_signals (void) +{ + /* This function is multithread-safe even without synchronization, because + if two threads execute it simultaneously, the fatal_signals[] array will + not change any more after the first of the threads has completed this + function. */ + static bool fatal_signals_initialized = false; + if (!fatal_signals_initialized) + { + size_t i; + + for (i = 0; i < num_fatal_signals; i++) + { + struct sigaction action; + + if (sigaction (fatal_signals[i], NULL, &action) >= 0 + && get_handler (&action) == SIG_IGN) + fatal_signals[i] = -1; + } + + fatal_signals_initialized = true; + } +} + + +/* ========================================================================= */ + + +typedef _GL_ASYNC_SAFE void (*action_t) (int sig); + +/* Type of an entry in the actions array. + The 'action' field is accessed from within the fatal_signal_handler(), + therefore we mark it as 'volatile'. */ +typedef struct +{ + volatile action_t action; +} +actions_entry_t; + +/* The registered cleanup actions. */ +static actions_entry_t static_actions[32]; +static actions_entry_t * volatile actions = static_actions; +static sig_atomic_t volatile actions_count = 0; +static size_t actions_allocated = SIZEOF (static_actions); + + +/* The saved signal handlers. + Size 32 would not be sufficient: On HP-UX, SIGXCPU = 33, SIGXFSZ = 34. */ +static struct sigaction saved_sigactions[64]; + + +/* Uninstall the handlers. */ +static _GL_ASYNC_SAFE void +uninstall_handlers (void) +{ + size_t i; + + for (i = 0; i < num_fatal_signals; i++) + if (fatal_signals[i] >= 0) + { + int sig = fatal_signals[i]; + if (saved_sigactions[sig].sa_handler == SIG_IGN) + saved_sigactions[sig].sa_handler = SIG_DFL; + sigaction (sig, &saved_sigactions[sig], NULL); + } +} + + +/* The signal handler. It gets called asynchronously. */ +static _GL_ASYNC_SAFE void +fatal_signal_handler (int sig) +{ + for (;;) + { + /* Get the last registered cleanup action, in a reentrant way. */ + action_t action; + size_t n = actions_count; + if (n == 0) + break; + n--; + actions_count = n; + action = actions[n].action; + /* Execute the action. */ + action (sig); + } + + /* Now execute the signal's default action. + If the signal being delivered was blocked, the re-raised signal would be + delivered when this handler returns. But the way we install this handler, + no signal is blocked, and the re-raised signal is delivered already + during raise(). */ + uninstall_handlers (); + raise (sig); +} + + +/* Install the handlers. */ +static void +install_handlers (void) +{ + size_t i; + struct sigaction action; + + action.sa_handler = &fatal_signal_handler; + /* If we get a fatal signal while executing fatal_signal_handler, enter + fatal_signal_handler recursively, since it is reentrant. Hence no + SA_RESETHAND. */ + action.sa_flags = SA_NODEFER; + sigemptyset (&action.sa_mask); + for (i = 0; i < num_fatal_signals; i++) + if (fatal_signals[i] >= 0) + { + int sig = fatal_signals[i]; + + if (!(sig < sizeof (saved_sigactions) / sizeof (saved_sigactions[0]))) + abort (); + sigaction (sig, &action, &saved_sigactions[sig]); + } +} + + +/* Lock that makes at_fatal_signal multi-thread safe. */ +gl_lock_define_initialized (static, at_fatal_signal_lock) + +/* Register a cleanup function to be executed when a catchable fatal signal + occurs. */ +int +at_fatal_signal (action_t action) +{ + bool mt = gl_multithreaded (); + + if (mt) gl_lock_lock (at_fatal_signal_lock); + + static bool cleanup_initialized = false; + if (!cleanup_initialized) + { + init_fatal_signals (); + install_handlers (); + cleanup_initialized = true; + } + + int ret = 0; + + if (actions_count == actions_allocated) + { + /* Extend the actions array. Note that we cannot use xrealloc(), + because then the cleanup() function could access an already + deallocated array. */ + actions_entry_t *old_actions = actions; + size_t old_actions_allocated = actions_allocated; + size_t new_actions_allocated = 2 * actions_allocated; + actions_entry_t *new_actions = + (actions_entry_t *) + malloc (new_actions_allocated * sizeof (actions_entry_t)); + if (new_actions == NULL) + { + ret = -1; + goto done; + } + + size_t k; + /* Don't use memcpy() here, because memcpy takes non-volatile arguments + and is therefore not guaranteed to complete all memory stores before + the next statement. */ + for (k = 0; k < old_actions_allocated; k++) + new_actions[k] = old_actions[k]; + actions = new_actions; + actions_allocated = new_actions_allocated; + /* Now we can free the old actions array. */ + /* No, we can't do that. If fatal_signal_handler is running in a + different thread and has already fetched the actions pointer (getting + old_actions) but not yet accessed its n-th element, that thread may + crash when accessing an element of the already freed old_actions + array. */ + #if 0 + if (old_actions != static_actions) + free (old_actions); + #endif + } + /* The two uses of 'volatile' in the types above (and ISO C 99 section + 5.1.2.3.(5)) ensure that we increment the actions_count only after + the new action has been written to the memory location + actions[actions_count]. */ + actions[actions_count].action = action; + actions_count++; + + done: + if (mt) gl_lock_unlock (at_fatal_signal_lock); + + return ret; +} + + +/* ========================================================================= */ + + +static sigset_t fatal_signal_set; + +static void +do_init_fatal_signal_set (void) +{ + size_t i; + + init_fatal_signals (); + + sigemptyset (&fatal_signal_set); + for (i = 0; i < num_fatal_signals; i++) + if (fatal_signals[i] >= 0) + sigaddset (&fatal_signal_set, fatal_signals[i]); +} + +/* Ensure that do_init_fatal_signal_set is called once only. */ +gl_once_define(static, fatal_signal_set_once) + +static void +init_fatal_signal_set (void) +{ + gl_once (fatal_signal_set_once, do_init_fatal_signal_set); +} + +/* Lock and counter that allow block_fatal_signals/unblock_fatal_signals pairs + to occur in different threads and even overlap in time. */ +gl_lock_define_initialized (static, fatal_signals_block_lock) +static unsigned int fatal_signals_block_counter = 0; + +/* Temporarily delay the catchable fatal signals. */ +void +block_fatal_signals (void) +{ + bool mt = gl_multithreaded (); + + if (mt) gl_lock_lock (fatal_signals_block_lock); + + if (fatal_signals_block_counter++ == 0) + { + init_fatal_signal_set (); + sigprocmask (SIG_BLOCK, &fatal_signal_set, NULL); + } + + if (mt) gl_lock_unlock (fatal_signals_block_lock); +} + +/* Stop delaying the catchable fatal signals. */ +void +unblock_fatal_signals (void) +{ + bool mt = gl_multithreaded (); + + if (mt) gl_lock_lock (fatal_signals_block_lock); + + if (fatal_signals_block_counter == 0) + /* There are more calls to unblock_fatal_signals() than to + block_fatal_signals(). */ + abort (); + if (--fatal_signals_block_counter == 0) + { + init_fatal_signal_set (); + sigprocmask (SIG_UNBLOCK, &fatal_signal_set, NULL); + } + + if (mt) gl_lock_unlock (fatal_signals_block_lock); +} + + +unsigned int +get_fatal_signals (int signals[64]) +{ + init_fatal_signal_set (); + + { + int *p = signals; + size_t i; + + for (i = 0; i < num_fatal_signals; i++) + if (fatal_signals[i] >= 0) + *p++ = fatal_signals[i]; + return p - signals; + } +} + +const sigset_t * +get_fatal_signal_set (void) +{ + init_fatal_signal_set (); + return &fatal_signal_set; +} diff --git a/gnulib-lib/fatal-signal.h b/gnulib-lib/fatal-signal.h new file mode 100644 index 0000000..e199484 --- /dev/null +++ b/gnulib-lib/fatal-signal.h @@ -0,0 +1,96 @@ +/* Emergency actions in case of a fatal signal. + Copyright (C) 2003-2004, 2009-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This file 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. + + This file 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 this program. If not, see . */ + + +#ifndef _FATAL_SIGNAL_H +#define _FATAL_SIGNAL_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* It is often useful to do some cleanup action when a usually fatal signal + terminates the process, like removing a temporary file or killing a + subprocess that may be stuck waiting for a device, pipe or network input. + Such signals are SIGHUP, SIGINT, SIGPIPE, SIGTERM, and possibly others. + The limitation of this facility is that it cannot work for SIGKILL. + + Signals with a SIG_IGN handler are considered to be non-fatal. The + functions in this file assume that when a SIG_IGN handler is installed + for a signal, it was installed before any functions in this file were + called and it stays so for the whole lifetime of the process. */ + +/* Register a cleanup function to be executed when a catchable fatal signal + occurs. + + Restrictions for the cleanup function: + - The cleanup function can do all kinds of system calls. It may also + modify (clobber) errno. + - It can also access application dependent memory locations and data + structures provided they are in a consistent state. One way to ensure + this is through block_fatal_signals()/unblock_fatal_signals(), see + below. Another - more tricky - way to ensure this is the careful use + of 'volatile'. + However, + - malloc() and similarly complex facilities are not safe to be called + because they are not guaranteed to be in a consistent state. + - Also, the cleanup function must not block the catchable fatal signals + and leave them blocked upon return. + + The cleanup function is executed asynchronously. It is unspecified + whether during its execution the catchable fatal signals are blocked + or not. + + Return 0 upon success, or -1 if there was a memory allocation problem. */ +extern int at_fatal_signal (_GL_ASYNC_SAFE void (*function) (int sig)); + + +/* Sometimes it is necessary to block the usually fatal signals while the + data structures being accessed by the cleanup action are being built or + reorganized. This is the case, for example, when a temporary file or + directory is created through mkstemp() or mkdtemp(), because these + functions create the temporary file or directory _before_ returning its + name to the application. */ + +/* Temporarily delay the catchable fatal signals. + The signals will be blocked (= delayed) until the next call to + unblock_fatal_signals(). If the signals are already blocked, a further + call to block_fatal_signals() has no effect. */ +extern void block_fatal_signals (void); + +/* Stop delaying the catchable fatal signals. */ +extern void unblock_fatal_signals (void); + + +/* Return the list of signals that block_fatal_signals/unblock_fatal_signals + would block or unblock. + Fills signals[0..count-1] and returns count. */ +extern unsigned int get_fatal_signals (int signals[64]); + +/* Return the list of signals that block_fatal_signals/unblock_fatal_signals + would block or unblock. */ +extern const sigset_t * get_fatal_signal_set (void); + + +#ifdef __cplusplus +} +#endif + +#endif /* _FATAL_SIGNAL_H */ diff --git a/gnulib-lib/fcntl.c b/gnulib-lib/fcntl.c new file mode 100644 index 0000000..c744eb9 --- /dev/null +++ b/gnulib-lib/fcntl.c @@ -0,0 +1,629 @@ +/* Provide file descriptor control. + + Copyright (C) 2009-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Eric Blake . */ + +#include + +/* Specification. */ +#include + +#include +#include +#include +#include +#include + +#ifdef __KLIBC__ +# define INCL_DOS +# include +#endif + +#if defined _WIN32 && ! defined __CYGWIN__ +/* Get declarations of the native Windows API functions. */ +# define WIN32_LEAN_AND_MEAN +# include + +/* Get _get_osfhandle. */ +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include +# endif + +/* Upper bound on getdtablesize(). See lib/getdtablesize.c. */ +# define OPEN_MAX_MAX 0x10000 + +/* Duplicate OLDFD into the first available slot of at least NEWFD, + which must be positive, with FLAGS determining whether the duplicate + will be inheritable. */ +static int +dupfd (int oldfd, int newfd, int flags) +{ + /* Mingw has no way to create an arbitrary fd. Iterate until all + file descriptors less than newfd are filled up. */ + HANDLE curr_process = GetCurrentProcess (); + HANDLE old_handle = (HANDLE) _get_osfhandle (oldfd); + unsigned char fds_to_close[OPEN_MAX_MAX / CHAR_BIT]; + unsigned int fds_to_close_bound = 0; + int result; + BOOL inherit = flags & O_CLOEXEC ? FALSE : TRUE; + int mode; + + if (newfd < 0 || getdtablesize () <= newfd) + { + errno = EINVAL; + return -1; + } + if (old_handle == INVALID_HANDLE_VALUE + || (mode = _setmode (oldfd, O_BINARY)) == -1) + { + /* oldfd is not open, or is an unassigned standard file + descriptor. */ + errno = EBADF; + return -1; + } + _setmode (oldfd, mode); + flags |= mode; + + for (;;) + { + HANDLE new_handle; + int duplicated_fd; + unsigned int index; + + if (!DuplicateHandle (curr_process, /* SourceProcessHandle */ + old_handle, /* SourceHandle */ + curr_process, /* TargetProcessHandle */ + (PHANDLE) &new_handle, /* TargetHandle */ + (DWORD) 0, /* DesiredAccess */ + inherit, /* InheritHandle */ + DUPLICATE_SAME_ACCESS)) /* Options */ + { + switch (GetLastError ()) + { + case ERROR_TOO_MANY_OPEN_FILES: + errno = EMFILE; + break; + case ERROR_INVALID_HANDLE: + case ERROR_INVALID_TARGET_HANDLE: + case ERROR_DIRECT_ACCESS_HANDLE: + errno = EBADF; + break; + case ERROR_INVALID_PARAMETER: + case ERROR_INVALID_FUNCTION: + case ERROR_INVALID_ACCESS: + errno = EINVAL; + break; + default: + errno = EACCES; + break; + } + result = -1; + break; + } + duplicated_fd = _open_osfhandle ((intptr_t) new_handle, flags); + if (duplicated_fd < 0) + { + CloseHandle (new_handle); + result = -1; + break; + } + if (newfd <= duplicated_fd) + { + result = duplicated_fd; + break; + } + + /* Set the bit duplicated_fd in fds_to_close[]. */ + index = (unsigned int) duplicated_fd / CHAR_BIT; + if (fds_to_close_bound <= index) + { + if (sizeof fds_to_close <= index) + /* Need to increase OPEN_MAX_MAX. */ + abort (); + memset (fds_to_close + fds_to_close_bound, '\0', + index + 1 - fds_to_close_bound); + fds_to_close_bound = index + 1; + } + fds_to_close[index] |= 1 << ((unsigned int) duplicated_fd % CHAR_BIT); + } + + /* Close the previous fds that turned out to be too small. */ + { + int saved_errno = errno; + unsigned int duplicated_fd; + + for (duplicated_fd = 0; + duplicated_fd < fds_to_close_bound * CHAR_BIT; + duplicated_fd++) + if ((fds_to_close[duplicated_fd / CHAR_BIT] + >> (duplicated_fd % CHAR_BIT)) + & 1) + close (duplicated_fd); + + errno = saved_errno; + } + +# if REPLACE_FCHDIR + if (0 <= result) + result = _gl_register_dup (oldfd, result); +# endif + return result; +} +#endif /* W32 */ + +/* Forward declarations, because we '#undef fcntl' in the middle of this + compilation unit. */ +/* Our implementation of fcntl (fd, F_DUPFD, target). */ +static int rpl_fcntl_DUPFD (int fd, int target); +/* Our implementation of fcntl (fd, F_DUPFD_CLOEXEC, target). */ +static int rpl_fcntl_DUPFD_CLOEXEC (int fd, int target); +#ifdef __KLIBC__ +/* Adds support for fcntl on directories. */ +static int klibc_fcntl (int fd, int action, /* arg */...); +#endif + + +/* Perform the specified ACTION on the file descriptor FD, possibly + using the argument ARG further described below. This replacement + handles the following actions, and forwards all others on to the + native fcntl. An unrecognized ACTION returns -1 with errno set to + EINVAL. + + F_DUPFD - duplicate FD, with int ARG being the minimum target fd. + If successful, return the duplicate, which will be inheritable; + otherwise return -1 and set errno. + + F_DUPFD_CLOEXEC - duplicate FD, with int ARG being the minimum + target fd. If successful, return the duplicate, which will not be + inheritable; otherwise return -1 and set errno. + + F_GETFD - ARG need not be present. If successful, return a + non-negative value containing the descriptor flags of FD (only + FD_CLOEXEC is portable, but other flags may be present); otherwise + return -1 and set errno. */ + +int +fcntl (int fd, int action, /* arg */...) +#undef fcntl +#ifdef __KLIBC__ +# define fcntl klibc_fcntl +#endif +{ + va_list arg; + int result = -1; + va_start (arg, action); + switch (action) + { + case F_DUPFD: + { + int target = va_arg (arg, int); + result = rpl_fcntl_DUPFD (fd, target); + break; + } + + case F_DUPFD_CLOEXEC: + { + int target = va_arg (arg, int); + result = rpl_fcntl_DUPFD_CLOEXEC (fd, target); + break; + } + +#if !HAVE_FCNTL + case F_GETFD: + { +# if defined _WIN32 && ! defined __CYGWIN__ + HANDLE handle = (HANDLE) _get_osfhandle (fd); + DWORD flags; + if (handle == INVALID_HANDLE_VALUE + || GetHandleInformation (handle, &flags) == 0) + errno = EBADF; + else + result = (flags & HANDLE_FLAG_INHERIT) ? 0 : FD_CLOEXEC; +# else /* !W32 */ + /* Use dup2 to reject invalid file descriptors. No way to + access this information, so punt. */ + if (0 <= dup2 (fd, fd)) + result = 0; +# endif /* !W32 */ + break; + } /* F_GETFD */ +#endif /* !HAVE_FCNTL */ + + /* Implementing F_SETFD on mingw is not trivial - there is no + API for changing the O_NOINHERIT bit on an fd, and merely + changing the HANDLE_FLAG_INHERIT bit on the underlying handle + can lead to odd state. It may be possible by duplicating the + handle, using _open_osfhandle with the right flags, then + using dup2 to move the duplicate onto the original, but that + is not supported for now. */ + + default: + { +#if HAVE_FCNTL + switch (action) + { + #ifdef F_BARRIERFSYNC /* macOS */ + case F_BARRIERFSYNC: + #endif + #ifdef F_CHKCLEAN /* macOS */ + case F_CHKCLEAN: + #endif + #ifdef F_CLOSEM /* NetBSD, HP-UX */ + case F_CLOSEM: + #endif + #ifdef F_FLUSH_DATA /* macOS */ + case F_FLUSH_DATA: + #endif + #ifdef F_FREEZE_FS /* macOS */ + case F_FREEZE_FS: + #endif + #ifdef F_FULLFSYNC /* macOS */ + case F_FULLFSYNC: + #endif + #ifdef F_GETCONFINED /* macOS */ + case F_GETCONFINED: + #endif + #ifdef F_GETDEFAULTPROTLEVEL /* macOS */ + case F_GETDEFAULTPROTLEVEL: + #endif + #ifdef F_GETFD /* POSIX */ + case F_GETFD: + #endif + #ifdef F_GETFL /* POSIX */ + case F_GETFL: + #endif + #ifdef F_GETLEASE /* Linux */ + case F_GETLEASE: + #endif + #ifdef F_GETNOSIGPIPE /* macOS */ + case F_GETNOSIGPIPE: + #endif + #ifdef F_GETOWN /* POSIX */ + case F_GETOWN: + #endif + #ifdef F_GETPIPE_SZ /* Linux */ + case F_GETPIPE_SZ: + #endif + #ifdef F_GETPROTECTIONCLASS /* macOS */ + case F_GETPROTECTIONCLASS: + #endif + #ifdef F_GETPROTECTIONLEVEL /* macOS */ + case F_GETPROTECTIONLEVEL: + #endif + #ifdef F_GET_SEALS /* Linux */ + case F_GET_SEALS: + #endif + #ifdef F_GETSIG /* Linux */ + case F_GETSIG: + #endif + #ifdef F_MAXFD /* NetBSD */ + case F_MAXFD: + #endif + #ifdef F_RECYCLE /* macOS */ + case F_RECYCLE: + #endif + #ifdef F_SETFIFOENH /* HP-UX */ + case F_SETFIFOENH: + #endif + #ifdef F_THAW_FS /* macOS */ + case F_THAW_FS: + #endif + /* These actions take no argument. */ + result = fcntl (fd, action); + break; + + #ifdef F_ADD_SEALS /* Linux */ + case F_ADD_SEALS: + #endif + #ifdef F_BADFD /* Solaris */ + case F_BADFD: + #endif + #ifdef F_CHECK_OPENEVT /* macOS */ + case F_CHECK_OPENEVT: + #endif + #ifdef F_DUP2FD /* FreeBSD, AIX, Solaris */ + case F_DUP2FD: + #endif + #ifdef F_DUP2FD_CLOEXEC /* FreeBSD, Solaris */ + case F_DUP2FD_CLOEXEC: + #endif + #ifdef F_DUP2FD_CLOFORK /* Solaris */ + case F_DUP2FD_CLOFORK: + #endif + #ifdef F_DUPFD /* POSIX */ + case F_DUPFD: + #endif + #ifdef F_DUPFD_CLOEXEC /* POSIX */ + case F_DUPFD_CLOEXEC: + #endif + #ifdef F_DUPFD_CLOFORK /* Solaris */ + case F_DUPFD_CLOFORK: + #endif + #ifdef F_GETXFL /* Solaris */ + case F_GETXFL: + #endif + #ifdef F_GLOBAL_NOCACHE /* macOS */ + case F_GLOBAL_NOCACHE: + #endif + #ifdef F_MAKECOMPRESSED /* macOS */ + case F_MAKECOMPRESSED: + #endif + #ifdef F_MOVEDATAEXTENTS /* macOS */ + case F_MOVEDATAEXTENTS: + #endif + #ifdef F_NOCACHE /* macOS */ + case F_NOCACHE: + #endif + #ifdef F_NODIRECT /* macOS */ + case F_NODIRECT: + #endif + #ifdef F_NOTIFY /* Linux */ + case F_NOTIFY: + #endif + #ifdef F_OPLKACK /* IRIX */ + case F_OPLKACK: + #endif + #ifdef F_OPLKREG /* IRIX */ + case F_OPLKREG: + #endif + #ifdef F_RDAHEAD /* macOS */ + case F_RDAHEAD: + #endif + #ifdef F_SETBACKINGSTORE /* macOS */ + case F_SETBACKINGSTORE: + #endif + #ifdef F_SETCONFINED /* macOS */ + case F_SETCONFINED: + #endif + #ifdef F_SETFD /* POSIX */ + case F_SETFD: + #endif + #ifdef F_SETFL /* POSIX */ + case F_SETFL: + #endif + #ifdef F_SETLEASE /* Linux */ + case F_SETLEASE: + #endif + #ifdef F_SETNOSIGPIPE /* macOS */ + case F_SETNOSIGPIPE: + #endif + #ifdef F_SETOWN /* POSIX */ + case F_SETOWN: + #endif + #ifdef F_SETPIPE_SZ /* Linux */ + case F_SETPIPE_SZ: + #endif + #ifdef F_SETPROTECTIONCLASS /* macOS */ + case F_SETPROTECTIONCLASS: + #endif + #ifdef F_SETSIG /* Linux */ + case F_SETSIG: + #endif + #ifdef F_SINGLE_WRITER /* macOS */ + case F_SINGLE_WRITER: + #endif + /* These actions take an 'int' argument. */ + { + int x = va_arg (arg, int); + result = fcntl (fd, action, x); + } + break; + + default: + /* Other actions take a pointer argument. */ + { + void *p = va_arg (arg, void *); + result = fcntl (fd, action, p); + } + break; + } +#else + errno = EINVAL; +#endif + break; + } + } + va_end (arg); + return result; +} + +static int +rpl_fcntl_DUPFD (int fd, int target) +{ + int result; +#if !HAVE_FCNTL + result = dupfd (fd, target, 0); +#elif FCNTL_DUPFD_BUGGY || REPLACE_FCHDIR + /* Detect invalid target; needed for cygwin 1.5.x. */ + if (target < 0 || getdtablesize () <= target) + { + result = -1; + errno = EINVAL; + } + else + { + /* Haiku alpha 2 loses fd flags on original. */ + int flags = fcntl (fd, F_GETFD); + if (flags < 0) + result = -1; + else + { + result = fcntl (fd, F_DUPFD, target); + if (0 <= result && fcntl (fd, F_SETFD, flags) == -1) + { + int saved_errno = errno; + close (result); + result = -1; + errno = saved_errno; + } +# if REPLACE_FCHDIR + if (0 <= result) + result = _gl_register_dup (fd, result); +# endif + } + } +#else + result = fcntl (fd, F_DUPFD, target); +#endif + return result; +} + +static int +rpl_fcntl_DUPFD_CLOEXEC (int fd, int target) +{ + int result; +#if !HAVE_FCNTL + result = dupfd (fd, target, O_CLOEXEC); +#else /* HAVE_FCNTL */ +# if defined __NetBSD__ || defined __HAIKU__ + /* On NetBSD 9.0, the system fcntl (fd, F_DUPFD_CLOEXEC, target) + has only the same effect as fcntl (fd, F_DUPFD, target). */ + /* On Haiku, the system fcntl (fd, F_DUPFD_CLOEXEC, target) sets + the FD_CLOEXEC flag on fd, not on target. Therefore avoid the + system fcntl in this case. */ +# define have_dupfd_cloexec -1 +# else + /* Try the system call first, if the headers claim it exists + (that is, if GNULIB_defined_F_DUPFD_CLOEXEC is 0), since we + may be running with a glibc that has the macro but with an + older kernel that does not support it. Cache the + information on whether the system call really works, but + avoid caching failure if the corresponding F_DUPFD fails + for any reason. 0 = unknown, 1 = yes, -1 = no. */ + static int have_dupfd_cloexec = GNULIB_defined_F_DUPFD_CLOEXEC ? -1 : 0; + if (0 <= have_dupfd_cloexec) + { + result = fcntl (fd, F_DUPFD_CLOEXEC, target); + if (0 <= result || errno != EINVAL) + { + have_dupfd_cloexec = 1; +# if REPLACE_FCHDIR + if (0 <= result) + result = _gl_register_dup (fd, result); +# endif + } + else + { + result = rpl_fcntl_DUPFD (fd, target); + if (result >= 0) + have_dupfd_cloexec = -1; + } + } + else +# endif + result = rpl_fcntl_DUPFD (fd, target); + if (0 <= result && have_dupfd_cloexec == -1) + { + int flags = fcntl (result, F_GETFD); + if (flags < 0 || fcntl (result, F_SETFD, flags | FD_CLOEXEC) == -1) + { + int saved_errno = errno; + close (result); + errno = saved_errno; + result = -1; + } + } +#endif /* HAVE_FCNTL */ + return result; +} + +#undef fcntl + +#ifdef __KLIBC__ + +static int +klibc_fcntl (int fd, int action, /* arg */...) +{ + va_list arg_ptr; + int arg; + struct stat sbuf; + int result; + + va_start (arg_ptr, action); + arg = va_arg (arg_ptr, int); + result = fcntl (fd, action, arg); + /* EPERM for F_DUPFD, ENOTSUP for others */ + if (result == -1 && (errno == EPERM || errno == ENOTSUP) + && !fstat (fd, &sbuf) && S_ISDIR (sbuf.st_mode)) + { + ULONG ulMode; + + switch (action) + { + case F_DUPFD: + /* Find available fd */ + while (fcntl (arg, F_GETFL) != -1 || errno != EBADF) + arg++; + + result = dup2 (fd, arg); + break; + + /* Using underlying APIs is right ? */ + case F_GETFD: + if (DosQueryFHState (fd, &ulMode)) + break; + + result = (ulMode & OPEN_FLAGS_NOINHERIT) ? FD_CLOEXEC : 0; + break; + + case F_SETFD: + if (arg & ~FD_CLOEXEC) + break; + + if (DosQueryFHState (fd, &ulMode)) + break; + + if (arg & FD_CLOEXEC) + ulMode |= OPEN_FLAGS_NOINHERIT; + else + ulMode &= ~OPEN_FLAGS_NOINHERIT; + + /* Filter supported flags. */ + ulMode &= (OPEN_FLAGS_WRITE_THROUGH | OPEN_FLAGS_FAIL_ON_ERROR + | OPEN_FLAGS_NO_CACHE | OPEN_FLAGS_NOINHERIT); + + if (DosSetFHState (fd, ulMode)) + break; + + result = 0; + break; + + case F_GETFL: + result = 0; + break; + + case F_SETFL: + if (arg != 0) + break; + + result = 0; + break; + + default: + errno = EINVAL; + break; + } + } + + va_end (arg_ptr); + + return result; +} + +#endif diff --git a/gnulib-lib/fcntl.in.h b/gnulib-lib/fcntl.in.h new file mode 100644 index 0000000..26dedc3 --- /dev/null +++ b/gnulib-lib/fcntl.in.h @@ -0,0 +1,441 @@ +/* Like , but with non-working flags defined to 0. + + Copyright (C) 2006-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* written by Paul Eggert */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_system_fcntl_h +/* Special invocation convention. */ + +/* Needed before . + May also define off_t to a 64-bit type on native Windows. */ +#include +/* On some systems other than glibc, is a prerequisite of + . On glibc systems, we would like to avoid namespace pollution. + But on glibc systems, includes inside an + extern "C" { ... } block, which leads to errors in C++ mode with the + overridden from gnulib. These errors are known to be gone + with g++ version >= 4.3. */ +#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) +# include +#endif +#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ + +/* Native Windows platforms declare open(), creat() in . */ +#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) +# include +#endif + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_FCNTL_H + +/* Needed before . + May also define off_t to a 64-bit type on native Windows. */ +#include +/* On some systems other than glibc, is a prerequisite of + . On glibc systems, we would like to avoid namespace pollution. + But on glibc systems, includes inside an + extern "C" { ... } block, which leads to errors in C++ mode with the + overridden from gnulib. These errors are known to be gone + with g++ version >= 4.3. */ +#if !(defined __GLIBC__ || defined __UCLIBC__) || (defined __cplusplus && defined GNULIB_NAMESPACE && (defined __ICC || !(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)))) +# include +#endif +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_FCNTL_H@ + +/* Native Windows platforms declare open(), creat() in . */ +#if (@GNULIB_CREAT@ || @GNULIB_OPEN@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) +# include +#endif + +#ifndef _@GUARD_PREFIX@_FCNTL_H +#define _@GUARD_PREFIX@_FCNTL_H + +#ifndef __GLIBC__ /* Avoid namespace pollution on glibc systems. */ +# include +#endif + + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +/* Declare overridden functions. */ + +#if @GNULIB_CREAT@ +# if @REPLACE_CREAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef creat +# define creat rpl_creat +# endif +_GL_FUNCDECL_RPL (creat, int, (const char *filename, mode_t mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (creat, int, (const char *filename, mode_t mode)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef creat +# define creat _creat +# endif +_GL_CXXALIAS_MDA (creat, int, (const char *filename, mode_t mode)); +# else +_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); +# endif +_GL_CXXALIASWARN (creat); +#elif defined GNULIB_POSIXCHECK +# undef creat +/* Assume creat is always declared. */ +_GL_WARN_ON_USE (creat, "creat is not always POSIX compliant - " + "use gnulib module creat for portability"); +#elif @GNULIB_MDA_CREAT@ +/* On native Windows, map 'creat' to '_creat', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::creat always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef creat +# define creat _creat +# endif +/* Need to cast, because in mingw the last argument is 'int mode'. */ +_GL_CXXALIAS_MDA_CAST (creat, int, (const char *filename, mode_t mode)); +# else +_GL_CXXALIAS_SYS (creat, int, (const char *filename, mode_t mode)); +# endif +_GL_CXXALIASWARN (creat); +#endif + +#if @GNULIB_FCNTL@ +# if @REPLACE_FCNTL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fcntl +# define fcntl rpl_fcntl +# endif +_GL_FUNCDECL_RPL (fcntl, int, (int fd, int action, ...)); +_GL_CXXALIAS_RPL (fcntl, int, (int fd, int action, ...)); +# if !GNULIB_defined_rpl_fcntl +# define GNULIB_defined_rpl_fcntl 1 +# endif +# else +# if !@HAVE_FCNTL@ +_GL_FUNCDECL_SYS (fcntl, int, (int fd, int action, ...)); +# if !GNULIB_defined_fcntl +# define GNULIB_defined_fcntl 1 +# endif +# endif +_GL_CXXALIAS_SYS (fcntl, int, (int fd, int action, ...)); +# endif +_GL_CXXALIASWARN (fcntl); +#elif defined GNULIB_POSIXCHECK +# undef fcntl +# if HAVE_RAW_DECL_FCNTL +_GL_WARN_ON_USE (fcntl, "fcntl is not always POSIX compliant - " + "use gnulib module fcntl for portability"); +# endif +#endif + +#if @GNULIB_OPEN@ +# if @REPLACE_OPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef open +# define open rpl_open +# endif +_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef open +# define open _open +# endif +_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); +# else +_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); +# endif +/* On HP-UX 11, in C++ mode, open() is defined as an inline function with a + default argument. _GL_CXXALIASWARN does not work in this case. */ +# if !defined __hpux +_GL_CXXALIASWARN (open); +# endif +#elif defined GNULIB_POSIXCHECK +# undef open +/* Assume open is always declared. */ +_GL_WARN_ON_USE (open, "open is not always POSIX compliant - " + "use gnulib module open for portability"); +#elif @GNULIB_MDA_OPEN@ +/* On native Windows, map 'open' to '_open', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::open always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef open +# define open _open +# endif +_GL_CXXALIAS_MDA (open, int, (const char *filename, int flags, ...)); +# else +_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...)); +# endif +# if !defined __hpux +_GL_CXXALIASWARN (open); +# endif +#endif + +#if @GNULIB_OPENAT@ +# if @REPLACE_OPENAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef openat +# define openat rpl_openat +# endif +_GL_FUNCDECL_RPL (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...)); +# else +# if !@HAVE_OPENAT@ +_GL_FUNCDECL_SYS (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (openat, int, + (int fd, char const *file, int flags, /* mode_t mode */ ...)); +# endif +_GL_CXXALIASWARN (openat); +#elif defined GNULIB_POSIXCHECK +# undef openat +# if HAVE_RAW_DECL_OPENAT +_GL_WARN_ON_USE (openat, "openat is not portable - " + "use gnulib module openat for portability"); +# endif +#endif + + +/* Fix up the FD_* macros, only known to be missing on mingw. */ + +#ifndef FD_CLOEXEC +# define FD_CLOEXEC 1 +#endif + +/* Fix up the supported F_* macros. Intentionally leave other F_* + macros undefined. Only known to be missing on mingw. */ + +#ifndef F_DUPFD_CLOEXEC +# define F_DUPFD_CLOEXEC 0x40000000 +/* Witness variable: 1 if gnulib defined F_DUPFD_CLOEXEC, 0 otherwise. */ +# define GNULIB_defined_F_DUPFD_CLOEXEC 1 +#else +# define GNULIB_defined_F_DUPFD_CLOEXEC 0 +#endif + +#ifndef F_DUPFD +# define F_DUPFD 1 +#endif + +#ifndef F_GETFD +# define F_GETFD 2 +#endif + +/* Fix up the O_* macros. */ + +/* AIX 7.1 with XL C 12.1 defines O_CLOEXEC, O_NOFOLLOW, and O_TTY_INIT + to values outside 'int' range, so omit these misdefinitions. + But avoid namespace pollution on non-AIX systems. */ +#ifdef _AIX +# include +# if defined O_CLOEXEC && ! (INT_MIN <= O_CLOEXEC && O_CLOEXEC <= INT_MAX) +# undef O_CLOEXEC +# endif +# if defined O_NOFOLLOW && ! (INT_MIN <= O_NOFOLLOW && O_NOFOLLOW <= INT_MAX) +# undef O_NOFOLLOW +# endif +# if defined O_TTY_INIT && ! (INT_MIN <= O_TTY_INIT && O_TTY_INIT <= INT_MAX) +# undef O_TTY_INIT +# endif +#endif + +#if !defined O_DIRECT && defined O_DIRECTIO +/* Tru64 spells it 'O_DIRECTIO'. */ +# define O_DIRECT O_DIRECTIO +#endif + +#if !defined O_CLOEXEC && defined O_NOINHERIT +/* Mingw spells it 'O_NOINHERIT'. */ +# define O_CLOEXEC O_NOINHERIT +#endif + +#ifndef O_CLOEXEC +# define O_CLOEXEC 0x40000000 /* Try to not collide with system O_* flags. */ +# define GNULIB_defined_O_CLOEXEC 1 +#else +# define GNULIB_defined_O_CLOEXEC 0 +#endif + +#ifndef O_DIRECT +# define O_DIRECT 0 +#endif + +#ifndef O_DIRECTORY +# define O_DIRECTORY 0 +#endif + +#ifndef O_DSYNC +# define O_DSYNC 0 +#endif + +#ifndef O_EXEC +# define O_EXEC O_RDONLY /* This is often close enough in older systems. */ +#endif + +#ifndef O_IGNORE_CTTY +# define O_IGNORE_CTTY 0 +#endif + +#ifndef O_NDELAY +# define O_NDELAY 0 +#endif + +#ifndef O_NOATIME +# define O_NOATIME 0 +#endif + +#ifndef O_NONBLOCK +# define O_NONBLOCK O_NDELAY +#endif + +/* If the gnulib module 'nonblocking' is in use, guarantee a working non-zero + value of O_NONBLOCK. Otherwise, O_NONBLOCK is defined (above) to O_NDELAY + or to 0 as fallback. */ +#if @GNULIB_NONBLOCKING@ +# if O_NONBLOCK +# define GNULIB_defined_O_NONBLOCK 0 +# else +# define GNULIB_defined_O_NONBLOCK 1 +# undef O_NONBLOCK +# define O_NONBLOCK 0x40000000 +# endif +#endif + +#ifndef O_NOCTTY +# define O_NOCTTY 0 +#endif + +#ifndef O_NOFOLLOW +# define O_NOFOLLOW 0 +#endif + +#ifndef O_NOLINK +# define O_NOLINK 0 +#endif + +#ifndef O_NOLINKS +# define O_NOLINKS 0 +#endif + +#ifndef O_NOTRANS +# define O_NOTRANS 0 +#endif + +#ifndef O_RSYNC +# define O_RSYNC 0 +#endif + +#ifndef O_SEARCH +# define O_SEARCH O_RDONLY /* This is often close enough in older systems. */ +#endif + +#ifndef O_SYNC +# define O_SYNC 0 +#endif + +#ifndef O_TTY_INIT +# define O_TTY_INIT 0 +#endif + +#if ~O_ACCMODE & (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) +# undef O_ACCMODE +# define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR | O_EXEC | O_SEARCH) +#endif + +/* For systems that distinguish between text and binary I/O. + O_BINARY is usually declared in fcntl.h */ +#if !defined O_BINARY && defined _O_BINARY + /* For MSC-compatible compilers. */ +# define O_BINARY _O_BINARY +# define O_TEXT _O_TEXT +#endif + +#if defined __BEOS__ || defined __HAIKU__ + /* BeOS 5 and Haiku have O_BINARY and O_TEXT, but they have no effect. */ +# undef O_BINARY +# undef O_TEXT +#endif + +#ifndef O_BINARY +# define O_BINARY 0 +# define O_TEXT 0 +#endif + +/* Fix up the AT_* macros. */ + +/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its + value exceeds INT_MAX, so its use as an int doesn't conform to the + C standard, and GCC and Sun C complain in some cases. If the bug + is present, undef AT_FDCWD here, so it can be redefined below. */ +#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553 +# undef AT_FDCWD +#endif + +/* Use the same bit pattern as Solaris 9, but with the proper + signedness. The bit pattern is important, in case this actually is + Solaris with the above workaround. */ +#ifndef AT_FDCWD +# define AT_FDCWD (-3041965) +#endif + +/* Use the same values as Solaris 9. This shouldn't matter, but + there's no real reason to differ. */ +#ifndef AT_SYMLINK_NOFOLLOW +# define AT_SYMLINK_NOFOLLOW 4096 +#endif + +#ifndef AT_REMOVEDIR +# define AT_REMOVEDIR 1 +#endif + +/* Solaris 9 lacks these two, so just pick unique values. */ +#ifndef AT_SYMLINK_FOLLOW +# define AT_SYMLINK_FOLLOW 2 +#endif + +#ifndef AT_EACCESS +# define AT_EACCESS 4 +#endif + + +#endif /* _@GUARD_PREFIX@_FCNTL_H */ +#endif /* _@GUARD_PREFIX@_FCNTL_H */ +#endif diff --git a/gnulib-lib/fd-hook.c b/gnulib-lib/fd-hook.c new file mode 100644 index 0000000..75b1626 --- /dev/null +++ b/gnulib-lib/fd-hook.c @@ -0,0 +1,116 @@ +/* Hook for making file descriptor functions close(), ioctl() extensible. + Copyright (C) 2009-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2009. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include "fd-hook.h" + +#include + +/* Currently, this entire code is only needed for the handling of sockets + on native Windows platforms. */ +#if WINDOWS_SOCKETS + +/* The first and last link in the doubly linked list. + Initially the list is empty. */ +static struct fd_hook anchor = { &anchor, &anchor, NULL, NULL }; + +int +execute_close_hooks (const struct fd_hook *remaining_list, gl_close_fn primary, + int fd) +{ + if (remaining_list == &anchor) + /* End of list reached. */ + return primary (fd); + else + return remaining_list->private_close_fn (remaining_list->private_next, + primary, fd); +} + +int +execute_all_close_hooks (gl_close_fn primary, int fd) +{ + return execute_close_hooks (anchor.private_next, primary, fd); +} + +int +execute_ioctl_hooks (const struct fd_hook *remaining_list, gl_ioctl_fn primary, + int fd, int request, void *arg) +{ + if (remaining_list == &anchor) + /* End of list reached. */ + return primary (fd, request, arg); + else + return remaining_list->private_ioctl_fn (remaining_list->private_next, + primary, fd, request, arg); +} + +int +execute_all_ioctl_hooks (gl_ioctl_fn primary, + int fd, int request, void *arg) +{ + return execute_ioctl_hooks (anchor.private_next, primary, fd, request, arg); +} + +void +register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, struct fd_hook *link) +{ + if (close_hook == NULL) + close_hook = execute_close_hooks; + if (ioctl_hook == NULL) + ioctl_hook = execute_ioctl_hooks; + + if (link->private_next == NULL && link->private_prev == NULL) + { + /* Add the link to the doubly linked list. */ + link->private_next = anchor.private_next; + link->private_prev = &anchor; + link->private_close_fn = close_hook; + link->private_ioctl_fn = ioctl_hook; + anchor.private_next->private_prev = link; + anchor.private_next = link; + } + else + { + /* The link is already in use. */ + if (link->private_close_fn != close_hook + || link->private_ioctl_fn != ioctl_hook) + abort (); + } +} + +void +unregister_fd_hook (struct fd_hook *link) +{ + struct fd_hook *next = link->private_next; + struct fd_hook *prev = link->private_prev; + + if (next != NULL && prev != NULL) + { + /* The link is in use. Remove it from the doubly linked list. */ + prev->private_next = next; + next->private_prev = prev; + /* Clear the link, to mark it unused. */ + link->private_next = NULL; + link->private_prev = NULL; + link->private_close_fn = NULL; + link->private_ioctl_fn = NULL; + } +} + +#endif diff --git a/gnulib-lib/fd-hook.h b/gnulib-lib/fd-hook.h new file mode 100644 index 0000000..98e2a52 --- /dev/null +++ b/gnulib-lib/fd-hook.h @@ -0,0 +1,119 @@ +/* Hook for making file descriptor functions close(), ioctl() extensible. + Copyright (C) 2009-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + + +#ifndef FD_HOOK_H +#define FD_HOOK_H + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Currently, this entire code is only needed for the handling of sockets + on native Windows platforms. */ +#if WINDOWS_SOCKETS + + +/* Type of function that closes FD. */ +typedef int (*gl_close_fn) (int fd); + +/* Type of function that applies a control request to FD. */ +typedef int (*gl_ioctl_fn) (int fd, int request, void *arg); + +/* An element of the list of file descriptor hooks. + In CLOS (Common Lisp Object System) speak, it consists of an "around" + method for the close() function and an "around" method for the ioctl() + function. + The fields of this structure are considered private. */ +struct fd_hook +{ + /* Doubly linked list. */ + struct fd_hook *private_next; + struct fd_hook *private_prev; + /* Function that treats the types of FD that it knows about and calls + execute_close_hooks (REMAINING_LIST, PRIMARY, FD) as a fallback. */ + int (*private_close_fn) (const struct fd_hook *remaining_list, + gl_close_fn primary, + int fd); + /* Function that treats the types of FD that it knows about and calls + execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) as a + fallback. */ + int (*private_ioctl_fn) (const struct fd_hook *remaining_list, + gl_ioctl_fn primary, + int fd, int request, void *arg); +}; + +/* This type of function closes FD, applying special knowledge for the FD + types it knows about, and calls + execute_close_hooks (REMAINING_LIST, PRIMARY, FD) + for the other FD types. + In CLOS speak, REMAINING_LIST is the remaining list of "around" methods, + and PRIMARY is the "primary" method for close(). */ +typedef int (*close_hook_fn) (const struct fd_hook *remaining_list, + gl_close_fn primary, + int fd); + +/* Execute the close hooks in REMAINING_LIST, with PRIMARY as "primary" method. + Return 0 or -1, like close() would do. */ +extern int execute_close_hooks (const struct fd_hook *remaining_list, + gl_close_fn primary, + int fd); + +/* Execute all close hooks, with PRIMARY as "primary" method. + Return 0 or -1, like close() would do. */ +extern int execute_all_close_hooks (gl_close_fn primary, int fd); + +/* This type of function applies a control request to FD, applying special + knowledge for the FD types it knows about, and calls + execute_ioctl_hooks (REMAINING_LIST, PRIMARY, FD, REQUEST, ARG) + for the other FD types. + In CLOS speak, REMAINING_LIST is the remaining list of "around" methods, + and PRIMARY is the "primary" method for ioctl(). */ +typedef int (*ioctl_hook_fn) (const struct fd_hook *remaining_list, + gl_ioctl_fn primary, + int fd, int request, void *arg); + +/* Execute the ioctl hooks in REMAINING_LIST, with PRIMARY as "primary" method. + Return 0 or -1, like ioctl() would do. */ +extern int execute_ioctl_hooks (const struct fd_hook *remaining_list, + gl_ioctl_fn primary, + int fd, int request, void *arg); + +/* Execute all ioctl hooks, with PRIMARY as "primary" method. + Return 0 or -1, like ioctl() would do. */ +extern int execute_all_ioctl_hooks (gl_ioctl_fn primary, + int fd, int request, void *arg); + +/* Add a function pair to the list of file descriptor hooks. + CLOSE_HOOK and IOCTL_HOOK may be NULL, indicating no change. + The LINK variable points to a piece of memory which is guaranteed to be + accessible until the corresponding call to unregister_fd_hook. */ +extern void register_fd_hook (close_hook_fn close_hook, ioctl_hook_fn ioctl_hook, + struct fd_hook *link); + +/* Removes a hook from the list of file descriptor hooks. */ +extern void unregister_fd_hook (struct fd_hook *link); + + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* FD_HOOK_H */ diff --git a/gnulib-lib/filename.h b/gnulib-lib/filename.h new file mode 100644 index 0000000..dafe3df --- /dev/null +++ b/gnulib-lib/filename.h @@ -0,0 +1,112 @@ +/* Basic filename support macros. + Copyright (C) 2001-2004, 2007-2021 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, see + . */ + +/* From Paul Eggert and Jim Meyering. */ + +#ifndef _FILENAME_H +#define _FILENAME_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Filename support. + ISSLASH(C) tests whether C is a directory separator + character. + HAS_DEVICE(Filename) tests whether Filename contains a device + specification. + FILE_SYSTEM_PREFIX_LEN(Filename) length of the device specification + at the beginning of Filename, + index of the part consisting of + alternating components and slashes. + FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE + 1 when a non-empty device specification + can be followed by an empty or relative + part, + 0 when a non-empty device specification + must be followed by a slash, + 0 when device specification don't exist. + IS_ABSOLUTE_FILE_NAME(Filename) + tests whether Filename is independent of + any notion of "current directory". + IS_RELATIVE_FILE_NAME(Filename) + tests whether Filename may be concatenated + to a directory filename. + Note: On native Windows, OS/2, DOS, "c:" is neither an absolute nor a + relative file name! + IS_FILE_NAME_WITH_DIR(Filename) tests whether Filename contains a device + or directory specification. + */ +#if defined _WIN32 || defined __CYGWIN__ \ + || defined __EMX__ || defined __MSDOS__ || defined __DJGPP__ + /* Native Windows, Cygwin, OS/2, DOS */ +# define ISSLASH(C) ((C) == '/' || (C) == '\\') + /* Internal macro: Tests whether a character is a drive letter. */ +# define _IS_DRIVE_LETTER(C) \ + (((C) >= 'A' && (C) <= 'Z') || ((C) >= 'a' && (C) <= 'z')) + /* Help the compiler optimizing it. This assumes ASCII. */ +# undef _IS_DRIVE_LETTER +# define _IS_DRIVE_LETTER(C) \ + (((unsigned int) (C) | ('a' - 'A')) - 'a' <= 'z' - 'a') +# define HAS_DEVICE(Filename) \ + (_IS_DRIVE_LETTER ((Filename)[0]) && (Filename)[1] == ':') +# define FILE_SYSTEM_PREFIX_LEN(Filename) (HAS_DEVICE (Filename) ? 2 : 0) +# ifdef __CYGWIN__ +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 +# else + /* On native Windows, OS/2, DOS, the system has the notion of a + "current directory" on each drive. */ +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 1 +# endif +# if FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE +# define IS_ABSOLUTE_FILE_NAME(Filename) \ + ISSLASH ((Filename)[FILE_SYSTEM_PREFIX_LEN (Filename)]) +# else +# define IS_ABSOLUTE_FILE_NAME(Filename) \ + (ISSLASH ((Filename)[0]) || HAS_DEVICE (Filename)) +# endif +# define IS_RELATIVE_FILE_NAME(Filename) \ + (! (ISSLASH ((Filename)[0]) || HAS_DEVICE (Filename))) +# define IS_FILE_NAME_WITH_DIR(Filename) \ + (strchr ((Filename), '/') != NULL || strchr ((Filename), '\\') != NULL \ + || HAS_DEVICE (Filename)) +#else + /* Unix */ +# define ISSLASH(C) ((C) == '/') +# define HAS_DEVICE(Filename) ((void) (Filename), 0) +# define FILE_SYSTEM_PREFIX_LEN(Filename) ((void) (Filename), 0) +# define FILE_SYSTEM_DRIVE_PREFIX_CAN_BE_RELATIVE 0 +# define IS_ABSOLUTE_FILE_NAME(Filename) ISSLASH ((Filename)[0]) +# define IS_RELATIVE_FILE_NAME(Filename) (! ISSLASH ((Filename)[0])) +# define IS_FILE_NAME_WITH_DIR(Filename) (strchr ((Filename), '/') != NULL) +#endif + +/* Deprecated macros. For backward compatibility with old users of the + 'filename' module. */ +#define IS_ABSOLUTE_PATH IS_ABSOLUTE_FILE_NAME +#define IS_PATH_WITH_DIR IS_FILE_NAME_WITH_DIR + + +#ifdef __cplusplus +} +#endif + +#endif /* _FILENAME_H */ diff --git a/gnulib-lib/fstat.c b/gnulib-lib/fstat.c new file mode 100644 index 0000000..512c688 --- /dev/null +++ b/gnulib-lib/fstat.c @@ -0,0 +1,94 @@ +/* fstat() replacement. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* If the user's config.h happens to include , let it include only + the system's here, so that orig_fstat doesn't recurse to + rpl_fstat. */ +#define __need_system_sys_stat_h +#include + +/* Get the original definition of fstat. It might be defined as a macro. */ +#include +#include +#undef __need_system_sys_stat_h + +#if defined _WIN32 && ! defined __CYGWIN__ +# define WINDOWS_NATIVE +#endif + +#if !defined WINDOWS_NATIVE + +static int +orig_fstat (int fd, struct stat *buf) +{ + return fstat (fd, buf); +} + +#endif + +/* Specification. */ +#ifdef __osf__ +/* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc + eliminates this include because of the preliminary #include + above. */ +# include "sys/stat.h" +#else +# include +#endif + +#include "stat-time.h" + +#include +#include +#ifdef WINDOWS_NATIVE +# define WIN32_LEAN_AND_MEAN +# include +# if GNULIB_MSVC_NOTHROW +# include "msvc-nothrow.h" +# else +# include +# endif +# include "stat-w32.h" +#endif + +int +rpl_fstat (int fd, struct stat *buf) +{ +#if REPLACE_FCHDIR && REPLACE_OPEN_DIRECTORY + /* Handle the case when rpl_open() used a dummy file descriptor to work + around an open() that can't normally visit directories. */ + const char *name = _gl_directory_name (fd); + if (name != NULL) + return stat (name, buf); +#endif + +#ifdef WINDOWS_NATIVE + /* Fill the fields ourselves, because the original fstat function returns + values for st_atime, st_mtime, st_ctime that depend on the current time + zone. See + */ + HANDLE h = (HANDLE) _get_osfhandle (fd); + + if (h == INVALID_HANDLE_VALUE) + { + errno = EBADF; + return -1; + } + return _gl_fstat_by_handle (h, NULL, buf); +#else + return stat_time_normalize (orig_fstat (fd, buf), buf); +#endif +} diff --git a/gnulib-lib/getdtablesize.c b/gnulib-lib/getdtablesize.c new file mode 100644 index 0000000..5006c2d --- /dev/null +++ b/gnulib-lib/getdtablesize.c @@ -0,0 +1,124 @@ +/* getdtablesize() function: Return maximum possible file descriptor value + 1. + Copyright (C) 2008-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2008. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include + +#if defined _WIN32 && ! defined __CYGWIN__ + +# include + +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +# endif + +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +static int +_setmaxstdio_nothrow (int newmax) +{ + int result; + + TRY_MSVC_INVAL + { + result = _setmaxstdio (newmax); + } + CATCH_MSVC_INVAL + { + result = -1; + } + DONE_MSVC_INVAL; + + return result; +} +# else +# define _setmaxstdio_nothrow _setmaxstdio +# endif + +/* Cache for the previous getdtablesize () result. Safe to cache because + Windows also lacks setrlimit. */ +static int dtablesize; + +int +getdtablesize (void) +{ + if (dtablesize == 0) + { + /* We are looking for the number N such that the valid file descriptors + are 0..N-1. It can be obtained through a loop as follows: + { + int fd; + for (fd = 3; fd < 65536; fd++) + if (dup2 (0, fd) == -1) + break; + return fd; + } + On Windows XP, the result is 2048. + The drawback of this loop is that it allocates memory for a libc + internal array that is never freed. + + The number N can also be obtained as the upper bound for + _getmaxstdio (). _getmaxstdio () returns the maximum number of open + FILE objects. The sanity check in _setmaxstdio reveals the maximum + number of file descriptors. This too allocates memory, but it is + freed when we call _setmaxstdio with the original value. */ + int orig_max_stdio = _getmaxstdio (); + unsigned int bound; + for (bound = 0x10000; _setmaxstdio_nothrow (bound) < 0; bound = bound / 2) + ; + _setmaxstdio_nothrow (orig_max_stdio); + dtablesize = bound; + } + return dtablesize; +} + +#else + +# include +# include + +# ifndef RLIM_SAVED_CUR +# define RLIM_SAVED_CUR RLIM_INFINITY +# endif +# ifndef RLIM_SAVED_MAX +# define RLIM_SAVED_MAX RLIM_INFINITY +# endif + +# ifdef __CYGWIN__ + /* Cygwin 1.7.25 auto-increases the RLIMIT_NOFILE soft limit until it + hits the compile-time constant hard limit of 3200. We might as + well just report the hard limit. */ +# define rlim_cur rlim_max +# endif + +int +getdtablesize (void) +{ + struct rlimit lim; + + if (getrlimit (RLIMIT_NOFILE, &lim) == 0 + && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX + && lim.rlim_cur != RLIM_INFINITY + && lim.rlim_cur != RLIM_SAVED_CUR + && lim.rlim_cur != RLIM_SAVED_MAX) + return lim.rlim_cur; + + return INT_MAX; +} + +#endif diff --git a/gnulib-lib/getprogname.c b/gnulib-lib/getprogname.c new file mode 100644 index 0000000..9a80281 --- /dev/null +++ b/gnulib-lib/getprogname.c @@ -0,0 +1,302 @@ +/* Program name management. + Copyright (C) 2016-2021 Free Software Foundation, Inc. + + This program 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. + + 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#include + +/* Specification. */ +#include "getprogname.h" + +#include /* get program_invocation_name declaration */ +#include /* get __argv declaration */ + +#ifdef _AIX +# include +# include +# include +#endif + +#ifdef __MVS__ +# ifndef _OPEN_SYS +# define _OPEN_SYS +# endif +# include +# include +#endif + +#ifdef __hpux +# include +# include +# include +# include +#endif + +#if defined __sgi || defined __osf__ +# include +# include +# include +# include +# include +#endif + +#if defined __SCO_VERSION__ || defined __sysv5__ +# include +# include +# include +#endif + +#include "basename-lgpl.h" + +#ifndef HAVE_GETPROGNAME /* not Mac OS X, FreeBSD, NetBSD, OpenBSD >= 5.4, Cygwin */ +char const * +getprogname (void) +{ +# if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME /* glibc, BeOS */ + /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ + return program_invocation_short_name; +# elif HAVE_DECL_PROGRAM_INVOCATION_NAME /* glibc, BeOS */ + /* https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html */ + return last_component (program_invocation_name); +# elif HAVE_GETEXECNAME /* Solaris */ + /* https://docs.oracle.com/cd/E19253-01/816-5168/6mbb3hrb1/index.html */ + const char *p = getexecname (); + if (!p) + p = "?"; + return last_component (p); +# elif HAVE_DECL___ARGV /* mingw, MSVC */ + /* https://docs.microsoft.com/en-us/cpp/c-runtime-library/argc-argv-wargv */ + const char *p = __argv && __argv[0] ? __argv[0] : "?"; + return last_component (p); +# elif HAVE_VAR___PROGNAME /* OpenBSD, Android, QNX */ + /* https://man.openbsd.org/style.9 */ + /* http://www.qnx.de/developers/docs/6.5.0/index.jsp?topic=%2Fcom.qnx.doc.neutrino_lib_ref%2Fp%2F__progname.html */ + /* Be careful to declare this only when we absolutely need it + (OpenBSD 5.1), rather than when it's available. Otherwise, + its mere declaration makes program_invocation_short_name + malfunction (have zero length) with Fedora 25's glibc. */ + extern char *__progname; + const char *p = __progname; +# if defined __ANDROID__ + return last_component (p); +# else + return p && p[0] ? p : "?"; +# endif +# elif _AIX /* AIX */ + /* Idea by Bastien ROUCARIÈS, + https://lists.gnu.org/r/bug-gnulib/2010-12/msg00095.html + Reference: https://www.ibm.com/support/knowledgecenter/en/ssw_aix_61/com.ibm.aix.basetrf1/getprocs.htm + */ + static char *p; + static int first = 1; + if (first) + { + first = 0; + pid_t pid = getpid (); + struct procentry64 procs; + p = (0 < getprocs64 (&procs, sizeof procs, NULL, 0, &pid, 1) + ? strdup (procs.pi_comm) + : NULL); + if (!p) + p = "?"; + } + return p; +# elif defined __hpux + static char *p; + static int first = 1; + if (first) + { + first = 0; + pid_t pid = getpid (); + struct pst_status status; + if (pstat_getproc (&status, sizeof status, 0, pid) > 0) + { + char *ucomm = status.pst_ucomm; + char *cmd = status.pst_cmd; + if (strlen (ucomm) < PST_UCOMMLEN - 1) + p = ucomm; + else + { + /* ucomm is truncated to length PST_UCOMMLEN - 1. + Look at cmd instead. */ + char *space = strchr (cmd, ' '); + if (space != NULL) + *space = '\0'; + p = strrchr (cmd, '/'); + if (p != NULL) + p++; + else + p = cmd; + if (strlen (p) > PST_UCOMMLEN - 1 + && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0) + /* p is less truncated than ucomm. */ + ; + else + p = ucomm; + } + p = strdup (p); + } + else + { +# if !defined __LP64__ + /* Support for 32-bit programs running in 64-bit HP-UX. + The documented way to do this is to use the same source code + as above, but in a compilation unit where '#define _PSTAT64 1' + is in effect. I prefer a single compilation unit; the struct + size and the offsets are not going to change. */ + char status64[1216]; + if (__pstat_getproc64 (status64, sizeof status64, 0, pid) > 0) + { + char *ucomm = status64 + 288; + char *cmd = status64 + 168; + if (strlen (ucomm) < PST_UCOMMLEN - 1) + p = ucomm; + else + { + /* ucomm is truncated to length PST_UCOMMLEN - 1. + Look at cmd instead. */ + char *space = strchr (cmd, ' '); + if (space != NULL) + *space = '\0'; + p = strrchr (cmd, '/'); + if (p != NULL) + p++; + else + p = cmd; + if (strlen (p) > PST_UCOMMLEN - 1 + && memcmp (p, ucomm, PST_UCOMMLEN - 1) == 0) + /* p is less truncated than ucomm. */ + ; + else + p = ucomm; + } + p = strdup (p); + } + else +# endif + p = NULL; + } + if (!p) + p = "?"; + } + return p; +# elif __MVS__ /* z/OS */ + /* https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.bpxbd00/rtwgetp.htm */ + static char *p = "?"; + static int first = 1; + if (first) + { + pid_t pid = getpid (); + int token; + W_PSPROC buf; + first = 0; + memset (&buf, 0, sizeof(buf)); + buf.ps_cmdptr = (char *) malloc (buf.ps_cmdlen = PS_CMDBLEN_LONG); + buf.ps_conttyptr = (char *) malloc (buf.ps_conttylen = PS_CONTTYBLEN); + buf.ps_pathptr = (char *) malloc (buf.ps_pathlen = PS_PATHBLEN); + if (buf.ps_cmdptr && buf.ps_conttyptr && buf.ps_pathptr) + { + for (token = 0; token >= 0; + token = w_getpsent (token, &buf, sizeof(buf))) + { + if (token > 0 && buf.ps_pid == pid) + { + char *s = strdup (last_component (buf.ps_pathptr)); + if (s) + p = s; + break; + } + } + } + free (buf.ps_cmdptr); + free (buf.ps_conttyptr); + free (buf.ps_pathptr); + } + return p; +# elif defined __sgi || defined __osf__ /* IRIX or Tru64 */ + char filename[50]; + int fd; + + # if defined __sgi + sprintf (filename, "/proc/pinfo/%d", (int) getpid ()); + # else + sprintf (filename, "/proc/%d", (int) getpid ()); + # endif + fd = open (filename, O_RDONLY | O_CLOEXEC); + if (0 <= fd) + { + prpsinfo_t buf; + int ioctl_ok = 0 <= ioctl (fd, PIOCPSINFO, &buf); + close (fd); + if (ioctl_ok) + { + char *name = buf.pr_fname; + size_t namesize = sizeof buf.pr_fname; + /* It may not be NUL-terminated. */ + char *namenul = memchr (name, '\0', namesize); + size_t namelen = namenul ? namenul - name : namesize; + char *namecopy = malloc (namelen + 1); + if (namecopy) + { + namecopy[namelen] = '\0'; + return memcpy (namecopy, name, namelen); + } + } + } + return NULL; +# elif defined __SCO_VERSION__ || defined __sysv5__ /* SCO OpenServer6/UnixWare */ + char buf[80]; + int fd; + sprintf (buf, "/proc/%d/cmdline", getpid()); + fd = open (buf, O_RDONLY); + if (0 <= fd) + { + size_t n = read (fd, buf, 79); + if (n > 0) + { + buf[n] = '\0'; /* Guarantee null-termination */ + char *progname; + progname = strrchr (buf, '/'); + if (progname) + { + progname = progname + 1; /* Skip the '/' */ + } + else + { + progname = buf; + } + char *ret; + ret = malloc (strlen (progname) + 1); + if (ret) + { + strcpy (ret, progname); + return ret; + } + } + close (fd); + } + return "?"; +# else +# error "getprogname module not ported to this OS" +# endif +} + +#endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/gnulib-lib/getprogname.h b/gnulib-lib/getprogname.h new file mode 100644 index 0000000..eb12dcd --- /dev/null +++ b/gnulib-lib/getprogname.h @@ -0,0 +1,40 @@ +/* Program name management. + Copyright (C) 2016-2021 Free Software Foundation, Inc. + + This program 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. + + 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +#ifndef _GL_GETPROGNAME_H +#define _GL_GETPROGNAME_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Return the base name of the executing program. + On native Windows this will usually end in ".exe" or ".EXE". */ +#ifndef HAVE_GETPROGNAME +extern char const *getprogname (void) +# ifdef HAVE_DECL_PROGRAM_INVOCATION_NAME + _GL_ATTRIBUTE_PURE +# endif + ; +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/gnulib-lib/gettext.h b/gnulib-lib/gettext.h new file mode 100644 index 0000000..f1c7a24 --- /dev/null +++ b/gnulib-lib/gettext.h @@ -0,0 +1,301 @@ +/* Convenience header for conditional use of GNU . + Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2021 Free Software + Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option + or through "#define ENABLE NLS 0" before including this file. */ +#if defined ENABLE_NLS && ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include + +/* You can set the DEFAULT_TEXT_DOMAIN macro to specify the domain used by + the gettext() and ngettext() macros. This is an alternative to calling + textdomain(), and is useful for libraries. */ +# ifdef DEFAULT_TEXT_DOMAIN +# undef gettext +# define gettext(Msgid) \ + dgettext (DEFAULT_TEXT_DOMAIN, Msgid) +# undef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + dngettext (DEFAULT_TEXT_DOMAIN, Msgid1, Msgid2, N) +# endif + +#else + +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of a NOP. We don't include + as well because people using "gettext.h" will not include , + and also including would fail on SunOS 4, whereas + is OK. */ +#if defined(__sun) +# include +#endif + +/* Many header files from the libstdc++ coming with g++ 3.3 or newer include + , which chokes if dcgettext is defined as a macro. So include + it now, to make later inclusions of a NOP. */ +#if defined(__cplusplus) && defined(__GNUG__) && (__GNUC__ >= 3) +# include +# if (__GLIBC__ >= 2 && !defined __UCLIBC__) || _GLIBCXX_HAVE_LIBINTL_H +# include +# endif +#endif + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# undef gettext +# define gettext(Msgid) ((const char *) (Msgid)) +# undef dgettext +# define dgettext(Domainname, Msgid) ((void) (Domainname), gettext (Msgid)) +# undef dcgettext +# define dcgettext(Domainname, Msgid, Category) \ + ((void) (Category), dgettext (Domainname, Msgid)) +# undef ngettext +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 \ + ? ((void) (Msgid2), (const char *) (Msgid1)) \ + : ((void) (Msgid1), (const char *) (Msgid2))) +# undef dngettext +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((void) (Domainname), ngettext (Msgid1, Msgid2, N)) +# undef dcngettext +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((void) (Category), dngettext (Domainname, Msgid1, Msgid2, N)) +# undef textdomain +# define textdomain(Domainname) ((const char *) (Domainname)) +# undef bindtextdomain +# define bindtextdomain(Domainname, Dirname) \ + ((void) (Domainname), (const char *) (Dirname)) +# undef bind_textdomain_codeset +# define bind_textdomain_codeset(Domainname, Codeset) \ + ((void) (Domainname), (const char *) (Codeset)) + +#endif + +/* Prefer gnulib's setlocale override over libintl's setlocale override. */ +#ifdef GNULIB_defined_setlocale +# undef setlocale +# define setlocale rpl_setlocale +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +/* The separator between msgctxt and msgid in a .mo file. */ +#define GETTEXT_CONTEXT_GLUE "\004" + +/* Pseudo function calls, taking a MSGCTXT and a MSGID instead of just a + MSGID. MSGCTXT and MSGID must be string literals. MSGCTXT should be + short and rarely need to change. + The letter 'p' stands for 'particular' or 'special'. */ +#ifdef DEFAULT_TEXT_DOMAIN +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#else +# define pgettext(Msgctxt, Msgid) \ + pgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#endif +#define dpgettext(Domainname, Msgctxt, Msgid) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, LC_MESSAGES) +#define dcpgettext(Domainname, Msgctxt, Msgid, Category) \ + pgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, Category) +#ifdef DEFAULT_TEXT_DOMAIN +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (DEFAULT_TEXT_DOMAIN, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#else +# define npgettext(Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (NULL, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#endif +#define dnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dcnpgettext(Domainname, Msgctxt, Msgid, MsgidPlural, N, Category) \ + npgettext_aux (Domainname, Msgctxt GETTEXT_CONTEXT_GLUE Msgid, Msgid, MsgidPlural, N, Category) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +pgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + int category) +{ + const char *translation = dcgettext (domain, msg_ctxt_id, category); + if (translation == msg_ctxt_id) + return msgid; + else + return translation; +} + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +npgettext_aux (const char *domain, + const char *msg_ctxt_id, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + const char *translation = + dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + if (translation == msg_ctxt_id || translation == msgid_plural) + return (n == 1 ? msgid : msgid_plural); + else + return translation; +} + +/* The same thing extended for non-constant arguments. Here MSGCTXT and MSGID + can be arbitrary expressions. But for string literals these macros are + less efficient than those above. */ + +#include + +/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported. + This relates to the -Wvla and -Wvla-larger-than warnings, enabled in + the default GCC many warnings set. This allows programs to disable use + of VLAs, which may be unintended, or may be awkward to support portably, + or may have security implications due to non-deterministic stack usage. */ + +#if (!defined GNULIB_NO_VLA \ + && (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \ + /* || (__STDC_VERSION__ == 199901L && !defined __HP_cc) + || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )) +# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1 +#else +# define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0 +#endif + +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS +#include +#endif + +#define pgettext_expr(Msgctxt, Msgid) \ + dcpgettext_expr (NULL, Msgctxt, Msgid, LC_MESSAGES) +#define dpgettext_expr(Domainname, Msgctxt, Msgid) \ + dcpgettext_expr (Domainname, Msgctxt, Msgid, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + int found_translation; + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcgettext (domain, msg_ctxt_id, category); + found_translation = (translation != msg_ctxt_id); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (found_translation) + return translation; + } + return msgid; +} + +#define npgettext_expr(Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (NULL, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) +#define dnpgettext_expr(Domainname, Msgctxt, Msgid, MsgidPlural, N) \ + dcnpgettext_expr (Domainname, Msgctxt, Msgid, MsgidPlural, N, LC_MESSAGES) + +#ifdef __GNUC__ +__inline +#else +#ifdef __cplusplus +inline +#endif +#endif +static const char * +dcnpgettext_expr (const char *domain, + const char *msgctxt, const char *msgid, + const char *msgid_plural, unsigned long int n, + int category) +{ + size_t msgctxt_len = strlen (msgctxt) + 1; + size_t msgid_len = strlen (msgid) + 1; + const char *translation; +#if _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + char msg_ctxt_id[msgctxt_len + msgid_len]; +#else + char buf[1024]; + char *msg_ctxt_id = + (msgctxt_len + msgid_len <= sizeof (buf) + ? buf + : (char *) malloc (msgctxt_len + msgid_len)); + if (msg_ctxt_id != NULL) +#endif + { + int found_translation; + memcpy (msg_ctxt_id, msgctxt, msgctxt_len - 1); + msg_ctxt_id[msgctxt_len - 1] = '\004'; + memcpy (msg_ctxt_id + msgctxt_len, msgid, msgid_len); + translation = dcngettext (domain, msg_ctxt_id, msgid_plural, n, category); + found_translation = !(translation == msg_ctxt_id || translation == msgid_plural); +#if !_LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS + if (msg_ctxt_id != buf) + free (msg_ctxt_id); +#endif + if (found_translation) + return translation; + } + return (n == 1 ? msgid : msgid_plural); +} + +#endif /* _LIBGETTEXT_H */ diff --git a/gnulib-lib/gl_anyhash1.h b/gnulib-lib/gl_anyhash1.h new file mode 100644 index 0000000..49b727d --- /dev/null +++ b/gnulib-lib/gl_anyhash1.h @@ -0,0 +1,31 @@ +/* Hash table for sequential list, set, and map data type. + Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Common code of + gl_linkedhash_list.c, gl_avltreehash_list.c, gl_rbtreehash_list.c, + gl_linkedhash_set.c, gl_hash_set.c, + gl_linkedhash_map.c, gl_hash_map.c. */ + +/* Hash table entry. */ +struct gl_hash_entry +{ + struct gl_hash_entry *hash_next; /* chain of entries in same bucket */ + size_t hashcode; /* cache of the hash code of + - the key (for map data type) or + - the value (for list, set data types) */ +}; +typedef struct gl_hash_entry * gl_hash_entry_t; diff --git a/gnulib-lib/gl_anyhash2.h b/gnulib-lib/gl_anyhash2.h new file mode 100644 index 0000000..7a9fcba --- /dev/null +++ b/gnulib-lib/gl_anyhash2.h @@ -0,0 +1,82 @@ +/* Hash table for sequential list, set, and map data type. + Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Common code of + gl_linkedhash_list.c, gl_avltreehash_list.c, gl_rbtreehash_list.c, + gl_linkedhash_set.c, gl_hash_set.c, + gl_linkedhash_map.c, gl_hash_map.c. */ + +#include "gl_anyhash_primes.h" + +/* Resizes the hash table with a new estimated size. */ +static void +hash_resize (CONTAINER_T container, size_t estimate) +{ + size_t new_size = next_prime (estimate); + + if (new_size > container->table_size) + { + gl_hash_entry_t *old_table = container->table; + /* Allocate the new table. */ + gl_hash_entry_t *new_table; + size_t i; + + if (size_overflow_p (xtimes (new_size, sizeof (gl_hash_entry_t)))) + goto fail; + new_table = + (gl_hash_entry_t *) calloc (new_size, sizeof (gl_hash_entry_t)); + if (new_table == NULL) + goto fail; + + /* Iterate through the entries of the old table. */ + for (i = container->table_size; i > 0; ) + { + gl_hash_entry_t node = old_table[--i]; + + while (node != NULL) + { + gl_hash_entry_t next = node->hash_next; + /* Add the entry to the new table. */ + size_t bucket = node->hashcode % new_size; + node->hash_next = new_table[bucket]; + new_table[bucket] = node; + + node = next; + } + } + + container->table = new_table; + container->table_size = new_size; + free (old_table); + } + return; + + fail: + /* Just continue without resizing the table. */ + return; +} + +/* Resizes the hash table if needed, after CONTAINER_COUNT (container) was + incremented. */ +static void +hash_resize_after_add (CONTAINER_T container) +{ + size_t count = CONTAINER_COUNT (container); + size_t estimate = xsum (count, count / 2); /* 1.5 * count */ + if (estimate > container->table_size) + hash_resize (container, estimate); +} diff --git a/gnulib-lib/gl_anyhash_primes.h b/gnulib-lib/gl_anyhash_primes.h new file mode 100644 index 0000000..fc69e9c --- /dev/null +++ b/gnulib-lib/gl_anyhash_primes.h @@ -0,0 +1,87 @@ +/* Table of primes, for use by hash tables. + Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Array of primes, approximately in steps of factor 1.2. + This table was computed by executing the Common Lisp expression + (dotimes (i 244) (format t "nextprime(~D)~%" (ceiling (expt 1.2d0 i)))) + and feeding the result to PARI/gp. */ +static const size_t primes[] = + { + 11, 13, 17, 19, 23, 29, 37, 41, 47, 59, 67, 83, 97, 127, 139, 167, 199, + 239, 293, 347, 419, 499, 593, 709, 853, 1021, 1229, 1471, 1777, 2129, 2543, + 3049, 3659, 4391, 5273, 6323, 7589, 9103, 10937, 13109, 15727, 18899, + 22651, 27179, 32609, 39133, 46957, 56359, 67619, 81157, 97369, 116849, + 140221, 168253, 201907, 242309, 290761, 348889, 418667, 502409, 602887, + 723467, 868151, 1041779, 1250141, 1500181, 1800191, 2160233, 2592277, + 3110741, 3732887, 4479463, 5375371, 6450413, 7740517, 9288589, 11146307, + 13375573, 16050689, 19260817, 23112977, 27735583, 33282701, 39939233, + 47927081, 57512503, 69014987, 82818011, 99381577, 119257891, 143109469, + 171731387, 206077643, 247293161, 296751781, 356102141, 427322587, + 512787097, 615344489, 738413383, 886096061, 1063315271, 1275978331, + 1531174013, 1837408799, 2204890543UL, 2645868653UL, 3175042391UL, + 3810050851UL, +#if SIZE_MAX > 4294967295UL + 4572061027UL, 5486473229UL, 6583767889UL, 7900521449UL, 9480625733UL, + 11376750877UL, 13652101063UL, 16382521261UL, 19659025513UL, 23590830631UL, + 28308996763UL, 33970796089UL, 40764955463UL, 48917946377UL, 58701535657UL, + 70441842749UL, 84530211301UL, 101436253561UL, 121723504277UL, + 146068205131UL, 175281846149UL, 210338215379UL, 252405858521UL, + 302887030151UL, 363464436191UL, 436157323417UL, 523388788231UL, + 628066545713UL, 753679854847UL, 904415825857UL, 1085298991109UL, + 1302358789181UL, 1562830547009UL, 1875396656429UL, 2250475987709UL, + 2700571185239UL, 3240685422287UL, 3888822506759UL, 4666587008147UL, + 5599904409713UL, 6719885291641UL, 8063862349969UL, 9676634819959UL, + 11611961783951UL, 13934354140769UL, 16721224968907UL, 20065469962669UL, + 24078563955191UL, 28894276746229UL, 34673132095507UL, 41607758514593UL, + 49929310217531UL, 59915172260971UL, 71898206713183UL, 86277848055823UL, + 103533417666967UL, 124240101200359UL, 149088121440451UL, 178905745728529UL, + 214686894874223UL, 257624273849081UL, 309149128618903UL, 370978954342639UL, + 445174745211143UL, 534209694253381UL, 641051633104063UL, 769261959724877UL, + 923114351670013UL, 1107737222003791UL, 1329284666404567UL, + 1595141599685509UL, 1914169919622551UL, 2297003903547091UL, + 2756404684256459UL, 3307685621107757UL, 3969222745329323UL, + 4763067294395177UL, 5715680753274209UL, 6858816903929113UL, + 8230580284714831UL, 9876696341657791UL, 11852035609989371UL, + 14222442731987227UL, 17066931278384657UL, 20480317534061597UL, + 24576381040873903UL, 29491657249048679UL, 35389988698858471UL, + 42467986438630267UL, 50961583726356109UL, 61153900471627387UL, + 73384680565952851UL, 88061616679143347UL, 105673940014972061UL, + 126808728017966413UL, 152170473621559703UL, 182604568345871671UL, + 219125482015045997UL, 262950578418055169UL, 315540694101666193UL, + 378648832921999397UL, 454378599506399233UL, 545254319407679131UL, + 654305183289214771UL, 785166219947057701UL, 942199463936469157UL, + 1130639356723763129UL, 1356767228068515623UL, 1628120673682218619UL, + 1953744808418662409UL, 2344493770102394881UL, 2813392524122873857UL, + 3376071028947448339UL, 4051285234736937517UL, 4861542281684325481UL, + 5833850738021191727UL, 7000620885625427969UL, 8400745062750513217UL, + 10080894075300616261UL, 12097072890360739951UL, 14516487468432885797UL, + 17419784962119465179UL, +#endif + SIZE_MAX /* sentinel, to ensure the search terminates */ + }; + +/* Returns a suitable prime >= ESTIMATE. */ +static size_t +next_prime (size_t estimate) +{ + size_t i; + + for (i = 0; i < sizeof (primes) / sizeof (primes[0]); i++) + if (primes[i] >= estimate) + return primes[i]; + return SIZE_MAX; /* not a prime, but better than nothing */ +} diff --git a/gnulib-lib/gl_anylinked_list1.h b/gnulib-lib/gl_anylinked_list1.h new file mode 100644 index 0000000..10d6e9b --- /dev/null +++ b/gnulib-lib/gl_anylinked_list1.h @@ -0,0 +1,48 @@ +/* Sequential list data type implemented by a linked list. + Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Common code of gl_linked_list.c and gl_linkedhash_list.c. */ + +/* -------------------------- gl_list_t Data Type -------------------------- */ + +/* Concrete list node implementation, valid for this file only. */ +struct gl_list_node_impl +{ +#if WITH_HASHTABLE + struct gl_hash_entry h; /* hash table entry fields; must be first */ +#endif + struct gl_list_node_impl *next; + struct gl_list_node_impl *prev; + const void *value; +}; + +/* Concrete gl_list_impl type, valid for this file only. */ +struct gl_list_impl +{ + struct gl_list_impl_base base; +#if WITH_HASHTABLE + /* A hash table: managed as an array of collision lists. */ + struct gl_hash_entry **table; + size_t table_size; +#endif + /* A circular list anchored at root. + The first node is = root.next, the last node is = root.prev. + The root's value is unused. */ + struct gl_list_node_impl root; + /* Number of list nodes, excluding the root. */ + size_t count; +}; diff --git a/gnulib-lib/gl_anylinked_list2.h b/gnulib-lib/gl_anylinked_list2.h new file mode 100644 index 0000000..176403a --- /dev/null +++ b/gnulib-lib/gl_anylinked_list2.h @@ -0,0 +1,1215 @@ +/* Sequential list data type implemented by a linked list. + Copyright (C) 2006-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Common code of gl_linked_list.c and gl_linkedhash_list.c. */ + +/* If the symbol SIGNAL_SAFE_LIST is defined, the code is compiled in such + a way that a gl_list_t data structure may be used from within a signal + handler. The operations allowed in the signal handler are: + gl_list_iterator, gl_list_iterator_next, gl_list_iterator_free. + The list and node fields that are therefore accessed from the signal handler + are: + list->root, node->next, node->value. + We are careful to make modifications to these fields only in an order + that maintains the consistency of the list data structure at any moment, + and we use 'volatile' assignments to prevent the compiler from reordering + such assignments. */ +#ifdef SIGNAL_SAFE_LIST +# define ASYNCSAFE(type) *(type volatile *)& +#else +# define ASYNCSAFE(type) +#endif + +/* -------------------------- gl_list_t Data Type -------------------------- */ + +static gl_list_t +gl_linked_nx_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates) +{ + struct gl_list_impl *list = + (struct gl_list_impl *) malloc (sizeof (struct gl_list_impl)); + + if (list == NULL) + return NULL; + + list->base.vtable = implementation; + list->base.equals_fn = equals_fn; + list->base.hashcode_fn = hashcode_fn; + list->base.dispose_fn = dispose_fn; + list->base.allow_duplicates = allow_duplicates; +#if WITH_HASHTABLE + list->table_size = 11; + list->table = + (gl_hash_entry_t *) calloc (list->table_size, sizeof (gl_hash_entry_t)); + if (list->table == NULL) + goto fail; +#endif + list->root.next = &list->root; + list->root.prev = &list->root; + list->count = 0; + + return list; + +#if WITH_HASHTABLE + fail: + free (list); + return NULL; +#endif +} + +static gl_list_t +gl_linked_nx_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents) +{ + struct gl_list_impl *list = + (struct gl_list_impl *) malloc (sizeof (struct gl_list_impl)); + gl_list_node_t tail; + + if (list == NULL) + return NULL; + + list->base.vtable = implementation; + list->base.equals_fn = equals_fn; + list->base.hashcode_fn = hashcode_fn; + list->base.dispose_fn = dispose_fn; + list->base.allow_duplicates = allow_duplicates; +#if WITH_HASHTABLE + { + size_t estimate = xsum (count, count / 2); /* 1.5 * count */ + if (estimate < 10) + estimate = 10; + list->table_size = next_prime (estimate); + if (size_overflow_p (xtimes (list->table_size, sizeof (gl_hash_entry_t)))) + goto fail1; + list->table = + (gl_hash_entry_t *) calloc (list->table_size, sizeof (gl_hash_entry_t)); + if (list->table == NULL) + goto fail1; + } +#endif + list->count = count; + tail = &list->root; + for (; count > 0; contents++, count--) + { + gl_list_node_t node = + (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl)); + + if (node == NULL) + goto fail2; + + node->value = *contents; +#if WITH_HASHTABLE + node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (node->value) + : (size_t)(uintptr_t) node->value); + + /* Add node to the hash table. */ + if (add_to_bucket (list, node) < 0) + { + free (node); + goto fail2; + } +#endif + + /* Add node to the list. */ + node->prev = tail; + tail->next = node; + tail = node; + } + tail->next = &list->root; + list->root.prev = tail; + + return list; + + fail2: + { + gl_list_node_t node; + + for (node = tail; node != &list->root; ) + { + gl_list_node_t prev = node->prev; + + free (node); + node = prev; + } + } +#if WITH_HASHTABLE + free (list->table); + fail1: +#endif + free (list); + return NULL; +} + +static size_t _GL_ATTRIBUTE_PURE +gl_linked_size (gl_list_t list) +{ + return list->count; +} + +static const void * _GL_ATTRIBUTE_PURE +gl_linked_node_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node) +{ + return node->value; +} + +static int +gl_linked_node_nx_set_value (gl_list_t list _GL_ATTRIBUTE_MAYBE_UNUSED, + gl_list_node_t node, + const void *elt) +{ +#if WITH_HASHTABLE + if (elt != node->value) + { + size_t new_hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (elt) + : (size_t)(uintptr_t) elt); + + if (new_hashcode != node->h.hashcode) + { + remove_from_bucket (list, node); + node->value = elt; + node->h.hashcode = new_hashcode; + if (add_to_bucket (list, node) < 0) + { + /* Out of memory. We removed node from a bucket but cannot add + it to another bucket. In order to avoid inconsistencies, we + must remove node entirely from the list. */ + gl_list_node_t before_removed = node->prev; + gl_list_node_t after_removed = node->next; + ASYNCSAFE(gl_list_node_t) before_removed->next = after_removed; + after_removed->prev = before_removed; + list->count--; + free (node); + return -1; + } + } + else + node->value = elt; + } +#else + node->value = elt; +#endif + return 0; +} + +static gl_list_node_t _GL_ATTRIBUTE_PURE +gl_linked_next_node (gl_list_t list, gl_list_node_t node) +{ + return (node->next != &list->root ? node->next : NULL); +} + +static gl_list_node_t _GL_ATTRIBUTE_PURE +gl_linked_previous_node (gl_list_t list, gl_list_node_t node) +{ + return (node->prev != &list->root ? node->prev : NULL); +} + +static gl_list_node_t _GL_ATTRIBUTE_PURE +gl_linked_first_node (gl_list_t list) +{ + if (list->count > 0) + return list->root.next; + else + return NULL; +} + +static gl_list_node_t _GL_ATTRIBUTE_PURE +gl_linked_last_node (gl_list_t list) +{ + if (list->count > 0) + return list->root.prev; + else + return NULL; +} + +static const void * _GL_ATTRIBUTE_PURE +gl_linked_get_at (gl_list_t list, size_t position) +{ + size_t count = list->count; + gl_list_node_t node; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + /* Here we know count > 0. */ + if (position <= ((count - 1) / 2)) + { + node = list->root.next; + for (; position > 0; position--) + node = node->next; + } + else + { + position = count - 1 - position; + node = list->root.prev; + for (; position > 0; position--) + node = node->prev; + } + return node->value; +} + +static gl_list_node_t +gl_linked_nx_set_at (gl_list_t list, size_t position, const void *elt) +{ + size_t count = list->count; + gl_list_node_t node; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + /* Here we know count > 0. */ + if (position <= ((count - 1) / 2)) + { + node = list->root.next; + for (; position > 0; position--) + node = node->next; + } + else + { + position = count - 1 - position; + node = list->root.prev; + for (; position > 0; position--) + node = node->prev; + } +#if WITH_HASHTABLE + if (elt != node->value) + { + size_t new_hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (elt) + : (size_t)(uintptr_t) elt); + + if (new_hashcode != node->h.hashcode) + { + remove_from_bucket (list, node); + node->value = elt; + node->h.hashcode = new_hashcode; + if (add_to_bucket (list, node) < 0) + { + /* Out of memory. We removed node from a bucket but cannot add + it to another bucket. In order to avoid inconsistencies, we + must remove node entirely from the list. */ + gl_list_node_t before_removed = node->prev; + gl_list_node_t after_removed = node->next; + ASYNCSAFE(gl_list_node_t) before_removed->next = after_removed; + after_removed->prev = before_removed; + list->count--; + free (node); + return NULL; + } + } + else + node->value = elt; + } +#else + node->value = elt; +#endif + return node; +} + +static gl_list_node_t _GL_ATTRIBUTE_PURE +gl_linked_search_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + size_t count = list->count; + + if (!(start_index <= end_index && end_index <= count)) + /* Invalid arguments. */ + abort (); + { +#if WITH_HASHTABLE + size_t hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (elt) + : (size_t)(uintptr_t) elt); + size_t bucket = hashcode % list->table_size; + gl_listelement_equals_fn equals = list->base.equals_fn; + + if (!list->base.allow_duplicates) + { + /* Look for the first match in the hash bucket. */ + gl_list_node_t found = NULL; + gl_list_node_t node; + + for (node = (gl_list_node_t) list->table[bucket]; + node != NULL; + node = (gl_list_node_t) node->h.hash_next) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + { + found = node; + break; + } + if (start_index > 0) + /* Look whether found's index is < start_index. */ + for (node = list->root.next; ; node = node->next) + { + if (node == found) + return NULL; + if (--start_index == 0) + break; + } + if (end_index < count) + /* Look whether found's index is >= end_index. */ + { + end_index = count - end_index; + for (node = list->root.prev; ; node = node->prev) + { + if (node == found) + return NULL; + if (--end_index == 0) + break; + } + } + return found; + } + else + { + /* Look whether there is more than one match in the hash bucket. */ + bool multiple_matches = false; + gl_list_node_t first_match = NULL; + gl_list_node_t node; + + for (node = (gl_list_node_t) list->table[bucket]; + node != NULL; + node = (gl_list_node_t) node->h.hash_next) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + { + if (first_match == NULL) + first_match = node; + else + { + multiple_matches = true; + break; + } + } + if (multiple_matches) + { + /* We need the match with the smallest index. But we don't have + a fast mapping node -> index. So we have to walk the list. */ + end_index -= start_index; + node = list->root.next; + for (; start_index > 0; start_index--) + node = node->next; + + for (; + end_index > 0; + node = node->next, end_index--) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + return node; + /* The matches must have all been at indices < start_index or + >= end_index. */ + return NULL; + } + else + { + if (start_index > 0) + /* Look whether first_match's index is < start_index. */ + for (node = list->root.next; node != &list->root; node = node->next) + { + if (node == first_match) + return NULL; + if (--start_index == 0) + break; + } + if (end_index < list->count) + /* Look whether first_match's index is >= end_index. */ + { + end_index = list->count - end_index; + for (node = list->root.prev; ; node = node->prev) + { + if (node == first_match) + return NULL; + if (--end_index == 0) + break; + } + } + return first_match; + } + } +#else + gl_listelement_equals_fn equals = list->base.equals_fn; + gl_list_node_t node = list->root.next; + + end_index -= start_index; + for (; start_index > 0; start_index--) + node = node->next; + + if (equals != NULL) + { + for (; end_index > 0; node = node->next, end_index--) + if (equals (elt, node->value)) + return node; + } + else + { + for (; end_index > 0; node = node->next, end_index--) + if (elt == node->value) + return node; + } + return NULL; +#endif + } +} + +static size_t _GL_ATTRIBUTE_PURE +gl_linked_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + size_t count = list->count; + + if (!(start_index <= end_index && end_index <= count)) + /* Invalid arguments. */ + abort (); + { +#if WITH_HASHTABLE + /* Here the hash table doesn't help much. It only allows us to minimize + the number of equals() calls, by looking up first the node and then + its index. */ + size_t hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (elt) + : (size_t)(uintptr_t) elt); + size_t bucket = hashcode % list->table_size; + gl_listelement_equals_fn equals = list->base.equals_fn; + gl_list_node_t node; + + /* First step: Look up the node. */ + if (!list->base.allow_duplicates) + { + /* Look for the first match in the hash bucket. */ + for (node = (gl_list_node_t) list->table[bucket]; + node != NULL; + node = (gl_list_node_t) node->h.hash_next) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + break; + } + else + { + /* Look whether there is more than one match in the hash bucket. */ + bool multiple_matches = false; + gl_list_node_t first_match = NULL; + + for (node = (gl_list_node_t) list->table[bucket]; + node != NULL; + node = (gl_list_node_t) node->h.hash_next) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + { + if (first_match == NULL) + first_match = node; + else + { + multiple_matches = true; + break; + } + } + if (multiple_matches) + { + /* We need the match with the smallest index. But we don't have + a fast mapping node -> index. So we have to walk the list. */ + size_t index; + + index = start_index; + node = list->root.next; + for (; start_index > 0; start_index--) + node = node->next; + + for (; + index < end_index; + node = node->next, index++) + if (node->h.hashcode == hashcode + && (equals != NULL + ? equals (elt, node->value) + : elt == node->value)) + return index; + /* The matches must have all been at indices < start_index or + >= end_index. */ + return (size_t)(-1); + } + node = first_match; + } + + /* Second step: Look up the index of the node. */ + if (node == NULL) + return (size_t)(-1); + else + { + size_t index = 0; + + for (; node->prev != &list->root; node = node->prev) + index++; + + if (index >= start_index && index < end_index) + return index; + else + return (size_t)(-1); + } +#else + gl_listelement_equals_fn equals = list->base.equals_fn; + size_t index = start_index; + gl_list_node_t node = list->root.next; + + for (; start_index > 0; start_index--) + node = node->next; + + if (equals != NULL) + { + for (; + index < end_index; + node = node->next, index++) + if (equals (elt, node->value)) + return index; + } + else + { + for (; + index < end_index; + node = node->next, index++) + if (elt == node->value) + return index; + } + return (size_t)(-1); +#endif + } +} + +static gl_list_node_t +gl_linked_nx_add_first (gl_list_t list, const void *elt) +{ + gl_list_node_t node = + (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl)); + + if (node == NULL) + return NULL; + + ASYNCSAFE(const void *) node->value = elt; +#if WITH_HASHTABLE + node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (node->value) + : (size_t)(uintptr_t) node->value); + + /* Add node to the hash table. */ + if (add_to_bucket (list, node) < 0) + { + free (node); + return NULL; + } +#endif + + /* Add node to the list. */ + node->prev = &list->root; + ASYNCSAFE(gl_list_node_t) node->next = list->root.next; + node->next->prev = node; + ASYNCSAFE(gl_list_node_t) list->root.next = node; + list->count++; + +#if WITH_HASHTABLE + hash_resize_after_add (list); +#endif + + return node; +} + +static gl_list_node_t +gl_linked_nx_add_last (gl_list_t list, const void *elt) +{ + gl_list_node_t node = + (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl)); + + if (node == NULL) + return NULL; + + ASYNCSAFE(const void *) node->value = elt; +#if WITH_HASHTABLE + node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (node->value) + : (size_t)(uintptr_t) node->value); + + /* Add node to the hash table. */ + if (add_to_bucket (list, node) < 0) + { + free (node); + return NULL; + } +#endif + + /* Add node to the list. */ + ASYNCSAFE(gl_list_node_t) node->next = &list->root; + node->prev = list->root.prev; + ASYNCSAFE(gl_list_node_t) node->prev->next = node; + list->root.prev = node; + list->count++; + +#if WITH_HASHTABLE + hash_resize_after_add (list); +#endif + + return node; +} + +static gl_list_node_t +gl_linked_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt) +{ + gl_list_node_t new_node = + (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl)); + + if (new_node == NULL) + return NULL; + + ASYNCSAFE(const void *) new_node->value = elt; +#if WITH_HASHTABLE + new_node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (new_node->value) + : (size_t)(uintptr_t) new_node->value); + + /* Add new_node to the hash table. */ + if (add_to_bucket (list, new_node) < 0) + { + free (new_node); + return NULL; + } +#endif + + /* Add new_node to the list. */ + ASYNCSAFE(gl_list_node_t) new_node->next = node; + new_node->prev = node->prev; + ASYNCSAFE(gl_list_node_t) new_node->prev->next = new_node; + node->prev = new_node; + list->count++; + +#if WITH_HASHTABLE + hash_resize_after_add (list); +#endif + + return new_node; +} + +static gl_list_node_t +gl_linked_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt) +{ + gl_list_node_t new_node = + (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl)); + + if (new_node == NULL) + return NULL; + + ASYNCSAFE(const void *) new_node->value = elt; +#if WITH_HASHTABLE + new_node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (new_node->value) + : (size_t)(uintptr_t) new_node->value); + + /* Add new_node to the hash table. */ + if (add_to_bucket (list, new_node) < 0) + { + free (new_node); + return NULL; + } +#endif + + /* Add new_node to the list. */ + new_node->prev = node; + ASYNCSAFE(gl_list_node_t) new_node->next = node->next; + new_node->next->prev = new_node; + ASYNCSAFE(gl_list_node_t) node->next = new_node; + list->count++; + +#if WITH_HASHTABLE + hash_resize_after_add (list); +#endif + + return new_node; +} + +static gl_list_node_t +gl_linked_nx_add_at (gl_list_t list, size_t position, const void *elt) +{ + size_t count = list->count; + gl_list_node_t new_node; + + if (!(position <= count)) + /* Invalid argument. */ + abort (); + + new_node = (struct gl_list_node_impl *) malloc (sizeof (struct gl_list_node_impl)); + if (new_node == NULL) + return NULL; + + ASYNCSAFE(const void *) new_node->value = elt; +#if WITH_HASHTABLE + new_node->h.hashcode = + (list->base.hashcode_fn != NULL + ? list->base.hashcode_fn (new_node->value) + : (size_t)(uintptr_t) new_node->value); + + /* Add new_node to the hash table. */ + if (add_to_bucket (list, new_node) < 0) + { + free (new_node); + return NULL; + } +#endif + + /* Add new_node to the list. */ + if (position <= (count / 2)) + { + gl_list_node_t node; + + node = &list->root; + for (; position > 0; position--) + node = node->next; + new_node->prev = node; + ASYNCSAFE(gl_list_node_t) new_node->next = node->next; + new_node->next->prev = new_node; + ASYNCSAFE(gl_list_node_t) node->next = new_node; + } + else + { + gl_list_node_t node; + + position = count - position; + node = &list->root; + for (; position > 0; position--) + node = node->prev; + ASYNCSAFE(gl_list_node_t) new_node->next = node; + new_node->prev = node->prev; + ASYNCSAFE(gl_list_node_t) new_node->prev->next = new_node; + node->prev = new_node; + } + list->count++; + +#if WITH_HASHTABLE + hash_resize_after_add (list); +#endif + + return new_node; +} + +static bool +gl_linked_remove_node (gl_list_t list, gl_list_node_t node) +{ + gl_list_node_t prev; + gl_list_node_t next; + +#if WITH_HASHTABLE + /* Remove node from the hash table. */ + remove_from_bucket (list, node); +#endif + + /* Remove node from the list. */ + prev = node->prev; + next = node->next; + + ASYNCSAFE(gl_list_node_t) prev->next = next; + next->prev = prev; + list->count--; + + if (list->base.dispose_fn != NULL) + list->base.dispose_fn (node->value); + free (node); + return true; +} + +static bool +gl_linked_remove_at (gl_list_t list, size_t position) +{ + size_t count = list->count; + gl_list_node_t removed_node; + + if (!(position < count)) + /* Invalid argument. */ + abort (); + /* Here we know count > 0. */ + if (position <= ((count - 1) / 2)) + { + gl_list_node_t node; + gl_list_node_t after_removed; + + node = &list->root; + for (; position > 0; position--) + node = node->next; + removed_node = node->next; + after_removed = node->next->next; + ASYNCSAFE(gl_list_node_t) node->next = after_removed; + after_removed->prev = node; + } + else + { + gl_list_node_t node; + gl_list_node_t before_removed; + + position = count - 1 - position; + node = &list->root; + for (; position > 0; position--) + node = node->prev; + removed_node = node->prev; + before_removed = node->prev->prev; + node->prev = before_removed; + ASYNCSAFE(gl_list_node_t) before_removed->next = node; + } +#if WITH_HASHTABLE + remove_from_bucket (list, removed_node); +#endif + list->count--; + + if (list->base.dispose_fn != NULL) + list->base.dispose_fn (removed_node->value); + free (removed_node); + return true; +} + +static bool +gl_linked_remove (gl_list_t list, const void *elt) +{ + gl_list_node_t node = gl_linked_search_from_to (list, 0, list->count, elt); + + if (node != NULL) + return gl_linked_remove_node (list, node); + else + return false; +} + +static void +gl_linked_list_free (gl_list_t list) +{ + gl_listelement_dispose_fn dispose = list->base.dispose_fn; + gl_list_node_t node; + + for (node = list->root.next; node != &list->root; ) + { + gl_list_node_t next = node->next; + if (dispose != NULL) + dispose (node->value); + free (node); + node = next; + } +#if WITH_HASHTABLE + free (list->table); +#endif + free (list); +} + +/* --------------------- gl_list_iterator_t Data Type --------------------- */ + +static gl_list_iterator_t _GL_ATTRIBUTE_PURE +gl_linked_iterator (gl_list_t list) +{ + gl_list_iterator_t result; + + result.vtable = list->base.vtable; + result.list = list; + result.p = list->root.next; + result.q = &list->root; +#if defined GCC_LINT || defined lint + result.i = 0; + result.j = 0; + result.count = 0; +#endif + + return result; +} + +static gl_list_iterator_t _GL_ATTRIBUTE_PURE +gl_linked_iterator_from_to (gl_list_t list, + size_t start_index, size_t end_index) +{ + gl_list_iterator_t result; + size_t n1, n2, n3; + + if (!(start_index <= end_index && end_index <= list->count)) + /* Invalid arguments. */ + abort (); + result.vtable = list->base.vtable; + result.list = list; + n1 = start_index; + n2 = end_index - start_index; + n3 = list->count - end_index; + /* Find the maximum among n1, n2, n3, so as to reduce the number of + loop iterations to n1 + n2 + n3 - max(n1,n2,n3). */ + if (n1 > n2 && n1 > n3) + { + /* n1 is the maximum, use n2 and n3. */ + gl_list_node_t node; + size_t i; + + node = &list->root; + for (i = n3; i > 0; i--) + node = node->prev; + result.q = node; + for (i = n2; i > 0; i--) + node = node->prev; + result.p = node; + } + else if (n2 > n3) + { + /* n2 is the maximum, use n1 and n3. */ + gl_list_node_t node; + size_t i; + + node = list->root.next; + for (i = n1; i > 0; i--) + node = node->next; + result.p = node; + + node = &list->root; + for (i = n3; i > 0; i--) + node = node->prev; + result.q = node; + } + else + { + /* n3 is the maximum, use n1 and n2. */ + gl_list_node_t node; + size_t i; + + node = list->root.next; + for (i = n1; i > 0; i--) + node = node->next; + result.p = node; + for (i = n2; i > 0; i--) + node = node->next; + result.q = node; + } + +#if defined GCC_LINT || defined lint + result.i = 0; + result.j = 0; + result.count = 0; +#endif + + return result; +} + +static bool +gl_linked_iterator_next (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep) +{ + if (iterator->p != iterator->q) + { + gl_list_node_t node = (gl_list_node_t) iterator->p; + *eltp = node->value; + if (nodep != NULL) + *nodep = node; + iterator->p = node->next; + return true; + } + else + return false; +} + +static void +gl_linked_iterator_free (gl_list_iterator_t *iterator _GL_ATTRIBUTE_MAYBE_UNUSED) +{ +} + +/* ---------------------- Sorted gl_list_t Data Type ---------------------- */ + +static gl_list_node_t _GL_ATTRIBUTE_PURE +gl_linked_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + gl_list_node_t node; + + for (node = list->root.next; node != &list->root; node = node->next) + { + int cmp = compar (node->value, elt); + + if (cmp > 0) + break; + if (cmp == 0) + return node; + } + return NULL; +} + +static gl_list_node_t _GL_ATTRIBUTE_PURE +gl_linked_sortedlist_search_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t low, size_t high, + const void *elt) +{ + size_t count = list->count; + + if (!(low <= high && high <= list->count)) + /* Invalid arguments. */ + abort (); + + high -= low; + if (high > 0) + { + /* Here we know low < count. */ + size_t position = low; + gl_list_node_t node; + + if (position <= ((count - 1) / 2)) + { + node = list->root.next; + for (; position > 0; position--) + node = node->next; + } + else + { + position = count - 1 - position; + node = list->root.prev; + for (; position > 0; position--) + node = node->prev; + } + + do + { + int cmp = compar (node->value, elt); + + if (cmp > 0) + break; + if (cmp == 0) + return node; + node = node->next; + } + while (--high > 0); + } + return NULL; +} + +static size_t _GL_ATTRIBUTE_PURE +gl_linked_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + gl_list_node_t node; + size_t index; + + for (node = list->root.next, index = 0; + node != &list->root; + node = node->next, index++) + { + int cmp = compar (node->value, elt); + + if (cmp > 0) + break; + if (cmp == 0) + return index; + } + return (size_t)(-1); +} + +static size_t _GL_ATTRIBUTE_PURE +gl_linked_sortedlist_indexof_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t low, size_t high, + const void *elt) +{ + size_t count = list->count; + + if (!(low <= high && high <= list->count)) + /* Invalid arguments. */ + abort (); + + high -= low; + if (high > 0) + { + /* Here we know low < count. */ + size_t index = low; + size_t position = low; + gl_list_node_t node; + + if (position <= ((count - 1) / 2)) + { + node = list->root.next; + for (; position > 0; position--) + node = node->next; + } + else + { + position = count - 1 - position; + node = list->root.prev; + for (; position > 0; position--) + node = node->prev; + } + + do + { + int cmp = compar (node->value, elt); + + if (cmp > 0) + break; + if (cmp == 0) + return index; + node = node->next; + index++; + } + while (--high > 0); + } + return (size_t)(-1); +} + +static gl_list_node_t +gl_linked_sortedlist_nx_add (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + gl_list_node_t node; + + for (node = list->root.next; node != &list->root; node = node->next) + if (compar (node->value, elt) >= 0) + return gl_linked_nx_add_before (list, node, elt); + return gl_linked_nx_add_last (list, elt); +} + +static bool +gl_linked_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, + const void *elt) +{ + gl_list_node_t node; + + for (node = list->root.next; node != &list->root; node = node->next) + { + int cmp = compar (node->value, elt); + + if (cmp > 0) + break; + if (cmp == 0) + return gl_linked_remove_node (list, node); + } + return false; +} diff --git a/gnulib-lib/gl_linkedhash_list.c b/gnulib-lib/gl_linkedhash_list.c new file mode 100644 index 0000000..3a155b7 --- /dev/null +++ b/gnulib-lib/gl_linkedhash_list.c @@ -0,0 +1,114 @@ +/* Sequential list data type implemented by a hash table with a linked list. + Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include "gl_linkedhash_list.h" + +#include /* for uintptr_t, SIZE_MAX */ +#include + +#include "xsize.h" + +#define WITH_HASHTABLE 1 + +/* -------------------------- gl_list_t Data Type -------------------------- */ + +/* Generic hash-table code. */ +#include "gl_anyhash1.h" + +/* Generic linked list code. */ +#include "gl_anylinked_list1.h" + +/* Generic hash-table code. */ +#define CONTAINER_T gl_list_t +#define CONTAINER_COUNT(list) (list)->count +#include "gl_anyhash2.h" + +/* Add a node to the hash table structure. */ +static void +add_to_bucket (gl_list_t list, gl_list_node_t node) +{ + size_t bucket = node->h.hashcode % list->table_size; + + node->h.hash_next = list->table[bucket]; + list->table[bucket] = &node->h; +} +/* Tell all compilers that the return value is 0. */ +#define add_to_bucket(list,node) ((add_to_bucket) (list, node), 0) + +/* Remove a node from the hash table structure. */ +static void +remove_from_bucket (gl_list_t list, gl_list_node_t node) +{ + size_t bucket = node->h.hashcode % list->table_size; + gl_hash_entry_t *p; + + for (p = &list->table[bucket]; ; p = &(*p)->hash_next) + { + if (*p == &node->h) + { + *p = node->h.hash_next; + break; + } + if (*p == NULL) + /* node is not in the right bucket. Did the hash codes + change inadvertently? */ + abort (); + } +} + +/* Generic linked list code. */ +#include "gl_anylinked_list2.h" + + +const struct gl_list_implementation gl_linkedhash_list_implementation = + { + gl_linked_nx_create_empty, + gl_linked_nx_create, + gl_linked_size, + gl_linked_node_value, + gl_linked_node_nx_set_value, + gl_linked_next_node, + gl_linked_previous_node, + gl_linked_first_node, + gl_linked_last_node, + gl_linked_get_at, + gl_linked_nx_set_at, + gl_linked_search_from_to, + gl_linked_indexof_from_to, + gl_linked_nx_add_first, + gl_linked_nx_add_last, + gl_linked_nx_add_before, + gl_linked_nx_add_after, + gl_linked_nx_add_at, + gl_linked_remove_node, + gl_linked_remove_at, + gl_linked_remove, + gl_linked_list_free, + gl_linked_iterator, + gl_linked_iterator_from_to, + gl_linked_iterator_next, + gl_linked_iterator_free, + gl_linked_sortedlist_search, + gl_linked_sortedlist_search_from_to, + gl_linked_sortedlist_indexof, + gl_linked_sortedlist_indexof_from_to, + gl_linked_sortedlist_nx_add, + gl_linked_sortedlist_remove + }; diff --git a/gnulib-lib/gl_linkedhash_list.h b/gnulib-lib/gl_linkedhash_list.h new file mode 100644 index 0000000..a2536ed --- /dev/null +++ b/gnulib-lib/gl_linkedhash_list.h @@ -0,0 +1,34 @@ +/* Sequential list data type implemented by a hash table with a linked list. + Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _GL_LINKEDHASH_LIST_H +#define _GL_LINKEDHASH_LIST_H + +#include "gl_list.h" + +#ifdef __cplusplus +extern "C" { +#endif + +extern const struct gl_list_implementation gl_linkedhash_list_implementation; +#define GL_LINKEDHASH_LIST &gl_linkedhash_list_implementation + +#ifdef __cplusplus +} +#endif + +#endif /* _GL_LINKEDHASH_LIST_H */ diff --git a/gnulib-lib/gl_list.c b/gnulib-lib/gl_list.c new file mode 100644 index 0000000..08d2e88 --- /dev/null +++ b/gnulib-lib/gl_list.c @@ -0,0 +1,21 @@ +/* Abstract sequential list data type. + + Copyright (C) 2006-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +#define GL_LIST_INLINE _GL_EXTERN_INLINE +#include "gl_list.h" diff --git a/gnulib-lib/gl_list.h b/gnulib-lib/gl_list.h new file mode 100644 index 0000000..d600580 --- /dev/null +++ b/gnulib-lib/gl_list.h @@ -0,0 +1,914 @@ +/* Abstract sequential list data type. -*- coding: utf-8 -*- + Copyright (C) 2006-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _GL_LIST_H +#define _GL_LIST_H + +#include +#include + +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif +_GL_INLINE_HEADER_BEGIN +#ifndef GL_LIST_INLINE +# define GL_LIST_INLINE _GL_INLINE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +/* gl_list is an abstract list data type. It can contain any number of + objects ('void *' or 'const void *' pointers) in any given order. + Duplicates are allowed, but can optionally be forbidden. + + There are several implementations of this list datatype, optimized for + different operations or for memory. You can start using the simplest list + implementation, GL_ARRAY_LIST, and switch to a different implementation + later, when you realize which operations are performed the most frequently. + The API of the different implementations is exactly the same; when + switching to a different implementation, you only have to change the + gl_list_create call. + + The implementations are: + GL_ARRAY_LIST a growable array + GL_CARRAY_LIST a growable circular array + GL_LINKED_LIST a linked list + GL_AVLTREE_LIST a binary tree (AVL tree) + GL_RBTREE_LIST a binary tree (red-black tree) + GL_LINKEDHASH_LIST a hash table with a linked list + GL_AVLTREEHASH_LIST a hash table with a binary tree (AVL tree) + GL_RBTREEHASH_LIST a hash table with a binary tree (red-black tree) + + The memory consumption is asymptotically the same: O(1) for every object + in the list. When looking more closely at the average memory consumed + for an object, GL_ARRAY_LIST is the most compact representation, and + GL_LINKEDHASH_LIST and GL_TREEHASH_LIST need more memory. + + The guaranteed average performance of the operations is, for a list of + n elements: + + Operation ARRAY LINKED TREE LINKEDHASH TREEHASH + CARRAY with|without with|without + duplicates duplicates + + gl_list_size O(1) O(1) O(1) O(1) O(1) + gl_list_node_value O(1) O(1) O(1) O(1) O(1) + gl_list_node_set_value O(1) O(1) O(1) O(1) O((log n)²)/O(1) + gl_list_next_node O(1) O(1) O(log n) O(1) O(log n) + gl_list_previous_node O(1) O(1) O(log n) O(1) O(log n) + gl_list_first_node O(1) O(1) O(log n) O(1) O(log n) + gl_list_last_node O(1) O(1) O(log n) O(1) O(log n) + gl_list_get_at O(1) O(n) O(log n) O(n) O(log n) + gl_list_get_first O(1) O(1) O(log n) O(1) O(log n) + gl_list_get_last O(1) O(1) O(log n) O(1) O(log n) + gl_list_set_at O(1) O(n) O(log n) O(n) O((log n)²)/O(log n) + gl_list_set_first O(1) O(1) O(log n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_set_last O(1) O(1) O(log n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_search O(n) O(n) O(n) O(n)/O(1) O(log n)/O(1) + gl_list_search_from O(n) O(n) O(n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_search_from_to O(n) O(n) O(n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_indexof O(n) O(n) O(n) O(n) O(log n) + gl_list_indexof_from O(n) O(n) O(n) O(n) O((log n)²)/O(log n) + gl_list_indexof_from_to O(n) O(n) O(n) O(n) O((log n)²)/O(log n) + gl_list_add_first O(n)/O(1) O(1) O(log n) O(1) O((log n)²)/O(log n) + gl_list_add_last O(1) O(1) O(log n) O(1) O((log n)²)/O(log n) + gl_list_add_before O(n) O(1) O(log n) O(1) O((log n)²)/O(log n) + gl_list_add_after O(n) O(1) O(log n) O(1) O((log n)²)/O(log n) + gl_list_add_at O(n) O(n) O(log n) O(n) O((log n)²)/O(log n) + gl_list_remove_node O(n) O(1) O(log n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_remove_at O(n) O(n) O(log n) O(n) O((log n)²)/O(log n) + gl_list_remove_first O(n)/O(1) O(1) O(log n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_remove_last O(1) O(1) O(log n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_remove O(n) O(n) O(n) O(n)/O(1) O((log n)²)/O(log n) + gl_list_iterator O(1) O(1) O(log n) O(1) O(log n) + gl_list_iterator_from_to O(1) O(n) O(log n) O(n) O(log n) + gl_list_iterator_next O(1) O(1) O(log n) O(1) O(log n) + gl_sortedlist_search O(log n) O(n) O(log n) O(n) O(log n) + gl_sortedlist_search_from O(log n) O(n) O(log n) O(n) O(log n) + gl_sortedlist_indexof O(log n) O(n) O(log n) O(n) O(log n) + gl_sortedlist_indexof_fro O(log n) O(n) O(log n) O(n) O(log n) + gl_sortedlist_add O(n) O(n) O(log n) O(n) O((log n)²)/O(log n) + gl_sortedlist_remove O(n) O(n) O(log n) O(n) O((log n)²)/O(log n) + */ + +/* -------------------------- gl_list_t Data Type -------------------------- */ + +/* Type of function used to compare two elements. + NULL denotes pointer comparison. */ +typedef bool (*gl_listelement_equals_fn) (const void *elt1, const void *elt2); + +/* Type of function used to compute a hash code. + NULL denotes a function that depends only on the pointer itself. */ +typedef size_t (*gl_listelement_hashcode_fn) (const void *elt); + +/* Type of function used to dispose an element once it's removed from a list. + NULL denotes a no-op. */ +typedef void (*gl_listelement_dispose_fn) (const void *elt); + +struct gl_list_impl; +/* Type representing an entire list. */ +typedef struct gl_list_impl * gl_list_t; + +struct gl_list_node_impl; +/* Type representing the position of an element in the list, in a way that + is more adapted to the list implementation than a plain index. + Note: It is invalidated by insertions and removals! */ +typedef struct gl_list_node_impl * gl_list_node_t; + +struct gl_list_implementation; +/* Type representing a list datatype implementation. */ +typedef const struct gl_list_implementation * gl_list_implementation_t; + +#if 0 /* Unless otherwise specified, these are defined inline below. */ + +/* Creates an empty list. + IMPLEMENTATION is one of GL_ARRAY_LIST, GL_CARRAY_LIST, GL_LINKED_LIST, + GL_AVLTREE_LIST, GL_RBTREE_LIST, GL_LINKEDHASH_LIST, GL_AVLTREEHASH_LIST, + GL_RBTREEHASH_LIST. + EQUALS_FN is an element comparison function or NULL. + HASHCODE_FN is an element hash code function or NULL. + DISPOSE_FN is an element disposal function or NULL. + ALLOW_DUPLICATES is false if duplicate elements shall not be allowed in + the list. The implementation may verify this at runtime. */ +/* declared in gl_xlist.h */ +extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_t gl_list_nx_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates); + +/* Creates a list with given contents. + IMPLEMENTATION is one of GL_ARRAY_LIST, GL_CARRAY_LIST, GL_LINKED_LIST, + GL_AVLTREE_LIST, GL_RBTREE_LIST, GL_LINKEDHASH_LIST, GL_AVLTREEHASH_LIST, + GL_RBTREEHASH_LIST. + EQUALS_FN is an element comparison function or NULL. + HASHCODE_FN is an element hash code function or NULL. + DISPOSE_FN is an element disposal function or NULL. + ALLOW_DUPLICATES is false if duplicate elements shall not be allowed in + the list. The implementation may verify this at runtime. + COUNT is the number of initial elements. + CONTENTS[0..COUNT-1] is the initial contents. */ +/* declared in gl_xlist.h */ +extern gl_list_t gl_list_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_t gl_list_nx_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents); + +/* Returns the current number of elements in a list. */ +extern size_t gl_list_size (gl_list_t list); + +/* Returns the element value represented by a list node. */ +extern const void * gl_list_node_value (gl_list_t list, gl_list_node_t node); + +/* Replaces the element value represented by a list node. */ +/* declared in gl_xlist.h */ +extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node, + const void *elt); +/* Likewise. Returns 0 upon success, -1 upon out-of-memory. */ +extern int gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node, + const void *elt) + _GL_ATTRIBUTE_NODISCARD; + +/* Returns the node immediately after the given node in the list, or NULL + if the given node is the last (rightmost) one in the list. */ +extern gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node); + +/* Returns the node immediately before the given node in the list, or NULL + if the given node is the first (leftmost) one in the list. */ +extern gl_list_node_t gl_list_previous_node (gl_list_t list, gl_list_node_t node); + +/* Returns the first node in the list, or NULL if the list is empty. + This function is useful for iterating through the list like this: + gl_list_node_t node; + for (node = gl_list_first_node (list); node != NULL; node = gl_list_next_node (node)) + ... + */ +extern gl_list_node_t gl_list_first_node (gl_list_t list); + +/* Returns the last node in the list, or NULL if the list is empty. + This function is useful for iterating through the list in backward order, + like this: + gl_list_node_t node; + for (node = gl_list_last_node (list); node != NULL; node = gl_list_previous_node (node)) + ... + */ +extern gl_list_node_t gl_list_last_node (gl_list_t list); + +/* Returns the element at a given position in the list. + POSITION must be >= 0 and < gl_list_size (list). */ +extern const void * gl_list_get_at (gl_list_t list, size_t position); + +/* Returns the element at the first position in the list. + The list must be non-empty. */ +extern const void * gl_list_get_first (gl_list_t list); + +/* Returns the element at the last position in the list. + The list must be non-empty. */ +extern const void * gl_list_get_last (gl_list_t list); + +/* Replaces the element at a given position in the list. + POSITION must be >= 0 and < gl_list_size (list). + Returns its node. */ +/* declared in gl_xlist.h */ +extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position, + const void *elt); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_set_at (gl_list_t list, size_t position, + const void *elt) + _GL_ATTRIBUTE_NODISCARD; + +/* Replaces the element at the first position in the list. + Returns its node. + The list must be non-empty. */ +/* declared in gl_xlist.h */ +extern gl_list_node_t gl_list_set_first (gl_list_t list, const void *elt); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_set_first (gl_list_t list, const void *elt) + _GL_ATTRIBUTE_NODISCARD; + +/* Replaces the element at the last position in the list. + Returns its node. + The list must be non-empty. */ +/* declared in gl_xlist.h */ +extern gl_list_node_t gl_list_set_last (gl_list_t list, const void *elt); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_set_last (gl_list_t list, const void *elt) + _GL_ATTRIBUTE_NODISCARD; + +/* Searches whether an element is already in the list. + Returns its node if found, or NULL if not present in the list. */ +extern gl_list_node_t gl_list_search (gl_list_t list, const void *elt); + +/* Searches whether an element is already in the list, + at a position >= START_INDEX. + Returns its node if found, or NULL if not present in the list. */ +extern gl_list_node_t gl_list_search_from (gl_list_t list, size_t start_index, + const void *elt); + +/* Searches whether an element is already in the list, + at a position >= START_INDEX and < END_INDEX. + Returns its node if found, or NULL if not present in the list. */ +extern gl_list_node_t gl_list_search_from_to (gl_list_t list, + size_t start_index, + size_t end_index, + const void *elt); + +/* Searches whether an element is already in the list. + Returns its position if found, or (size_t)(-1) if not present in the list. */ +extern size_t gl_list_indexof (gl_list_t list, const void *elt); + +/* Searches whether an element is already in the list, + at a position >= START_INDEX. + Returns its position if found, or (size_t)(-1) if not present in the list. */ +extern size_t gl_list_indexof_from (gl_list_t list, size_t start_index, + const void *elt); + +/* Searches whether an element is already in the list, + at a position >= START_INDEX and < END_INDEX. + Returns its position if found, or (size_t)(-1) if not present in the list. */ +extern size_t gl_list_indexof_from_to (gl_list_t list, + size_t start_index, size_t end_index, + const void *elt); + +/* Adds an element as the first element of the list. + Returns its node. */ +/* declared in gl_xlist.h */ +extern gl_list_node_t gl_list_add_first (gl_list_t list, const void *elt); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_add_first (gl_list_t list, const void *elt) + _GL_ATTRIBUTE_NODISCARD; + +/* Adds an element as the last element of the list. + Returns its node. */ +/* declared in gl_xlist.h */ +extern gl_list_node_t gl_list_add_last (gl_list_t list, const void *elt); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_add_last (gl_list_t list, const void *elt) + _GL_ATTRIBUTE_NODISCARD; + +/* Adds an element before a given element node of the list. + Returns its node. */ +/* declared in gl_xlist.h */ +extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node, + const void *elt); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_add_before (gl_list_t list, + gl_list_node_t node, + const void *elt) + _GL_ATTRIBUTE_NODISCARD; + +/* Adds an element after a given element node of the list. + Returns its node. */ +/* declared in gl_xlist.h */ +extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node, + const void *elt); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_add_after (gl_list_t list, gl_list_node_t node, + const void *elt) + _GL_ATTRIBUTE_NODISCARD; + +/* Adds an element at a given position in the list. + POSITION must be >= 0 and <= gl_list_size (list). */ +/* declared in gl_xlist.h */ +extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position, + const void *elt); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_node_t gl_list_nx_add_at (gl_list_t list, size_t position, + const void *elt) + _GL_ATTRIBUTE_NODISCARD; + +/* Removes an element from the list. + Returns true. */ +extern bool gl_list_remove_node (gl_list_t list, gl_list_node_t node); + +/* Removes an element at a given position from the list. + POSITION must be >= 0 and < gl_list_size (list). + Returns true. */ +extern bool gl_list_remove_at (gl_list_t list, size_t position); + +/* Removes the element at the first position from the list. + Returns true if it was found and removed, or false if the list was empty. */ +extern bool gl_list_remove_first (gl_list_t list); + +/* Removes the element at the last position from the list. + Returns true if it was found and removed, or false if the list was empty. */ +extern bool gl_list_remove_last (gl_list_t list); + +/* Searches and removes an element from the list. + Returns true if it was found and removed. */ +extern bool gl_list_remove (gl_list_t list, const void *elt); + +/* Frees an entire list. + (But this call does not free the elements of the list. It only invokes + the DISPOSE_FN on each of the elements of the list, and only if the list + is not a sublist.) */ +extern void gl_list_free (gl_list_t list); + +#endif /* End of inline and gl_xlist.h-defined functions. */ + +/* --------------------- gl_list_iterator_t Data Type --------------------- */ + +/* Functions for iterating through a list. */ + +/* Type of an iterator that traverses a list. + This is a fixed-size struct, so that creation of an iterator doesn't need + memory allocation on the heap. */ +typedef struct +{ + /* For fast dispatch of gl_list_iterator_next. */ + const struct gl_list_implementation *vtable; + /* For detecting whether the last returned element was removed. */ + gl_list_t list; + size_t count; + /* Other, implementation-private fields. */ + void *p; void *q; + size_t i; size_t j; +} gl_list_iterator_t; + +#if 0 /* These are defined inline below. */ + +/* Creates an iterator traversing a list. + The list contents must not be modified while the iterator is in use, + except for replacing or removing the last returned element. */ +extern gl_list_iterator_t gl_list_iterator (gl_list_t list); + +/* Creates an iterator traversing the element with indices i, + start_index <= i < end_index, of a list. + The list contents must not be modified while the iterator is in use, + except for replacing or removing the last returned element. */ +extern gl_list_iterator_t gl_list_iterator_from_to (gl_list_t list, + size_t start_index, + size_t end_index); + +/* If there is a next element, stores the next element in *ELTP, stores its + node in *NODEP if NODEP is non-NULL, advances the iterator and returns true. + Otherwise, returns false. */ +extern bool gl_list_iterator_next (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep); + +/* Frees an iterator. */ +extern void gl_list_iterator_free (gl_list_iterator_t *iterator); + +#endif /* End of inline functions. */ + +/* ---------------------- Sorted gl_list_t Data Type ---------------------- */ + +/* The following functions are for lists without duplicates where the + order is given by a sort criterion. */ + +/* Type of function used to compare two elements. Same as for qsort(). + NULL denotes pointer comparison. */ +typedef int (*gl_listelement_compar_fn) (const void *elt1, const void *elt2); + +#if 0 /* Unless otherwise specified, these are defined inline below. */ + +/* Searches whether an element is already in the list. + The list is assumed to be sorted with COMPAR. + Returns its node if found, or NULL if not present in the list. + If the list contains several copies of ELT, the node of the leftmost one is + returned. */ +extern gl_list_node_t gl_sortedlist_search (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + +/* Searches whether an element is already in the list. + The list is assumed to be sorted with COMPAR. + Only list elements with indices >= START_INDEX and < END_INDEX are + considered; the implementation uses these bounds to minimize the number + of COMPAR invocations. + Returns its node if found, or NULL if not present in the list. + If the list contains several copies of ELT, the node of the leftmost one is + returned. */ +extern gl_list_node_t gl_sortedlist_search_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t start_index, + size_t end_index, + const void *elt); + +/* Searches whether an element is already in the list. + The list is assumed to be sorted with COMPAR. + Returns its position if found, or (size_t)(-1) if not present in the list. + If the list contains several copies of ELT, the position of the leftmost one + is returned. */ +extern size_t gl_sortedlist_indexof (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + +/* Searches whether an element is already in the list. + The list is assumed to be sorted with COMPAR. + Only list elements with indices >= START_INDEX and < END_INDEX are + considered; the implementation uses these bounds to minimize the number + of COMPAR invocations. + Returns its position if found, or (size_t)(-1) if not present in the list. + If the list contains several copies of ELT, the position of the leftmost one + is returned. */ +extern size_t gl_sortedlist_indexof_from_to (gl_list_t list, + gl_listelement_compar_fn compar, + size_t start_index, + size_t end_index, + const void *elt); + +/* Adds an element at the appropriate position in the list. + The list is assumed to be sorted with COMPAR. + Returns its node. */ +/* declared in gl_xlist.h */ +extern gl_list_node_t gl_sortedlist_add (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); +/* Likewise. Returns NULL upon out-of-memory. */ +extern gl_list_node_t gl_sortedlist_nx_add (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt) + _GL_ATTRIBUTE_NODISCARD; + +/* Searches and removes an element from the list. + The list is assumed to be sorted with COMPAR. + Returns true if it was found and removed. + If the list contains several copies of ELT, only the leftmost one is + removed. */ +extern bool gl_sortedlist_remove (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + +#endif /* End of inline and gl_xlist.h-defined functions. */ + +/* ------------------------ Implementation Details ------------------------ */ + +struct gl_list_implementation +{ + /* gl_list_t functions. */ + gl_list_t (*nx_create_empty) (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates); + gl_list_t (*nx_create) (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents); + size_t (*size) (gl_list_t list); + const void * (*node_value) (gl_list_t list, gl_list_node_t node); + int (*node_nx_set_value) (gl_list_t list, gl_list_node_t node, + const void *elt); + gl_list_node_t (*next_node) (gl_list_t list, gl_list_node_t node); + gl_list_node_t (*previous_node) (gl_list_t list, gl_list_node_t node); + gl_list_node_t (*first_node) (gl_list_t list); + gl_list_node_t (*last_node) (gl_list_t list); + const void * (*get_at) (gl_list_t list, size_t position); + gl_list_node_t (*nx_set_at) (gl_list_t list, size_t position, + const void *elt); + gl_list_node_t (*search_from_to) (gl_list_t list, size_t start_index, + size_t end_index, const void *elt); + size_t (*indexof_from_to) (gl_list_t list, size_t start_index, + size_t end_index, const void *elt); + gl_list_node_t (*nx_add_first) (gl_list_t list, const void *elt); + gl_list_node_t (*nx_add_last) (gl_list_t list, const void *elt); + gl_list_node_t (*nx_add_before) (gl_list_t list, gl_list_node_t node, + const void *elt); + gl_list_node_t (*nx_add_after) (gl_list_t list, gl_list_node_t node, + const void *elt); + gl_list_node_t (*nx_add_at) (gl_list_t list, size_t position, + const void *elt); + bool (*remove_node) (gl_list_t list, gl_list_node_t node); + bool (*remove_at) (gl_list_t list, size_t position); + bool (*remove_elt) (gl_list_t list, const void *elt); + void (*list_free) (gl_list_t list); + /* gl_list_iterator_t functions. */ + gl_list_iterator_t (*iterator) (gl_list_t list); + gl_list_iterator_t (*iterator_from_to) (gl_list_t list, + size_t start_index, + size_t end_index); + bool (*iterator_next) (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep); + void (*iterator_free) (gl_list_iterator_t *iterator); + /* Sorted gl_list_t functions. */ + gl_list_node_t (*sortedlist_search) (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + gl_list_node_t (*sortedlist_search_from_to) (gl_list_t list, + gl_listelement_compar_fn compar, + size_t start_index, + size_t end_index, + const void *elt); + size_t (*sortedlist_indexof) (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + size_t (*sortedlist_indexof_from_to) (gl_list_t list, + gl_listelement_compar_fn compar, + size_t start_index, size_t end_index, + const void *elt); + gl_list_node_t (*sortedlist_nx_add) (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); + bool (*sortedlist_remove) (gl_list_t list, + gl_listelement_compar_fn compar, + const void *elt); +}; + +struct gl_list_impl_base +{ + const struct gl_list_implementation *vtable; + gl_listelement_equals_fn equals_fn; + gl_listelement_hashcode_fn hashcode_fn; + gl_listelement_dispose_fn dispose_fn; + bool allow_duplicates; +}; + +/* Define all functions of this file as accesses to the + struct gl_list_implementation. */ + +GL_LIST_INLINE gl_list_t +gl_list_nx_create_empty (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates) +{ + return implementation->nx_create_empty (implementation, equals_fn, + hashcode_fn, dispose_fn, + allow_duplicates); +} + +GL_LIST_INLINE gl_list_t +gl_list_nx_create (gl_list_implementation_t implementation, + gl_listelement_equals_fn equals_fn, + gl_listelement_hashcode_fn hashcode_fn, + gl_listelement_dispose_fn dispose_fn, + bool allow_duplicates, + size_t count, const void **contents) +{ + return implementation->nx_create (implementation, equals_fn, hashcode_fn, + dispose_fn, allow_duplicates, count, + contents); +} + +GL_LIST_INLINE size_t +gl_list_size (gl_list_t list) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->size (list); +} + +GL_LIST_INLINE const void * +gl_list_node_value (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->node_value (list, node); +} + +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD int +gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node, + const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->node_nx_set_value (list, node, elt); +} + +GL_LIST_INLINE gl_list_node_t +gl_list_next_node (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->next_node (list, node); +} + +GL_LIST_INLINE gl_list_node_t +gl_list_previous_node (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->previous_node (list, node); +} + +GL_LIST_INLINE gl_list_node_t +gl_list_first_node (gl_list_t list) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->first_node (list); +} + +GL_LIST_INLINE gl_list_node_t +gl_list_last_node (gl_list_t list) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->last_node (list); +} + +GL_LIST_INLINE const void * +gl_list_get_at (gl_list_t list, size_t position) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->get_at (list, position); +} + +GL_LIST_INLINE const void * +gl_list_get_first (gl_list_t list) +{ + return gl_list_get_at (list, 0); +} + +GL_LIST_INLINE const void * +gl_list_get_last (gl_list_t list) +{ + return gl_list_get_at (list, gl_list_size (list) - 1); +} + +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t +gl_list_nx_set_at (gl_list_t list, size_t position, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->nx_set_at (list, position, elt); +} + +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t +gl_list_nx_set_first (gl_list_t list, const void *elt) +{ + return gl_list_nx_set_at (list, 0, elt); +} + +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t +gl_list_nx_set_last (gl_list_t list, const void *elt) +{ + return gl_list_nx_set_at (list, gl_list_size (list) - 1, elt); +} + +GL_LIST_INLINE gl_list_node_t +gl_list_search (gl_list_t list, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->search_from_to (list, 0, size, elt); +} + +GL_LIST_INLINE gl_list_node_t +gl_list_search_from (gl_list_t list, size_t start_index, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->search_from_to (list, start_index, size, elt); +} + +GL_LIST_INLINE gl_list_node_t +gl_list_search_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->search_from_to (list, start_index, end_index, elt); +} + +GL_LIST_INLINE size_t +gl_list_indexof (gl_list_t list, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->indexof_from_to (list, 0, size, elt); +} + +GL_LIST_INLINE size_t +gl_list_indexof_from (gl_list_t list, size_t start_index, const void *elt) +{ + size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list); + return ((const struct gl_list_impl_base *) list)->vtable + ->indexof_from_to (list, start_index, size, elt); +} + +GL_LIST_INLINE size_t +gl_list_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index, + const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->indexof_from_to (list, start_index, end_index, elt); +} + +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t +gl_list_nx_add_first (gl_list_t list, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->nx_add_first (list, elt); +} + +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t +gl_list_nx_add_last (gl_list_t list, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->nx_add_last (list, elt); +} + +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t +gl_list_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->nx_add_before (list, node, elt); +} + +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t +gl_list_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->nx_add_after (list, node, elt); +} + +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t +gl_list_nx_add_at (gl_list_t list, size_t position, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->nx_add_at (list, position, elt); +} + +GL_LIST_INLINE bool +gl_list_remove_node (gl_list_t list, gl_list_node_t node) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->remove_node (list, node); +} + +GL_LIST_INLINE bool +gl_list_remove_at (gl_list_t list, size_t position) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->remove_at (list, position); +} + +GL_LIST_INLINE bool +gl_list_remove_first (gl_list_t list) +{ + size_t size = gl_list_size (list); + if (size > 0) + return gl_list_remove_at (list, 0); + else + return false; +} + +GL_LIST_INLINE bool +gl_list_remove_last (gl_list_t list) +{ + size_t size = gl_list_size (list); + if (size > 0) + return gl_list_remove_at (list, size - 1); + else + return false; +} + +GL_LIST_INLINE bool +gl_list_remove (gl_list_t list, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->remove_elt (list, elt); +} + +GL_LIST_INLINE void +gl_list_free (gl_list_t list) +{ + ((const struct gl_list_impl_base *) list)->vtable->list_free (list); +} + +GL_LIST_INLINE gl_list_iterator_t +gl_list_iterator (gl_list_t list) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->iterator (list); +} + +GL_LIST_INLINE gl_list_iterator_t +gl_list_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->iterator_from_to (list, start_index, end_index); +} + +GL_LIST_INLINE bool +gl_list_iterator_next (gl_list_iterator_t *iterator, + const void **eltp, gl_list_node_t *nodep) +{ + return iterator->vtable->iterator_next (iterator, eltp, nodep); +} + +GL_LIST_INLINE void +gl_list_iterator_free (gl_list_iterator_t *iterator) +{ + iterator->vtable->iterator_free (iterator); +} + +GL_LIST_INLINE gl_list_node_t +gl_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_search (list, compar, elt); +} + +GL_LIST_INLINE gl_list_node_t +gl_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_search_from_to (list, compar, start_index, end_index, + elt); +} + +GL_LIST_INLINE size_t +gl_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_indexof (list, compar, elt); +} + +GL_LIST_INLINE size_t +gl_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_indexof_from_to (list, compar, start_index, end_index, + elt); +} + +GL_LIST_INLINE _GL_ATTRIBUTE_NODISCARD gl_list_node_t +gl_sortedlist_nx_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_nx_add (list, compar, elt); +} + +GL_LIST_INLINE bool +gl_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, const void *elt) +{ + return ((const struct gl_list_impl_base *) list)->vtable + ->sortedlist_remove (list, compar, elt); +} + +#ifdef __cplusplus +} +#endif + +_GL_INLINE_HEADER_END + +#endif /* _GL_LIST_H */ diff --git a/gnulib-lib/glthread/lock.c b/gnulib-lib/glthread/lock.c new file mode 100644 index 0000000..44335e3 --- /dev/null +++ b/gnulib-lib/glthread/lock.c @@ -0,0 +1,749 @@ +/* Locking in multithreaded situations. + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-posix.h, gthr-posix95.h. */ + +#include + +#include "glthread/lock.h" + +/* ========================================================================= */ + +#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +int +glthread_lock_init (gl_lock_t *lock) +{ + if (mtx_init (&lock->mutex, mtx_plain) != thrd_success) + return ENOMEM; + lock->init_needed = 0; + return 0; +} + +int +glthread_lock_lock (gl_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_lock (&lock->mutex) != thrd_success) + return EAGAIN; + return 0; +} + +int +glthread_lock_unlock (gl_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_unlock (&lock->mutex) != thrd_success) + return EINVAL; + return 0; +} + +int +glthread_lock_destroy (gl_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + mtx_destroy (&lock->mutex); + return 0; +} + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +int +glthread_rwlock_init (gl_rwlock_t *lock) +{ + if (mtx_init (&lock->lock, mtx_plain) != thrd_success + || cnd_init (&lock->waiting_readers) != thrd_success + || cnd_init (&lock->waiting_writers) != thrd_success) + return ENOMEM; + lock->waiting_writers_count = 0; + lock->runcount = 0; + lock->init_needed = 0; + return 0; +} + +int +glthread_rwlock_rdlock (gl_rwlock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_lock (&lock->lock) != thrd_success) + return EAGAIN; + /* Test whether only readers are currently running, and whether the runcount + field will not overflow, and whether no writer is waiting. The latter + condition is because POSIX recommends that "write locks shall take + precedence over read locks", to avoid "writer starvation". */ + while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_readers. */ + if (cnd_wait (&lock->waiting_readers, &lock->lock) != thrd_success) + { + mtx_unlock (&lock->lock); + return EINVAL; + } + } + lock->runcount++; + if (mtx_unlock (&lock->lock) != thrd_success) + return EINVAL; + return 0; +} + +int +glthread_rwlock_wrlock (gl_rwlock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_lock (&lock->lock) != thrd_success) + return EAGAIN; + /* Test whether no readers or writers are currently running. */ + while (!(lock->runcount == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_writers. */ + lock->waiting_writers_count++; + if (cnd_wait (&lock->waiting_writers, &lock->lock) != thrd_success) + { + lock->waiting_writers_count--; + mtx_unlock (&lock->lock); + return EINVAL; + } + lock->waiting_writers_count--; + } + lock->runcount--; /* runcount becomes -1 */ + if (mtx_unlock (&lock->lock) != thrd_success) + return EINVAL; + return 0; +} + +int +glthread_rwlock_unlock (gl_rwlock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_lock (&lock->lock) != thrd_success) + return EAGAIN; + if (lock->runcount < 0) + { + /* Drop a writer lock. */ + if (!(lock->runcount == -1)) + { + mtx_unlock (&lock->lock); + return EINVAL; + } + lock->runcount = 0; + } + else + { + /* Drop a reader lock. */ + if (!(lock->runcount > 0)) + { + mtx_unlock (&lock->lock); + return EINVAL; + } + lock->runcount--; + } + if (lock->runcount == 0) + { + /* POSIX recommends that "write locks shall take precedence over read + locks", to avoid "writer starvation". */ + if (lock->waiting_writers_count > 0) + { + /* Wake up one of the waiting writers. */ + if (cnd_signal (&lock->waiting_writers) != thrd_success) + { + mtx_unlock (&lock->lock); + return EINVAL; + } + } + else + { + /* Wake up all waiting readers. */ + if (cnd_broadcast (&lock->waiting_readers) != thrd_success) + { + mtx_unlock (&lock->lock); + return EINVAL; + } + } + } + if (mtx_unlock (&lock->lock) != thrd_success) + return EINVAL; + return 0; +} + +int +glthread_rwlock_destroy (gl_rwlock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + mtx_destroy (&lock->lock); + cnd_destroy (&lock->waiting_readers); + cnd_destroy (&lock->waiting_writers); + return 0; +} + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +int +glthread_recursive_lock_init (gl_recursive_lock_t *lock) +{ + if (mtx_init (&lock->mutex, mtx_plain | mtx_recursive) != thrd_success) + return ENOMEM; + lock->init_needed = 0; + return 0; +} + +int +glthread_recursive_lock_lock (gl_recursive_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_lock (&lock->mutex) != thrd_success) + return EAGAIN; + return 0; +} + +int +glthread_recursive_lock_unlock (gl_recursive_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + if (mtx_unlock (&lock->mutex) != thrd_success) + return EINVAL; + return 0; +} + +int +glthread_recursive_lock_destroy (gl_recursive_lock_t *lock) +{ + if (lock->init_needed) + call_once (&lock->init_once, lock->init_func); + mtx_destroy (&lock->mutex); + return 0; +} + +/* -------------------------- gl_once_t datatype -------------------------- */ + +#endif + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1))) + +# if defined PTHREAD_RWLOCK_INITIALIZER || defined PTHREAD_RWLOCK_INITIALIZER_NP + +# if !HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER + /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */ + +int +glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock) +{ + pthread_rwlockattr_t attributes; + int err; + + err = pthread_rwlockattr_init (&attributes); + if (err != 0) + return err; + /* Note: PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP is the only value that + causes the writer to be preferred. PTHREAD_RWLOCK_PREFER_WRITER_NP does not + do this; see + http://man7.org/linux/man-pages/man3/pthread_rwlockattr_setkind_np.3.html */ + err = pthread_rwlockattr_setkind_np (&attributes, + PTHREAD_RWLOCK_PREFER_WRITER_NONRECURSIVE_NP); + if (err == 0) + err = pthread_rwlock_init(lock, &attributes); + /* pthread_rwlockattr_destroy always returns 0. It cannot influence the + return value. */ + pthread_rwlockattr_destroy (&attributes); + return err; +} + +# endif +# else + +int +glthread_rwlock_init_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_rwlock_init (&lock->rwlock, NULL); + if (err != 0) + return err; + lock->initialized = 1; + return 0; +} + +int +glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock) +{ + if (!lock->initialized) + { + int err; + + err = pthread_mutex_lock (&lock->guard); + if (err != 0) + return err; + if (!lock->initialized) + { + err = glthread_rwlock_init_multithreaded (lock); + if (err != 0) + { + pthread_mutex_unlock (&lock->guard); + return err; + } + } + err = pthread_mutex_unlock (&lock->guard); + if (err != 0) + return err; + } + return pthread_rwlock_rdlock (&lock->rwlock); +} + +int +glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock) +{ + if (!lock->initialized) + { + int err; + + err = pthread_mutex_lock (&lock->guard); + if (err != 0) + return err; + if (!lock->initialized) + { + err = glthread_rwlock_init_multithreaded (lock); + if (err != 0) + { + pthread_mutex_unlock (&lock->guard); + return err; + } + } + err = pthread_mutex_unlock (&lock->guard); + if (err != 0) + return err; + } + return pthread_rwlock_wrlock (&lock->rwlock); +} + +int +glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock) +{ + if (!lock->initialized) + return EINVAL; + return pthread_rwlock_unlock (&lock->rwlock); +} + +int +glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock) +{ + int err; + + if (!lock->initialized) + return EINVAL; + err = pthread_rwlock_destroy (&lock->rwlock); + if (err != 0) + return err; + lock->initialized = 0; + return 0; +} + +# endif + +# else + +int +glthread_rwlock_init_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_mutex_init (&lock->lock, NULL); + if (err != 0) + return err; + err = pthread_cond_init (&lock->waiting_readers, NULL); + if (err != 0) + return err; + err = pthread_cond_init (&lock->waiting_writers, NULL); + if (err != 0) + return err; + lock->waiting_writers_count = 0; + lock->runcount = 0; + return 0; +} + +int +glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + /* Test whether only readers are currently running, and whether the runcount + field will not overflow, and whether no writer is waiting. The latter + condition is because POSIX recommends that "write locks shall take + precedence over read locks", to avoid "writer starvation". */ + while (!(lock->runcount + 1 > 0 && lock->waiting_writers_count == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_readers. */ + err = pthread_cond_wait (&lock->waiting_readers, &lock->lock); + if (err != 0) + { + pthread_mutex_unlock (&lock->lock); + return err; + } + } + lock->runcount++; + return pthread_mutex_unlock (&lock->lock); +} + +int +glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + /* Test whether no readers or writers are currently running. */ + while (!(lock->runcount == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_writers. */ + lock->waiting_writers_count++; + err = pthread_cond_wait (&lock->waiting_writers, &lock->lock); + if (err != 0) + { + lock->waiting_writers_count--; + pthread_mutex_unlock (&lock->lock); + return err; + } + lock->waiting_writers_count--; + } + lock->runcount--; /* runcount becomes -1 */ + return pthread_mutex_unlock (&lock->lock); +} + +int +glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_mutex_lock (&lock->lock); + if (err != 0) + return err; + if (lock->runcount < 0) + { + /* Drop a writer lock. */ + if (!(lock->runcount == -1)) + { + pthread_mutex_unlock (&lock->lock); + return EINVAL; + } + lock->runcount = 0; + } + else + { + /* Drop a reader lock. */ + if (!(lock->runcount > 0)) + { + pthread_mutex_unlock (&lock->lock); + return EINVAL; + } + lock->runcount--; + } + if (lock->runcount == 0) + { + /* POSIX recommends that "write locks shall take precedence over read + locks", to avoid "writer starvation". */ + if (lock->waiting_writers_count > 0) + { + /* Wake up one of the waiting writers. */ + err = pthread_cond_signal (&lock->waiting_writers); + if (err != 0) + { + pthread_mutex_unlock (&lock->lock); + return err; + } + } + else + { + /* Wake up all waiting readers. */ + err = pthread_cond_broadcast (&lock->waiting_readers); + if (err != 0) + { + pthread_mutex_unlock (&lock->lock); + return err; + } + } + } + return pthread_mutex_unlock (&lock->lock); +} + +int +glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock) +{ + int err; + + err = pthread_mutex_destroy (&lock->lock); + if (err != 0) + return err; + err = pthread_cond_destroy (&lock->waiting_readers); + if (err != 0) + return err; + err = pthread_cond_destroy (&lock->waiting_writers); + if (err != 0) + return err; + return 0; +} + +# endif + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +# if HAVE_PTHREAD_MUTEX_RECURSIVE + +# if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + +int +glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) +{ + pthread_mutexattr_t attributes; + int err; + + err = pthread_mutexattr_init (&attributes); + if (err != 0) + return err; + err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE); + if (err != 0) + { + pthread_mutexattr_destroy (&attributes); + return err; + } + err = pthread_mutex_init (lock, &attributes); + if (err != 0) + { + pthread_mutexattr_destroy (&attributes); + return err; + } + err = pthread_mutexattr_destroy (&attributes); + if (err != 0) + return err; + return 0; +} + +# else + +int +glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) +{ + pthread_mutexattr_t attributes; + int err; + + err = pthread_mutexattr_init (&attributes); + if (err != 0) + return err; + err = pthread_mutexattr_settype (&attributes, PTHREAD_MUTEX_RECURSIVE); + if (err != 0) + { + pthread_mutexattr_destroy (&attributes); + return err; + } + err = pthread_mutex_init (&lock->recmutex, &attributes); + if (err != 0) + { + pthread_mutexattr_destroy (&attributes); + return err; + } + err = pthread_mutexattr_destroy (&attributes); + if (err != 0) + return err; + lock->initialized = 1; + return 0; +} + +int +glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock) +{ + if (!lock->initialized) + { + int err; + + err = pthread_mutex_lock (&lock->guard); + if (err != 0) + return err; + if (!lock->initialized) + { + err = glthread_recursive_lock_init_multithreaded (lock); + if (err != 0) + { + pthread_mutex_unlock (&lock->guard); + return err; + } + } + err = pthread_mutex_unlock (&lock->guard); + if (err != 0) + return err; + } + return pthread_mutex_lock (&lock->recmutex); +} + +int +glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock) +{ + if (!lock->initialized) + return EINVAL; + return pthread_mutex_unlock (&lock->recmutex); +} + +int +glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) +{ + int err; + + if (!lock->initialized) + return EINVAL; + err = pthread_mutex_destroy (&lock->recmutex); + if (err != 0) + return err; + lock->initialized = 0; + return 0; +} + +# endif + +# else + +int +glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock) +{ + int err; + + err = pthread_mutex_init (&lock->mutex, NULL); + if (err != 0) + return err; + lock->owner = (pthread_t) 0; + lock->depth = 0; + return 0; +} + +int +glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock) +{ + pthread_t self = pthread_self (); + if (lock->owner != self) + { + int err; + + err = pthread_mutex_lock (&lock->mutex); + if (err != 0) + return err; + lock->owner = self; + } + if (++(lock->depth) == 0) /* wraparound? */ + { + lock->depth--; + return EAGAIN; + } + return 0; +} + +int +glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock) +{ + if (lock->owner != pthread_self ()) + return EPERM; + if (lock->depth == 0) + return EINVAL; + if (--(lock->depth) == 0) + { + lock->owner = (pthread_t) 0; + return pthread_mutex_unlock (&lock->mutex); + } + else + return 0; +} + +int +glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock) +{ + if (lock->owner != (pthread_t) 0) + return EBUSY; + return pthread_mutex_destroy (&lock->mutex); +} + +# endif + +/* -------------------------- gl_once_t datatype -------------------------- */ + +static const pthread_once_t fresh_once = PTHREAD_ONCE_INIT; + +int +glthread_once_singlethreaded (pthread_once_t *once_control) +{ + /* We don't know whether pthread_once_t is an integer type, a floating-point + type, a pointer type, or a structure type. */ + char *firstbyte = (char *)once_control; + if (*firstbyte == *(const char *)&fresh_once) + { + /* First time use of once_control. Invert the first byte. */ + *firstbyte = ~ *(const char *)&fresh_once; + return 1; + } + else + return 0; +} + +# if !(PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK) + +int +glthread_once_multithreaded (pthread_once_t *once_control, + void (*init_function) (void)) +{ + int err = pthread_once (once_control, init_function); + if (err == ENOSYS) + { + /* This happens on FreeBSD 11: The pthread_once function in libc returns + ENOSYS. */ + if (glthread_once_singlethreaded (once_control)) + init_function (); + return 0; + } + return err; +} + +# endif + +#endif + +/* ========================================================================= */ + +#if USE_WINDOWS_THREADS + +#endif + +/* ========================================================================= */ diff --git a/gnulib-lib/glthread/lock.h b/gnulib-lib/glthread/lock.h new file mode 100644 index 0000000..624ce67 --- /dev/null +++ b/gnulib-lib/glthread/lock.h @@ -0,0 +1,789 @@ +/* Locking in multithreaded situations. + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-posix.h, gthr-posix95.h, gthr-win32.h. */ + +/* This file contains locking primitives for use with a given thread library. + It does not contain primitives for creating threads or for other + synchronization primitives. + + Normal (non-recursive) locks: + Type: gl_lock_t + Declaration: gl_lock_define(extern, name) + Initializer: gl_lock_define_initialized(, name) + Initialization: gl_lock_init (name); + Taking the lock: gl_lock_lock (name); + Releasing the lock: gl_lock_unlock (name); + De-initialization: gl_lock_destroy (name); + Equivalent functions with control of error handling: + Initialization: err = glthread_lock_init (&name); + Taking the lock: err = glthread_lock_lock (&name); + Releasing the lock: err = glthread_lock_unlock (&name); + De-initialization: err = glthread_lock_destroy (&name); + + Read-Write (non-recursive) locks: + Type: gl_rwlock_t + Declaration: gl_rwlock_define(extern, name) + Initializer: gl_rwlock_define_initialized(, name) + Initialization: gl_rwlock_init (name); + Taking the lock: gl_rwlock_rdlock (name); + gl_rwlock_wrlock (name); + Releasing the lock: gl_rwlock_unlock (name); + De-initialization: gl_rwlock_destroy (name); + Equivalent functions with control of error handling: + Initialization: err = glthread_rwlock_init (&name); + Taking the lock: err = glthread_rwlock_rdlock (&name); + err = glthread_rwlock_wrlock (&name); + Releasing the lock: err = glthread_rwlock_unlock (&name); + De-initialization: err = glthread_rwlock_destroy (&name); + + Recursive locks: + Type: gl_recursive_lock_t + Declaration: gl_recursive_lock_define(extern, name) + Initializer: gl_recursive_lock_define_initialized(, name) + Initialization: gl_recursive_lock_init (name); + Taking the lock: gl_recursive_lock_lock (name); + Releasing the lock: gl_recursive_lock_unlock (name); + De-initialization: gl_recursive_lock_destroy (name); + Equivalent functions with control of error handling: + Initialization: err = glthread_recursive_lock_init (&name); + Taking the lock: err = glthread_recursive_lock_lock (&name); + Releasing the lock: err = glthread_recursive_lock_unlock (&name); + De-initialization: err = glthread_recursive_lock_destroy (&name); + + Once-only execution: + Type: gl_once_t + Initializer: gl_once_define(extern, name) + Execution: gl_once (name, initfunction); + Equivalent functions with control of error handling: + Execution: err = glthread_once (&name, initfunction); +*/ + + +#ifndef _LOCK_H +#define _LOCK_H + +#include +#include + +#if !defined c11_threads_in_use +# if HAVE_THREADS_H && USE_POSIX_THREADS_WEAK +# include +# pragma weak thrd_exit +# define c11_threads_in_use() (thrd_exit != NULL) +# else +# define c11_threads_in_use() 0 +# endif +#endif + +/* ========================================================================= */ + +#if USE_ISOC_THREADS || USE_ISOC_AND_POSIX_THREADS + +/* Use the ISO C threads library. */ + +# include + +# ifdef __cplusplus +extern "C" { +# endif + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +typedef struct + { + int volatile init_needed; + once_flag init_once; + void (*init_func) (void); + mtx_t mutex; + } + gl_lock_t; +# define gl_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_lock_t NAME; +# define gl_lock_define_initialized(STORAGECLASS, NAME) \ + static void _atomic_init_##NAME (void); \ + STORAGECLASS gl_lock_t NAME = \ + { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \ + static void _atomic_init_##NAME (void) \ + { \ + if (glthread_lock_init (&(NAME))) \ + abort (); \ + } +extern int glthread_lock_init (gl_lock_t *lock); +extern int glthread_lock_lock (gl_lock_t *lock); +extern int glthread_lock_unlock (gl_lock_t *lock); +extern int glthread_lock_destroy (gl_lock_t *lock); + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +typedef struct + { + int volatile init_needed; + once_flag init_once; + void (*init_func) (void); + mtx_t lock; /* protects the remaining fields */ + cnd_t waiting_readers; /* waiting readers */ + cnd_t waiting_writers; /* waiting writers */ + unsigned int waiting_writers_count; /* number of waiting writers */ + int runcount; /* number of readers running, or -1 when a writer runs */ + } + gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + static void _atomic_init_##NAME (void); \ + STORAGECLASS gl_rwlock_t NAME = \ + { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \ + static void _atomic_init_##NAME (void) \ + { \ + if (glthread_rwlock_init (&(NAME))) \ + abort (); \ + } +extern int glthread_rwlock_init (gl_rwlock_t *lock); +extern int glthread_rwlock_rdlock (gl_rwlock_t *lock); +extern int glthread_rwlock_wrlock (gl_rwlock_t *lock); +extern int glthread_rwlock_unlock (gl_rwlock_t *lock); +extern int glthread_rwlock_destroy (gl_rwlock_t *lock); + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +typedef struct + { + int volatile init_needed; + once_flag init_once; + void (*init_func) (void); + mtx_t mutex; + } + gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + static void _atomic_init_##NAME (void); \ + STORAGECLASS gl_recursive_lock_t NAME = \ + { 1, ONCE_FLAG_INIT, _atomic_init_##NAME }; \ + static void _atomic_init_##NAME (void) \ + { \ + if (glthread_recursive_lock_init (&(NAME))) \ + abort (); \ + } +extern int glthread_recursive_lock_init (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_lock (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_unlock (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_destroy (gl_recursive_lock_t *lock); + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef once_flag gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS once_flag NAME = ONCE_FLAG_INIT; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (call_once (ONCE_CONTROL, INITFUNCTION), 0) + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include + +# ifdef __cplusplus +extern "C" { +# endif + +# if PTHREAD_IN_USE_DETECTION_HARD + +/* The pthread_in_use() detection needs to be done at runtime. */ +# define pthread_in_use() \ + glthread_in_use () +extern int glthread_in_use (void); + +# endif + +# if USE_POSIX_THREADS_WEAK + +/* Use weak references to the POSIX threads library. */ + +/* Weak references avoid dragging in external libraries if the other parts + of the program don't use them. Here we use them, because we don't want + every program that uses libintl to depend on libpthread. This assumes + that libpthread would not be loaded after libintl; i.e. if libintl is + loaded first, by an executable that does not depend on libpthread, and + then a module is dynamically loaded that depends on libpthread, libintl + will not be multithread-safe. */ + +/* The way to test at runtime whether libpthread is present is to test + whether a function pointer's value, such as &pthread_mutex_init, is + non-NULL. However, some versions of GCC have a bug through which, in + PIC mode, &foo != NULL always evaluates to true if there is a direct + call to foo(...) in the same function. To avoid this, we test the + address of a function in libpthread that we don't use. */ + +# pragma weak pthread_mutex_init +# pragma weak pthread_mutex_lock +# pragma weak pthread_mutex_unlock +# pragma weak pthread_mutex_destroy +# pragma weak pthread_rwlock_init +# pragma weak pthread_rwlock_rdlock +# pragma weak pthread_rwlock_wrlock +# pragma weak pthread_rwlock_unlock +# pragma weak pthread_rwlock_destroy +# pragma weak pthread_once +# pragma weak pthread_cond_init +# pragma weak pthread_cond_wait +# pragma weak pthread_cond_signal +# pragma weak pthread_cond_broadcast +# pragma weak pthread_cond_destroy +# pragma weak pthread_mutexattr_init +# pragma weak pthread_mutexattr_settype +# pragma weak pthread_mutexattr_destroy +# pragma weak pthread_rwlockattr_init +# if __GNU_LIBRARY__ > 1 +# pragma weak pthread_rwlockattr_setkind_np +# endif +# pragma weak pthread_rwlockattr_destroy +# ifndef pthread_self +# pragma weak pthread_self +# endif + +# if !PTHREAD_IN_USE_DETECTION_HARD + /* Considering all platforms with USE_POSIX_THREADS_WEAK, only few symbols + can be used to determine whether libpthread is in use. These are: + pthread_mutexattr_gettype + pthread_rwlockattr_destroy + pthread_rwlockattr_init + */ +# pragma weak pthread_mutexattr_gettype +# define pthread_in_use() \ + (pthread_mutexattr_gettype != NULL || c11_threads_in_use ()) +# endif + +# else + +# if !PTHREAD_IN_USE_DETECTION_HARD +# define pthread_in_use() 1 +# endif + +# endif + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +typedef pthread_mutex_t gl_lock_t; +# define gl_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS pthread_mutex_t NAME; +# define gl_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS pthread_mutex_t NAME = gl_lock_initializer; +# define gl_lock_initializer \ + PTHREAD_MUTEX_INITIALIZER +# define glthread_lock_init(LOCK) \ + (pthread_in_use () ? pthread_mutex_init (LOCK, NULL) : 0) +# define glthread_lock_lock(LOCK) \ + (pthread_in_use () ? pthread_mutex_lock (LOCK) : 0) +# define glthread_lock_unlock(LOCK) \ + (pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0) +# define glthread_lock_destroy(LOCK) \ + (pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0) + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +# if HAVE_PTHREAD_RWLOCK && (HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER || (defined PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP && (__GNU_LIBRARY__ > 1))) + +# if defined PTHREAD_RWLOCK_INITIALIZER || defined PTHREAD_RWLOCK_INITIALIZER_NP + +typedef pthread_rwlock_t gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS pthread_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS pthread_rwlock_t NAME = gl_rwlock_initializer; +# if HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER +# if defined PTHREAD_RWLOCK_INITIALIZER +# define gl_rwlock_initializer \ + PTHREAD_RWLOCK_INITIALIZER +# else +# define gl_rwlock_initializer \ + PTHREAD_RWLOCK_INITIALIZER_NP +# endif +# define glthread_rwlock_init(LOCK) \ + (pthread_in_use () ? pthread_rwlock_init (LOCK, NULL) : 0) +# else /* glibc with bug https://sourceware.org/bugzilla/show_bug.cgi?id=13701 */ +# define gl_rwlock_initializer \ + PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP +# define glthread_rwlock_init(LOCK) \ + (pthread_in_use () ? glthread_rwlock_init_for_glibc (LOCK) : 0) +extern int glthread_rwlock_init_for_glibc (pthread_rwlock_t *lock); +# endif +# define glthread_rwlock_rdlock(LOCK) \ + (pthread_in_use () ? pthread_rwlock_rdlock (LOCK) : 0) +# define glthread_rwlock_wrlock(LOCK) \ + (pthread_in_use () ? pthread_rwlock_wrlock (LOCK) : 0) +# define glthread_rwlock_unlock(LOCK) \ + (pthread_in_use () ? pthread_rwlock_unlock (LOCK) : 0) +# define glthread_rwlock_destroy(LOCK) \ + (pthread_in_use () ? pthread_rwlock_destroy (LOCK) : 0) + +# else + +typedef struct + { + int initialized; + pthread_mutex_t guard; /* protects the initialization */ + pthread_rwlock_t rwlock; /* read-write lock */ + } + gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; +# define gl_rwlock_initializer \ + { 0, PTHREAD_MUTEX_INITIALIZER } +# define glthread_rwlock_init(LOCK) \ + (pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0) +# define glthread_rwlock_rdlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_wrlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_unlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_destroy(LOCK) \ + (pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0) +extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock); + +# endif + +# else + +typedef struct + { + pthread_mutex_t lock; /* protects the remaining fields */ + pthread_cond_t waiting_readers; /* waiting readers */ + pthread_cond_t waiting_writers; /* waiting writers */ + unsigned int waiting_writers_count; /* number of waiting writers */ + int runcount; /* number of readers running, or -1 when a writer runs */ + } + gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; +# define gl_rwlock_initializer \ + { PTHREAD_MUTEX_INITIALIZER, PTHREAD_COND_INITIALIZER, PTHREAD_COND_INITIALIZER, 0, 0 } +# define glthread_rwlock_init(LOCK) \ + (pthread_in_use () ? glthread_rwlock_init_multithreaded (LOCK) : 0) +# define glthread_rwlock_rdlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_rdlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_wrlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_wrlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_unlock(LOCK) \ + (pthread_in_use () ? glthread_rwlock_unlock_multithreaded (LOCK) : 0) +# define glthread_rwlock_destroy(LOCK) \ + (pthread_in_use () ? glthread_rwlock_destroy_multithreaded (LOCK) : 0) +extern int glthread_rwlock_init_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_rdlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_wrlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_unlock_multithreaded (gl_rwlock_t *lock); +extern int glthread_rwlock_destroy_multithreaded (gl_rwlock_t *lock); + +# endif + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +# if HAVE_PTHREAD_MUTEX_RECURSIVE + +# if defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER || defined PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + +typedef pthread_mutex_t gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS pthread_mutex_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS pthread_mutex_t NAME = gl_recursive_lock_initializer; +# ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER +# define gl_recursive_lock_initializer \ + PTHREAD_RECURSIVE_MUTEX_INITIALIZER +# else +# define gl_recursive_lock_initializer \ + PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP +# endif +# define glthread_recursive_lock_init(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_lock(LOCK) \ + (pthread_in_use () ? pthread_mutex_lock (LOCK) : 0) +# define glthread_recursive_lock_unlock(LOCK) \ + (pthread_in_use () ? pthread_mutex_unlock (LOCK) : 0) +# define glthread_recursive_lock_destroy(LOCK) \ + (pthread_in_use () ? pthread_mutex_destroy (LOCK) : 0) +extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); + +# else + +typedef struct + { + pthread_mutex_t recmutex; /* recursive mutex */ + pthread_mutex_t guard; /* protects the initialization */ + int initialized; + } + gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; +# define gl_recursive_lock_initializer \ + { PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER, 0 } +# define glthread_recursive_lock_init(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_lock(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_unlock(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_destroy(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0) +extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock); + +# endif + +# else + +/* Old versions of POSIX threads on Solaris did not have recursive locks. + We have to implement them ourselves. */ + +typedef struct + { + pthread_mutex_t mutex; + pthread_t owner; + unsigned long depth; + } + gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; +# define gl_recursive_lock_initializer \ + { PTHREAD_MUTEX_INITIALIZER, (pthread_t) 0, 0 } +# define glthread_recursive_lock_init(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_init_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_lock(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_lock_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_unlock(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_unlock_multithreaded (LOCK) : 0) +# define glthread_recursive_lock_destroy(LOCK) \ + (pthread_in_use () ? glthread_recursive_lock_destroy_multithreaded (LOCK) : 0) +extern int glthread_recursive_lock_init_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_lock_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_unlock_multithreaded (gl_recursive_lock_t *lock); +extern int glthread_recursive_lock_destroy_multithreaded (gl_recursive_lock_t *lock); + +# endif + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef pthread_once_t gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS pthread_once_t NAME = PTHREAD_ONCE_INIT; +# if PTHREAD_IN_USE_DETECTION_HARD || USE_POSIX_THREADS_WEAK +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (pthread_in_use () \ + ? pthread_once (ONCE_CONTROL, INITFUNCTION) \ + : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) +# else +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (pthread_in_use () \ + ? glthread_once_multithreaded (ONCE_CONTROL, INITFUNCTION) \ + : (glthread_once_singlethreaded (ONCE_CONTROL) ? (INITFUNCTION (), 0) : 0)) +extern int glthread_once_multithreaded (pthread_once_t *once_control, + void (*init_function) (void)); +# endif +extern int glthread_once_singlethreaded (pthread_once_t *once_control); + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if USE_WINDOWS_THREADS + +# define WIN32_LEAN_AND_MEAN /* avoid including junk */ +# include + +# include "windows-mutex.h" +# include "windows-rwlock.h" +# include "windows-recmutex.h" +# include "windows-once.h" + +# ifdef __cplusplus +extern "C" { +# endif + +/* We can use CRITICAL_SECTION directly, rather than the native Windows Event, + Mutex, Semaphore types, because + - we need only to synchronize inside a single process (address space), + not inter-process locking, + - we don't need to support trylock operations. (TryEnterCriticalSection + does not work on Windows 95/98/ME. Packages that need trylock usually + define their own mutex type.) */ + +/* There is no way to statically initialize a CRITICAL_SECTION. It needs + to be done lazily, once only. For this we need spinlocks. */ + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +typedef glwthread_mutex_t gl_lock_t; +# define gl_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_lock_t NAME; +# define gl_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_lock_t NAME = gl_lock_initializer; +# define gl_lock_initializer \ + GLWTHREAD_MUTEX_INIT +# define glthread_lock_init(LOCK) \ + (glwthread_mutex_init (LOCK), 0) +# define glthread_lock_lock(LOCK) \ + glwthread_mutex_lock (LOCK) +# define glthread_lock_unlock(LOCK) \ + glwthread_mutex_unlock (LOCK) +# define glthread_lock_destroy(LOCK) \ + glwthread_mutex_destroy (LOCK) + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +typedef glwthread_rwlock_t gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME; +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_rwlock_t NAME = gl_rwlock_initializer; +# define gl_rwlock_initializer \ + GLWTHREAD_RWLOCK_INIT +# define glthread_rwlock_init(LOCK) \ + (glwthread_rwlock_init (LOCK), 0) +# define glthread_rwlock_rdlock(LOCK) \ + glwthread_rwlock_rdlock (LOCK) +# define glthread_rwlock_wrlock(LOCK) \ + glwthread_rwlock_wrlock (LOCK) +# define glthread_rwlock_unlock(LOCK) \ + glwthread_rwlock_unlock (LOCK) +# define glthread_rwlock_destroy(LOCK) \ + glwthread_rwlock_destroy (LOCK) + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +typedef glwthread_recmutex_t gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME; +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) \ + STORAGECLASS gl_recursive_lock_t NAME = gl_recursive_lock_initializer; +# define gl_recursive_lock_initializer \ + GLWTHREAD_RECMUTEX_INIT +# define glthread_recursive_lock_init(LOCK) \ + (glwthread_recmutex_init (LOCK), 0) +# define glthread_recursive_lock_lock(LOCK) \ + glwthread_recmutex_lock (LOCK) +# define glthread_recursive_lock_unlock(LOCK) \ + glwthread_recmutex_unlock (LOCK) +# define glthread_recursive_lock_destroy(LOCK) \ + glwthread_recmutex_destroy (LOCK) + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef glwthread_once_t gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_once_t NAME = GLWTHREAD_ONCE_INIT; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (glwthread_once (ONCE_CONTROL, INITFUNCTION), 0) + +# ifdef __cplusplus +} +# endif + +#endif + +/* ========================================================================= */ + +#if !(USE_ISOC_THREADS || USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS || USE_WINDOWS_THREADS) + +/* Provide dummy implementation if threads are not supported. */ + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +typedef int gl_lock_t; +# define gl_lock_define(STORAGECLASS, NAME) +# define gl_lock_define_initialized(STORAGECLASS, NAME) +# define glthread_lock_init(NAME) 0 +# define glthread_lock_lock(NAME) 0 +# define glthread_lock_unlock(NAME) 0 +# define glthread_lock_destroy(NAME) 0 + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +typedef int gl_rwlock_t; +# define gl_rwlock_define(STORAGECLASS, NAME) +# define gl_rwlock_define_initialized(STORAGECLASS, NAME) +# define glthread_rwlock_init(NAME) 0 +# define glthread_rwlock_rdlock(NAME) 0 +# define glthread_rwlock_wrlock(NAME) 0 +# define glthread_rwlock_unlock(NAME) 0 +# define glthread_rwlock_destroy(NAME) 0 + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +typedef int gl_recursive_lock_t; +# define gl_recursive_lock_define(STORAGECLASS, NAME) +# define gl_recursive_lock_define_initialized(STORAGECLASS, NAME) +# define glthread_recursive_lock_init(NAME) 0 +# define glthread_recursive_lock_lock(NAME) 0 +# define glthread_recursive_lock_unlock(NAME) 0 +# define glthread_recursive_lock_destroy(NAME) 0 + +/* -------------------------- gl_once_t datatype -------------------------- */ + +typedef int gl_once_t; +# define gl_once_define(STORAGECLASS, NAME) \ + STORAGECLASS gl_once_t NAME = 0; +# define glthread_once(ONCE_CONTROL, INITFUNCTION) \ + (*(ONCE_CONTROL) == 0 ? (*(ONCE_CONTROL) = ~ 0, INITFUNCTION (), 0) : 0) + +#endif + +/* ========================================================================= */ + +/* Macros with built-in error handling. */ + +/* -------------------------- gl_lock_t datatype -------------------------- */ + +#define gl_lock_init(NAME) \ + do \ + { \ + if (glthread_lock_init (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_lock_lock(NAME) \ + do \ + { \ + if (glthread_lock_lock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_lock_unlock(NAME) \ + do \ + { \ + if (glthread_lock_unlock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_lock_destroy(NAME) \ + do \ + { \ + if (glthread_lock_destroy (&NAME)) \ + abort (); \ + } \ + while (0) + +/* ------------------------- gl_rwlock_t datatype ------------------------- */ + +#define gl_rwlock_init(NAME) \ + do \ + { \ + if (glthread_rwlock_init (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_rwlock_rdlock(NAME) \ + do \ + { \ + if (glthread_rwlock_rdlock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_rwlock_wrlock(NAME) \ + do \ + { \ + if (glthread_rwlock_wrlock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_rwlock_unlock(NAME) \ + do \ + { \ + if (glthread_rwlock_unlock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_rwlock_destroy(NAME) \ + do \ + { \ + if (glthread_rwlock_destroy (&NAME)) \ + abort (); \ + } \ + while (0) + +/* --------------------- gl_recursive_lock_t datatype --------------------- */ + +#define gl_recursive_lock_init(NAME) \ + do \ + { \ + if (glthread_recursive_lock_init (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_recursive_lock_lock(NAME) \ + do \ + { \ + if (glthread_recursive_lock_lock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_recursive_lock_unlock(NAME) \ + do \ + { \ + if (glthread_recursive_lock_unlock (&NAME)) \ + abort (); \ + } \ + while (0) +#define gl_recursive_lock_destroy(NAME) \ + do \ + { \ + if (glthread_recursive_lock_destroy (&NAME)) \ + abort (); \ + } \ + while (0) + +/* -------------------------- gl_once_t datatype -------------------------- */ + +#define gl_once(NAME, INITFUNCTION) \ + do \ + { \ + if (glthread_once (&NAME, INITFUNCTION)) \ + abort (); \ + } \ + while (0) + +/* ========================================================================= */ + +#endif /* _LOCK_H */ diff --git a/gnulib-lib/glthread/threadlib.c b/gnulib-lib/glthread/threadlib.c new file mode 100644 index 0000000..793bc69 --- /dev/null +++ b/gnulib-lib/glthread/threadlib.c @@ -0,0 +1,108 @@ +/* Multithreading primitives. + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. */ + +#include + +/* ========================================================================= */ + +#if USE_POSIX_THREADS || USE_ISOC_AND_POSIX_THREADS + +/* Use the POSIX threads library. */ + +# include +# include +# include + +# if PTHREAD_IN_USE_DETECTION_HARD + +# if defined __FreeBSD__ || defined __DragonFly__ /* FreeBSD */ + +/* Test using pthread_key_create. */ + +int +glthread_in_use (void) +{ + static int tested; + static int result; /* 1: linked with -lpthread, 0: only with libc */ + + if (!tested) + { + pthread_key_t key; + int err = pthread_key_create (&key, NULL); + + if (err == ENOSYS) + result = 0; + else + { + result = 1; + if (err == 0) + pthread_key_delete (key); + } + tested = 1; + } + return result; +} + +# else /* Solaris, HP-UX */ + +/* Test using pthread_create. */ + +/* The function to be executed by a dummy thread. */ +static void * +dummy_thread_func (void *arg) +{ + return arg; +} + +int +glthread_in_use (void) +{ + static int tested; + static int result; /* 1: linked with -lpthread, 0: only with libc */ + + if (!tested) + { + pthread_t thread; + + if (pthread_create (&thread, NULL, dummy_thread_func, NULL) != 0) + /* Thread creation failed. */ + result = 0; + else + { + /* Thread creation works. */ + void *retval; + if (pthread_join (thread, &retval) != 0) + abort (); + result = 1; + } + tested = 1; + } + return result; +} + +# endif + +# endif + +#endif + +/* ========================================================================= */ + +/* This declaration is solely to ensure that after preprocessing + this file is never empty. */ +typedef int dummy; diff --git a/gnulib-lib/idx.h b/gnulib-lib/idx.h new file mode 100644 index 0000000..483587e --- /dev/null +++ b/gnulib-lib/idx.h @@ -0,0 +1,114 @@ +/* A type for indices and sizes. + Copyright (C) 2020-2021 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, see + . */ + +#ifndef _IDX_H +#define _IDX_H + +/* Get ptrdiff_t. */ +#include + +/* Get PTRDIFF_MAX. */ +#include + +/* The type 'idx_t' holds an (array) index or an (object) size. + Its implementation promotes to a signed integer type, + which can hold the values + 0..2^63-1 (on 64-bit platforms) or + 0..2^31-1 (on 32-bit platforms). + + Why a signed integer type? + + * Security: Signed types can be checked for overflow via + '-fsanitize=undefined', but unsigned types cannot. + + * Comparisons without surprises: ISO C99 § 6.3.1.8 specifies a few + surprising results for comparisons, such as + + (int) -3 < (unsigned long) 7 => false + (int) -3 < (unsigned int) 7 => false + and on 32-bit machines: + (long) -3 < (unsigned int) 7 => false + + This is surprising because the natural comparison order is by + value in the realm of infinite-precision signed integers (ℤ). + + The best way to get rid of such surprises is to use signed types + for numerical integer values, and use unsigned types only for + bit masks and enums. + + Why not use 'size_t' directly? + + * Because 'size_t' is an unsigned type, and a signed type is better. + See above. + + Why not use 'ptrdiff_t' directly? + + * Maintainability: When reading and modifying code, it helps to know that + a certain variable cannot have negative values. For example, when you + have a loop + + int n = ...; + for (int i = 0; i < n; i++) ... + + or + + ptrdiff_t n = ...; + for (ptrdiff_t i = 0; i < n; i++) ... + + you have to ask yourself "what if n < 0?". Whereas in + + idx_t n = ...; + for (idx_t i = 0; i < n; i++) ... + + you know that this case cannot happen. + + Similarly, when a programmer writes + + idx_t = ptr2 - ptr1; + + there is an implied assertion that ptr1 and ptr2 point into the same + object and that ptr1 <= ptr2. + + * Being future-proof: In the future, range types (integers which are + constrained to a certain range of values) may be added to C compilers + or to the C standard. Several programming languages (Ada, Haskell, + Common Lisp, Pascal) already have range types. Such range types may + help producing good code and good warnings. The type 'idx_t' could + then be typedef'ed to a range type that is signed after promotion. */ + +/* In the future, idx_t could be typedef'ed to a signed range type. + The clang "extended integer types", supported in Clang 11 or newer + , + are a special case of range types. However, these types don't support binary + operators with plain integer types (e.g. expressions such as x > 1). + Therefore, they don't behave like signed types (and not like unsigned types + either). So, we cannot use them here. */ + +/* Use the signed type 'ptrdiff_t'. */ +/* Note: ISO C does not mandate that 'size_t' and 'ptrdiff_t' have the same + size, but it is so on all platforms we have seen since 1990. */ +typedef ptrdiff_t idx_t; + +/* IDX_MAX is the maximum value of an idx_t. */ +#define IDX_MAX PTRDIFF_MAX + +/* So far no need has been found for an IDX_WIDTH macro. + Perhaps there should be another macro IDX_VALUE_BITS that does not + count the sign bit and is therefore one less than PTRDIFF_WIDTH. */ + +#endif /* _IDX_H */ diff --git a/gnulib-lib/intprops.h b/gnulib-lib/intprops.h new file mode 100644 index 0000000..9d10028 --- /dev/null +++ b/gnulib-lib/intprops.h @@ -0,0 +1,640 @@ +/* intprops.h -- properties of integer types + + Copyright (C) 2001-2021 Free Software Foundation, Inc. + + This program 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. + + 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 Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* Written by Paul Eggert. */ + +#ifndef _GL_INTPROPS_H +#define _GL_INTPROPS_H + +#include + +/* Return a value with the common real type of E and V and the value of V. + Do not evaluate E. */ +#define _GL_INT_CONVERT(e, v) ((1 ? 0 : (e)) + (v)) + +/* Act like _GL_INT_CONVERT (E, -V) but work around a bug in IRIX 6.5 cc; see + . */ +#define _GL_INT_NEGATE_CONVERT(e, v) ((1 ? 0 : (e)) - (v)) + +/* The extra casts in the following macros work around compiler bugs, + e.g., in Cray C 5.0.3.0. */ + +/* True if the arithmetic type T is an integer type. bool counts as + an integer. */ +#define TYPE_IS_INTEGER(t) ((t) 1.5 == 1) + +/* True if the real type T is signed. */ +#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) + +/* Return 1 if the real expression E, after promotion, has a + signed or floating type. Do not evaluate E. */ +#define EXPR_SIGNED(e) (_GL_INT_NEGATE_CONVERT (e, 1) < 0) + + +/* Minimum and maximum values for integer types and expressions. */ + +/* The width in bits of the integer type or expression T. + Do not evaluate T. T must not be a bit-field expression. + Padding bits are not supported; this is checked at compile-time below. */ +#define TYPE_WIDTH(t) (sizeof (t) * CHAR_BIT) + +/* The maximum and minimum values for the integer type T. */ +#define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t)) +#define TYPE_MAXIMUM(t) \ + ((t) (! TYPE_SIGNED (t) \ + ? (t) -1 \ + : ((((t) 1 << (TYPE_WIDTH (t) - 2)) - 1) * 2 + 1))) + +/* The maximum and minimum values for the type of the expression E, + after integer promotion. E is not evaluated. */ +#define _GL_INT_MINIMUM(e) \ + (EXPR_SIGNED (e) \ + ? ~ _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_CONVERT (e, 0)) +#define _GL_INT_MAXIMUM(e) \ + (EXPR_SIGNED (e) \ + ? _GL_SIGNED_INT_MAXIMUM (e) \ + : _GL_INT_NEGATE_CONVERT (e, 1)) +#define _GL_SIGNED_INT_MAXIMUM(e) \ + (((_GL_INT_CONVERT (e, 1) << (TYPE_WIDTH (+ (e)) - 2)) - 1) * 2 + 1) + +/* Work around OpenVMS incompatibility with C99. */ +#if !defined LLONG_MAX && defined __INT64_MAX +# define LLONG_MAX __INT64_MAX +# define LLONG_MIN __INT64_MIN +#endif + +/* This include file assumes that signed types are two's complement without + padding bits; the above macros have undefined behavior otherwise. + If this is a problem for you, please let us know how to fix it for your host. + This assumption is tested by the intprops-tests module. */ + +/* Does the __typeof__ keyword work? This could be done by + 'configure', but for now it's easier to do it by hand. */ +#if (2 <= __GNUC__ \ + || (4 <= __clang_major__) \ + || (1210 <= __IBMC__ && defined __IBM__TYPEOF__) \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) +# define _GL_HAVE___TYPEOF__ 1 +#else +# define _GL_HAVE___TYPEOF__ 0 +#endif + +/* Return 1 if the integer type or expression T might be signed. Return 0 + if it is definitely unsigned. T must not be a bit-field expression. + This macro does not evaluate its argument, and expands to an + integer constant expression. */ +#if _GL_HAVE___TYPEOF__ +# define _GL_SIGNED_TYPE_OR_EXPR(t) TYPE_SIGNED (__typeof__ (t)) +#else +# define _GL_SIGNED_TYPE_OR_EXPR(t) 1 +#endif + +/* Bound on length of the string representing an unsigned integer + value representable in B bits. log10 (2.0) < 146/485. The + smallest value of B where this bound is not tight is 2621. */ +#define INT_BITS_STRLEN_BOUND(b) (((b) * 146 + 484) / 485) + +/* Bound on length of the string representing an integer type or expression T. + T must not be a bit-field expression. + + Subtract 1 for the sign bit if T is signed, and then add 1 more for + a minus sign if needed. + + Because _GL_SIGNED_TYPE_OR_EXPR sometimes returns 1 when its argument is + unsigned, this macro may overestimate the true bound by one byte when + applied to unsigned types of size 2, 4, 16, ... bytes. */ +#define INT_STRLEN_BOUND(t) \ + (INT_BITS_STRLEN_BOUND (TYPE_WIDTH (t) - _GL_SIGNED_TYPE_OR_EXPR (t)) \ + + _GL_SIGNED_TYPE_OR_EXPR (t)) + +/* Bound on buffer size needed to represent an integer type or expression T, + including the terminating null. T must not be a bit-field expression. */ +#define INT_BUFSIZE_BOUND(t) (INT_STRLEN_BOUND (t) + 1) + + +/* Range overflow checks. + + The INT__RANGE_OVERFLOW macros return 1 if the corresponding C + operators might not yield numerically correct answers due to + arithmetic overflow. They do not rely on undefined or + implementation-defined behavior. Their implementations are simple + and straightforward, but they are harder to use and may be less + efficient than the INT__WRAPV, INT__OK, and + INT__OVERFLOW macros described below. + + Example usage: + + long int i = ...; + long int j = ...; + if (INT_MULTIPLY_RANGE_OVERFLOW (i, j, LONG_MIN, LONG_MAX)) + printf ("multiply would overflow"); + else + printf ("product is %ld", i * j); + + Restrictions on *_RANGE_OVERFLOW macros: + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, + so the arguments should not have side effects. The arithmetic + arguments (including the MIN and MAX arguments) must be of the same + integer type after the usual arithmetic conversions, and the type + must have minimum value MIN and maximum MAX. Unsigned types should + use a zero MIN of the proper type. + + Because all arguments are subject to integer promotions, these + macros typically do not work on types narrower than 'int'. + + These macros are tuned for constant MIN and MAX. For commutative + operations such as A + B, they are also tuned for constant B. */ + +/* Return 1 if A + B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_ADD_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (a) < (min) - (b) \ + : (max) - (b) < (a)) + +/* Return 1 if A - B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_SUBTRACT_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? (max) + (b) < (a) \ + : (a) < (min) + (b)) + +/* Return 1 if - A would overflow in [MIN,MAX] arithmetic. + See above for restrictions. */ +#define INT_NEGATE_RANGE_OVERFLOW(a, min, max) \ + ((min) < 0 \ + ? (a) < - (max) \ + : 0 < (a)) + +/* Return 1 if A * B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Avoid && and || as they tickle + bugs in Sun C 5.11 2010/08/13 and other compilers; see + . */ +#define INT_MULTIPLY_RANGE_OVERFLOW(a, b, min, max) \ + ((b) < 0 \ + ? ((a) < 0 \ + ? (a) < (max) / (b) \ + : (b) == -1 \ + ? 0 \ + : (min) / (b) < (a)) \ + : (b) == 0 \ + ? 0 \ + : ((a) < 0 \ + ? (a) < (min) / (b) \ + : (max) / (b) < (a))) + +/* Return 1 if A / B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. */ +#define INT_DIVIDE_RANGE_OVERFLOW(a, b, min, max) \ + ((min) < 0 && (b) == -1 && (a) < - (max)) + +/* Return 1 if A % B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Do not check for division by zero. + Mathematically, % should never overflow, but on x86-like hosts + INT_MIN % -1 traps, and the C standard permits this, so treat this + as an overflow too. */ +#define INT_REMAINDER_RANGE_OVERFLOW(a, b, min, max) \ + INT_DIVIDE_RANGE_OVERFLOW (a, b, min, max) + +/* Return 1 if A << B would overflow in [MIN,MAX] arithmetic. + See above for restrictions. Here, MIN and MAX are for A only, and B need + not be of the same type as the other arguments. The C standard says that + behavior is undefined for shifts unless 0 <= B < wordwidth, and that when + A is negative then A << B has undefined behavior and A >> B has + implementation-defined behavior, but do not check these other + restrictions. */ +#define INT_LEFT_SHIFT_RANGE_OVERFLOW(a, b, min, max) \ + ((a) < 0 \ + ? (a) < (min) >> (b) \ + : (max) >> (b) < (a)) + +/* True if __builtin_add_overflow (A, B, P) and __builtin_sub_overflow + (A, B, P) work when P is non-null. */ +/* __builtin_{add,sub}_overflow exists but is not reliable in GCC 5.x and 6.x, + see . */ +#if 7 <= __GNUC__ && !defined __ICC +# define _GL_HAS_BUILTIN_ADD_OVERFLOW 1 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow) +#else +# define _GL_HAS_BUILTIN_ADD_OVERFLOW 0 +#endif + +/* True if __builtin_mul_overflow (A, B, P) works when P is non-null. */ +#ifdef __clang__ +/* Work around Clang bug . */ +# define _GL_HAS_BUILTIN_MUL_OVERFLOW 0 +#else +# define _GL_HAS_BUILTIN_MUL_OVERFLOW _GL_HAS_BUILTIN_ADD_OVERFLOW +#endif + +/* True if __builtin_add_overflow_p (A, B, C) works, and similarly for + __builtin_sub_overflow_p and __builtin_mul_overflow_p. */ +#if defined __clang__ || defined __ICC +/* Clang 11 lacks __builtin_mul_overflow_p, and even if it did it + would presumably run afoul of Clang bug 16404. ICC 2021.1's + __builtin_add_overflow_p etc. are not treated as integral constant + expressions even when all arguments are. */ +# define _GL_HAS_BUILTIN_OVERFLOW_P 0 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_OVERFLOW_P __has_builtin (__builtin_mul_overflow_p) +#else +# define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__) +#endif + +/* The _GL*_OVERFLOW macros have the same restrictions as the + *_RANGE_OVERFLOW macros, except that they do not assume that operands + (e.g., A and B) have the same type as MIN and MAX. Instead, they assume + that the result (e.g., A + B) has that type. */ +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define _GL_ADD_OVERFLOW(a, b, min, max) \ + __builtin_add_overflow_p (a, b, (__typeof__ ((a) + (b))) 0) +# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + __builtin_sub_overflow_p (a, b, (__typeof__ ((a) - (b))) 0) +# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + __builtin_mul_overflow_p (a, b, (__typeof__ ((a) * (b))) 0) +#else +# define _GL_ADD_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_ADD_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? (b) <= (a) + (b) \ + : (b) < 0 ? (a) <= (a) + (b) \ + : (a) + (b) < (b)) +# define _GL_SUBTRACT_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? INT_SUBTRACT_RANGE_OVERFLOW (a, b, min, max) \ + : (a) < 0 ? 1 \ + : (b) < 0 ? (a) - (b) <= (a) \ + : (a) < (b)) +# define _GL_MULTIPLY_OVERFLOW(a, b, min, max) \ + (((min) == 0 && (((a) < 0 && 0 < (b)) || ((b) < 0 && 0 < (a)))) \ + || INT_MULTIPLY_RANGE_OVERFLOW (a, b, min, max)) +#endif +#define _GL_DIVIDE_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + : (a) < 0 ? (b) <= (a) + (b) - 1 \ + : (b) < 0 && (a) + (b) <= (a)) +#define _GL_REMAINDER_OVERFLOW(a, b, min, max) \ + ((min) < 0 ? (b) == _GL_INT_NEGATE_CONVERT (min, 1) && (a) < - (max) \ + : (a) < 0 ? (a) % (b) != ((max) - (b) + 1) % (b) \ + : (b) < 0 && ! _GL_UNSIGNED_NEG_MULTIPLE (a, b, max)) + +/* Return a nonzero value if A is a mathematical multiple of B, where + A is unsigned, B is negative, and MAX is the maximum value of A's + type. A's type must be the same as (A % B)'s type. Normally (A % + -B == 0) suffices, but things get tricky if -B would overflow. */ +#define _GL_UNSIGNED_NEG_MULTIPLE(a, b, max) \ + (((b) < -_GL_SIGNED_INT_MAXIMUM (b) \ + ? (_GL_SIGNED_INT_MAXIMUM (b) == (max) \ + ? (a) \ + : (a) % (_GL_INT_CONVERT (a, _GL_SIGNED_INT_MAXIMUM (b)) + 1)) \ + : (a) % - (b)) \ + == 0) + +/* Check for integer overflow, and report low order bits of answer. + + The INT__OVERFLOW macros return 1 if the corresponding C operators + might not yield numerically correct answers due to arithmetic overflow. + The INT__WRAPV macros compute the low-order bits of the sum, + difference, and product of two C integers, and return 1 if these + low-order bits are not numerically correct. + These macros work correctly on all known practical hosts, and do not rely + on undefined behavior due to signed arithmetic overflow. + + Example usage, assuming A and B are long int: + + if (INT_MULTIPLY_OVERFLOW (a, b)) + printf ("result would overflow\n"); + else + printf ("result is %ld (no overflow)\n", a * b); + + Example usage with WRAPV flavor: + + long int result; + bool overflow = INT_MULTIPLY_WRAPV (a, b, &result); + printf ("result is %ld (%s)\n", result, + overflow ? "after overflow" : "no overflow"); + + Restrictions on these macros: + + These macros do not check for all possible numerical problems or + undefined or unspecified behavior: they do not check for division + by zero, for bad shift counts, or for shifting negative numbers. + + These macros may evaluate their arguments zero or multiple times, so the + arguments should not have side effects. + + The WRAPV macros are not constant expressions. They support only + +, binary -, and *. + + Because the WRAPV macros convert the result, they report overflow + in different circumstances than the OVERFLOW macros do. For + example, in the typical case with 16-bit 'short' and 32-bit 'int', + if A, B and R are all of type 'short' then INT_ADD_OVERFLOW (A, B) + returns false because the addition cannot overflow after A and B + are converted to 'int', whereas INT_ADD_WRAPV (A, B, &R) returns + true or false depending on whether the sum fits into 'short'. + + These macros are tuned for their last input argument being a constant. + + Return 1 if the integer expressions A * B, A - B, -A, A * B, A / B, + A % B, and A << B would overflow, respectively. */ + +#define INT_ADD_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_ADD_OVERFLOW) +#define INT_SUBTRACT_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_SUBTRACT_OVERFLOW) +#if _GL_HAS_BUILTIN_OVERFLOW_P +# define INT_NEGATE_OVERFLOW(a) INT_SUBTRACT_OVERFLOW (0, a) +#else +# define INT_NEGATE_OVERFLOW(a) \ + INT_NEGATE_RANGE_OVERFLOW (a, _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) +#endif +#define INT_MULTIPLY_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_MULTIPLY_OVERFLOW) +#define INT_DIVIDE_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_DIVIDE_OVERFLOW) +#define INT_REMAINDER_OVERFLOW(a, b) \ + _GL_BINARY_OP_OVERFLOW (a, b, _GL_REMAINDER_OVERFLOW) +#define INT_LEFT_SHIFT_OVERFLOW(a, b) \ + INT_LEFT_SHIFT_RANGE_OVERFLOW (a, b, \ + _GL_INT_MINIMUM (a), _GL_INT_MAXIMUM (a)) + +/* Return 1 if the expression A B would overflow, + where OP_RESULT_OVERFLOW (A, B, MIN, MAX) does the actual test, + assuming MIN and MAX are the minimum and maximum for the result type. + Arguments should be free of side effects. */ +#define _GL_BINARY_OP_OVERFLOW(a, b, op_result_overflow) \ + op_result_overflow (a, b, \ + _GL_INT_MINIMUM (_GL_INT_CONVERT (a, b)), \ + _GL_INT_MAXIMUM (_GL_INT_CONVERT (a, b))) + +/* Store the low-order bits of A + B, A - B, A * B, respectively, into *R. + Return 1 if the result overflows. See above for restrictions. */ +#if _GL_HAS_BUILTIN_ADD_OVERFLOW +# define INT_ADD_WRAPV(a, b, r) __builtin_add_overflow (a, b, r) +# define INT_SUBTRACT_WRAPV(a, b, r) __builtin_sub_overflow (a, b, r) +#else +# define INT_ADD_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, +, _GL_INT_ADD_RANGE_OVERFLOW) +# define INT_SUBTRACT_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW) +#endif +#if _GL_HAS_BUILTIN_MUL_OVERFLOW +# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \ + || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \ + && !defined __ICC) +# define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r) +# else + /* Work around GCC bug 91450. */ +# define INT_MULTIPLY_WRAPV(a, b, r) \ + ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && EXPR_SIGNED (a) && EXPR_SIGNED (b) \ + && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \ + ? ((void) __builtin_mul_overflow (a, b, r), 1) \ + : __builtin_mul_overflow (a, b, r)) +# endif +#else +# define INT_MULTIPLY_WRAPV(a, b, r) \ + _GL_INT_OP_WRAPV (a, b, r, *, _GL_INT_MULTIPLY_RANGE_OVERFLOW) +#endif + +/* Nonzero if this compiler has GCC bug 68193 or Clang bug 25390. See: + https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68193 + https://llvm.org/bugs/show_bug.cgi?id=25390 + For now, assume all versions of GCC-like compilers generate bogus + warnings for _Generic. This matters only for compilers that + lack relevant builtins. */ +#if __GNUC__ || defined __clang__ +# define _GL__GENERIC_BOGUS 1 +#else +# define _GL__GENERIC_BOGUS 0 +#endif + +/* Store the low-order bits of A B into *R, where OP specifies + the operation and OVERFLOW the overflow predicate. Return 1 if the + result overflows. See above for restrictions. */ +#if 201112 <= __STDC_VERSION__ && !_GL__GENERIC_BOGUS +# define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ + (_Generic \ + (*(r), \ + signed char: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + signed char, SCHAR_MIN, SCHAR_MAX), \ + unsigned char: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned char, 0, UCHAR_MAX), \ + short int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + short int, SHRT_MIN, SHRT_MAX), \ + unsigned short int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned short int, 0, USHRT_MAX), \ + int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX), \ + unsigned int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned int, 0, UINT_MAX), \ + long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX), \ + unsigned long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + unsigned long int, 0, ULONG_MAX), \ + long long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX), \ + unsigned long long int: \ + _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + unsigned long long int, 0, ULLONG_MAX))) +#else +/* Store the low-order bits of A B into *R, where OP specifies + the operation and OVERFLOW the overflow predicate. If *R is + signed, its type is ST with bounds SMIN..SMAX; otherwise its type + is UT with bounds U..UMAX. ST and UT are narrower than int. + Return 1 if the result overflows. See above for restrictions. */ +# if _GL_HAVE___TYPEOF__ +# define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ + (TYPE_SIGNED (__typeof__ (*(r))) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, st, smin, smax) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, ut, 0, umax)) +# else +# define _GL_INT_OP_WRAPV_SMALLISH(a,b,r,op,overflow,st,smin,smax,ut,umax) \ + (overflow (a, b, smin, smax) \ + ? (overflow (a, b, 0, umax) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) < 0) \ + : (overflow (a, b, 0, umax) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st)) >= 0 \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a,b,op,unsigned,st), 0))) +# endif + +# define _GL_INT_OP_WRAPV(a, b, r, op, overflow) \ + (sizeof *(r) == sizeof (signed char) \ + ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \ + signed char, SCHAR_MIN, SCHAR_MAX, \ + unsigned char, UCHAR_MAX) \ + : sizeof *(r) == sizeof (short int) \ + ? _GL_INT_OP_WRAPV_SMALLISH (a, b, r, op, overflow, \ + short int, SHRT_MIN, SHRT_MAX, \ + unsigned short int, USHRT_MAX) \ + : sizeof *(r) == sizeof (int) \ + ? (EXPR_SIGNED (*(r)) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + int, INT_MIN, INT_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \ + unsigned int, 0, UINT_MAX)) \ + : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow)) +# ifdef LLONG_MAX +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + (sizeof *(r) == sizeof (long int) \ + ? (EXPR_SIGNED (*(r)) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + unsigned long int, 0, ULONG_MAX)) \ + : (EXPR_SIGNED (*(r)) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + long long int, LLONG_MIN, LLONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long long int, \ + unsigned long long int, 0, ULLONG_MAX))) +# else +# define _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow) \ + (EXPR_SIGNED (*(r)) \ + ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + long int, LONG_MIN, LONG_MAX) \ + : _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \ + unsigned long int, 0, ULONG_MAX)) +# endif +#endif + +/* Store the low-order bits of A B into *R, where the operation + is given by OP. Use the unsigned type UT for calculation to avoid + overflow problems. *R's type is T, with extrema TMIN and TMAX. + T must be a signed integer type. Return 1 if the result overflows. */ +#define _GL_INT_OP_CALC(a, b, r, op, overflow, ut, t, tmin, tmax) \ + (overflow (a, b, tmin, tmax) \ + ? (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 1) \ + : (*(r) = _GL_INT_OP_WRAPV_VIA_UNSIGNED (a, b, op, ut, t), 0)) + +/* Return the low-order bits of A B, where the operation is given + by OP. Use the unsigned type UT for calculation to avoid undefined + behavior on signed integer overflow, and convert the result to type T. + UT is at least as wide as T and is no narrower than unsigned int, + T is two's complement, and there is no padding or trap representations. + Assume that converting UT to T yields the low-order bits, as is + done in all known two's-complement C compilers. E.g., see: + https://gcc.gnu.org/onlinedocs/gcc/Integers-implementation.html + + According to the C standard, converting UT to T yields an + implementation-defined result or signal for values outside T's + range. However, code that works around this theoretical problem + runs afoul of a compiler bug in Oracle Studio 12.3 x86. See: + https://lists.gnu.org/r/bug-gnulib/2017-04/msg00049.html + As the compiler bug is real, don't try to work around the + theoretical problem. */ + +#define _GL_INT_OP_WRAPV_VIA_UNSIGNED(a, b, op, ut, t) \ + ((t) ((ut) (a) op (ut) (b))) + +/* Return true if the numeric values A + B, A - B, A * B fall outside + the range TMIN..TMAX. Arguments should be integer expressions + without side effects. TMIN should be signed and nonpositive. + TMAX should be positive, and should be signed unless TMIN is zero. */ +#define _GL_INT_ADD_RANGE_OVERFLOW(a, b, tmin, tmax) \ + ((b) < 0 \ + ? (((tmin) \ + ? ((EXPR_SIGNED (_GL_INT_CONVERT (a, (tmin) - (b))) || (b) < (tmin)) \ + && (a) < (tmin) - (b)) \ + : (a) <= -1 - (b)) \ + || ((EXPR_SIGNED (a) ? 0 <= (a) : (tmax) < (a)) && (tmax) < (a) + (b))) \ + : (a) < 0 \ + ? (((tmin) \ + ? ((EXPR_SIGNED (_GL_INT_CONVERT (b, (tmin) - (a))) || (a) < (tmin)) \ + && (b) < (tmin) - (a)) \ + : (b) <= -1 - (a)) \ + || ((EXPR_SIGNED (_GL_INT_CONVERT (a, b)) || (tmax) < (b)) \ + && (tmax) < (a) + (b))) \ + : (tmax) < (b) || (tmax) - (b) < (a)) +#define _GL_INT_SUBTRACT_RANGE_OVERFLOW(a, b, tmin, tmax) \ + (((a) < 0) == ((b) < 0) \ + ? ((a) < (b) \ + ? !(tmin) || -1 - (tmin) < (b) - (a) - 1 \ + : (tmax) < (a) - (b)) \ + : (a) < 0 \ + ? ((!EXPR_SIGNED (_GL_INT_CONVERT ((a) - (tmin), b)) && (a) - (tmin) < 0) \ + || (a) - (tmin) < (b)) \ + : ((! (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ + && EXPR_SIGNED (_GL_INT_CONVERT ((tmax) + (b), a))) \ + && (tmax) <= -1 - (b)) \ + || (tmax) + (b) < (a))) +#define _GL_INT_MULTIPLY_RANGE_OVERFLOW(a, b, tmin, tmax) \ + ((b) < 0 \ + ? ((a) < 0 \ + ? (EXPR_SIGNED (_GL_INT_CONVERT (tmax, b)) \ + ? (a) < (tmax) / (b) \ + : ((INT_NEGATE_OVERFLOW (b) \ + ? _GL_INT_CONVERT (b, tmax) >> (TYPE_WIDTH (+ (b)) - 1) \ + : (tmax) / -(b)) \ + <= -1 - (a))) \ + : INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (b, tmin)) && (b) == -1 \ + ? (EXPR_SIGNED (a) \ + ? 0 < (a) + (tmin) \ + : 0 < (a) && -1 - (tmin) < (a) - 1) \ + : (tmin) / (b) < (a)) \ + : (b) == 0 \ + ? 0 \ + : ((a) < 0 \ + ? (INT_NEGATE_OVERFLOW (_GL_INT_CONVERT (a, tmin)) && (a) == -1 \ + ? (EXPR_SIGNED (b) ? 0 < (b) + (tmin) : -1 - (tmin) < (b) - 1) \ + : (tmin) / (a) < (b)) \ + : (tmax) / (b) < (a))) + +/* The following macros compute A + B, A - B, and A * B, respectively. + If no overflow occurs, they set *R to the result and return 1; + otherwise, they return 0 and may modify *R. + + Example usage: + + long int result; + if (INT_ADD_OK (a, b, &result)) + printf ("result is %ld\n", result); + else + printf ("overflow\n"); + + A, B, and *R should be integers; they need not be the same type, + and they need not be all signed or all unsigned. + + These macros work correctly on all known practical hosts, and do not rely + on undefined behavior due to signed arithmetic overflow. + + These macros are not constant expressions. + + These macros may evaluate their arguments zero or multiple times, so the + arguments should not have side effects. + + These macros are tuned for B being a constant. */ + +#define INT_ADD_OK(a, b, r) ! INT_ADD_WRAPV (a, b, r) +#define INT_SUBTRACT_OK(a, b, r) ! INT_SUBTRACT_WRAPV (a, b, r) +#define INT_MULTIPLY_OK(a, b, r) ! INT_MULTIPLY_WRAPV (a, b, r) + +#endif /* _GL_INTPROPS_H */ diff --git a/gnulib-lib/limits.in.h b/gnulib-lib/limits.in.h new file mode 100644 index 0000000..65ea12d --- /dev/null +++ b/gnulib-lib/limits.in.h @@ -0,0 +1,121 @@ +/* A GNU-like . + + Copyright 2016-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined _GL_ALREADY_INCLUDING_LIMITS_H +/* Special invocation convention: + On Haiku/x86_64, we have a sequence of nested includes + -> -> . + In this situation, LONG_MAX and INT_MAX are not yet defined, + therefore we should not attempt to define LONG_BIT. */ + +#@INCLUDE_NEXT@ @NEXT_LIMITS_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_LIMITS_H + +# define _GL_ALREADY_INCLUDING_LIMITS_H + +/* The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_LIMITS_H@ + +# undef _GL_ALREADY_INCLUDING_LIMITS_H + +#ifndef _@GUARD_PREFIX@_LIMITS_H +#define _@GUARD_PREFIX@_LIMITS_H + +#ifndef LLONG_MIN +# if defined LONG_LONG_MIN /* HP-UX 11.31 */ +# define LLONG_MIN LONG_LONG_MIN +# elif defined LONGLONG_MIN /* IRIX 6.5 */ +# define LLONG_MIN LONGLONG_MIN +# elif defined __GNUC__ +# define LLONG_MIN (- __LONG_LONG_MAX__ - 1LL) +# endif +#endif +#ifndef LLONG_MAX +# if defined LONG_LONG_MAX /* HP-UX 11.31 */ +# define LLONG_MAX LONG_LONG_MAX +# elif defined LONGLONG_MAX /* IRIX 6.5 */ +# define LLONG_MAX LONGLONG_MAX +# elif defined __GNUC__ +# define LLONG_MAX __LONG_LONG_MAX__ +# endif +#endif +#ifndef ULLONG_MAX +# if defined ULONG_LONG_MAX /* HP-UX 11.31 */ +# define ULLONG_MAX ULONG_LONG_MAX +# elif defined ULONGLONG_MAX /* IRIX 6.5 */ +# define ULLONG_MAX ULONGLONG_MAX +# elif defined __GNUC__ +# define ULLONG_MAX (__LONG_LONG_MAX__ * 2ULL + 1ULL) +# endif +#endif + +/* The number of usable bits in an unsigned or signed integer type + with minimum value MIN and maximum value MAX, as an int expression + suitable in #if. Cover all known practical hosts. This + implementation exploits the fact that MAX is 1 less than a power of + 2, and merely counts the number of 1 bits in MAX; "COBn" means + "count the number of 1 bits in the low-order n bits"). */ +#define _GL_INTEGER_WIDTH(min, max) (((min) < 0) + _GL_COB128 (max)) +#define _GL_COB128(n) (_GL_COB64 ((n) >> 31 >> 31 >> 2) + _GL_COB64 (n)) +#define _GL_COB64(n) (_GL_COB32 ((n) >> 31 >> 1) + _GL_COB32 (n)) +#define _GL_COB32(n) (_GL_COB16 ((n) >> 16) + _GL_COB16 (n)) +#define _GL_COB16(n) (_GL_COB8 ((n) >> 8) + _GL_COB8 (n)) +#define _GL_COB8(n) (_GL_COB4 ((n) >> 4) + _GL_COB4 (n)) +#define _GL_COB4(n) (!!((n) & 8) + !!((n) & 4) + !!((n) & 2) + !!((n) & 1)) + +#ifndef WORD_BIT +/* Assume 'int' is 32 bits wide. */ +# define WORD_BIT 32 +#endif +#ifndef LONG_BIT +/* Assume 'long' is 32 or 64 bits wide. */ +# if LONG_MAX == INT_MAX +# define LONG_BIT 32 +# else +# define LONG_BIT 64 +# endif +#endif + +/* Macros specified by ISO/IEC TS 18661-1:2014. */ + +#if (! defined ULLONG_WIDTH \ + && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) +# define CHAR_WIDTH _GL_INTEGER_WIDTH (CHAR_MIN, CHAR_MAX) +# define SCHAR_WIDTH _GL_INTEGER_WIDTH (SCHAR_MIN, SCHAR_MAX) +# define UCHAR_WIDTH _GL_INTEGER_WIDTH (0, UCHAR_MAX) +# define SHRT_WIDTH _GL_INTEGER_WIDTH (SHRT_MIN, SHRT_MAX) +# define USHRT_WIDTH _GL_INTEGER_WIDTH (0, USHRT_MAX) +# define INT_WIDTH _GL_INTEGER_WIDTH (INT_MIN, INT_MAX) +# define UINT_WIDTH _GL_INTEGER_WIDTH (0, UINT_MAX) +# define LONG_WIDTH _GL_INTEGER_WIDTH (LONG_MIN, LONG_MAX) +# define ULONG_WIDTH _GL_INTEGER_WIDTH (0, ULONG_MAX) +# define LLONG_WIDTH _GL_INTEGER_WIDTH (LLONG_MIN, LLONG_MAX) +# define ULLONG_WIDTH _GL_INTEGER_WIDTH (0, ULLONG_MAX) +#endif /* !ULLONG_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ + +#endif /* _@GUARD_PREFIX@_LIMITS_H */ +#endif /* _@GUARD_PREFIX@_LIMITS_H */ +#endif diff --git a/gnulib-lib/malloca.c b/gnulib-lib/malloca.c new file mode 100644 index 0000000..d7ad095 --- /dev/null +++ b/gnulib-lib/malloca.c @@ -0,0 +1,107 @@ +/* Safe automatic memory allocation. + Copyright (C) 2003, 2006-2007, 2009-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2003, 2018. + + This file 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. + + This file 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 this program. If not, see . */ + +#define _GL_USE_STDLIB_ALLOC 1 +#include + +/* Specification. */ +#include "malloca.h" + +#include "idx.h" +#include "intprops.h" +#include "verify.h" + +/* The speed critical point in this file is freea() applied to an alloca() + result: it must be fast, to match the speed of alloca(). The speed of + mmalloca() and freea() in the other case are not critical, because they + are only invoked for big memory sizes. + Here we use a bit in the address as an indicator, an idea by Ondřej Bílka. + malloca() can return three types of pointers: + - Pointers ≡ 0 mod 2*sa_alignment_max come from stack allocation. + - Pointers ≡ sa_alignment_max mod 2*sa_alignment_max come from heap + allocation. + - NULL comes from a failed heap allocation. */ + +/* Type for holding very small pointer differences. */ +typedef unsigned char small_t; +/* Verify that it is wide enough. */ +verify (2 * sa_alignment_max - 1 <= (small_t) -1); + +void * +mmalloca (size_t n) +{ +#if HAVE_ALLOCA + /* Allocate one more word, used to determine the address to pass to freea(), + and room for the alignment ≡ sa_alignment_max mod 2*sa_alignment_max. */ + int plus = sizeof (small_t) + 2 * sa_alignment_max - 1; + idx_t nplus; + if (!INT_ADD_WRAPV (n, plus, &nplus) && !xalloc_oversized (nplus, 1)) + { + char *mem = (char *) malloc (nplus); + + if (mem != NULL) + { + char *p = + (char *)((((uintptr_t)mem + sizeof (small_t) + sa_alignment_max - 1) + & ~(uintptr_t)(2 * sa_alignment_max - 1)) + + sa_alignment_max); + /* Here p >= mem + sizeof (small_t), + and p <= mem + sizeof (small_t) + 2 * sa_alignment_max - 1 + hence p + n <= mem + nplus. + So, the memory range [p, p+n) lies in the allocated memory range + [mem, mem + nplus). */ + ((small_t *) p)[-1] = p - mem; + /* p ≡ sa_alignment_max mod 2*sa_alignment_max. */ + return p; + } + } + /* Out of memory. */ + return NULL; +#else +# if !MALLOC_0_IS_NONNULL + if (n == 0) + n = 1; +# endif + return malloc (n); +#endif +} + +#if HAVE_ALLOCA +void +freea (void *p) +{ + /* Check argument. */ + if ((uintptr_t) p & (sa_alignment_max - 1)) + { + /* p was not the result of a malloca() call. Invalid argument. */ + abort (); + } + /* Determine whether p was a non-NULL pointer returned by mmalloca(). */ + if ((uintptr_t) p & sa_alignment_max) + { + void *mem = (char *) p - ((small_t *) p)[-1]; + free (mem); + } +} +#endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ diff --git a/gnulib-lib/malloca.h b/gnulib-lib/malloca.h new file mode 100644 index 0000000..6fa1d8b --- /dev/null +++ b/gnulib-lib/malloca.h @@ -0,0 +1,124 @@ +/* Safe automatic memory allocation. + Copyright (C) 2003-2007, 2009-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2003. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _MALLOCA_H +#define _MALLOCA_H + +#include +#include +#include +#include + +#include "xalloc-oversized.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* safe_alloca(N) is equivalent to alloca(N) when it is safe to call + alloca(N); otherwise it returns NULL. It either returns N bytes of + memory allocated on the stack, that lasts until the function returns, + or NULL. + Use of safe_alloca should be avoided: + - inside arguments of function calls - undefined behaviour, + - in inline functions - the allocation may actually last until the + calling function returns. +*/ +#if HAVE_ALLOCA +/* The OS usually guarantees only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + allocate anything larger than 4096 bytes. Also care for the possibility + of a few compiler-allocated temporary stack slots. + This must be a macro, not a function. */ +# define safe_alloca(N) ((N) < 4032 ? alloca (N) : NULL) +#else +# define safe_alloca(N) ((void) (N), NULL) +#endif + +/* malloca(N) is a safe variant of alloca(N). It allocates N bytes of + memory allocated on the stack, that must be freed using freea() before + the function returns. Upon failure, it returns NULL. */ +#if HAVE_ALLOCA +# define malloca(N) \ + ((N) < 4032 - (2 * sa_alignment_max - 1) \ + ? (void *) (((uintptr_t) (char *) alloca ((N) + 2 * sa_alignment_max - 1) \ + + (2 * sa_alignment_max - 1)) \ + & ~(uintptr_t)(2 * sa_alignment_max - 1)) \ + : mmalloca (N)) +#else +# define malloca(N) \ + mmalloca (N) +#endif +extern void * mmalloca (size_t n); + +/* Free a block of memory allocated through malloca(). */ +#if HAVE_ALLOCA +extern void freea (void *p); +#else +# define freea free +#endif + +/* nmalloca(N,S) is an overflow-safe variant of malloca (N * S). + It allocates an array of N objects, each with S bytes of memory, + on the stack. N and S should be nonnegative and free of side effects. + The array must be freed using freea() before the function returns. */ +#define nmalloca(n, s) \ + (xalloc_oversized (n, s) ? NULL : malloca ((n) * (size_t) (s))) + + +#ifdef __cplusplus +} +#endif + + +/* ------------------- Auxiliary, non-public definitions ------------------- */ + +/* Determine the alignment of a type at compile time. */ +#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ +# define sa_alignof __alignof__ +#elif defined __cplusplus + template struct sa_alignof_helper { char __slot1; type __slot2; }; +# define sa_alignof(type) offsetof (sa_alignof_helper, __slot2) +#elif defined __hpux + /* Work around a HP-UX 10.20 cc bug with enums constants defined as offsetof + values. */ +# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#elif defined _AIX + /* Work around an AIX 3.2.5 xlc bug with enums constants defined as offsetof + values. */ +# define sa_alignof(type) (sizeof (type) <= 4 ? 4 : 8) +#else +# define sa_alignof(type) offsetof (struct { char __slot1; type __slot2; }, __slot2) +#endif + +enum +{ +/* The desired alignment of memory allocations is the maximum alignment + among all elementary types. */ + sa_alignment_long = sa_alignof (long), + sa_alignment_double = sa_alignof (double), + sa_alignment_longlong = sa_alignof (long long), + sa_alignment_longdouble = sa_alignof (long double), + sa_alignment_max = ((sa_alignment_long - 1) | (sa_alignment_double - 1) + | (sa_alignment_longlong - 1) + | (sa_alignment_longdouble - 1) + ) + 1 +}; + +#endif /* _MALLOCA_H */ diff --git a/gnulib-lib/msvc-inval.c b/gnulib-lib/msvc-inval.c new file mode 100644 index 0000000..a23dac9 --- /dev/null +++ b/gnulib-lib/msvc-inval.c @@ -0,0 +1,129 @@ +/* Invalid parameter handler for MSVC runtime libraries. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include "msvc-inval.h" + +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ + && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING) + +/* Get _invalid_parameter_handler type and _set_invalid_parameter_handler + declaration. */ +# include + +# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING + +static void __cdecl +gl_msvc_invalid_parameter_handler (const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, + unsigned int line, + uintptr_t dummy) +{ +} + +# else + +/* Get declarations of the native Windows API functions. */ +# define WIN32_LEAN_AND_MEAN +# include + +# if defined _MSC_VER + +static void __cdecl +gl_msvc_invalid_parameter_handler (const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, + unsigned int line, + uintptr_t dummy) +{ + RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL); +} + +# else + +/* An index to thread-local storage. */ +static DWORD tls_index; +static int tls_initialized /* = 0 */; + +/* Used as a fallback only. */ +static struct gl_msvc_inval_per_thread not_per_thread; + +struct gl_msvc_inval_per_thread * +gl_msvc_inval_current (void) +{ + if (!tls_initialized) + { + tls_index = TlsAlloc (); + tls_initialized = 1; + } + if (tls_index == TLS_OUT_OF_INDEXES) + /* TlsAlloc had failed. */ + return ¬_per_thread; + else + { + struct gl_msvc_inval_per_thread *pointer = + (struct gl_msvc_inval_per_thread *) TlsGetValue (tls_index); + if (pointer == NULL) + { + /* First call. Allocate a new 'struct gl_msvc_inval_per_thread'. */ + pointer = + (struct gl_msvc_inval_per_thread *) + malloc (sizeof (struct gl_msvc_inval_per_thread)); + if (pointer == NULL) + /* Could not allocate memory. Use the global storage. */ + pointer = ¬_per_thread; + TlsSetValue (tls_index, pointer); + } + return pointer; + } +} + +static void __cdecl +gl_msvc_invalid_parameter_handler (const wchar_t *expression, + const wchar_t *function, + const wchar_t *file, + unsigned int line, + uintptr_t dummy) +{ + struct gl_msvc_inval_per_thread *current = gl_msvc_inval_current (); + if (current->restart_valid) + longjmp (current->restart, 1); + else + /* An invalid parameter notification from outside the gnulib code. + Give the caller a chance to intervene. */ + RaiseException (STATUS_GNULIB_INVALID_PARAMETER, 0, 0, NULL); +} + +# endif + +# endif + +static int gl_msvc_inval_initialized /* = 0 */; + +void +gl_msvc_inval_ensure_handler (void) +{ + if (gl_msvc_inval_initialized == 0) + { + _set_invalid_parameter_handler (gl_msvc_invalid_parameter_handler); + gl_msvc_inval_initialized = 1; + } +} + +#endif diff --git a/gnulib-lib/msvc-inval.h b/gnulib-lib/msvc-inval.h new file mode 100644 index 0000000..e115a35 --- /dev/null +++ b/gnulib-lib/msvc-inval.h @@ -0,0 +1,222 @@ +/* Invalid parameter handler for MSVC runtime libraries. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _MSVC_INVAL_H +#define _MSVC_INVAL_H + +/* With MSVC runtime libraries with the "invalid parameter handler" concept, + functions like fprintf(), dup2(), or close() crash when the caller passes + an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF) + instead. + This file defines macros that turn such an invalid parameter notification + into a non-local exit. An error code can then be produced at the target + of this exit. You can thus write code like + + TRY_MSVC_INVAL + { + + } + CATCH_MSVC_INVAL + { + + } + DONE_MSVC_INVAL; + + This entire block expands to a single statement. + + The handling of invalid parameters can be done in three ways: + + * The default way, which is reasonable for programs (not libraries): + AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [DEFAULT_HANDLING]) + + * The way for libraries that make "hairy" calls (like close(-1), or + fclose(fp) where fileno(fp) is closed, or simply getdtablesize()): + AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [HAIRY_LIBRARY_HANDLING]) + + * The way for libraries that make no "hairy" calls: + AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING]) + */ + +#define DEFAULT_HANDLING 0 +#define HAIRY_LIBRARY_HANDLING 1 +#define SANE_LIBRARY_HANDLING 2 + +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER \ + && !(MSVC_INVALID_PARAMETER_HANDLING == SANE_LIBRARY_HANDLING) +/* A native Windows platform with the "invalid parameter handler" concept, + and either DEFAULT_HANDLING or HAIRY_LIBRARY_HANDLING. */ + +# if MSVC_INVALID_PARAMETER_HANDLING == DEFAULT_HANDLING +/* Default handling. */ + +# ifdef __cplusplus +extern "C" { +# endif + +/* Ensure that the invalid parameter handler in installed that just returns. + Because we assume no other part of the program installs a different + invalid parameter handler, this solution is multithread-safe. */ +extern void gl_msvc_inval_ensure_handler (void); + +# ifdef __cplusplus +} +# endif + +# define TRY_MSVC_INVAL \ + do \ + { \ + gl_msvc_inval_ensure_handler (); \ + if (1) +# define CATCH_MSVC_INVAL \ + else +# define DONE_MSVC_INVAL \ + } \ + while (0) + +# else +/* Handling for hairy libraries. */ + +# include + +/* Gnulib can define its own status codes, as described in the page + "Raising Software Exceptions" on microsoft.com + . + Our status codes are composed of + - 0xE0000000, mandatory for all user-defined status codes, + - 0x474E550, a API identifier ("GNU"), + - 0, 1, 2, ..., used to distinguish different status codes from the + same API. */ +# define STATUS_GNULIB_INVALID_PARAMETER (0xE0000000 + 0x474E550 + 0) + +# if defined _MSC_VER +/* A compiler that supports __try/__except, as described in the page + "try-except statement" on microsoft.com + . + With __try/__except, we can use the multithread-safe exception handling. */ + +# ifdef __cplusplus +extern "C" { +# endif + +/* Ensure that the invalid parameter handler in installed that raises a + software exception with code STATUS_GNULIB_INVALID_PARAMETER. + Because we assume no other part of the program installs a different + invalid parameter handler, this solution is multithread-safe. */ +extern void gl_msvc_inval_ensure_handler (void); + +# ifdef __cplusplus +} +# endif + +# define TRY_MSVC_INVAL \ + do \ + { \ + gl_msvc_inval_ensure_handler (); \ + __try +# define CATCH_MSVC_INVAL \ + __except (GetExceptionCode () == STATUS_GNULIB_INVALID_PARAMETER \ + ? EXCEPTION_EXECUTE_HANDLER \ + : EXCEPTION_CONTINUE_SEARCH) +# define DONE_MSVC_INVAL \ + } \ + while (0) + +# else +/* Any compiler. + We can only use setjmp/longjmp. */ + +# include + +# ifdef __cplusplus +extern "C" { +# endif + +struct gl_msvc_inval_per_thread +{ + /* The restart that will resume execution at the code between + CATCH_MSVC_INVAL and DONE_MSVC_INVAL. It is enabled only between + TRY_MSVC_INVAL and CATCH_MSVC_INVAL. */ + jmp_buf restart; + + /* Tells whether the contents of restart is valid. */ + int restart_valid; +}; + +/* Ensure that the invalid parameter handler in installed that passes + control to the gl_msvc_inval_restart if it is valid, or raises a + software exception with code STATUS_GNULIB_INVALID_PARAMETER otherwise. + Because we assume no other part of the program installs a different + invalid parameter handler, this solution is multithread-safe. */ +extern void gl_msvc_inval_ensure_handler (void); + +/* Return a pointer to the per-thread data for the current thread. */ +extern struct gl_msvc_inval_per_thread *gl_msvc_inval_current (void); + +# ifdef __cplusplus +} +# endif + +# define TRY_MSVC_INVAL \ + do \ + { \ + struct gl_msvc_inval_per_thread *msvc_inval_current; \ + gl_msvc_inval_ensure_handler (); \ + msvc_inval_current = gl_msvc_inval_current (); \ + /* First, initialize gl_msvc_inval_restart. */ \ + if (setjmp (msvc_inval_current->restart) == 0) \ + { \ + /* Then, mark it as valid. */ \ + msvc_inval_current->restart_valid = 1; +# define CATCH_MSVC_INVAL \ + /* Execution completed. \ + Mark gl_msvc_inval_restart as invalid. */ \ + msvc_inval_current->restart_valid = 0; \ + } \ + else \ + { \ + /* Execution triggered an invalid parameter notification. \ + Mark gl_msvc_inval_restart as invalid. */ \ + msvc_inval_current->restart_valid = 0; +# define DONE_MSVC_INVAL \ + } \ + } \ + while (0) + +# endif + +# endif + +#else +/* A platform that does not need to the invalid parameter handler, + or when SANE_LIBRARY_HANDLING is desired. */ + +/* The braces here avoid GCC warnings like + "warning: suggest explicit braces to avoid ambiguous 'else'". */ +# define TRY_MSVC_INVAL \ + do \ + { \ + if (1) +# define CATCH_MSVC_INVAL \ + else +# define DONE_MSVC_INVAL \ + } \ + while (0) + +#endif + +#endif /* _MSVC_INVAL_H */ diff --git a/gnulib-lib/msvc-nothrow.c b/gnulib-lib/msvc-nothrow.c new file mode 100644 index 0000000..d3c1f54 --- /dev/null +++ b/gnulib-lib/msvc-nothrow.c @@ -0,0 +1,51 @@ +/* Wrappers that don't throw invalid parameter notifications + with MSVC runtime libraries. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include "msvc-nothrow.h" + +/* Get declarations of the native Windows API functions. */ +#define WIN32_LEAN_AND_MEAN +#include + +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +#endif + +#undef _get_osfhandle + +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +intptr_t +_gl_nothrow_get_osfhandle (int fd) +{ + intptr_t result; + + TRY_MSVC_INVAL + { + result = _get_osfhandle (fd); + } + CATCH_MSVC_INVAL + { + result = (intptr_t) INVALID_HANDLE_VALUE; + } + DONE_MSVC_INVAL; + + return result; +} +#endif diff --git a/gnulib-lib/msvc-nothrow.h b/gnulib-lib/msvc-nothrow.h new file mode 100644 index 0000000..057b5dd --- /dev/null +++ b/gnulib-lib/msvc-nothrow.h @@ -0,0 +1,43 @@ +/* Wrappers that don't throw invalid parameter notifications + with MSVC runtime libraries. + Copyright (C) 2011-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _MSVC_NOTHROW_H +#define _MSVC_NOTHROW_H + +/* With MSVC runtime libraries with the "invalid parameter handler" concept, + functions like fprintf(), dup2(), or close() crash when the caller passes + an invalid argument. But POSIX wants error codes (such as EINVAL or EBADF) + instead. + This file defines wrappers that turn such an invalid parameter notification + into an error code. */ + +#if defined _WIN32 && ! defined __CYGWIN__ + +/* Get original declaration of _get_osfhandle. */ +# include + +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER + +/* Override _get_osfhandle. */ +extern intptr_t _gl_nothrow_get_osfhandle (int fd); +# define _get_osfhandle _gl_nothrow_get_osfhandle + +# endif + +#endif + +#endif /* _MSVC_NOTHROW_H */ diff --git a/gnulib-lib/open.c b/gnulib-lib/open.c new file mode 100644 index 0000000..372cda8 --- /dev/null +++ b/gnulib-lib/open.c @@ -0,0 +1,209 @@ +/* Open a descriptor to a file. + Copyright (C) 2007-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2007. */ + +/* If the user's config.h happens to include , let it include only + the system's here, so that orig_open doesn't recurse to + rpl_open. */ +#define __need_system_fcntl_h +#include + +/* Get the original definition of open. It might be defined as a macro. */ +#include +#include +#undef __need_system_fcntl_h + +static int +orig_open (const char *filename, int flags, mode_t mode) +{ +#if defined _WIN32 && !defined __CYGWIN__ + return _open (filename, flags, mode); +#else + return open (filename, flags, mode); +#endif +} + +/* Specification. */ +/* Write "fcntl.h" here, not , otherwise OSF/1 5.1 DTK cc eliminates + this include because of the preliminary #include above. */ +#include "fcntl.h" + +#include "cloexec.h" + +#include +#include +#include +#include +#include +#include + +#ifndef REPLACE_OPEN_DIRECTORY +# define REPLACE_OPEN_DIRECTORY 0 +#endif + +int +open (const char *filename, int flags, ...) +{ + /* 0 = unknown, 1 = yes, -1 = no. */ +#if GNULIB_defined_O_CLOEXEC + int have_cloexec = -1; +#else + static int have_cloexec; +#endif + + mode_t mode; + int fd; + + mode = 0; + if (flags & O_CREAT) + { + va_list arg; + va_start (arg, flags); + + /* We have to use PROMOTED_MODE_T instead of mode_t, otherwise GCC 4 + creates crashing code when 'mode_t' is smaller than 'int'. */ + mode = va_arg (arg, PROMOTED_MODE_T); + + va_end (arg); + } + +#if GNULIB_defined_O_NONBLOCK + /* The only known platform that lacks O_NONBLOCK is mingw, but it + also lacks named pipes and Unix sockets, which are the only two + file types that require non-blocking handling in open(). + Therefore, it is safe to ignore O_NONBLOCK here. It is handy + that mingw also lacks openat(), so that is also covered here. */ + flags &= ~O_NONBLOCK; +#endif + +#if defined _WIN32 && ! defined __CYGWIN__ + if (strcmp (filename, "/dev/null") == 0) + filename = "NUL"; +#endif + +#if OPEN_TRAILING_SLASH_BUG + /* Fail if one of O_CREAT, O_WRONLY, O_RDWR is specified and the filename + ends in a slash, as POSIX says such a filename must name a directory + : + "A pathname that contains at least one non- character and that + ends with one or more trailing characters shall not be resolved + successfully unless the last pathname component before the trailing + characters names an existing directory" + If the named file already exists as a directory, then + - if O_CREAT is specified, open() must fail because of the semantics + of O_CREAT, + - if O_WRONLY or O_RDWR is specified, open() must fail because POSIX + + says that it fails with errno = EISDIR in this case. + If the named file does not exist or does not name a directory, then + - if O_CREAT is specified, open() must fail since open() cannot create + directories, + - if O_WRONLY or O_RDWR is specified, open() must fail because the + file does not contain a '.' directory. */ + if ((flags & O_CREAT) + || (flags & O_ACCMODE) == O_RDWR + || (flags & O_ACCMODE) == O_WRONLY) + { + size_t len = strlen (filename); + if (len > 0 && filename[len - 1] == '/') + { + errno = EISDIR; + return -1; + } + } +#endif + + fd = orig_open (filename, + flags & ~(have_cloexec < 0 ? O_CLOEXEC : 0), mode); + + if (flags & O_CLOEXEC) + { + if (! have_cloexec) + { + if (0 <= fd) + have_cloexec = 1; + else if (errno == EINVAL) + { + fd = orig_open (filename, flags & ~O_CLOEXEC, mode); + have_cloexec = -1; + } + } + if (have_cloexec < 0 && 0 <= fd) + set_cloexec_flag (fd, true); + } + + +#if REPLACE_FCHDIR + /* Implementing fchdir and fdopendir requires the ability to open a + directory file descriptor. If open doesn't support that (as on + mingw), we use a dummy file that behaves the same as directories + on Linux (ie. always reports EOF on attempts to read()), and + override fstat() in fchdir.c to hide the fact that we have a + dummy. */ + if (REPLACE_OPEN_DIRECTORY && fd < 0 && errno == EACCES + && ((flags & O_ACCMODE) == O_RDONLY + || (O_SEARCH != O_RDONLY && (flags & O_ACCMODE) == O_SEARCH))) + { + struct stat statbuf; + if (stat (filename, &statbuf) == 0 && S_ISDIR (statbuf.st_mode)) + { + /* Maximum recursion depth of 1. */ + fd = open ("/dev/null", flags, mode); + if (0 <= fd) + fd = _gl_register_fd (fd, filename); + } + else + errno = EACCES; + } +#endif + +#if OPEN_TRAILING_SLASH_BUG + /* If the filename ends in a slash and fd does not refer to a directory, + then fail. + Rationale: POSIX says such a filename must name a directory + : + "A pathname that contains at least one non- character and that + ends with one or more trailing characters shall not be resolved + successfully unless the last pathname component before the trailing + characters names an existing directory" + If the named file without the slash is not a directory, open() must fail + with ENOTDIR. */ + if (fd >= 0) + { + /* We know len is positive, since open did not fail with ENOENT. */ + size_t len = strlen (filename); + if (filename[len - 1] == '/') + { + struct stat statbuf; + + if (fstat (fd, &statbuf) >= 0 && !S_ISDIR (statbuf.st_mode)) + { + close (fd); + errno = ENOTDIR; + return -1; + } + } + } +#endif + +#if REPLACE_FCHDIR + if (!REPLACE_OPEN_DIRECTORY && 0 <= fd) + fd = _gl_register_fd (fd, filename); +#endif + + return fd; +} diff --git a/gnulib-lib/pathmax.h b/gnulib-lib/pathmax.h new file mode 100644 index 0000000..716f4a9 --- /dev/null +++ b/gnulib-lib/pathmax.h @@ -0,0 +1,83 @@ +/* Define PATH_MAX somehow. Requires sys/types.h. + Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2021 Free Software + Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _PATHMAX_H +# define _PATHMAX_H + +/* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename, + including the terminating NUL byte. + + PATH_MAX is not defined on systems which have no limit on filename length, + such as GNU/Hurd. + + This file does *not* define PATH_MAX always. Programs that use this file + can handle the GNU/Hurd case in several ways: + - Either with a package-wide handling, or with a per-file handling, + - Either through a + #ifdef PATH_MAX + or through a fallback like + #ifndef PATH_MAX + # define PATH_MAX 8192 + #endif + or through a fallback like + #ifndef PATH_MAX + # define PATH_MAX pathconf ("/", _PC_PATH_MAX) + #endif + */ + +# include + +# include + +# ifndef _POSIX_PATH_MAX +# define _POSIX_PATH_MAX 256 +# endif + +/* Don't include sys/param.h if it already has been. */ +# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include +# endif + +# if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +# endif + +# ifdef __hpux +/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename, + *not* including the terminating NUL byte, and is set to 1023. + Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is + not defined at all any more. */ +# undef PATH_MAX +# define PATH_MAX 1024 +# endif + +# if defined _WIN32 && ! defined __CYGWIN__ +/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com, + section "Maximum Path Length Limitation", + + explains that the maximum size of a filename, including the terminating + NUL byte, is 260 = 3 + 256 + 1. + This is the same value as + - FILENAME_MAX in , + - _MAX_PATH in , + - MAX_PATH in . + Undefine the original value, because mingw's gets it wrong. */ +# undef PATH_MAX +# define PATH_MAX 260 +# endif + +#endif /* _PATHMAX_H */ diff --git a/gnulib-lib/raise.c b/gnulib-lib/raise.c new file mode 100644 index 0000000..37c100d --- /dev/null +++ b/gnulib-lib/raise.c @@ -0,0 +1,83 @@ +/* Provide a non-threads replacement for the POSIX raise function. + + Copyright (C) 2002-2003, 2005-2006, 2009-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* written by Jim Meyering and Bruno Haible */ + +#include + +/* Specification. */ +#include + +#if HAVE_RAISE +/* Native Windows platform. */ + +# include + +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +# endif + +# if HAVE_MSVC_INVALID_PARAMETER_HANDLER +/* Forward declaration. */ +static int raise_nothrow (int sig); +# else +# define raise_nothrow raise +# endif + +#else +/* An old Unix platform. */ + +# include + +#endif + +int +raise (int sig) +#undef raise +{ +#if GNULIB_defined_signal_blocking && GNULIB_defined_SIGPIPE + if (sig == SIGPIPE) + return _gl_raise_SIGPIPE (); +#endif + +#if HAVE_RAISE + return raise_nothrow (sig); +#else + return kill (getpid (), sig); +#endif +} + +#if HAVE_RAISE && HAVE_MSVC_INVALID_PARAMETER_HANDLER +static int +raise_nothrow (int sig) +{ + int result; + + TRY_MSVC_INVAL + { + result = raise (sig); + } + CATCH_MSVC_INVAL + { + result = -1; + errno = EINVAL; + } + DONE_MSVC_INVAL; + + return result; +} +#endif diff --git a/gnulib-lib/rmdir.c b/gnulib-lib/rmdir.c new file mode 100644 index 0000000..6295e41 --- /dev/null +++ b/gnulib-lib/rmdir.c @@ -0,0 +1,56 @@ +/* Work around rmdir bugs. + + Copyright (C) 1988, 1990, 1999, 2003-2006, 2009-2021 Free Software + Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +#include + +#include +#include + +#include "filename.h" + +#undef rmdir +#if defined _WIN32 && !defined __CYGWIN__ +# define rmdir _rmdir +#endif + +/* Remove directory DIR. + Return 0 if successful, -1 if not. */ + +int +rpl_rmdir (char const *dir) +{ + /* Work around cygwin 1.5.x bug where rmdir("dir/./") succeeds. */ + size_t len = strlen (dir); + int result; + while (len && ISSLASH (dir[len - 1])) + len--; + if (len && dir[len - 1] == '.' && (1 == len || ISSLASH (dir[len - 2]))) + { + errno = EINVAL; + return -1; + } + result = rmdir (dir); + /* Work around mingw bug, where rmdir("file/") fails with EINVAL + instead of ENOTDIR. We've already filtered out trailing ., the + only reason allowed by POSIX for EINVAL. */ + if (result == -1 && errno == EINVAL) + errno = ENOTDIR; + return result; +} diff --git a/gnulib-lib/sig-handler.c b/gnulib-lib/sig-handler.c new file mode 100644 index 0000000..6257914 --- /dev/null +++ b/gnulib-lib/sig-handler.c @@ -0,0 +1,21 @@ +/* Convenience declarations when working with . + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +#define SIG_HANDLER_INLINE _GL_EXTERN_INLINE +#include "sig-handler.h" diff --git a/gnulib-lib/sig-handler.h b/gnulib-lib/sig-handler.h new file mode 100644 index 0000000..0ce5897 --- /dev/null +++ b/gnulib-lib/sig-handler.h @@ -0,0 +1,51 @@ +/* Convenience declarations when working with . + + Copyright (C) 2008-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _GL_SIG_HANDLER_H +#define _GL_SIG_HANDLER_H + +#include + +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif +_GL_INLINE_HEADER_BEGIN +#ifndef SIG_HANDLER_INLINE +# define SIG_HANDLER_INLINE _GL_INLINE +#endif + +/* Convenience type when working with signal handlers. */ +typedef void (*sa_handler_t) (int); + +/* Return the handler of a signal, as a sa_handler_t value regardless + of its true type. The resulting function can be compared to + special values like SIG_IGN but it is not portable to call it. */ +SIG_HANDLER_INLINE sa_handler_t _GL_ATTRIBUTE_PURE +get_handler (struct sigaction const *a) +{ + /* POSIX says that special values like SIG_IGN can only occur when + action.sa_flags does not contain SA_SIGINFO. But in Linux 2.4, + for example, sa_sigaction and sa_handler are aliases and a signal + is ignored if sa_sigaction (after casting) equals SIG_IGN. In + this case, this implementation relies on the fact that the two + are aliases, and simply returns sa_handler. */ + return a->sa_handler; +} + +_GL_INLINE_HEADER_END + +#endif /* _GL_SIG_HANDLER_H */ diff --git a/gnulib-lib/sigaction.c b/gnulib-lib/sigaction.c new file mode 100644 index 0000000..e1ace46 --- /dev/null +++ b/gnulib-lib/sigaction.c @@ -0,0 +1,204 @@ +/* POSIX compatible signal blocking. + Copyright (C) 2008-2021 Free Software Foundation, Inc. + Written by Eric Blake , 2008. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include + +#include +#include +#include + +/* This implementation of sigaction is tailored to native Windows behavior: + signal() has SysV semantics (ie. the handler is uninstalled before + it is invoked). This is an inherent data race if an asynchronous + signal is sent twice in a row before we can reinstall our handler, + but there's nothing we can do about it. Meanwhile, sigprocmask() + is not present, and while we can use the gnulib replacement to + provide critical sections, it too suffers from potential data races + in the face of an ill-timed asynchronous signal. And we compound + the situation by reading static storage in a signal handler, which + POSIX warns is not generically async-signal-safe. Oh well. + + Additionally: + - We don't implement SA_NOCLDSTOP or SA_NOCLDWAIT, because SIGCHLD + is not defined. + - We don't implement SA_ONSTACK, because sigaltstack() is not present. + - We ignore SA_RESTART, because blocking native Windows API calls are + not interrupted anyway when an asynchronous signal occurs, and the + MSVCRT runtime never sets errno to EINTR. + - We don't implement SA_SIGINFO because it is impossible to do so + portably. + + POSIX states that an application should not mix signal() and + sigaction(). We support the use of signal() within the gnulib + sigprocmask() substitute, but all other application code linked + with this module should stick with only sigaction(). */ + +/* Check some of our assumptions. */ +#if defined SIGCHLD || defined HAVE_SIGALTSTACK || defined HAVE_SIGINTERRUPT +# error "Revisit the assumptions made in the sigaction module" +#endif + +/* Out-of-range substitutes make a good fallback for uncatchable + signals. */ +#ifndef SIGKILL +# define SIGKILL (-1) +#endif +#ifndef SIGSTOP +# define SIGSTOP (-1) +#endif + +/* On native Windows, as of 2008, the signal SIGABRT_COMPAT is an alias + for the signal SIGABRT. Only one signal handler is stored for both + SIGABRT and SIGABRT_COMPAT. SIGABRT_COMPAT is not a signal of its own. */ +#if defined _WIN32 && ! defined __CYGWIN__ +# undef SIGABRT_COMPAT +# define SIGABRT_COMPAT 6 +#endif + +/* A signal handler. */ +typedef void (*handler_t) (int signal); + +/* Set of current actions. If sa_handler for an entry is NULL, then + that signal is not currently handled by the sigaction handler. */ +static struct sigaction volatile action_array[NSIG] /* = 0 */; + +/* Signal handler that is installed for signals. */ +static void +sigaction_handler (int sig) +{ + handler_t handler; + sigset_t mask; + sigset_t oldmask; + int saved_errno = errno; + if (sig < 0 || NSIG <= sig || !action_array[sig].sa_handler) + { + /* Unexpected situation; be careful to avoid recursive abort. */ + if (sig == SIGABRT) + signal (SIGABRT, SIG_DFL); + abort (); + } + + /* Reinstall the signal handler when required; otherwise update the + bookkeeping so that the user's handler may call sigaction and get + accurate results. We know the signal isn't currently blocked, or + we wouldn't be in its handler, therefore we know that we are not + interrupting a sigaction() call. There is a race where any + asynchronous instance of the same signal occurring before we + reinstall the handler will trigger the default handler; oh + well. */ + handler = action_array[sig].sa_handler; + if ((action_array[sig].sa_flags & SA_RESETHAND) == 0) + signal (sig, sigaction_handler); + else + action_array[sig].sa_handler = NULL; + + /* Block appropriate signals. */ + mask = action_array[sig].sa_mask; + if ((action_array[sig].sa_flags & SA_NODEFER) == 0) + sigaddset (&mask, sig); + sigprocmask (SIG_BLOCK, &mask, &oldmask); + + /* Invoke the user's handler, then restore prior mask. */ + errno = saved_errno; + handler (sig); + saved_errno = errno; + sigprocmask (SIG_SETMASK, &oldmask, NULL); + errno = saved_errno; +} + +/* Change and/or query the action that will be taken on delivery of + signal SIG. If not NULL, ACT describes the new behavior. If not + NULL, OACT is set to the prior behavior. Return 0 on success, or + set errno and return -1 on failure. */ +int +sigaction (int sig, const struct sigaction *restrict act, + struct sigaction *restrict oact) +{ + sigset_t mask; + sigset_t oldmask; + int saved_errno; + + if (sig < 0 || NSIG <= sig || sig == SIGKILL || sig == SIGSTOP + || (act && act->sa_handler == SIG_ERR)) + { + errno = EINVAL; + return -1; + } + +#ifdef SIGABRT_COMPAT + if (sig == SIGABRT_COMPAT) + sig = SIGABRT; +#endif + + /* POSIX requires sigaction() to be async-signal-safe. In other + words, if an asynchronous signal can occur while we are anywhere + inside this function, the user's handler could then call + sigaction() recursively and expect consistent results. We meet + this rule by using sigprocmask to block all signals before + modifying any data structure that could be read from a signal + handler; this works since we know that the gnulib sigprocmask + replacement does not try to use sigaction() from its handler. */ + if (!act && !oact) + return 0; + sigfillset (&mask); + sigprocmask (SIG_BLOCK, &mask, &oldmask); + if (oact) + { + if (action_array[sig].sa_handler) + *oact = action_array[sig]; + else + { + /* Safe to change the handler at will here, since all + signals are currently blocked. */ + oact->sa_handler = signal (sig, SIG_DFL); + if (oact->sa_handler == SIG_ERR) + goto failure; + signal (sig, oact->sa_handler); + oact->sa_flags = SA_RESETHAND | SA_NODEFER; + sigemptyset (&oact->sa_mask); + } + } + + if (act) + { + /* Safe to install the handler before updating action_array, + since all signals are currently blocked. */ + if (act->sa_handler == SIG_DFL || act->sa_handler == SIG_IGN) + { + if (signal (sig, act->sa_handler) == SIG_ERR) + goto failure; + action_array[sig].sa_handler = NULL; + } + else + { + if (signal (sig, sigaction_handler) == SIG_ERR) + goto failure; + action_array[sig] = *act; + } + } + sigprocmask (SIG_SETMASK, &oldmask, NULL); + return 0; + + failure: + saved_errno = errno; + sigprocmask (SIG_SETMASK, &oldmask, NULL); + errno = saved_errno; + return -1; +} diff --git a/gnulib-lib/signal.in.h b/gnulib-lib/signal.in.h new file mode 100644 index 0000000..275da8c --- /dev/null +++ b/gnulib-lib/signal.in.h @@ -0,0 +1,487 @@ +/* A GNU-like . + + Copyright (C) 2006-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_sig_atomic_t || defined __need_sigset_t || defined _GL_ALREADY_INCLUDING_SIGNAL_H || (defined _SIGNAL_H && !defined __SIZEOF_PTHREAD_MUTEX_T) +/* Special invocation convention: + - Inside glibc header files. + - On glibc systems we have a sequence of nested includes + -> -> . + In this situation, the functions are not yet declared, therefore we cannot + provide the C++ aliases. + - On glibc systems with GCC 4.3 we have a sequence of nested includes + -> -> -> . + In this situation, some of the functions are not yet declared, therefore + we cannot provide the C++ aliases. */ + +# @INCLUDE_NEXT@ @NEXT_SIGNAL_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_SIGNAL_H + +#define _GL_ALREADY_INCLUDING_SIGNAL_H + +/* Define pid_t, uid_t. + Also, mingw defines sigset_t not in , but in . + On Solaris 10, includes , which eventually includes + us; so include now, before the second inclusion guard. */ +#include + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_SIGNAL_H@ + +#undef _GL_ALREADY_INCLUDING_SIGNAL_H + +#ifndef _@GUARD_PREFIX@_SIGNAL_H +#define _@GUARD_PREFIX@_SIGNAL_H + +/* Mac OS X 10.3, FreeBSD 6.4, OpenBSD 3.8, OSF/1 4.0, Solaris 2.6, Android, + OS/2 kLIBC declare pthread_sigmask in , not in . + But avoid namespace pollution on glibc systems.*/ +#if (@GNULIB_PTHREAD_SIGMASK@ || defined GNULIB_POSIXCHECK) \ + && ((defined __APPLE__ && defined __MACH__) \ + || defined __FreeBSD__ || defined __OpenBSD__ || defined __osf__ \ + || defined __sun || defined __ANDROID__ || defined __KLIBC__) \ + && ! defined __GLIBC__ +# include +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* On AIX, sig_atomic_t already includes volatile. C99 requires that + 'volatile sig_atomic_t' ignore the extra modifier, but C89 did not. + Hence, redefine this to a non-volatile type as needed. */ +#if ! @HAVE_TYPE_VOLATILE_SIG_ATOMIC_T@ +# if !GNULIB_defined_sig_atomic_t +typedef int rpl_sig_atomic_t; +# undef sig_atomic_t +# define sig_atomic_t rpl_sig_atomic_t +# define GNULIB_defined_sig_atomic_t 1 +# endif +#endif + +/* A set or mask of signals. */ +#if !@HAVE_SIGSET_T@ +# if !GNULIB_defined_sigset_t +typedef unsigned int sigset_t; +# define GNULIB_defined_sigset_t 1 +# endif +#endif + +/* Define sighandler_t, the type of signal handlers. A GNU extension. */ +#if !@HAVE_SIGHANDLER_T@ +# ifdef __cplusplus +extern "C" { +# endif +# if !GNULIB_defined_sighandler_t +typedef void (*sighandler_t) (int); +# define GNULIB_defined_sighandler_t 1 +# endif +# ifdef __cplusplus +} +# endif +#endif + + +#if @GNULIB_SIGNAL_H_SIGPIPE@ +# ifndef SIGPIPE +/* Define SIGPIPE to a value that does not overlap with other signals. */ +# define SIGPIPE 13 +# define GNULIB_defined_SIGPIPE 1 +/* To actually use SIGPIPE, you also need the gnulib modules 'sigprocmask', + 'write', 'stdio'. */ +# endif +#endif + + +/* Maximum signal number + 1. */ +#ifndef NSIG +# if defined __TANDEM +# define NSIG 32 +# endif +#endif + + +#if @GNULIB_PTHREAD_SIGMASK@ +# if @REPLACE_PTHREAD_SIGMASK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pthread_sigmask +# define pthread_sigmask rpl_pthread_sigmask +# endif +_GL_FUNCDECL_RPL (pthread_sigmask, int, + (int how, + const sigset_t *restrict new_mask, + sigset_t *restrict old_mask)); +_GL_CXXALIAS_RPL (pthread_sigmask, int, + (int how, + const sigset_t *restrict new_mask, + sigset_t *restrict old_mask)); +# else +# if !(@HAVE_PTHREAD_SIGMASK@ || defined pthread_sigmask) +_GL_FUNCDECL_SYS (pthread_sigmask, int, + (int how, + const sigset_t *restrict new_mask, + sigset_t *restrict old_mask)); +# endif +_GL_CXXALIAS_SYS (pthread_sigmask, int, + (int how, + const sigset_t *restrict new_mask, + sigset_t *restrict old_mask)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (pthread_sigmask); +# endif +#elif defined GNULIB_POSIXCHECK +# undef pthread_sigmask +# if HAVE_RAW_DECL_PTHREAD_SIGMASK +_GL_WARN_ON_USE (pthread_sigmask, "pthread_sigmask is not portable - " + "use gnulib module pthread_sigmask for portability"); +# endif +#endif + + +#if @GNULIB_RAISE@ +# if @REPLACE_RAISE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef raise +# define raise rpl_raise +# endif +_GL_FUNCDECL_RPL (raise, int, (int sig)); +_GL_CXXALIAS_RPL (raise, int, (int sig)); +# else +# if !@HAVE_RAISE@ +_GL_FUNCDECL_SYS (raise, int, (int sig)); +# endif +_GL_CXXALIAS_SYS (raise, int, (int sig)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (raise); +# endif +#elif defined GNULIB_POSIXCHECK +# undef raise +/* Assume raise is always declared. */ +_GL_WARN_ON_USE (raise, "raise can crash on native Windows - " + "use gnulib module raise for portability"); +#endif + + +#if @GNULIB_SIGPROCMASK@ +# if !@HAVE_POSIX_SIGNALBLOCKING@ + +# ifndef GNULIB_defined_signal_blocking +# define GNULIB_defined_signal_blocking 1 +# endif + +/* Maximum signal number + 1. */ +# ifndef NSIG +# define NSIG 32 +# endif + +/* This code supports only 32 signals. */ +# if !GNULIB_defined_verify_NSIG_constraint +typedef int verify_NSIG_constraint[NSIG <= 32 ? 1 : -1]; +# define GNULIB_defined_verify_NSIG_constraint 1 +# endif + +# endif + +/* When also using extern inline, suppress the use of static inline in + standard headers of problematic Apple configurations, as Libc at + least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., + . + Perhaps Apple will fix this some day. */ +#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ + && (defined __i386__ || defined __x86_64__)) +# undef sigaddset +# undef sigdelset +# undef sigemptyset +# undef sigfillset +# undef sigismember +#endif + +/* Test whether a given signal is contained in a signal set. */ +# if @HAVE_POSIX_SIGNALBLOCKING@ +/* This function is defined as a macro on Mac OS X. */ +# if defined __cplusplus && defined GNULIB_NAMESPACE +# undef sigismember +# endif +# else +_GL_FUNCDECL_SYS (sigismember, int, (const sigset_t *set, int sig) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (sigismember, int, (const sigset_t *set, int sig)); +_GL_CXXALIASWARN (sigismember); + +/* Initialize a signal set to the empty set. */ +# if @HAVE_POSIX_SIGNALBLOCKING@ +/* This function is defined as a macro on Mac OS X. */ +# if defined __cplusplus && defined GNULIB_NAMESPACE +# undef sigemptyset +# endif +# else +_GL_FUNCDECL_SYS (sigemptyset, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (sigemptyset, int, (sigset_t *set)); +_GL_CXXALIASWARN (sigemptyset); + +/* Add a signal to a signal set. */ +# if @HAVE_POSIX_SIGNALBLOCKING@ +/* This function is defined as a macro on Mac OS X. */ +# if defined __cplusplus && defined GNULIB_NAMESPACE +# undef sigaddset +# endif +# else +_GL_FUNCDECL_SYS (sigaddset, int, (sigset_t *set, int sig) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (sigaddset, int, (sigset_t *set, int sig)); +_GL_CXXALIASWARN (sigaddset); + +/* Remove a signal from a signal set. */ +# if @HAVE_POSIX_SIGNALBLOCKING@ +/* This function is defined as a macro on Mac OS X. */ +# if defined __cplusplus && defined GNULIB_NAMESPACE +# undef sigdelset +# endif +# else +_GL_FUNCDECL_SYS (sigdelset, int, (sigset_t *set, int sig) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (sigdelset, int, (sigset_t *set, int sig)); +_GL_CXXALIASWARN (sigdelset); + +/* Fill a signal set with all possible signals. */ +# if @HAVE_POSIX_SIGNALBLOCKING@ +/* This function is defined as a macro on Mac OS X. */ +# if defined __cplusplus && defined GNULIB_NAMESPACE +# undef sigfillset +# endif +# else +_GL_FUNCDECL_SYS (sigfillset, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (sigfillset, int, (sigset_t *set)); +_GL_CXXALIASWARN (sigfillset); + +/* Return the set of those blocked signals that are pending. */ +# if !@HAVE_POSIX_SIGNALBLOCKING@ +_GL_FUNCDECL_SYS (sigpending, int, (sigset_t *set) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (sigpending, int, (sigset_t *set)); +_GL_CXXALIASWARN (sigpending); + +/* If OLD_SET is not NULL, put the current set of blocked signals in *OLD_SET. + Then, if SET is not NULL, affect the current set of blocked signals by + combining it with *SET as indicated in OPERATION. + In this implementation, you are not allowed to change a signal handler + while the signal is blocked. */ +# if !@HAVE_POSIX_SIGNALBLOCKING@ +# define SIG_BLOCK 0 /* blocked_set = blocked_set | *set; */ +# define SIG_SETMASK 1 /* blocked_set = *set; */ +# define SIG_UNBLOCK 2 /* blocked_set = blocked_set & ~*set; */ +_GL_FUNCDECL_SYS (sigprocmask, int, + (int operation, + const sigset_t *restrict set, + sigset_t *restrict old_set)); +# endif +_GL_CXXALIAS_SYS (sigprocmask, int, + (int operation, + const sigset_t *restrict set, + sigset_t *restrict old_set)); +_GL_CXXALIASWARN (sigprocmask); + +/* Install the handler FUNC for signal SIG, and return the previous + handler. */ +# ifdef __cplusplus +extern "C" { +# endif +# if !GNULIB_defined_function_taking_int_returning_void_t +typedef void (*_gl_function_taking_int_returning_void_t) (int); +# define GNULIB_defined_function_taking_int_returning_void_t 1 +# endif +# ifdef __cplusplus +} +# endif +# if !@HAVE_POSIX_SIGNALBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define signal rpl_signal +# endif +_GL_FUNCDECL_RPL (signal, _gl_function_taking_int_returning_void_t, + (int sig, _gl_function_taking_int_returning_void_t func)); +_GL_CXXALIAS_RPL (signal, _gl_function_taking_int_returning_void_t, + (int sig, _gl_function_taking_int_returning_void_t func)); +# else +/* On OpenBSD, the declaration of 'signal' may not be present at this point, + because it occurs in , not directly. */ +# if defined __OpenBSD__ +_GL_FUNCDECL_SYS (signal, _gl_function_taking_int_returning_void_t, + (int sig, _gl_function_taking_int_returning_void_t func)); +# endif +_GL_CXXALIAS_SYS (signal, _gl_function_taking_int_returning_void_t, + (int sig, _gl_function_taking_int_returning_void_t func)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (signal); +# endif + +# if !@HAVE_POSIX_SIGNALBLOCKING@ && GNULIB_defined_SIGPIPE +/* Raise signal SIGPIPE. */ +_GL_EXTERN_C int _gl_raise_SIGPIPE (void); +# endif + +#elif defined GNULIB_POSIXCHECK +# undef sigaddset +# if HAVE_RAW_DECL_SIGADDSET +_GL_WARN_ON_USE (sigaddset, "sigaddset is unportable - " + "use the gnulib module sigprocmask for portability"); +# endif +# undef sigdelset +# if HAVE_RAW_DECL_SIGDELSET +_GL_WARN_ON_USE (sigdelset, "sigdelset is unportable - " + "use the gnulib module sigprocmask for portability"); +# endif +# undef sigemptyset +# if HAVE_RAW_DECL_SIGEMPTYSET +_GL_WARN_ON_USE (sigemptyset, "sigemptyset is unportable - " + "use the gnulib module sigprocmask for portability"); +# endif +# undef sigfillset +# if HAVE_RAW_DECL_SIGFILLSET +_GL_WARN_ON_USE (sigfillset, "sigfillset is unportable - " + "use the gnulib module sigprocmask for portability"); +# endif +# undef sigismember +# if HAVE_RAW_DECL_SIGISMEMBER +_GL_WARN_ON_USE (sigismember, "sigismember is unportable - " + "use the gnulib module sigprocmask for portability"); +# endif +# undef sigpending +# if HAVE_RAW_DECL_SIGPENDING +_GL_WARN_ON_USE (sigpending, "sigpending is unportable - " + "use the gnulib module sigprocmask for portability"); +# endif +# undef sigprocmask +# if HAVE_RAW_DECL_SIGPROCMASK +_GL_WARN_ON_USE (sigprocmask, "sigprocmask is unportable - " + "use the gnulib module sigprocmask for portability"); +# endif +#endif /* @GNULIB_SIGPROCMASK@ */ + + +#if @GNULIB_SIGACTION@ +# if !@HAVE_SIGACTION@ + +# if !@HAVE_SIGINFO_T@ + +# if !GNULIB_defined_siginfo_types + +/* Present to allow compilation, but unsupported by gnulib. */ +union sigval +{ + int sival_int; + void *sival_ptr; +}; + +/* Present to allow compilation, but unsupported by gnulib. */ +struct siginfo_t +{ + int si_signo; + int si_code; + int si_errno; + pid_t si_pid; + uid_t si_uid; + void *si_addr; + int si_status; + long si_band; + union sigval si_value; +}; +typedef struct siginfo_t siginfo_t; + +# define GNULIB_defined_siginfo_types 1 +# endif + +# endif /* !@HAVE_SIGINFO_T@ */ + +/* We assume that platforms which lack the sigaction() function also lack + the 'struct sigaction' type, and vice versa. */ + +# if !GNULIB_defined_struct_sigaction + +struct sigaction +{ + union + { + void (*_sa_handler) (int); + /* Present to allow compilation, but unsupported by gnulib. POSIX + says that implementations may, but not must, make sa_sigaction + overlap with sa_handler, but we know of no implementation where + they do not overlap. */ + void (*_sa_sigaction) (int, siginfo_t *, void *); + } _sa_func; + sigset_t sa_mask; + /* Not all POSIX flags are supported. */ + int sa_flags; +}; +# define sa_handler _sa_func._sa_handler +# define sa_sigaction _sa_func._sa_sigaction +/* Unsupported flags are not present. */ +# define SA_RESETHAND 1 +# define SA_NODEFER 2 +# define SA_RESTART 4 + +# define GNULIB_defined_struct_sigaction 1 +# endif + +_GL_FUNCDECL_SYS (sigaction, int, (int, const struct sigaction *restrict, + struct sigaction *restrict)); + +# elif !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ + +# define sa_sigaction sa_handler + +# endif /* !@HAVE_SIGACTION@, !@HAVE_STRUCT_SIGACTION_SA_SIGACTION@ */ + +_GL_CXXALIAS_SYS (sigaction, int, (int, const struct sigaction *restrict, + struct sigaction *restrict)); +_GL_CXXALIASWARN (sigaction); + +#elif defined GNULIB_POSIXCHECK +# undef sigaction +# if HAVE_RAW_DECL_SIGACTION +_GL_WARN_ON_USE (sigaction, "sigaction is unportable - " + "use the gnulib module sigaction for portability"); +# endif +#endif + +/* Some systems don't have SA_NODEFER. */ +#ifndef SA_NODEFER +# define SA_NODEFER 0 +#endif + + +#endif /* _@GUARD_PREFIX@_SIGNAL_H */ +#endif /* _@GUARD_PREFIX@_SIGNAL_H */ +#endif diff --git a/gnulib-lib/sigprocmask.c b/gnulib-lib/sigprocmask.c new file mode 100644 index 0000000..c479204 --- /dev/null +++ b/gnulib-lib/sigprocmask.c @@ -0,0 +1,349 @@ +/* POSIX compatible signal blocking. + Copyright (C) 2006-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2006. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include + +#include +#include +#include + +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +# include "msvc-inval.h" +#endif + +/* We assume that a platform without POSIX signal blocking functions + also does not have the POSIX sigaction() function, only the + signal() function. We also assume signal() has SysV semantics, + where any handler is uninstalled prior to being invoked. This is + true for native Windows platforms. */ + +/* We use raw signal(), but also provide a wrapper rpl_signal() so + that applications can query or change a blocked signal. */ +#undef signal + +/* Provide invalid signal numbers as fallbacks if the uncatchable + signals are not defined. */ +#ifndef SIGKILL +# define SIGKILL (-1) +#endif +#ifndef SIGSTOP +# define SIGSTOP (-1) +#endif + +/* On native Windows, as of 2008, the signal SIGABRT_COMPAT is an alias + for the signal SIGABRT. Only one signal handler is stored for both + SIGABRT and SIGABRT_COMPAT. SIGABRT_COMPAT is not a signal of its own. */ +#if defined _WIN32 && ! defined __CYGWIN__ +# undef SIGABRT_COMPAT +# define SIGABRT_COMPAT 6 +#endif +#ifdef SIGABRT_COMPAT +# define SIGABRT_COMPAT_MASK (1U << SIGABRT_COMPAT) +#else +# define SIGABRT_COMPAT_MASK 0 +#endif + +typedef void (*handler_t) (int); + +#if HAVE_MSVC_INVALID_PARAMETER_HANDLER +static handler_t +signal_nothrow (int sig, handler_t handler) +{ + handler_t result; + + TRY_MSVC_INVAL + { + result = signal (sig, handler); + } + CATCH_MSVC_INVAL + { + result = SIG_ERR; + errno = EINVAL; + } + DONE_MSVC_INVAL; + + return result; +} +# define signal signal_nothrow +#endif + +/* Handling of gnulib defined signals. */ + +#if GNULIB_defined_SIGPIPE +static handler_t SIGPIPE_handler = SIG_DFL; +#endif + +#if GNULIB_defined_SIGPIPE +static handler_t +ext_signal (int sig, handler_t handler) +{ + switch (sig) + { + case SIGPIPE: + { + handler_t old_handler = SIGPIPE_handler; + SIGPIPE_handler = handler; + return old_handler; + } + default: /* System defined signal */ + return signal (sig, handler); + } +} +# undef signal +# define signal ext_signal +#endif + +int +sigismember (const sigset_t *set, int sig) +{ + if (sig >= 0 && sig < NSIG) + { + #ifdef SIGABRT_COMPAT + if (sig == SIGABRT_COMPAT) + sig = SIGABRT; + #endif + + return (*set >> sig) & 1; + } + else + return 0; +} + +int +sigemptyset (sigset_t *set) +{ + *set = 0; + return 0; +} + +int +sigaddset (sigset_t *set, int sig) +{ + if (sig >= 0 && sig < NSIG) + { + #ifdef SIGABRT_COMPAT + if (sig == SIGABRT_COMPAT) + sig = SIGABRT; + #endif + + *set |= 1U << sig; + return 0; + } + else + { + errno = EINVAL; + return -1; + } +} + +int +sigdelset (sigset_t *set, int sig) +{ + if (sig >= 0 && sig < NSIG) + { + #ifdef SIGABRT_COMPAT + if (sig == SIGABRT_COMPAT) + sig = SIGABRT; + #endif + + *set &= ~(1U << sig); + return 0; + } + else + { + errno = EINVAL; + return -1; + } +} + + +int +sigfillset (sigset_t *set) +{ + *set = ((2U << (NSIG - 1)) - 1) & ~ SIGABRT_COMPAT_MASK; + return 0; +} + +/* Set of currently blocked signals. */ +static volatile sigset_t blocked_set /* = 0 */; + +/* Set of currently blocked and pending signals. */ +static volatile sig_atomic_t pending_array[NSIG] /* = { 0 } */; + +/* Signal handler that is installed for blocked signals. */ +static void +blocked_handler (int sig) +{ + /* Reinstall the handler, in case the signal occurs multiple times + while blocked. There is an inherent race where an asynchronous + signal in between when the kernel uninstalled the handler and + when we reinstall it will trigger the default handler; oh + well. */ + signal (sig, blocked_handler); + if (sig >= 0 && sig < NSIG) + pending_array[sig] = 1; +} + +int +sigpending (sigset_t *set) +{ + sigset_t pending = 0; + int sig; + + for (sig = 0; sig < NSIG; sig++) + if (pending_array[sig]) + pending |= 1U << sig; + *set = pending; + return 0; +} + +/* The previous signal handlers. + Only the array elements corresponding to blocked signals are relevant. */ +static volatile handler_t old_handlers[NSIG]; + +int +sigprocmask (int operation, const sigset_t *set, sigset_t *old_set) +{ + if (old_set != NULL) + *old_set = blocked_set; + + if (set != NULL) + { + sigset_t new_blocked_set; + sigset_t to_unblock; + sigset_t to_block; + + switch (operation) + { + case SIG_BLOCK: + new_blocked_set = blocked_set | *set; + break; + case SIG_SETMASK: + new_blocked_set = *set; + break; + case SIG_UNBLOCK: + new_blocked_set = blocked_set & ~*set; + break; + default: + errno = EINVAL; + return -1; + } + to_unblock = blocked_set & ~new_blocked_set; + to_block = new_blocked_set & ~blocked_set; + + if (to_block != 0) + { + int sig; + + for (sig = 0; sig < NSIG; sig++) + if ((to_block >> sig) & 1) + { + pending_array[sig] = 0; + if ((old_handlers[sig] = signal (sig, blocked_handler)) != SIG_ERR) + blocked_set |= 1U << sig; + } + } + + if (to_unblock != 0) + { + sig_atomic_t received[NSIG]; + int sig; + + for (sig = 0; sig < NSIG; sig++) + if ((to_unblock >> sig) & 1) + { + if (signal (sig, old_handlers[sig]) != blocked_handler) + /* The application changed a signal handler while the signal + was blocked, bypassing our rpl_signal replacement. + We don't support this. */ + abort (); + received[sig] = pending_array[sig]; + blocked_set &= ~(1U << sig); + pending_array[sig] = 0; + } + else + received[sig] = 0; + + for (sig = 0; sig < NSIG; sig++) + if (received[sig]) + raise (sig); + } + } + return 0; +} + +/* Install the handler FUNC for signal SIG, and return the previous + handler. */ +handler_t +rpl_signal (int sig, handler_t handler) +{ + /* We must provide a wrapper, so that a user can query what handler + they installed even if that signal is currently blocked. */ + if (sig >= 0 && sig < NSIG && sig != SIGKILL && sig != SIGSTOP + && handler != SIG_ERR) + { + #ifdef SIGABRT_COMPAT + if (sig == SIGABRT_COMPAT) + sig = SIGABRT; + #endif + + if (blocked_set & (1U << sig)) + { + /* POSIX states that sigprocmask and signal are both + async-signal-safe. This is not true of our + implementation - there is a slight data race where an + asynchronous interrupt on signal A can occur after we + install blocked_handler but before we have updated + old_handlers for signal B, such that handler A can see + stale information if it calls signal(B). Oh well - + signal handlers really shouldn't try to manipulate the + installed handlers of unrelated signals. */ + handler_t result = old_handlers[sig]; + old_handlers[sig] = handler; + return result; + } + else + return signal (sig, handler); + } + else + { + errno = EINVAL; + return SIG_ERR; + } +} + +#if GNULIB_defined_SIGPIPE +/* Raise the signal SIGPIPE. */ +int +_gl_raise_SIGPIPE (void) +{ + if (blocked_set & (1U << SIGPIPE)) + pending_array[SIGPIPE] = 1; + else + { + handler_t handler = SIGPIPE_handler; + if (handler == SIG_DFL) + exit (128 + SIGPIPE); + else if (handler != SIG_IGN) + (*handler) (SIGPIPE); + } + return 0; +} +#endif diff --git a/gnulib-lib/size_max.h b/gnulib-lib/size_max.h new file mode 100644 index 0000000..1186ba9 --- /dev/null +++ b/gnulib-lib/size_max.h @@ -0,0 +1,30 @@ +/* size_max.h -- declare SIZE_MAX through system headers + Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. + Written by Simon Josefsson. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef GNULIB_SIZE_MAX_H +#define GNULIB_SIZE_MAX_H + +/* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */ +# include +/* Get SIZE_MAX declaration on systems like glibc 2. */ +# if HAVE_STDINT_H +# include +# endif +/* On systems where these include files don't define it, SIZE_MAX is defined + in config.h. */ + +#endif /* GNULIB_SIZE_MAX_H */ diff --git a/gnulib-lib/stat-time.c b/gnulib-lib/stat-time.c new file mode 100644 index 0000000..7b92792 --- /dev/null +++ b/gnulib-lib/stat-time.c @@ -0,0 +1,21 @@ +/* stat-related time functions. + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +#define _GL_STAT_TIME_INLINE _GL_EXTERN_INLINE +#include "stat-time.h" diff --git a/gnulib-lib/stat-time.h b/gnulib-lib/stat-time.h new file mode 100644 index 0000000..fe3483d --- /dev/null +++ b/gnulib-lib/stat-time.h @@ -0,0 +1,252 @@ +/* stat-related time functions. + + Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Paul Eggert. */ + +#ifndef STAT_TIME_H +#define STAT_TIME_H 1 + +#include "intprops.h" + +#include +#include +#include +#include + +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_STAT_TIME_INLINE +# define _GL_STAT_TIME_INLINE _GL_INLINE +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* STAT_TIMESPEC (ST, ST_XTIM) is the ST_XTIM member for *ST of type + struct timespec, if available. If not, then STAT_TIMESPEC_NS (ST, + ST_XTIM) is the nanosecond component of the ST_XTIM member for *ST, + if available. ST_XTIM can be st_atim, st_ctim, st_mtim, or st_birthtim + for access, status change, data modification, or birth (creation) + time respectively. + + These macros are private to stat-time.h. */ +#if _GL_WINDOWS_STAT_TIMESPEC || defined HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC +# if _GL_WINDOWS_STAT_TIMESPEC || defined TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC +# define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim) +# else +# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.tv_nsec) +# endif +#elif defined HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC +# define STAT_TIMESPEC(st, st_xtim) ((st)->st_xtim##espec) +#elif defined HAVE_STRUCT_STAT_ST_ATIMENSEC +# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim##ensec) +#elif defined HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC +# define STAT_TIMESPEC_NS(st, st_xtim) ((st)->st_xtim.st__tim.tv_nsec) +#endif + +/* Return the nanosecond component of *ST's access time. */ +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE +get_stat_atime_ns (struct stat const *st) +{ +# if defined STAT_TIMESPEC + return STAT_TIMESPEC (st, st_atim).tv_nsec; +# elif defined STAT_TIMESPEC_NS + return STAT_TIMESPEC_NS (st, st_atim); +# else + return 0; +# endif +} + +/* Return the nanosecond component of *ST's status change time. */ +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE +get_stat_ctime_ns (struct stat const *st) +{ +# if defined STAT_TIMESPEC + return STAT_TIMESPEC (st, st_ctim).tv_nsec; +# elif defined STAT_TIMESPEC_NS + return STAT_TIMESPEC_NS (st, st_ctim); +# else + return 0; +# endif +} + +/* Return the nanosecond component of *ST's data modification time. */ +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE +get_stat_mtime_ns (struct stat const *st) +{ +# if defined STAT_TIMESPEC + return STAT_TIMESPEC (st, st_mtim).tv_nsec; +# elif defined STAT_TIMESPEC_NS + return STAT_TIMESPEC_NS (st, st_mtim); +# else + return 0; +# endif +} + +/* Return the nanosecond component of *ST's birth time. */ +_GL_STAT_TIME_INLINE long int _GL_ATTRIBUTE_PURE +get_stat_birthtime_ns (struct stat const *st _GL_UNUSED) +{ +# if defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC + return STAT_TIMESPEC (st, st_birthtim).tv_nsec; +# elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC + return STAT_TIMESPEC_NS (st, st_birthtim); +# else + return 0; +# endif +} + +/* Return *ST's access time. */ +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE +get_stat_atime (struct stat const *st) +{ +#ifdef STAT_TIMESPEC + return STAT_TIMESPEC (st, st_atim); +#else + struct timespec t; + t.tv_sec = st->st_atime; + t.tv_nsec = get_stat_atime_ns (st); + return t; +#endif +} + +/* Return *ST's status change time. */ +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE +get_stat_ctime (struct stat const *st) +{ +#ifdef STAT_TIMESPEC + return STAT_TIMESPEC (st, st_ctim); +#else + struct timespec t; + t.tv_sec = st->st_ctime; + t.tv_nsec = get_stat_ctime_ns (st); + return t; +#endif +} + +/* Return *ST's data modification time. */ +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE +get_stat_mtime (struct stat const *st) +{ +#ifdef STAT_TIMESPEC + return STAT_TIMESPEC (st, st_mtim); +#else + struct timespec t; + t.tv_sec = st->st_mtime; + t.tv_nsec = get_stat_mtime_ns (st); + return t; +#endif +} + +/* Return *ST's birth time, if available; otherwise return a value + with tv_sec and tv_nsec both equal to -1. */ +_GL_STAT_TIME_INLINE struct timespec _GL_ATTRIBUTE_PURE +get_stat_birthtime (struct stat const *st _GL_UNUSED) +{ + struct timespec t; + +#if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ + || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC) + t = STAT_TIMESPEC (st, st_birthtim); +#elif defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC + t.tv_sec = st->st_birthtime; + t.tv_nsec = st->st_birthtimensec; +#elif defined _WIN32 && ! defined __CYGWIN__ + /* Native Windows platforms (but not Cygwin) put the "file creation + time" in st_ctime (!). See + . */ +# if _GL_WINDOWS_STAT_TIMESPEC + t = st->st_ctim; +# else + t.tv_sec = st->st_ctime; + t.tv_nsec = 0; +# endif +#else + /* Birth time is not supported. */ + t.tv_sec = -1; + t.tv_nsec = -1; +#endif + +#if (defined HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC \ + || defined HAVE_STRUCT_STAT_ST_BIRTHTIM_TV_NSEC \ + || defined HAVE_STRUCT_STAT_ST_BIRTHTIMENSEC) + /* FreeBSD and NetBSD sometimes signal the absence of knowledge by + using zero. Attempt to work around this problem. Alas, this can + report failure even for valid timestamps. Also, NetBSD + sometimes returns junk in the birth time fields; work around this + bug if it is detected. */ + if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000)) + { + t.tv_sec = -1; + t.tv_nsec = -1; + } +#endif + + return t; +} + +/* If a stat-like function returned RESULT, normalize the timestamps + in *ST, in case this platform suffers from the Solaris 11 bug where + tv_nsec might be negative. Return the adjusted RESULT, setting + errno to EOVERFLOW if normalization overflowed. This function + is intended to be private to this .h file. */ +_GL_STAT_TIME_INLINE int +stat_time_normalize (int result, struct stat *st _GL_UNUSED) +{ +#if defined __sun && defined STAT_TIMESPEC + if (result == 0) + { + long int timespec_hz = 1000000000; + short int const ts_off[] = { offsetof (struct stat, st_atim), + offsetof (struct stat, st_mtim), + offsetof (struct stat, st_ctim) }; + int i; + for (i = 0; i < sizeof ts_off / sizeof *ts_off; i++) + { + struct timespec *ts = (struct timespec *) ((char *) st + ts_off[i]); + long int q = ts->tv_nsec / timespec_hz; + long int r = ts->tv_nsec % timespec_hz; + if (r < 0) + { + r += timespec_hz; + q--; + } + ts->tv_nsec = r; + /* Overflow is possible, as Solaris 11 stat can yield + tv_sec == TYPE_MINIMUM (time_t) && tv_nsec == -1000000000. + INT_ADD_WRAPV is OK, since time_t is signed on Solaris. */ + if (INT_ADD_WRAPV (q, ts->tv_sec, &ts->tv_sec)) + { + errno = EOVERFLOW; + return -1; + } + } + } +#endif + return result; +} + +#ifdef __cplusplus +} +#endif + +_GL_INLINE_HEADER_END + +#endif diff --git a/gnulib-lib/stat-w32.c b/gnulib-lib/stat-w32.c new file mode 100644 index 0000000..4164199 --- /dev/null +++ b/gnulib-lib/stat-w32.c @@ -0,0 +1,461 @@ +/* Core of implementation of fstat and stat for native Windows. + Copyright (C) 2017-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible. */ + +#include + +#if defined _WIN32 && ! defined __CYGWIN__ + +/* Attempt to make define FILE_ID_INFO. + But ensure that the redefinition of _WIN32_WINNT does not make us assume + Windows Vista or newer when building for an older version of Windows. */ +#if HAVE_SDKDDKVER_H +# include +# if _WIN32_WINNT >= _WIN32_WINNT_VISTA +# define WIN32_ASSUME_VISTA 1 +# else +# define WIN32_ASSUME_VISTA 0 +# endif +# if !defined _WIN32_WINNT || (_WIN32_WINNT < _WIN32_WINNT_WIN8) +# undef _WIN32_WINNT +# define _WIN32_WINNT _WIN32_WINNT_WIN8 +# endif +#else +# define WIN32_ASSUME_VISTA (_WIN32_WINNT >= _WIN32_WINNT_VISTA) +#endif + +#include +#include +#include +#include +#include +#include +#include + +/* Specification. */ +#include "stat-w32.h" + +#include "pathmax.h" +#include "verify.h" + +/* Don't assume that UNICODE is not defined. */ +#undef LoadLibrary +#define LoadLibrary LoadLibraryA +#undef GetFinalPathNameByHandle +#define GetFinalPathNameByHandle GetFinalPathNameByHandleA + +/* Older mingw headers do not define VOLUME_NAME_NONE. */ +#ifndef VOLUME_NAME_NONE +# define VOLUME_NAME_NONE 4 +#endif + +#if !WIN32_ASSUME_VISTA + +/* Avoid warnings from gcc -Wcast-function-type. */ +# define GetProcAddress \ + (void *) GetProcAddress + +# if _GL_WINDOWS_STAT_INODES == 2 +/* GetFileInformationByHandleEx was introduced only in Windows Vista. */ +typedef DWORD (WINAPI * GetFileInformationByHandleExFuncType) (HANDLE hFile, + FILE_INFO_BY_HANDLE_CLASS fiClass, + LPVOID lpBuffer, + DWORD dwBufferSize); +static GetFileInformationByHandleExFuncType GetFileInformationByHandleExFunc = NULL; +# endif +/* GetFinalPathNameByHandle was introduced only in Windows Vista. */ +typedef DWORD (WINAPI * GetFinalPathNameByHandleFuncType) (HANDLE hFile, + LPSTR lpFilePath, + DWORD lenFilePath, + DWORD dwFlags); +static GetFinalPathNameByHandleFuncType GetFinalPathNameByHandleFunc = NULL; +static BOOL initialized = FALSE; + +static void +initialize (void) +{ + HMODULE kernel32 = LoadLibrary ("kernel32.dll"); + if (kernel32 != NULL) + { +# if _GL_WINDOWS_STAT_INODES == 2 + GetFileInformationByHandleExFunc = + (GetFileInformationByHandleExFuncType) GetProcAddress (kernel32, "GetFileInformationByHandleEx"); +# endif + GetFinalPathNameByHandleFunc = + (GetFinalPathNameByHandleFuncType) GetProcAddress (kernel32, "GetFinalPathNameByHandleA"); + } + initialized = TRUE; +} + +#else + +# define GetFileInformationByHandleExFunc GetFileInformationByHandleEx +# define GetFinalPathNameByHandleFunc GetFinalPathNameByHandle + +#endif + +/* Converts a FILETIME to GMT time since 1970-01-01 00:00:00. */ +#if _GL_WINDOWS_STAT_TIMESPEC +struct timespec +_gl_convert_FILETIME_to_timespec (const FILETIME *ft) +{ + struct timespec result; + /* FILETIME: */ + unsigned long long since_1601 = + ((unsigned long long) ft->dwHighDateTime << 32) + | (unsigned long long) ft->dwLowDateTime; + if (since_1601 == 0) + { + result.tv_sec = 0; + result.tv_nsec = 0; + } + else + { + /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 + leap years, in total 134774 days. */ + unsigned long long since_1970 = + since_1601 - (unsigned long long) 134774 * (unsigned long long) 86400 * (unsigned long long) 10000000; + result.tv_sec = since_1970 / (unsigned long long) 10000000; + result.tv_nsec = (unsigned long) (since_1970 % (unsigned long long) 10000000) * 100; + } + return result; +} +#else +time_t +_gl_convert_FILETIME_to_POSIX (const FILETIME *ft) +{ + /* FILETIME: */ + unsigned long long since_1601 = + ((unsigned long long) ft->dwHighDateTime << 32) + | (unsigned long long) ft->dwLowDateTime; + if (since_1601 == 0) + return 0; + else + { + /* Between 1601-01-01 and 1970-01-01 there were 280 normal years and 89 + leap years, in total 134774 days. */ + unsigned long long since_1970 = + since_1601 - (unsigned long long) 134774 * (unsigned long long) 86400 * (unsigned long long) 10000000; + return since_1970 / (unsigned long long) 10000000; + } +} +#endif + +/* Fill *BUF with information about the file designated by H. + PATH is the file name, if known, otherwise NULL. + Return 0 if successful, or -1 with errno set upon failure. */ +int +_gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf) +{ + /* GetFileType + */ + DWORD type = GetFileType (h); + if (type == FILE_TYPE_DISK) + { +#if !WIN32_ASSUME_VISTA + if (!initialized) + initialize (); +#endif + + /* st_mode can be determined through + GetFileAttributesEx + + + or through + GetFileInformationByHandle + + + or through + GetFileInformationByHandleEx with argument FileBasicInfo + + + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + BY_HANDLE_FILE_INFORMATION info; + if (! GetFileInformationByHandle (h, &info)) + goto failed; + + /* Test for error conditions before starting to fill *buf. */ + if (sizeof (buf->st_size) <= 4 && info.nFileSizeHigh > 0) + { + errno = EOVERFLOW; + return -1; + } + +#if _GL_WINDOWS_STAT_INODES + /* st_ino can be determined through + GetFileInformationByHandle + + + as 64 bits, or through + GetFileInformationByHandleEx with argument FileIdInfo + + + as 128 bits. + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_WIN8 or higher. */ + /* Experiments show that GetFileInformationByHandleEx does not provide + much more information than GetFileInformationByHandle: + * The dwVolumeSerialNumber from GetFileInformationByHandle is equal + to the low 32 bits of the 64-bit VolumeSerialNumber from + GetFileInformationByHandleEx, and is apparently sufficient for + identifying the device. + * The nFileIndex from GetFileInformationByHandle is equal to the low + 64 bits of the 128-bit FileId from GetFileInformationByHandleEx, + and the high 64 bits of this 128-bit FileId are zero. + * On a FAT file system, GetFileInformationByHandleEx fails with error + ERROR_INVALID_PARAMETER, whereas GetFileInformationByHandle + succeeds. + * On a CIFS/SMB file system, GetFileInformationByHandleEx fails with + error ERROR_INVALID_LEVEL, whereas GetFileInformationByHandle + succeeds. */ +# if _GL_WINDOWS_STAT_INODES == 2 + if (GetFileInformationByHandleExFunc != NULL) + { + FILE_ID_INFO id; + if (GetFileInformationByHandleExFunc (h, FileIdInfo, &id, sizeof (id))) + { + buf->st_dev = id.VolumeSerialNumber; + verify (sizeof (ino_t) == sizeof (id.FileId)); + memcpy (&buf->st_ino, &id.FileId, sizeof (ino_t)); + goto ino_done; + } + else + { + switch (GetLastError ()) + { + case ERROR_INVALID_PARAMETER: /* older Windows version, or FAT */ + case ERROR_INVALID_LEVEL: /* CIFS/SMB file system */ + goto fallback; + default: + goto failed; + } + } + } + fallback: ; + /* Fallback for older Windows versions. */ + buf->st_dev = info.dwVolumeSerialNumber; + buf->st_ino._gl_ino[0] = ((ULONGLONG) info.nFileIndexHigh << 32) | (ULONGLONG) info.nFileIndexLow; + buf->st_ino._gl_ino[1] = 0; + ino_done: ; +# else /* _GL_WINDOWS_STAT_INODES == 1 */ + buf->st_dev = info.dwVolumeSerialNumber; + buf->st_ino = ((ULONGLONG) info.nFileIndexHigh << 32) | (ULONGLONG) info.nFileIndexLow; +# endif +#else + /* st_ino is not wide enough for identifying a file on a device. + Without st_ino, st_dev is pointless. */ + buf->st_dev = 0; + buf->st_ino = 0; +#endif + + /* st_mode. */ + unsigned int mode = + /* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ? */ + ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG) + | S_IREAD_UGO + | ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO); + if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + /* Determine whether the file is executable by looking at the file + name suffix. + If the file name is already known, use it. Otherwise, for + non-empty files, it can be determined through + GetFinalPathNameByHandle + + or through + GetFileInformationByHandleEx with argument FileNameInfo + + + Both require -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) + { + char fpath[PATH_MAX]; + if (path != NULL + || (GetFinalPathNameByHandleFunc != NULL + && GetFinalPathNameByHandleFunc (h, fpath, sizeof (fpath), VOLUME_NAME_NONE) + < sizeof (fpath) + && (path = fpath, 1))) + { + const char *last_dot = NULL; + const char *p; + for (p = path; *p != '\0'; p++) + if (*p == '.') + last_dot = p; + if (last_dot != NULL) + { + const char *suffix = last_dot + 1; + if (_stricmp (suffix, "exe") == 0 + || _stricmp (suffix, "bat") == 0 + || _stricmp (suffix, "cmd") == 0 + || _stricmp (suffix, "com") == 0) + mode |= S_IEXEC_UGO; + } + } + else + /* Cannot determine file name. Pretend that it is executable. */ + mode |= S_IEXEC_UGO; + } + } + buf->st_mode = mode; + + /* st_nlink can be determined through + GetFileInformationByHandle + + + or through + GetFileInformationByHandleEx with argument FileStandardInfo + + + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + buf->st_nlink = (info.nNumberOfLinks > SHRT_MAX ? SHRT_MAX : info.nNumberOfLinks); + + /* There's no easy way to map the Windows SID concept to an integer. */ + buf->st_uid = 0; + buf->st_gid = 0; + + /* st_rdev is irrelevant for normal files and directories. */ + buf->st_rdev = 0; + + /* st_size can be determined through + GetFileSizeEx + + or through + GetFileAttributesEx + + + or through + GetFileInformationByHandle + + + or through + GetFileInformationByHandleEx with argument FileStandardInfo + + + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ + if (sizeof (buf->st_size) <= 4) + /* Range check already done above. */ + buf->st_size = info.nFileSizeLow; + else + buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow; + + /* st_atime, st_mtime, st_ctime can be determined through + GetFileTime + + or through + GetFileAttributesEx + + + or through + GetFileInformationByHandle + + + or through + GetFileInformationByHandleEx with argument FileBasicInfo + + + The latter requires -D_WIN32_WINNT=_WIN32_WINNT_VISTA or higher. */ +#if _GL_WINDOWS_STAT_TIMESPEC + buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime); + buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime); + buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime); +#else + buf->st_atime = _gl_convert_FILETIME_to_POSIX (&info.ftLastAccessTime); + buf->st_mtime = _gl_convert_FILETIME_to_POSIX (&info.ftLastWriteTime); + buf->st_ctime = _gl_convert_FILETIME_to_POSIX (&info.ftCreationTime); +#endif + + return 0; + } + else if (type == FILE_TYPE_CHAR || type == FILE_TYPE_PIPE) + { + buf->st_dev = 0; +#if _GL_WINDOWS_STAT_INODES == 2 + buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0; +#else + buf->st_ino = 0; +#endif + buf->st_mode = (type == FILE_TYPE_PIPE ? _S_IFIFO : _S_IFCHR); + buf->st_nlink = 1; + buf->st_uid = 0; + buf->st_gid = 0; + buf->st_rdev = 0; + if (type == FILE_TYPE_PIPE) + { + /* PeekNamedPipe + */ + DWORD bytes_available; + if (PeekNamedPipe (h, NULL, 0, NULL, &bytes_available, NULL)) + buf->st_size = bytes_available; + else + buf->st_size = 0; + } + else + buf->st_size = 0; +#if _GL_WINDOWS_STAT_TIMESPEC + buf->st_atim.tv_sec = 0; buf->st_atim.tv_nsec = 0; + buf->st_mtim.tv_sec = 0; buf->st_mtim.tv_nsec = 0; + buf->st_ctim.tv_sec = 0; buf->st_ctim.tv_nsec = 0; +#else + buf->st_atime = 0; + buf->st_mtime = 0; + buf->st_ctime = 0; +#endif + return 0; + } + else + { + errno = ENOENT; + return -1; + } + + failed: + { + DWORD error = GetLastError (); + #if 0 + fprintf (stderr, "_gl_fstat_by_handle error 0x%x\n", (unsigned int) error); + #endif + switch (error) + { + case ERROR_ACCESS_DENIED: + case ERROR_SHARING_VIOLATION: + errno = EACCES; + break; + + case ERROR_OUTOFMEMORY: + errno = ENOMEM; + break; + + case ERROR_WRITE_FAULT: + case ERROR_READ_FAULT: + case ERROR_GEN_FAILURE: + errno = EIO; + break; + + default: + errno = EINVAL; + break; + } + return -1; + } +} + +#else + +/* This declaration is solely to ensure that after preprocessing + this file is never empty. */ +typedef int dummy; + +#endif diff --git a/gnulib-lib/stat-w32.h b/gnulib-lib/stat-w32.h new file mode 100644 index 0000000..5b56c09 --- /dev/null +++ b/gnulib-lib/stat-w32.h @@ -0,0 +1,37 @@ +/* Core of implementation of fstat and stat for native Windows. + Copyright (C) 2017-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _STAT_W32_H +#define _STAT_W32_H 1 + +/* Converts a FILETIME to GMT time since 1970-01-01 00:00:00. */ +#if _GL_WINDOWS_STAT_TIMESPEC +extern struct timespec _gl_convert_FILETIME_to_timespec (const FILETIME *ft); +#else +extern time_t _gl_convert_FILETIME_to_POSIX (const FILETIME *ft); +#endif + +/* Fill *BUF with information about the file designated by H. + PATH is the file name, if known, otherwise NULL. + Return 0 if successful, or -1 with errno set upon failure. */ +extern int _gl_fstat_by_handle (HANDLE h, const char *path, struct stat *buf); + +/* Bitmasks for st_mode. */ +#define S_IREAD_UGO (_S_IREAD | (_S_IREAD >> 3) | (_S_IREAD >> 6)) +#define S_IWRITE_UGO (_S_IWRITE | (_S_IWRITE >> 3) | (_S_IWRITE >> 6)) +#define S_IEXEC_UGO (_S_IEXEC | (_S_IEXEC >> 3) | (_S_IEXEC >> 6)) + +#endif /* _STAT_W32_H */ diff --git a/gnulib-lib/stat.c b/gnulib-lib/stat.c new file mode 100644 index 0000000..bc9a767 --- /dev/null +++ b/gnulib-lib/stat.c @@ -0,0 +1,440 @@ +/* Work around platform bugs in stat. + Copyright (C) 2009-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Eric Blake and Bruno Haible. */ + +/* If the user's config.h happens to include , let it include only + the system's here, so that orig_stat doesn't recurse to + rpl_stat. */ +#define __need_system_sys_stat_h +#include + +/* Get the original definition of stat. It might be defined as a macro. */ +#include +#include +#undef __need_system_sys_stat_h + +#if defined _WIN32 && ! defined __CYGWIN__ +# define WINDOWS_NATIVE +#endif + +#if !defined WINDOWS_NATIVE + +static int +orig_stat (const char *filename, struct stat *buf) +{ + return stat (filename, buf); +} + +#endif + +/* Specification. */ +#ifdef __osf__ +/* Write "sys/stat.h" here, not , otherwise OSF/1 5.1 DTK cc + eliminates this include because of the preliminary #include + above. */ +# include "sys/stat.h" +#else +# include +#endif + +#include "stat-time.h" + +#include +#include +#include +#include +#include "filename.h" +#include "malloca.h" +#include "verify.h" + +#ifdef WINDOWS_NATIVE +# define WIN32_LEAN_AND_MEAN +# include +# include "stat-w32.h" +/* Don't assume that UNICODE is not defined. */ +# undef WIN32_FIND_DATA +# define WIN32_FIND_DATA WIN32_FIND_DATAA +# undef CreateFile +# define CreateFile CreateFileA +# undef FindFirstFile +# define FindFirstFile FindFirstFileA +#endif + +#ifdef WINDOWS_NATIVE +/* Return TRUE if the given file name denotes an UNC root. */ +static BOOL +is_unc_root (const char *rname) +{ + /* Test whether it has the syntax '\\server\share'. */ + if (ISSLASH (rname[0]) && ISSLASH (rname[1])) + { + /* It starts with two slashes. Find the next slash. */ + const char *p = rname + 2; + const char *q = p; + while (*q != '\0' && !ISSLASH (*q)) + q++; + if (q > p && *q != '\0') + { + /* Found the next slash at q. */ + q++; + const char *r = q; + while (*r != '\0' && !ISSLASH (*r)) + r++; + if (r > q && *r == '\0') + return TRUE; + } + } + return FALSE; +} +#endif + +/* Store information about NAME into ST. Work around bugs with + trailing slashes. Mingw has other bugs (such as st_ino always + being 0 on success) which this wrapper does not work around. But + at least this implementation provides the ability to emulate fchdir + correctly. */ + +int +rpl_stat (char const *name, struct stat *buf) +{ +#ifdef WINDOWS_NATIVE + /* Fill the fields ourselves, because the original stat function returns + values for st_atime, st_mtime, st_ctime that depend on the current time + zone. See + */ + /* XXX Should we convert to wchar_t* and prepend '\\?\', in order to work + around length limitations + ? */ + + /* POSIX + specifies: "More than two leading characters shall be treated as + a single character." */ + if (ISSLASH (name[0]) && ISSLASH (name[1]) && ISSLASH (name[2])) + { + name += 2; + while (ISSLASH (name[1])) + name++; + } + + size_t len = strlen (name); + size_t drive_prefix_len = (HAS_DEVICE (name) ? 2 : 0); + + /* Remove trailing slashes (except the very first one, at position + drive_prefix_len), but remember their presence. */ + size_t rlen; + bool check_dir = false; + + rlen = len; + while (rlen > drive_prefix_len && ISSLASH (name[rlen-1])) + { + check_dir = true; + if (rlen == drive_prefix_len + 1) + break; + rlen--; + } + + /* Handle '' and 'C:'. */ + if (!check_dir && rlen == drive_prefix_len) + { + errno = ENOENT; + return -1; + } + + /* Handle '\\'. */ + if (rlen == 1 && ISSLASH (name[0]) && len >= 2) + { + errno = ENOENT; + return -1; + } + + const char *rname; + char *malloca_rname; + if (rlen == len) + { + rname = name; + malloca_rname = NULL; + } + else + { + malloca_rname = malloca (rlen + 1); + if (malloca_rname == NULL) + { + errno = ENOMEM; + return -1; + } + memcpy (malloca_rname, name, rlen); + malloca_rname[rlen] = '\0'; + rname = malloca_rname; + } + + /* There are two ways to get at the requested information: + - by scanning the parent directory and examining the relevant + directory entry, + - by opening the file directly. + The first approach fails for root directories (e.g. 'C:\') and + UNC root directories (e.g. '\\server\share'). + The second approach fails for some system files (e.g. 'C:\pagefile.sys' + and 'C:\hiberfil.sys'): ERROR_SHARING_VIOLATION. + The second approach gives more information (in particular, correct + st_dev, st_ino, st_nlink fields). + So we use the second approach and, as a fallback except for root and + UNC root directories, also the first approach. */ + { + int ret; + + { + /* Approach based on the file. */ + + /* Open a handle to the file. + CreateFile + + */ + HANDLE h = + CreateFile (rname, + FILE_READ_ATTRIBUTES, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + /* FILE_FLAG_POSIX_SEMANTICS (treat file names that differ only + in case as different) makes sense only when applied to *all* + filesystem operations. */ + FILE_FLAG_BACKUP_SEMANTICS /* | FILE_FLAG_POSIX_SEMANTICS */, + NULL); + if (h != INVALID_HANDLE_VALUE) + { + ret = _gl_fstat_by_handle (h, rname, buf); + CloseHandle (h); + goto done; + } + } + + /* Test for root and UNC root directories. */ + if ((rlen == drive_prefix_len + 1 && ISSLASH (rname[drive_prefix_len])) + || is_unc_root (rname)) + goto failed; + + /* Fallback. */ + { + /* Approach based on the directory entry. */ + + if (strchr (rname, '?') != NULL || strchr (rname, '*') != NULL) + { + /* Other Windows API functions would fail with error + ERROR_INVALID_NAME. */ + if (malloca_rname != NULL) + freea (malloca_rname); + errno = ENOENT; + return -1; + } + + /* Get the details about the directory entry. This can be done through + FindFirstFile + + + or through + FindFirstFileEx with argument FindExInfoBasic + + + */ + WIN32_FIND_DATA info; + HANDLE h = FindFirstFile (rname, &info); + if (h == INVALID_HANDLE_VALUE) + goto failed; + + /* Test for error conditions before starting to fill *buf. */ + if (sizeof (buf->st_size) <= 4 && info.nFileSizeHigh > 0) + { + FindClose (h); + if (malloca_rname != NULL) + freea (malloca_rname); + errno = EOVERFLOW; + return -1; + } + +# if _GL_WINDOWS_STAT_INODES + buf->st_dev = 0; +# if _GL_WINDOWS_STAT_INODES == 2 + buf->st_ino._gl_ino[0] = buf->st_ino._gl_ino[1] = 0; +# else /* _GL_WINDOWS_STAT_INODES == 1 */ + buf->st_ino = 0; +# endif +# else + /* st_ino is not wide enough for identifying a file on a device. + Without st_ino, st_dev is pointless. */ + buf->st_dev = 0; + buf->st_ino = 0; +# endif + + /* st_mode. */ + unsigned int mode = + /* XXX How to handle FILE_ATTRIBUTE_REPARSE_POINT ? */ + ((info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? _S_IFDIR | S_IEXEC_UGO : _S_IFREG) + | S_IREAD_UGO + | ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) ? 0 : S_IWRITE_UGO); + if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) + { + /* Determine whether the file is executable by looking at the file + name suffix. */ + if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) + { + const char *last_dot = NULL; + const char *p; + for (p = info.cFileName; *p != '\0'; p++) + if (*p == '.') + last_dot = p; + if (last_dot != NULL) + { + const char *suffix = last_dot + 1; + if (_stricmp (suffix, "exe") == 0 + || _stricmp (suffix, "bat") == 0 + || _stricmp (suffix, "cmd") == 0 + || _stricmp (suffix, "com") == 0) + mode |= S_IEXEC_UGO; + } + } + } + buf->st_mode = mode; + + /* st_nlink. Ignore hard links here. */ + buf->st_nlink = 1; + + /* There's no easy way to map the Windows SID concept to an integer. */ + buf->st_uid = 0; + buf->st_gid = 0; + + /* st_rdev is irrelevant for normal files and directories. */ + buf->st_rdev = 0; + + /* st_size. */ + if (sizeof (buf->st_size) <= 4) + /* Range check already done above. */ + buf->st_size = info.nFileSizeLow; + else + buf->st_size = ((long long) info.nFileSizeHigh << 32) | (long long) info.nFileSizeLow; + + /* st_atime, st_mtime, st_ctime. */ +# if _GL_WINDOWS_STAT_TIMESPEC + buf->st_atim = _gl_convert_FILETIME_to_timespec (&info.ftLastAccessTime); + buf->st_mtim = _gl_convert_FILETIME_to_timespec (&info.ftLastWriteTime); + buf->st_ctim = _gl_convert_FILETIME_to_timespec (&info.ftCreationTime); +# else + buf->st_atime = _gl_convert_FILETIME_to_POSIX (&info.ftLastAccessTime); + buf->st_mtime = _gl_convert_FILETIME_to_POSIX (&info.ftLastWriteTime); + buf->st_ctime = _gl_convert_FILETIME_to_POSIX (&info.ftCreationTime); +# endif + + FindClose (h); + + ret = 0; + } + + done: + if (ret >= 0 && check_dir && !S_ISDIR (buf->st_mode)) + { + errno = ENOTDIR; + ret = -1; + } + if (malloca_rname != NULL) + { + int saved_errno = errno; + freea (malloca_rname); + errno = saved_errno; + } + return ret; + } + + failed: + { + DWORD error = GetLastError (); + #if 0 + fprintf (stderr, "rpl_stat error 0x%x\n", (unsigned int) error); + #endif + + if (malloca_rname != NULL) + freea (malloca_rname); + + switch (error) + { + /* Some of these errors probably cannot happen with the specific flags + that we pass to CreateFile. But who knows... */ + case ERROR_FILE_NOT_FOUND: /* The last component of rname does not exist. */ + case ERROR_PATH_NOT_FOUND: /* Some directory component in rname does not exist. */ + case ERROR_BAD_PATHNAME: /* rname is such as '\\server'. */ + case ERROR_BAD_NET_NAME: /* rname is such as '\\server\nonexistentshare'. */ + case ERROR_INVALID_NAME: /* rname contains wildcards, misplaced colon, etc. */ + case ERROR_DIRECTORY: + errno = ENOENT; + break; + + case ERROR_ACCESS_DENIED: /* rname is such as 'C:\System Volume Information\foo'. */ + case ERROR_SHARING_VIOLATION: /* rname is such as 'C:\pagefile.sys' (second approach only). */ + /* XXX map to EACCES or EPERM? */ + errno = EACCES; + break; + + case ERROR_OUTOFMEMORY: + errno = ENOMEM; + break; + + case ERROR_WRITE_PROTECT: + errno = EROFS; + break; + + case ERROR_WRITE_FAULT: + case ERROR_READ_FAULT: + case ERROR_GEN_FAILURE: + errno = EIO; + break; + + case ERROR_BUFFER_OVERFLOW: + case ERROR_FILENAME_EXCED_RANGE: + errno = ENAMETOOLONG; + break; + + case ERROR_DELETE_PENDING: /* XXX map to EACCES or EPERM? */ + errno = EPERM; + break; + + default: + errno = EINVAL; + break; + } + + return -1; + } +#else + int result = orig_stat (name, buf); + if (result == 0) + { +# if REPLACE_FUNC_STAT_FILE + /* Solaris 9 mistakenly succeeds when given a non-directory with a + trailing slash. */ + if (!S_ISDIR (buf->st_mode)) + { + size_t len = strlen (name); + if (ISSLASH (name[len - 1])) + { + errno = ENOTDIR; + return -1; + } + } +# endif /* REPLACE_FUNC_STAT_FILE */ + result = stat_time_normalize (result, buf); + } + return result; +#endif +} diff --git a/gnulib-lib/stdbool.in.h b/gnulib-lib/stdbool.in.h new file mode 100644 index 0000000..2a1992d --- /dev/null +++ b/gnulib-lib/stdbool.in.h @@ -0,0 +1,132 @@ +/* Copyright (C) 2001-2003, 2006-2021 Free Software Foundation, Inc. + Written by Bruno Haible , 2001. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _GL_STDBOOL_H +#define _GL_STDBOOL_H + +/* ISO C 99 for platforms that lack it. */ + +/* Usage suggestions: + + Programs that use should be aware of some limitations + and standards compliance issues. + + Standards compliance: + + - must be #included before 'bool', 'false', 'true' + can be used. + + - You cannot assume that sizeof (bool) == 1. + + - Programs should not undefine the macros bool, true, and false, + as C99 lists that as an "obsolescent feature". + + Limitations of this substitute, when used in a C89 environment: + + - must be #included before the '_Bool' type can be used. + + - You cannot assume that _Bool is a typedef; it might be a macro. + + - Bit-fields of type 'bool' are not supported. Portable code + should use 'unsigned int foo : 1;' rather than 'bool foo : 1;'. + + - In C99, casts and automatic conversions to '_Bool' or 'bool' are + performed in such a way that every nonzero value gets converted + to 'true', and zero gets converted to 'false'. This doesn't work + with this substitute. With this substitute, only the values 0 and 1 + give the expected result when converted to _Bool' or 'bool'. + + - C99 allows the use of (_Bool)0.0 in constant expressions, but + this substitute cannot always provide this property. + + Also, it is suggested that programs use 'bool' rather than '_Bool'; + this isn't required, but 'bool' is more common. */ + + +/* 7.16. Boolean type and values */ + +/* BeOS already #defines false 0, true 1. We use the same + definitions below, but temporarily we have to #undef them. */ +#if defined __BEOS__ && !defined __HAIKU__ +# include /* defines bool but not _Bool */ +# undef false +# undef true +#endif + +#ifdef __cplusplus +# define _Bool bool +# define bool bool +#else +# if defined __BEOS__ && !defined __HAIKU__ + /* A compiler known to have 'bool'. */ + /* If the compiler already has both 'bool' and '_Bool', we can assume they + are the same types. */ +# if !@HAVE__BOOL@ +typedef bool _Bool; +# endif +# else +# if !defined __GNUC__ + /* If @HAVE__BOOL@: + Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when + the built-in _Bool type is used. See + https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html + https://lists.gnu.org/r/bug-coreutils/2005-10/msg00086.html + Similar bugs are likely with other compilers as well; this file + wouldn't be used if was working. + So we override the _Bool type. + If !@HAVE__BOOL@: + Need to define _Bool ourselves. As 'signed char' or as an enum type? + Use of a typedef, with SunPRO C, leads to a stupid + "warning: _Bool is a keyword in ISO C99". + Use of an enum type, with IRIX cc, leads to a stupid + "warning(1185): enumerated type mixed with another type". + Even the existence of an enum type, without a typedef, + "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. + The only benefit of the enum, debuggability, is not important + with these compilers. So use 'signed char' and no enum. */ +# define _Bool signed char +# else + /* With this compiler, trust the _Bool type if the compiler has it. */ +# if !@HAVE__BOOL@ + /* For the sake of symbolic names in gdb, define true and false as + enum constants, not only as macros. + It is tempting to write + typedef enum { false = 0, true = 1 } _Bool; + so that gdb prints values of type 'bool' symbolically. But then + values of type '_Bool' might promote to 'int' or 'unsigned int' + (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' + (see ISO C 99 6.3.1.1.(2)). So add a negative value to the + enum; this ensures that '_Bool' promotes to 'int'. */ +typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; +# endif +# endif +# endif +# define bool _Bool +#endif + +/* The other macros must be usable in preprocessor directives. */ +#ifdef __cplusplus +# define false false +# define true true +#else +# define false 0 +# define true 1 +#endif + +#define __bool_true_false_are_defined 1 + +#endif /* _GL_STDBOOL_H */ diff --git a/gnulib-lib/stddef.in.h b/gnulib-lib/stddef.in.h new file mode 100644 index 0000000..42290d4 --- /dev/null +++ b/gnulib-lib/stddef.in.h @@ -0,0 +1,147 @@ +/* A substitute for POSIX 2008 , for platforms that have issues. + + Copyright (C) 2009-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Eric Blake. */ + +/* + * POSIX 2008 for platforms that have issues. + * + */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_wchar_t || defined __need_size_t \ + || defined __need_ptrdiff_t || defined __need_NULL \ + || defined __need_wint_t +/* Special invocation convention inside gcc header files. In + particular, gcc provides a version of that blindly + redefines NULL even when __need_wint_t was defined, even though + wint_t is not normally provided by . Hence, we must + remember if special invocation has ever been used to obtain wint_t, + in which case we need to clean up NULL yet again. */ + +# if !(defined _@GUARD_PREFIX@_STDDEF_H && defined _GL_STDDEF_WINT_T) +# ifdef __need_wint_t +# define _GL_STDDEF_WINT_T +# endif +# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ + /* On TinyCC, make sure that the macros that indicate the special invocation + convention get undefined. */ +# undef __need_wchar_t +# undef __need_size_t +# undef __need_ptrdiff_t +# undef __need_NULL +# undef __need_wint_t +# endif + +#else +/* Normal invocation convention. */ + +# ifndef _@GUARD_PREFIX@_STDDEF_H + +/* On AIX 7.2, with xlc in 64-bit mode, defines max_align_t to a + type with alignment 4, but 'long' has alignment 8. */ +# if defined _AIX && defined __LP64__ +# if !GNULIB_defined_max_align_t +# ifdef _MAX_ALIGN_T +/* /usr/include/stddef.h has already defined max_align_t. Override it. */ +typedef long rpl_max_align_t; +# define max_align_t rpl_max_align_t +# else +/* Prevent /usr/include/stddef.h from defining max_align_t. */ +typedef long max_align_t; +# define _MAX_ALIGN_T +# endif +# define GNULIB_defined_max_align_t 1 +# endif +# endif + +/* The include_next requires a split double-inclusion guard. */ + +# @INCLUDE_NEXT@ @NEXT_STDDEF_H@ + +/* On NetBSD 5.0, the definition of NULL lacks proper parentheses. */ +# if (@REPLACE_NULL@ \ + && (!defined _@GUARD_PREFIX@_STDDEF_H || defined _GL_STDDEF_WINT_T)) +# undef NULL +# ifdef __cplusplus + /* ISO C++ says that the macro NULL must expand to an integer constant + expression, hence '((void *) 0)' is not allowed in C++. */ +# if __GNUG__ >= 3 + /* GNU C++ has a __null macro that behaves like an integer ('int' or + 'long') but has the same size as a pointer. Use that, to avoid + warnings. */ +# define NULL __null +# else +# define NULL 0L +# endif +# else +# define NULL ((void *) 0) +# endif +# endif + +# ifndef _@GUARD_PREFIX@_STDDEF_H +# define _@GUARD_PREFIX@_STDDEF_H + +/* Some platforms lack wchar_t. */ +#if !@HAVE_WCHAR_T@ +# define wchar_t int +#endif + +/* Some platforms lack max_align_t. The check for _GCC_MAX_ALIGN_T is + a hack in case the configure-time test was done with g++ even though + we are currently compiling with gcc. + On MSVC, max_align_t is defined only in C++ mode, after was + included. Its definition is good since it has an alignment of 8 (on x86 + and x86_64). + Similarly on OS/2 kLIBC. */ +#if (defined _MSC_VER || (defined __KLIBC__ && !defined __LIBCN__)) \ + && defined __cplusplus +# include +#else +# if ! (@HAVE_MAX_ALIGN_T@ || (defined _GCC_MAX_ALIGN_T && !defined __clang__)) +# if !GNULIB_defined_max_align_t +/* On the x86, the maximum storage alignment of double, long, etc. is 4, + but GCC's C11 ABI for x86 says that max_align_t has an alignment of 8, + and the C11 standard allows this. Work around this problem by + using __alignof__ (which returns 8 for double) rather than _Alignof + (which returns 4), and align each union member accordingly. */ +# if defined __GNUC__ || (__clang_major__ >= 4) +# define _GL_STDDEF_ALIGNAS(type) \ + __attribute__ ((__aligned__ (__alignof__ (type)))) +# else +# define _GL_STDDEF_ALIGNAS(type) /* */ +# endif +typedef union +{ + char *__p _GL_STDDEF_ALIGNAS (char *); + double __d _GL_STDDEF_ALIGNAS (double); + long double __ld _GL_STDDEF_ALIGNAS (long double); + long int __i _GL_STDDEF_ALIGNAS (long int); +} rpl_max_align_t; +# define max_align_t rpl_max_align_t +# define GNULIB_defined_max_align_t 1 +# endif +# endif +#endif + +# endif /* _@GUARD_PREFIX@_STDDEF_H */ +# endif /* _@GUARD_PREFIX@_STDDEF_H */ +#endif /* __need_XXX */ diff --git a/gnulib-lib/stdint.in.h b/gnulib-lib/stdint.in.h new file mode 100644 index 0000000..85c5418 --- /dev/null +++ b/gnulib-lib/stdint.in.h @@ -0,0 +1,740 @@ +/* Copyright (C) 2001-2002, 2004-2021 Free Software Foundation, Inc. + Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood. + This file is part of gnulib. + + This file 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. + + This file 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 this program. If not, see . */ + +/* + * ISO C 99 for platforms that lack it. + * + */ + +#ifndef _@GUARD_PREFIX@_STDINT_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* When including a system file that in turn includes , + use the system , not our substitute. This avoids + problems with (for example) VMS, whose includes + . */ +#define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* On Android (Bionic libc), includes this file before + having defined 'time_t'. Therefore in this case avoid including + other system header files; just include the system's . + Ideally we should test __BIONIC__ here, but it is only defined after + has been included; hence test __ANDROID__ instead. */ +#if defined __ANDROID__ && defined _GL_INCLUDING_SYS_TYPES_H +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#else + +/* Get those types that are already defined in other system include + files, so that we can "#define int8_t signed char" below without + worrying about a later system include file containing a "typedef + signed char int8_t;" that will get messed up by our macro. Our + macros should all be consistent with the system versions, except + for the "fast" types and macros, which we recommend against using + in public interfaces due to compiler differences. */ + +#if @HAVE_STDINT_H@ +# if defined __sgi && ! defined __c99 + /* Bypass IRIX's if in C89 mode, since it merely annoys users + with "This header file is to be used only for c99 mode compilations" + diagnostics. */ +# define __STDINT_H__ +# endif + + /* Some pre-C++11 implementations need this. */ +# ifdef __cplusplus +# ifndef __STDC_CONSTANT_MACROS +# define __STDC_CONSTANT_MACROS 1 +# endif +# ifndef __STDC_LIMIT_MACROS +# define __STDC_LIMIT_MACROS 1 +# endif +# endif + + /* Other systems may have an incomplete or buggy . + Include it before , since any "#include " + in would reinclude us, skipping our contents because + _@GUARD_PREFIX@_STDINT_H is defined. + The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_STDINT_H@ +#endif + +#if ! defined _@GUARD_PREFIX@_STDINT_H && ! defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H +#define _@GUARD_PREFIX@_STDINT_H + +/* Get SCHAR_MIN, SCHAR_MAX, UCHAR_MAX, INT_MIN, INT_MAX, + LONG_MIN, LONG_MAX, ULONG_MAX, _GL_INTEGER_WIDTH. */ +#include + +/* Override WINT_MIN and WINT_MAX if gnulib's or overrides + wint_t. */ +#if @GNULIBHEADERS_OVERRIDE_WINT_T@ +# undef WINT_MIN +# undef WINT_MAX +# define WINT_MIN 0x0U +# define WINT_MAX 0xffffffffU +#endif + +#if ! @HAVE_C99_STDINT_H@ + +/* defines some of the stdint.h types as well, on glibc, + IRIX 6.5, and OpenBSD 3.8 (via ). + AIX 5.2 isn't needed and causes troubles. + Mac OS X 10.4.6 includes (which is us), but + relies on the system definitions, so include + after @NEXT_STDINT_H@. */ +# if @HAVE_SYS_TYPES_H@ && ! defined _AIX +# include +# endif + +# if @HAVE_INTTYPES_H@ + /* In OpenBSD 3.8, includes , which defines + int{8,16,32,64}_t, uint{8,16,32,64}_t and __BIT_TYPES_DEFINED__. + also defines intptr_t and uintptr_t. */ +# include +# elif @HAVE_SYS_INTTYPES_H@ + /* Solaris 7 has the types except the *_fast*_t types, and + the macros except for *_FAST*_*, INTPTR_MIN, PTRDIFF_MIN, PTRDIFF_MAX. */ +# include +# endif + +# if @HAVE_SYS_BITYPES_H@ && ! defined __BIT_TYPES_DEFINED__ + /* Linux libc4 >= 4.6.7 and libc5 have a that defines + int{8,16,32,64}_t and __BIT_TYPES_DEFINED__. In libc5 >= 5.2.2 it is + included by . */ +# include +# endif + +# undef _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H + +/* Minimum and maximum values for an integer type under the usual assumption. + Return an unspecified value if BITS == 0, adding a check to pacify + picky compilers. */ + +/* These are separate macros, because if you try to merge these macros into + a single one, HP-UX cc rejects the resulting expression in constant + expressions. */ +# define _STDINT_UNSIGNED_MIN(bits, zero) \ + (zero) +# define _STDINT_SIGNED_MIN(bits, zero) \ + (~ _STDINT_MAX (1, bits, zero)) + +# define _STDINT_MAX(signed, bits, zero) \ + (((((zero) + 1) << ((bits) ? (bits) - 1 - (signed) : 0)) - 1) * 2 + 1) + +#if !GNULIB_defined_stdint_types + +/* 7.18.1.1. Exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +# undef int8_t +# undef uint8_t +typedef signed char gl_int8_t; +typedef unsigned char gl_uint8_t; +# define int8_t gl_int8_t +# define uint8_t gl_uint8_t + +# undef int16_t +# undef uint16_t +typedef short int gl_int16_t; +typedef unsigned short int gl_uint16_t; +# define int16_t gl_int16_t +# define uint16_t gl_uint16_t + +# undef int32_t +# undef uint32_t +typedef int gl_int32_t; +typedef unsigned int gl_uint32_t; +# define int32_t gl_int32_t +# define uint32_t gl_uint32_t + +/* If the system defines INT64_MAX, assume int64_t works. That way, + if the underlying platform defines int64_t to be a 64-bit long long + int, the code below won't mistakenly define it to be a 64-bit long + int, which would mess up C++ name mangling. We must use #ifdef + rather than #if, to avoid an error with HP-UX 10.20 cc. */ + +# ifdef INT64_MAX +# define GL_INT64_T +# else +/* Do not undefine int64_t if gnulib is not being used with 64-bit + types, since otherwise it breaks platforms like Tandem/NSK. */ +# if LONG_MAX >> 31 >> 31 == 1 +# undef int64_t +typedef long int gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# elif defined _MSC_VER +# undef int64_t +typedef __int64 gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# else +# undef int64_t +typedef long long int gl_int64_t; +# define int64_t gl_int64_t +# define GL_INT64_T +# endif +# endif + +# ifdef UINT64_MAX +# define GL_UINT64_T +# else +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# undef uint64_t +typedef unsigned long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# elif defined _MSC_VER +# undef uint64_t +typedef unsigned __int64 gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# else +# undef uint64_t +typedef unsigned long long int gl_uint64_t; +# define uint64_t gl_uint64_t +# define GL_UINT64_T +# endif +# endif + +/* Avoid collision with Solaris 2.5.1 etc. */ +# define _UINT8_T +# define _UINT32_T +# define _UINT64_T + + +/* 7.18.1.2. Minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +# undef int_least8_t +# undef uint_least8_t +# undef int_least16_t +# undef uint_least16_t +# undef int_least32_t +# undef uint_least32_t +# undef int_least64_t +# undef uint_least64_t +# define int_least8_t int8_t +# define uint_least8_t uint8_t +# define int_least16_t int16_t +# define uint_least16_t uint16_t +# define int_least32_t int32_t +# define uint_least32_t uint32_t +# ifdef GL_INT64_T +# define int_least64_t int64_t +# endif +# ifdef GL_UINT64_T +# define uint_least64_t uint64_t +# endif + +/* 7.18.1.3. Fastest minimum-width integer types */ + +/* Note: Other substitutes may define these types differently. + It is not recommended to use these types in public header files. */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. The following code normally + uses types consistent with glibc, as that lessens the chance of + incompatibility with older GNU hosts. */ + +# undef int_fast8_t +# undef uint_fast8_t +# undef int_fast16_t +# undef uint_fast16_t +# undef int_fast32_t +# undef uint_fast32_t +# undef int_fast64_t +# undef uint_fast64_t +typedef signed char gl_int_fast8_t; +typedef unsigned char gl_uint_fast8_t; + +# ifdef __sun +/* Define types compatible with SunOS 5.10, so that code compiled under + earlier SunOS versions works with code compiled under SunOS 5.10. */ +typedef int gl_int_fast32_t; +typedef unsigned int gl_uint_fast32_t; +# else +typedef long int gl_int_fast32_t; +typedef unsigned long int gl_uint_fast32_t; +# endif +typedef gl_int_fast32_t gl_int_fast16_t; +typedef gl_uint_fast32_t gl_uint_fast16_t; + +# define int_fast8_t gl_int_fast8_t +# define uint_fast8_t gl_uint_fast8_t +# define int_fast16_t gl_int_fast16_t +# define uint_fast16_t gl_uint_fast16_t +# define int_fast32_t gl_int_fast32_t +# define uint_fast32_t gl_uint_fast32_t +# ifdef GL_INT64_T +# define int_fast64_t int64_t +# endif +# ifdef GL_UINT64_T +# define uint_fast64_t uint64_t +# endif + +/* 7.18.1.4. Integer types capable of holding object pointers */ + +/* kLIBC's defines _INTPTR_T_DECLARED and needs its own + definitions of intptr_t and uintptr_t (which use int and unsigned) + to avoid clashes with declarations of system functions like sbrk. + Similarly, MinGW WSL-5.4.1 needs its own intptr_t and + uintptr_t to avoid conflicting declarations of system functions like + _findclose in . */ +# if !((defined __KLIBC__ && defined _INTPTR_T_DECLARED) \ + || defined __MINGW32__) +# undef intptr_t +# undef uintptr_t +# ifdef _WIN64 +typedef long long int gl_intptr_t; +typedef unsigned long long int gl_uintptr_t; +# else +typedef long int gl_intptr_t; +typedef unsigned long int gl_uintptr_t; +# endif +# define intptr_t gl_intptr_t +# define uintptr_t gl_uintptr_t +# endif + +/* 7.18.1.5. Greatest-width integer types */ + +/* Note: These types are compiler dependent. It may be unwise to use them in + public header files. */ + +/* If the system defines INTMAX_MAX, assume that intmax_t works, and + similarly for UINTMAX_MAX and uintmax_t. This avoids problems with + assuming one type where another is used by the system. */ + +# ifndef INTMAX_MAX +# undef INTMAX_C +# undef intmax_t +# if LONG_MAX >> 30 == 1 +typedef long long int gl_intmax_t; +# define intmax_t gl_intmax_t +# elif defined GL_INT64_T +# define intmax_t int64_t +# else +typedef long int gl_intmax_t; +# define intmax_t gl_intmax_t +# endif +# endif + +# ifndef UINTMAX_MAX +# undef UINTMAX_C +# undef uintmax_t +# if ULONG_MAX >> 31 == 1 +typedef unsigned long long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t +# elif defined GL_UINT64_T +# define uintmax_t uint64_t +# else +typedef unsigned long int gl_uintmax_t; +# define uintmax_t gl_uintmax_t +# endif +# endif + +/* Verify that intmax_t and uintmax_t have the same size. Too much code + breaks if this is not the case. If this check fails, the reason is likely + to be found in the autoconf macros. */ +typedef int _verify_intmax_size[sizeof (intmax_t) == sizeof (uintmax_t) + ? 1 : -1]; + +# define GNULIB_defined_stdint_types 1 +# endif /* !GNULIB_defined_stdint_types */ + +/* 7.18.2. Limits of specified-width integer types */ + +/* 7.18.2.1. Limits of exact-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. */ + +# undef INT8_MIN +# undef INT8_MAX +# undef UINT8_MAX +# define INT8_MIN (~ INT8_MAX) +# define INT8_MAX 127 +# define UINT8_MAX 255 + +# undef INT16_MIN +# undef INT16_MAX +# undef UINT16_MAX +# define INT16_MIN (~ INT16_MAX) +# define INT16_MAX 32767 +# define UINT16_MAX 65535 + +# undef INT32_MIN +# undef INT32_MAX +# undef UINT32_MAX +# define INT32_MIN (~ INT32_MAX) +# define INT32_MAX 2147483647 +# define UINT32_MAX 4294967295U + +# if defined GL_INT64_T && ! defined INT64_MAX +/* Prefer (- INTMAX_C (1) << 63) over (~ INT64_MAX) because SunPRO C 5.0 + evaluates the latter incorrectly in preprocessor expressions. */ +# define INT64_MIN (- INTMAX_C (1) << 63) +# define INT64_MAX INTMAX_C (9223372036854775807) +# endif + +# if defined GL_UINT64_T && ! defined UINT64_MAX +# define UINT64_MAX UINTMAX_C (18446744073709551615) +# endif + +/* 7.18.2.2. Limits of minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the leastN_t types + are the same as the corresponding N_t types. */ + +# undef INT_LEAST8_MIN +# undef INT_LEAST8_MAX +# undef UINT_LEAST8_MAX +# define INT_LEAST8_MIN INT8_MIN +# define INT_LEAST8_MAX INT8_MAX +# define UINT_LEAST8_MAX UINT8_MAX + +# undef INT_LEAST16_MIN +# undef INT_LEAST16_MAX +# undef UINT_LEAST16_MAX +# define INT_LEAST16_MIN INT16_MIN +# define INT_LEAST16_MAX INT16_MAX +# define UINT_LEAST16_MAX UINT16_MAX + +# undef INT_LEAST32_MIN +# undef INT_LEAST32_MAX +# undef UINT_LEAST32_MAX +# define INT_LEAST32_MIN INT32_MIN +# define INT_LEAST32_MAX INT32_MAX +# define UINT_LEAST32_MAX UINT32_MAX + +# undef INT_LEAST64_MIN +# undef INT_LEAST64_MAX +# ifdef GL_INT64_T +# define INT_LEAST64_MIN INT64_MIN +# define INT_LEAST64_MAX INT64_MAX +# endif + +# undef UINT_LEAST64_MAX +# ifdef GL_UINT64_T +# define UINT_LEAST64_MAX UINT64_MAX +# endif + +/* 7.18.2.3. Limits of fastest minimum-width integer types */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits. Therefore the fastN_t types + are taken from the same list of types. */ + +# undef INT_FAST8_MIN +# undef INT_FAST8_MAX +# undef UINT_FAST8_MAX +# define INT_FAST8_MIN SCHAR_MIN +# define INT_FAST8_MAX SCHAR_MAX +# define UINT_FAST8_MAX UCHAR_MAX + +# undef INT_FAST16_MIN +# undef INT_FAST16_MAX +# undef UINT_FAST16_MAX +# define INT_FAST16_MIN INT_FAST32_MIN +# define INT_FAST16_MAX INT_FAST32_MAX +# define UINT_FAST16_MAX UINT_FAST32_MAX + +# undef INT_FAST32_MIN +# undef INT_FAST32_MAX +# undef UINT_FAST32_MAX +# ifdef __sun +# define INT_FAST32_MIN INT_MIN +# define INT_FAST32_MAX INT_MAX +# define UINT_FAST32_MAX UINT_MAX +# else +# define INT_FAST32_MIN LONG_MIN +# define INT_FAST32_MAX LONG_MAX +# define UINT_FAST32_MAX ULONG_MAX +# endif + +# undef INT_FAST64_MIN +# undef INT_FAST64_MAX +# ifdef GL_INT64_T +# define INT_FAST64_MIN INT64_MIN +# define INT_FAST64_MAX INT64_MAX +# endif + +# undef UINT_FAST64_MAX +# ifdef GL_UINT64_T +# define UINT_FAST64_MAX UINT64_MAX +# endif + +/* 7.18.2.4. Limits of integer types capable of holding object pointers */ + +# undef INTPTR_MIN +# undef INTPTR_MAX +# undef UINTPTR_MAX +# ifdef _WIN64 +# define INTPTR_MIN LLONG_MIN +# define INTPTR_MAX LLONG_MAX +# define UINTPTR_MAX ULLONG_MAX +# else +# define INTPTR_MIN LONG_MIN +# define INTPTR_MAX LONG_MAX +# define UINTPTR_MAX ULONG_MAX +# endif + +/* 7.18.2.5. Limits of greatest-width integer types */ + +# ifndef INTMAX_MAX +# undef INTMAX_MIN +# ifdef INT64_MAX +# define INTMAX_MIN INT64_MIN +# define INTMAX_MAX INT64_MAX +# else +# define INTMAX_MIN INT32_MIN +# define INTMAX_MAX INT32_MAX +# endif +# endif + +# ifndef UINTMAX_MAX +# ifdef UINT64_MAX +# define UINTMAX_MAX UINT64_MAX +# else +# define UINTMAX_MAX UINT32_MAX +# endif +# endif + +/* 7.18.3. Limits of other integer types */ + +/* ptrdiff_t limits */ +# undef PTRDIFF_MIN +# undef PTRDIFF_MAX +# if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define PTRDIFF_MIN _STDINT_SIGNED_MIN (64, 0l) +# define PTRDIFF_MAX _STDINT_MAX (1, 64, 0l) +# else +# define PTRDIFF_MIN _STDINT_SIGNED_MIN (32, 0) +# define PTRDIFF_MAX _STDINT_MAX (1, 32, 0) +# endif +# else +# define PTRDIFF_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +# define PTRDIFF_MAX \ + _STDINT_MAX (1, @BITSIZEOF_PTRDIFF_T@, 0@PTRDIFF_T_SUFFIX@) +# endif + +/* sig_atomic_t limits */ +# undef SIG_ATOMIC_MIN +# undef SIG_ATOMIC_MAX +# if @HAVE_SIGNED_SIG_ATOMIC_T@ +# define SIG_ATOMIC_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@) +# else +# define SIG_ATOMIC_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_SIG_ATOMIC_T@, 0@SIG_ATOMIC_T_SUFFIX@) +# endif +# define SIG_ATOMIC_MAX \ + _STDINT_MAX (@HAVE_SIGNED_SIG_ATOMIC_T@, @BITSIZEOF_SIG_ATOMIC_T@, \ + 0@SIG_ATOMIC_T_SUFFIX@) + + +/* size_t limit */ +# undef SIZE_MAX +# if @APPLE_UNIVERSAL_BUILD@ +# ifdef _LP64 +# define SIZE_MAX _STDINT_MAX (0, 64, 0ul) +# else +# define SIZE_MAX _STDINT_MAX (0, 32, 0ul) +# endif +# else +# define SIZE_MAX _STDINT_MAX (0, @BITSIZEOF_SIZE_T@, 0@SIZE_T_SUFFIX@) +# endif + +/* wchar_t limits */ +/* Get WCHAR_MIN, WCHAR_MAX. + This include is not on the top, above, because on OSF/1 4.0 we have a + sequence of nested includes + -> -> -> , and the latter includes + and assumes its types are already defined. */ +# if @HAVE_WCHAR_H@ && ! (defined WCHAR_MIN && defined WCHAR_MAX) +# define _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +# include +# undef _GL_JUST_INCLUDE_SYSTEM_WCHAR_H +# endif +# undef WCHAR_MIN +# undef WCHAR_MAX +# if @HAVE_SIGNED_WCHAR_T@ +# define WCHAR_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +# else +# define WCHAR_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) +# endif +# define WCHAR_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WCHAR_T@, @BITSIZEOF_WCHAR_T@, 0@WCHAR_T_SUFFIX@) + +/* wint_t limits */ +/* If gnulib's or overrides wint_t, @WINT_T_SUFFIX@ is not + accurate, therefore use the definitions from above. */ +# if !@GNULIBHEADERS_OVERRIDE_WINT_T@ +# undef WINT_MIN +# undef WINT_MAX +# if @HAVE_SIGNED_WINT_T@ +# define WINT_MIN \ + _STDINT_SIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# else +# define WINT_MIN \ + _STDINT_UNSIGNED_MIN (@BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# endif +# define WINT_MAX \ + _STDINT_MAX (@HAVE_SIGNED_WINT_T@, @BITSIZEOF_WINT_T@, 0@WINT_T_SUFFIX@) +# endif + +/* 7.18.4. Macros for integer constants */ + +/* 7.18.4.1. Macros for minimum-width integer constants */ +/* According to ISO C 99 Technical Corrigendum 1 */ + +/* Here we assume a standard architecture where the hardware integer + types have 8, 16, 32, optionally 64 bits, and int is 32 bits. */ + +# undef INT8_C +# undef UINT8_C +# define INT8_C(x) x +# define UINT8_C(x) x + +# undef INT16_C +# undef UINT16_C +# define INT16_C(x) x +# define UINT16_C(x) x + +# undef INT32_C +# undef UINT32_C +# define INT32_C(x) x +# define UINT32_C(x) x ## U + +# undef INT64_C +# undef UINT64_C +# if LONG_MAX >> 31 >> 31 == 1 +# define INT64_C(x) x##L +# elif defined _MSC_VER +# define INT64_C(x) x##i64 +# else +# define INT64_C(x) x##LL +# endif +# if ULONG_MAX >> 31 >> 31 >> 1 == 1 +# define UINT64_C(x) x##UL +# elif defined _MSC_VER +# define UINT64_C(x) x##ui64 +# else +# define UINT64_C(x) x##ULL +# endif + +/* 7.18.4.2. Macros for greatest-width integer constants */ + +# ifndef INTMAX_C +# if LONG_MAX >> 30 == 1 +# define INTMAX_C(x) x##LL +# elif defined GL_INT64_T +# define INTMAX_C(x) INT64_C(x) +# else +# define INTMAX_C(x) x##L +# endif +# endif + +# ifndef UINTMAX_C +# if ULONG_MAX >> 31 == 1 +# define UINTMAX_C(x) x##ULL +# elif defined GL_UINT64_T +# define UINTMAX_C(x) UINT64_C(x) +# else +# define UINTMAX_C(x) x##UL +# endif +# endif + +#endif /* !@HAVE_C99_STDINT_H@ */ + +/* Macros specified by ISO/IEC TS 18661-1:2014. */ + +#if (!defined UINTMAX_WIDTH \ + && (defined _GNU_SOURCE || defined __STDC_WANT_IEC_60559_BFP_EXT__)) +# ifdef INT8_MAX +# define INT8_WIDTH _GL_INTEGER_WIDTH (INT8_MIN, INT8_MAX) +# endif +# ifdef UINT8_MAX +# define UINT8_WIDTH _GL_INTEGER_WIDTH (0, UINT8_MAX) +# endif +# ifdef INT16_MAX +# define INT16_WIDTH _GL_INTEGER_WIDTH (INT16_MIN, INT16_MAX) +# endif +# ifdef UINT16_MAX +# define UINT16_WIDTH _GL_INTEGER_WIDTH (0, UINT16_MAX) +# endif +# ifdef INT32_MAX +# define INT32_WIDTH _GL_INTEGER_WIDTH (INT32_MIN, INT32_MAX) +# endif +# ifdef UINT32_MAX +# define UINT32_WIDTH _GL_INTEGER_WIDTH (0, UINT32_MAX) +# endif +# ifdef INT64_MAX +# define INT64_WIDTH _GL_INTEGER_WIDTH (INT64_MIN, INT64_MAX) +# endif +# ifdef UINT64_MAX +# define UINT64_WIDTH _GL_INTEGER_WIDTH (0, UINT64_MAX) +# endif +# define INT_LEAST8_WIDTH _GL_INTEGER_WIDTH (INT_LEAST8_MIN, INT_LEAST8_MAX) +# define UINT_LEAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST8_MAX) +# define INT_LEAST16_WIDTH _GL_INTEGER_WIDTH (INT_LEAST16_MIN, INT_LEAST16_MAX) +# define UINT_LEAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST16_MAX) +# define INT_LEAST32_WIDTH _GL_INTEGER_WIDTH (INT_LEAST32_MIN, INT_LEAST32_MAX) +# define UINT_LEAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST32_MAX) +# define INT_LEAST64_WIDTH _GL_INTEGER_WIDTH (INT_LEAST64_MIN, INT_LEAST64_MAX) +# define UINT_LEAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_LEAST64_MAX) +# define INT_FAST8_WIDTH _GL_INTEGER_WIDTH (INT_FAST8_MIN, INT_FAST8_MAX) +# define UINT_FAST8_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST8_MAX) +# define INT_FAST16_WIDTH _GL_INTEGER_WIDTH (INT_FAST16_MIN, INT_FAST16_MAX) +# define UINT_FAST16_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST16_MAX) +# define INT_FAST32_WIDTH _GL_INTEGER_WIDTH (INT_FAST32_MIN, INT_FAST32_MAX) +# define UINT_FAST32_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST32_MAX) +# define INT_FAST64_WIDTH _GL_INTEGER_WIDTH (INT_FAST64_MIN, INT_FAST64_MAX) +# define UINT_FAST64_WIDTH _GL_INTEGER_WIDTH (0, UINT_FAST64_MAX) +# define INTPTR_WIDTH _GL_INTEGER_WIDTH (INTPTR_MIN, INTPTR_MAX) +# define UINTPTR_WIDTH _GL_INTEGER_WIDTH (0, UINTPTR_MAX) +# define INTMAX_WIDTH _GL_INTEGER_WIDTH (INTMAX_MIN, INTMAX_MAX) +# define UINTMAX_WIDTH _GL_INTEGER_WIDTH (0, UINTMAX_MAX) +# define PTRDIFF_WIDTH _GL_INTEGER_WIDTH (PTRDIFF_MIN, PTRDIFF_MAX) +# define SIZE_WIDTH _GL_INTEGER_WIDTH (0, SIZE_MAX) +# define WCHAR_WIDTH _GL_INTEGER_WIDTH (WCHAR_MIN, WCHAR_MAX) +# ifdef WINT_MAX +# define WINT_WIDTH _GL_INTEGER_WIDTH (WINT_MIN, WINT_MAX) +# endif +# ifdef SIG_ATOMIC_MAX +# define SIG_ATOMIC_WIDTH _GL_INTEGER_WIDTH (SIG_ATOMIC_MIN, SIG_ATOMIC_MAX) +# endif +#endif /* !WINT_WIDTH && (_GNU_SOURCE || __STDC_WANT_IEC_60559_BFP_EXT__) */ + +#endif /* _@GUARD_PREFIX@_STDINT_H */ +#endif /* !(defined __ANDROID__ && ...) */ +#endif /* !defined _@GUARD_PREFIX@_STDINT_H && !defined _GL_JUST_INCLUDE_SYSTEM_STDINT_H */ diff --git a/gnulib-lib/stdio.in.h b/gnulib-lib/stdio.in.h new file mode 100644 index 0000000..f0f880a --- /dev/null +++ b/gnulib-lib/stdio.in.h @@ -0,0 +1,1641 @@ +/* A GNU-like . + + Copyright (C) 2004, 2007-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_FILE || defined __need___FILE || defined _GL_ALREADY_INCLUDING_STDIO_H +/* Special invocation convention: + - Inside glibc header files. + - On OSF/1 5.1 we have a sequence of nested includes + -> -> -> -> + -> -> -> . + In this situation, the functions are not yet declared, therefore we cannot + provide the C++ aliases. */ + +#@INCLUDE_NEXT@ @NEXT_STDIO_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_STDIO_H + +#define _GL_ALREADY_INCLUDING_STDIO_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STDIO_H@ + +#undef _GL_ALREADY_INCLUDING_STDIO_H + +#ifndef _@GUARD_PREFIX@_STDIO_H +#define _@GUARD_PREFIX@_STDIO_H + +/* Get va_list. Needed on many systems, including glibc 2.8. */ +#include + +#include + +/* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 + and eglibc 2.11.2. + May also define off_t to a 64-bit type on native Windows. */ +#include + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The __-protected variants of the attributes 'format' and 'printf' are + accepted by gcc versions 2.6.4 (effectively 2.7) and later. + We enable _GL_ATTRIBUTE_FORMAT only if these are supported too, because + gnulib and libintl do '#define printf __printf__' when they override + the 'printf' function. */ +#ifndef _GL_ATTRIBUTE_FORMAT +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || defined __clang__ +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +# else +# define _GL_ATTRIBUTE_FORMAT(spec) /* empty */ +# endif +#endif + +/* An __attribute__ __format__ specifier for a function that takes a format + string and arguments, where the format string directives are the ones + standardized by ISO C99 and POSIX. + _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD */ +/* __gnu_printf__ is supported in GCC >= 4.4. */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __gnu_printf__ +#else +# define _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD __printf__ +#endif + +/* An __attribute__ __format__ specifier for a function that takes a format + string and arguments, where the format string directives are the ones of the + system printf(), rather than the ones standardized by ISO C99 and POSIX. + _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM */ +/* On mingw, Gnulib sets __USE_MINGW_ANSI_STDIO in order to get closer to + the standards. The macro GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU indicates + whether this change is effective. On older mingw, it is not. */ +#if GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU +# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM _GL_ATTRIBUTE_SPEC_PRINTF_STANDARD +#else +# define _GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM __printf__ +#endif + +/* _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD + indicates to GCC that the function takes a format string and arguments, + where the format string directives are the ones standardized by ISO C99 + and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_STANDARD, formatstring_parameter, first_argument)) + +/* _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD, + except that it indicates to GCC that the supported format string directives + are the ones of the system printf(), rather than the ones standardized by + ISO C99 and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((_GL_ATTRIBUTE_SPEC_PRINTF_SYSTEM, formatstring_parameter, first_argument)) + +/* _GL_ATTRIBUTE_FORMAT_SCANF + indicates to GCC that the function takes a format string and arguments, + where the format string directives are the ones standardized by ISO C99 + and POSIX. */ +#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) +# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__gnu_scanf__, formatstring_parameter, first_argument)) +#else +# define _GL_ATTRIBUTE_FORMAT_SCANF(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) +#endif + +/* _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM is like _GL_ATTRIBUTE_FORMAT_SCANF, + except that it indicates to GCC that the supported format string directives + are the ones of the system scanf(), rather than the ones standardized by + ISO C99 and POSIX. */ +#define _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM(formatstring_parameter, first_argument) \ + _GL_ATTRIBUTE_FORMAT ((__scanf__, formatstring_parameter, first_argument)) + +/* Solaris 10 and NetBSD 7.0 declare renameat in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && (defined __sun || defined __NetBSD__) \ + && ! defined __GLIBC__ +# include +#endif + +/* Android 4.3 declares renameat in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && ! defined __GLIBC__ +# include +#endif + +/* MSVC declares 'perror' in , not in . We must include + it before we #define perror rpl_perror. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_PERROR@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + +/* MSVC declares 'remove' in , not in . We must include + it before we #define remove rpl_remove. */ +/* MSVC declares 'rename' in , not in . We must include + it before we #define rename rpl_rename. */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_REMOVE@ || @GNULIB_RENAME@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__) \ + && ! defined __GLIBC__ +# include +#endif + + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* Macros for stringification. */ +#define _GL_STDIO_STRINGIZE(token) #token +#define _GL_STDIO_MACROEXPAND_AND_STRINGIZE(token) _GL_STDIO_STRINGIZE(token) + +/* When also using extern inline, suppress the use of static inline in + standard headers of problematic Apple configurations, as Libc at + least through Libc-825.26 (2013-04-09) mishandles it; see, e.g., + . + Perhaps Apple will fix this some day. */ +#if (defined _GL_EXTERN_INLINE_IN_USE && defined __APPLE__ \ + && defined __GNUC__ && defined __STDC__) +# undef putc_unlocked +#endif + +#if @GNULIB_DPRINTF@ +# if @REPLACE_DPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define dprintf rpl_dprintf +# endif +_GL_FUNCDECL_RPL (dprintf, int, (int fd, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (dprintf, int, (int fd, const char *restrict format, ...)); +# else +# if !@HAVE_DPRINTF@ +_GL_FUNCDECL_SYS (dprintf, int, (int fd, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (dprintf, int, (int fd, const char *restrict format, ...)); +# endif +_GL_CXXALIASWARN (dprintf); +#elif defined GNULIB_POSIXCHECK +# undef dprintf +# if HAVE_RAW_DECL_DPRINTF +_GL_WARN_ON_USE (dprintf, "dprintf is unportable - " + "use gnulib module dprintf for portability"); +# endif +#endif + +#if @GNULIB_FCLOSE@ +/* Close STREAM and its underlying file descriptor. */ +# if @REPLACE_FCLOSE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fclose rpl_fclose +# endif +_GL_FUNCDECL_RPL (fclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fclose, int, (FILE *stream)); +# else +_GL_CXXALIAS_SYS (fclose, int, (FILE *stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fclose); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fclose +/* Assume fclose is always declared. */ +_GL_WARN_ON_USE (fclose, "fclose is not always POSIX compliant - " + "use gnulib module fclose for portable POSIX compliance"); +#endif + +#if @GNULIB_MDA_FCLOSEALL@ +/* On native Windows, map 'fcloseall' to '_fcloseall', so that -loldnames is + not required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::fcloseall on all platforms that have + it. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fcloseall +# define fcloseall _fcloseall +# endif +_GL_CXXALIAS_MDA (fcloseall, int, (void)); +# else +# if @HAVE_DECL_FCLOSEALL@ +# if defined __FreeBSD__ || defined __DragonFly__ +_GL_CXXALIAS_SYS (fcloseall, void, (void)); +# else +_GL_CXXALIAS_SYS (fcloseall, int, (void)); +# endif +# endif +# endif +# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_DECL_FCLOSEALL@ +_GL_CXXALIASWARN (fcloseall); +# endif +#endif + +#if @GNULIB_FDOPEN@ +# if @REPLACE_FDOPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fdopen +# define fdopen rpl_fdopen +# endif +_GL_FUNCDECL_RPL (fdopen, FILE *, (int fd, const char *mode) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (fdopen, FILE *, (int fd, const char *mode)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fdopen +# define fdopen _fdopen +# endif +_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); +# else +_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); +# endif +_GL_CXXALIASWARN (fdopen); +#elif defined GNULIB_POSIXCHECK +# undef fdopen +/* Assume fdopen is always declared. */ +_GL_WARN_ON_USE (fdopen, "fdopen on native Windows platforms is not POSIX compliant - " + "use gnulib module fdopen for portability"); +#elif @GNULIB_MDA_FDOPEN@ +/* On native Windows, map 'fdopen' to '_fdopen', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::fdopen always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fdopen +# define fdopen _fdopen +# endif +_GL_CXXALIAS_MDA (fdopen, FILE *, (int fd, const char *mode)); +# else +_GL_CXXALIAS_SYS (fdopen, FILE *, (int fd, const char *mode)); +# endif +_GL_CXXALIASWARN (fdopen); +#endif + +#if @GNULIB_FFLUSH@ +/* Flush all pending data on STREAM according to POSIX rules. Both + output and seekable input streams are supported. + Note! LOSS OF DATA can occur if fflush is applied on an input stream + that is _not_seekable_ or on an update stream that is _not_seekable_ + and in which the most recent operation was input. Seekability can + be tested with lseek(fileno(fp),0,SEEK_CUR). */ +# if @REPLACE_FFLUSH@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fflush rpl_fflush +# endif +_GL_FUNCDECL_RPL (fflush, int, (FILE *gl_stream)); +_GL_CXXALIAS_RPL (fflush, int, (FILE *gl_stream)); +# else +_GL_CXXALIAS_SYS (fflush, int, (FILE *gl_stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fflush); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fflush +/* Assume fflush is always declared. */ +_GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - " + "use gnulib module fflush for portable POSIX compliance"); +#endif + +#if @GNULIB_FGETC@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fgetc +# define fgetc rpl_fgetc +# endif +_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fgetc, int, (FILE *stream)); +# else +_GL_CXXALIAS_SYS (fgetc, int, (FILE *stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fgetc); +# endif +#endif + +#if @GNULIB_FGETS@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fgets +# define fgets rpl_fgets +# endif +_GL_FUNCDECL_RPL (fgets, char *, + (char *restrict s, int n, FILE *restrict stream) + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (fgets, char *, + (char *restrict s, int n, FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (fgets, char *, + (char *restrict s, int n, FILE *restrict stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fgets); +# endif +#endif + +#if @GNULIB_MDA_FILENO@ +/* On native Windows, map 'fileno' to '_fileno', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::fileno always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fileno +# define fileno _fileno +# endif +_GL_CXXALIAS_MDA (fileno, int, (FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (fileno, int, (FILE *restrict stream)); +# endif +_GL_CXXALIASWARN (fileno); +#endif + +#if @GNULIB_FOPEN@ +# if @REPLACE_FOPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fopen +# define fopen rpl_fopen +# endif +_GL_FUNCDECL_RPL (fopen, FILE *, + (const char *restrict filename, const char *restrict mode) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fopen, FILE *, + (const char *restrict filename, const char *restrict mode)); +# else +_GL_CXXALIAS_SYS (fopen, FILE *, + (const char *restrict filename, const char *restrict mode)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fopen); +# endif +#elif defined GNULIB_POSIXCHECK +# undef fopen +/* Assume fopen is always declared. */ +_GL_WARN_ON_USE (fopen, "fopen on native Windows platforms is not POSIX compliant - " + "use gnulib module fopen for portability"); +#endif + +#if @GNULIB_FPRINTF_POSIX@ || @GNULIB_FPRINTF@ +# if (@GNULIB_FPRINTF_POSIX@ && @REPLACE_FPRINTF@) \ + || (@GNULIB_FPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fprintf rpl_fprintf +# endif +# define GNULIB_overrides_fprintf 1 +# if @GNULIB_FPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +# else +_GL_FUNCDECL_RPL (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 3) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_RPL (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...)); +# else +_GL_CXXALIAS_SYS (fprintf, int, + (FILE *restrict fp, const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fprintf); +# endif +#endif +#if !@GNULIB_FPRINTF_POSIX@ && defined GNULIB_POSIXCHECK +# if !GNULIB_overrides_fprintf +# undef fprintf +# endif +/* Assume fprintf is always declared. */ +_GL_WARN_ON_USE (fprintf, "fprintf is not always POSIX compliant - " + "use gnulib module fprintf-posix for portable " + "POSIX compliance"); +#endif + +#if @GNULIB_FPURGE@ +/* Discard all pending buffered I/O data on STREAM. + STREAM must not be wide-character oriented. + When discarding pending output, the file position is set back to where it + was before the write calls. When discarding pending input, the file + position is advanced to match the end of the previously read input. + Return 0 if successful. Upon error, return -1 and set errno. */ +# if @REPLACE_FPURGE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fpurge rpl_fpurge +# endif +_GL_FUNCDECL_RPL (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fpurge, int, (FILE *gl_stream)); +# else +# if !@HAVE_DECL_FPURGE@ +_GL_FUNCDECL_SYS (fpurge, int, (FILE *gl_stream) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (fpurge, int, (FILE *gl_stream)); +# endif +_GL_CXXALIASWARN (fpurge); +#elif defined GNULIB_POSIXCHECK +# undef fpurge +# if HAVE_RAW_DECL_FPURGE +_GL_WARN_ON_USE (fpurge, "fpurge is not always present - " + "use gnulib module fpurge for portability"); +# endif +#endif + +#if @GNULIB_FPUTC@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fputc +# define fputc rpl_fputc +# endif +_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (fputc, int, (int c, FILE *stream)); +# else +_GL_CXXALIAS_SYS (fputc, int, (int c, FILE *stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fputc); +# endif +#endif + +#if @GNULIB_FPUTS@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fputs +# define fputs rpl_fputs +# endif +_GL_FUNCDECL_RPL (fputs, int, + (const char *restrict string, FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fputs, int, + (const char *restrict string, FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (fputs, int, + (const char *restrict string, FILE *restrict stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fputs); +# endif +#endif + +#if @GNULIB_FREAD@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fread +# define fread rpl_fread +# endif +_GL_FUNCDECL_RPL (fread, size_t, + (void *restrict ptr, size_t s, size_t n, + FILE *restrict stream) + _GL_ARG_NONNULL ((4))); +_GL_CXXALIAS_RPL (fread, size_t, + (void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (fread, size_t, + (void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fread); +# endif +#endif + +#if @GNULIB_FREOPEN@ +# if @REPLACE_FREOPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef freopen +# define freopen rpl_freopen +# endif +_GL_FUNCDECL_RPL (freopen, FILE *, + (const char *restrict filename, const char *restrict mode, + FILE *restrict stream) + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (freopen, FILE *, + (const char *restrict filename, const char *restrict mode, + FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (freopen, FILE *, + (const char *restrict filename, const char *restrict mode, + FILE *restrict stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (freopen); +# endif +#elif defined GNULIB_POSIXCHECK +# undef freopen +/* Assume freopen is always declared. */ +_GL_WARN_ON_USE (freopen, + "freopen on native Windows platforms is not POSIX compliant - " + "use gnulib module freopen for portability"); +#endif + +#if @GNULIB_FSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fscanf +# define fscanf rpl_fscanf +# endif +_GL_FUNCDECL_RPL (fscanf, int, + (FILE *restrict stream, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (fscanf, int, + (FILE *restrict stream, const char *restrict format, ...)); +# else +_GL_CXXALIAS_SYS (fscanf, int, + (FILE *restrict stream, const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fscanf); +# endif +#endif + + +/* Set up the following warnings, based on which modules are in use. + GNU Coding Standards discourage the use of fseek, since it imposes + an arbitrary limitation on some 32-bit hosts. Remember that the + fseek module depends on the fseeko module, so we only have three + cases to consider: + + 1. The developer is not using either module. Issue a warning under + GNULIB_POSIXCHECK for both functions, to remind them that both + functions have bugs on some systems. _GL_NO_LARGE_FILES has no + impact on this warning. + + 2. The developer is using both modules. They may be unaware of the + arbitrary limitations of fseek, so issue a warning under + GNULIB_POSIXCHECK. On the other hand, they may be using both + modules intentionally, so the developer can define + _GL_NO_LARGE_FILES in the compilation units where the use of fseek + is safe, to silence the warning. + + 3. The developer is using the fseeko module, but not fseek. Gnulib + guarantees that fseek will still work around platform bugs in that + case, but we presume that the developer is aware of the pitfalls of + fseek and was trying to avoid it, so issue a warning even when + GNULIB_POSIXCHECK is undefined. Again, _GL_NO_LARGE_FILES can be + defined to silence the warning in particular compilation units. + In C++ compilations with GNULIB_NAMESPACE, in order to avoid that + fseek gets defined as a macro, it is recommended that the developer + uses the fseek module, even if he is not calling the fseek function. + + Most gnulib clients that perform stream operations should fall into + category 3. */ + +#if @GNULIB_FSEEK@ +# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES +# define _GL_FSEEK_WARN /* Category 2, above. */ +# undef fseek +# endif +# if @REPLACE_FSEEK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fseek +# define fseek rpl_fseek +# endif +_GL_FUNCDECL_RPL (fseek, int, (FILE *fp, long offset, int whence) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fseek, int, (FILE *fp, long offset, int whence)); +# else +_GL_CXXALIAS_SYS (fseek, int, (FILE *fp, long offset, int whence)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fseek); +# endif +#endif + +#if @GNULIB_FSEEKO@ +# if !@GNULIB_FSEEK@ && !defined _GL_NO_LARGE_FILES +# define _GL_FSEEK_WARN /* Category 3, above. */ +# undef fseek +# endif +# if @REPLACE_FSEEKO@ +/* Provide an fseeko function that is aware of a preceding fflush(), and which + detects pipes. */ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fseeko +# define fseeko rpl_fseeko +# endif +_GL_FUNCDECL_RPL (fseeko, int, (FILE *fp, off_t offset, int whence) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (fseeko, int, (FILE *fp, off_t offset, int whence)); +# else +# if ! @HAVE_DECL_FSEEKO@ +_GL_FUNCDECL_SYS (fseeko, int, (FILE *fp, off_t offset, int whence) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (fseeko, int, (FILE *fp, off_t offset, int whence)); +# endif +_GL_CXXALIASWARN (fseeko); +#elif defined GNULIB_POSIXCHECK +# define _GL_FSEEK_WARN /* Category 1, above. */ +# undef fseek +# undef fseeko +# if HAVE_RAW_DECL_FSEEKO +_GL_WARN_ON_USE (fseeko, "fseeko is unportable - " + "use gnulib module fseeko for portability"); +# endif +#endif + +#ifdef _GL_FSEEK_WARN +# undef _GL_FSEEK_WARN +/* Here, either fseek is undefined (but C89 guarantees that it is + declared), or it is defined as rpl_fseek (declared above). */ +_GL_WARN_ON_USE (fseek, "fseek cannot handle files larger than 4 GB " + "on 32-bit platforms - " + "use fseeko function for handling of large files"); +#endif + + +/* ftell, ftello. See the comments on fseek/fseeko. */ + +#if @GNULIB_FTELL@ +# if defined GNULIB_POSIXCHECK && !defined _GL_NO_LARGE_FILES +# define _GL_FTELL_WARN /* Category 2, above. */ +# undef ftell +# endif +# if @REPLACE_FTELL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ftell +# define ftell rpl_ftell +# endif +_GL_FUNCDECL_RPL (ftell, long, (FILE *fp) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (ftell, long, (FILE *fp)); +# else +_GL_CXXALIAS_SYS (ftell, long, (FILE *fp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (ftell); +# endif +#endif + +#if @GNULIB_FTELLO@ +# if !@GNULIB_FTELL@ && !defined _GL_NO_LARGE_FILES +# define _GL_FTELL_WARN /* Category 3, above. */ +# undef ftell +# endif +# if @REPLACE_FTELLO@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ftello +# define ftello rpl_ftello +# endif +_GL_FUNCDECL_RPL (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (ftello, off_t, (FILE *fp)); +# else +# if ! @HAVE_DECL_FTELLO@ +_GL_FUNCDECL_SYS (ftello, off_t, (FILE *fp) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (ftello, off_t, (FILE *fp)); +# endif +_GL_CXXALIASWARN (ftello); +#elif defined GNULIB_POSIXCHECK +# define _GL_FTELL_WARN /* Category 1, above. */ +# undef ftell +# undef ftello +# if HAVE_RAW_DECL_FTELLO +_GL_WARN_ON_USE (ftello, "ftello is unportable - " + "use gnulib module ftello for portability"); +# endif +#endif + +#ifdef _GL_FTELL_WARN +# undef _GL_FTELL_WARN +/* Here, either ftell is undefined (but C89 guarantees that it is + declared), or it is defined as rpl_ftell (declared above). */ +_GL_WARN_ON_USE (ftell, "ftell cannot handle files larger than 4 GB " + "on 32-bit platforms - " + "use ftello function for handling of large files"); +#endif + + +#if @GNULIB_FWRITE@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fwrite +# define fwrite rpl_fwrite +# endif +_GL_FUNCDECL_RPL (fwrite, size_t, + (const void *restrict ptr, size_t s, size_t n, + FILE *restrict stream) + _GL_ARG_NONNULL ((1, 4))); +_GL_CXXALIAS_RPL (fwrite, size_t, + (const void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (fwrite, size_t, + (const void *restrict ptr, size_t s, size_t n, + FILE *restrict stream)); + +/* Work around bug 11959 when fortifying glibc 2.4 through 2.15 + , + which sometimes causes an unwanted diagnostic for fwrite calls. + This affects only function declaration attributes under certain + versions of gcc and clang, and is not needed for C++. */ +# if (0 < __USE_FORTIFY_LEVEL \ + && __GLIBC__ == 2 && 4 <= __GLIBC_MINOR__ && __GLIBC_MINOR__ <= 15 \ + && 3 < __GNUC__ + (4 <= __GNUC_MINOR__) \ + && !defined __cplusplus) +# undef fwrite +# undef fwrite_unlocked +extern size_t __REDIRECT (rpl_fwrite, + (const void *__restrict, size_t, size_t, + FILE *__restrict), + fwrite); +extern size_t __REDIRECT (rpl_fwrite_unlocked, + (const void *__restrict, size_t, size_t, + FILE *__restrict), + fwrite_unlocked); +# define fwrite rpl_fwrite +# define fwrite_unlocked rpl_fwrite_unlocked +# endif +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fwrite); +# endif +#endif + +#if @GNULIB_GETC@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getc +# define getc rpl_fgetc +# endif +_GL_FUNCDECL_RPL (fgetc, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL_1 (getc, rpl_fgetc, int, (FILE *stream)); +# else +_GL_CXXALIAS_SYS (getc, int, (FILE *stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (getc); +# endif +#endif + +#if @GNULIB_GETCHAR@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getchar +# define getchar rpl_getchar +# endif +_GL_FUNCDECL_RPL (getchar, int, (void)); +_GL_CXXALIAS_RPL (getchar, int, (void)); +# else +_GL_CXXALIAS_SYS (getchar, int, (void)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (getchar); +# endif +#endif + +#if @GNULIB_GETDELIM@ +/* Read input, up to (and including) the next occurrence of DELIMITER, from + STREAM, store it in *LINEPTR (and NUL-terminate it). + *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE + bytes of space. It is realloc'd as necessary. + Return the number of bytes read and stored at *LINEPTR (not including the + NUL terminator), or -1 on error or EOF. */ +# if @REPLACE_GETDELIM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getdelim +# define getdelim rpl_getdelim +# endif +_GL_FUNCDECL_RPL (getdelim, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2, 4))); +_GL_CXXALIAS_RPL (getdelim, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream)); +# else +# if !@HAVE_DECL_GETDELIM@ +_GL_FUNCDECL_SYS (getdelim, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2, 4))); +# endif +_GL_CXXALIAS_SYS (getdelim, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + int delimiter, + FILE *restrict stream)); +# endif +_GL_CXXALIASWARN (getdelim); +#elif defined GNULIB_POSIXCHECK +# undef getdelim +# if HAVE_RAW_DECL_GETDELIM +_GL_WARN_ON_USE (getdelim, "getdelim is unportable - " + "use gnulib module getdelim for portability"); +# endif +#endif + +#if @GNULIB_GETLINE@ +/* Read a line, up to (and including) the next newline, from STREAM, store it + in *LINEPTR (and NUL-terminate it). + *LINEPTR is a pointer returned from malloc (or NULL), pointing to *LINESIZE + bytes of space. It is realloc'd as necessary. + Return the number of bytes read and stored at *LINEPTR (not including the + NUL terminator), or -1 on error or EOF. */ +# if @REPLACE_GETLINE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getline +# define getline rpl_getline +# endif +_GL_FUNCDECL_RPL (getline, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2, 3))); +_GL_CXXALIAS_RPL (getline, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream)); +# else +# if !@HAVE_DECL_GETLINE@ +_GL_FUNCDECL_SYS (getline, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream) + _GL_ARG_NONNULL ((1, 2, 3))); +# endif +_GL_CXXALIAS_SYS (getline, ssize_t, + (char **restrict lineptr, size_t *restrict linesize, + FILE *restrict stream)); +# endif +# if @HAVE_DECL_GETLINE@ +_GL_CXXALIASWARN (getline); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getline +# if HAVE_RAW_DECL_GETLINE +_GL_WARN_ON_USE (getline, "getline is unportable - " + "use gnulib module getline for portability"); +# endif +#endif + +/* It is very rare that the developer ever has full control of stdin, + so any use of gets warrants an unconditional warning; besides, C11 + removed it. */ +#undef gets +#if HAVE_RAW_DECL_GETS && !defined __cplusplus +_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); +#endif + +#if @GNULIB_MDA_GETW@ +/* On native Windows, map 'getw' to '_getw', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::getw always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getw +# define getw _getw +# endif +_GL_CXXALIAS_MDA (getw, int, (FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (getw, int, (FILE *restrict stream)); +# endif +_GL_CXXALIASWARN (getw); +#endif + +#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ +struct obstack; +/* Grow an obstack with formatted output. Return the number of + bytes added to OBS. No trailing nul byte is added, and the + object should be closed with obstack_finish before use. Upon + memory allocation error, call obstack_alloc_failed_handler. Upon + other error, return -1. */ +# if @REPLACE_OBSTACK_PRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define obstack_printf rpl_obstack_printf +# endif +_GL_FUNCDECL_RPL (obstack_printf, int, + (struct obstack *obs, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (obstack_printf, int, + (struct obstack *obs, const char *format, ...)); +# else +# if !@HAVE_DECL_OBSTACK_PRINTF@ +_GL_FUNCDECL_SYS (obstack_printf, int, + (struct obstack *obs, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (obstack_printf, int, + (struct obstack *obs, const char *format, ...)); +# endif +_GL_CXXALIASWARN (obstack_printf); +# if @REPLACE_OBSTACK_PRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define obstack_vprintf rpl_obstack_vprintf +# endif +_GL_FUNCDECL_RPL (obstack_vprintf, int, + (struct obstack *obs, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (obstack_vprintf, int, + (struct obstack *obs, const char *format, va_list args)); +# else +# if !@HAVE_DECL_OBSTACK_PRINTF@ +_GL_FUNCDECL_SYS (obstack_vprintf, int, + (struct obstack *obs, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (obstack_vprintf, int, + (struct obstack *obs, const char *format, va_list args)); +# endif +_GL_CXXALIASWARN (obstack_vprintf); +#endif + +#if @GNULIB_PCLOSE@ +# if !@HAVE_PCLOSE@ +_GL_FUNCDECL_SYS (pclose, int, (FILE *stream) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pclose, int, (FILE *stream)); +_GL_CXXALIASWARN (pclose); +#elif defined GNULIB_POSIXCHECK +# undef pclose +# if HAVE_RAW_DECL_PCLOSE +_GL_WARN_ON_USE (pclose, "pclose is unportable - " + "use gnulib module pclose for more portability"); +# endif +#endif + +#if @GNULIB_PERROR@ +/* Print a message to standard error, describing the value of ERRNO, + (if STRING is not NULL and not empty) prefixed with STRING and ": ", + and terminated with a newline. */ +# if @REPLACE_PERROR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define perror rpl_perror +# endif +_GL_FUNCDECL_RPL (perror, void, (const char *string)); +_GL_CXXALIAS_RPL (perror, void, (const char *string)); +# else +_GL_CXXALIAS_SYS (perror, void, (const char *string)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (perror); +# endif +#elif defined GNULIB_POSIXCHECK +# undef perror +/* Assume perror is always declared. */ +_GL_WARN_ON_USE (perror, "perror is not always POSIX compliant - " + "use gnulib module perror for portability"); +#endif + +#if @GNULIB_POPEN@ +# if @REPLACE_POPEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef popen +# define popen rpl_popen +# endif +_GL_FUNCDECL_RPL (popen, FILE *, (const char *cmd, const char *mode) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (popen, FILE *, (const char *cmd, const char *mode)); +# else +# if !@HAVE_POPEN@ +_GL_FUNCDECL_SYS (popen, FILE *, (const char *cmd, const char *mode) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (popen, FILE *, (const char *cmd, const char *mode)); +# endif +_GL_CXXALIASWARN (popen); +#elif defined GNULIB_POSIXCHECK +# undef popen +# if HAVE_RAW_DECL_POPEN +_GL_WARN_ON_USE (popen, "popen is buggy on some platforms - " + "use gnulib module popen or pipe for more portability"); +# endif +#endif + +#if @GNULIB_PRINTF_POSIX@ || @GNULIB_PRINTF@ +# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \ + || (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) +# if defined __GNUC__ || defined __clang__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +/* Don't break __attribute__((format(printf,M,N))). */ +# define printf __printf__ +# endif +# if @GNULIB_PRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL_1 (__printf__, int, + (const char *restrict format, ...) + __asm__ (@ASM_SYMBOL_PREFIX@ + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) + _GL_ARG_NONNULL ((1))); +# else +_GL_FUNCDECL_RPL_1 (__printf__, int, + (const char *restrict format, ...) + __asm__ (@ASM_SYMBOL_PREFIX@ + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_printf)) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_RPL_1 (printf, __printf__, int, (const char *format, ...)); +# else +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define printf rpl_printf +# endif +_GL_FUNCDECL_RPL (printf, int, + (const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (printf, int, (const char *restrict format, ...)); +# endif +# define GNULIB_overrides_printf 1 +# else +_GL_CXXALIAS_SYS (printf, int, (const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (printf); +# endif +#endif +#if !@GNULIB_PRINTF_POSIX@ && defined GNULIB_POSIXCHECK +# if !GNULIB_overrides_printf +# undef printf +# endif +/* Assume printf is always declared. */ +_GL_WARN_ON_USE (printf, "printf is not always POSIX compliant - " + "use gnulib module printf-posix for portable " + "POSIX compliance"); +#endif + +#if @GNULIB_PUTC@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putc +# define putc rpl_fputc +# endif +_GL_FUNCDECL_RPL (fputc, int, (int c, FILE *stream) _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL_1 (putc, rpl_fputc, int, (int c, FILE *stream)); +# else +_GL_CXXALIAS_SYS (putc, int, (int c, FILE *stream)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (putc); +# endif +#endif + +#if @GNULIB_PUTCHAR@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putchar +# define putchar rpl_putchar +# endif +_GL_FUNCDECL_RPL (putchar, int, (int c)); +_GL_CXXALIAS_RPL (putchar, int, (int c)); +# else +_GL_CXXALIAS_SYS (putchar, int, (int c)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (putchar); +# endif +#endif + +#if @GNULIB_PUTS@ +# if @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef puts +# define puts rpl_puts +# endif +_GL_FUNCDECL_RPL (puts, int, (const char *string) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (puts, int, (const char *string)); +# else +_GL_CXXALIAS_SYS (puts, int, (const char *string)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (puts); +# endif +#endif + +#if @GNULIB_MDA_PUTW@ +/* On native Windows, map 'putw' to '_putw', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::putw always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef putw +# define putw _putw +# endif +_GL_CXXALIAS_MDA (putw, int, (int w, FILE *restrict stream)); +# else +_GL_CXXALIAS_SYS (putw, int, (int w, FILE *restrict stream)); +# endif +_GL_CXXALIASWARN (putw); +#endif + +#if @GNULIB_REMOVE@ +# if @REPLACE_REMOVE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef remove +# define remove rpl_remove +# endif +_GL_FUNCDECL_RPL (remove, int, (const char *name) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (remove, int, (const char *name)); +# else +_GL_CXXALIAS_SYS (remove, int, (const char *name)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (remove); +# endif +#elif defined GNULIB_POSIXCHECK +# undef remove +/* Assume remove is always declared. */ +_GL_WARN_ON_USE (remove, "remove cannot handle directories on some platforms - " + "use gnulib module remove for more portability"); +#endif + +#if @GNULIB_RENAME@ +# if @REPLACE_RENAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef rename +# define rename rpl_rename +# endif +_GL_FUNCDECL_RPL (rename, int, + (const char *old_filename, const char *new_filename) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (rename, int, + (const char *old_filename, const char *new_filename)); +# else +_GL_CXXALIAS_SYS (rename, int, + (const char *old_filename, const char *new_filename)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (rename); +# endif +#elif defined GNULIB_POSIXCHECK +# undef rename +/* Assume rename is always declared. */ +_GL_WARN_ON_USE (rename, "rename is buggy on some platforms - " + "use gnulib module rename for more portability"); +#endif + +#if @GNULIB_RENAMEAT@ +# if @REPLACE_RENAMEAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef renameat +# define renameat rpl_renameat +# endif +_GL_FUNCDECL_RPL (renameat, int, + (int fd1, char const *file1, int fd2, char const *file2) + _GL_ARG_NONNULL ((2, 4))); +_GL_CXXALIAS_RPL (renameat, int, + (int fd1, char const *file1, int fd2, char const *file2)); +# else +# if !@HAVE_RENAMEAT@ +_GL_FUNCDECL_SYS (renameat, int, + (int fd1, char const *file1, int fd2, char const *file2) + _GL_ARG_NONNULL ((2, 4))); +# endif +_GL_CXXALIAS_SYS (renameat, int, + (int fd1, char const *file1, int fd2, char const *file2)); +# endif +_GL_CXXALIASWARN (renameat); +#elif defined GNULIB_POSIXCHECK +# undef renameat +# if HAVE_RAW_DECL_RENAMEAT +_GL_WARN_ON_USE (renameat, "renameat is not portable - " + "use gnulib module renameat for portability"); +# endif +#endif + +#if @GNULIB_SCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if defined __GNUC__ || defined __clang__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef scanf +/* Don't break __attribute__((format(scanf,M,N))). */ +# define scanf __scanf__ +# endif +_GL_FUNCDECL_RPL_1 (__scanf__, int, + (const char *restrict format, ...) + __asm__ (@ASM_SYMBOL_PREFIX@ + _GL_STDIO_MACROEXPAND_AND_STRINGIZE(rpl_scanf)) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL_1 (scanf, __scanf__, int, (const char *restrict format, ...)); +# else +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef scanf +# define scanf rpl_scanf +# endif +_GL_FUNCDECL_RPL (scanf, int, (const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 2) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (scanf, int, (const char *restrict format, ...)); +# endif +# else +_GL_CXXALIAS_SYS (scanf, int, (const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (scanf); +# endif +#endif + +#if @GNULIB_SNPRINTF@ +# if @REPLACE_SNPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define snprintf rpl_snprintf +# endif +_GL_FUNCDECL_RPL (snprintf, int, + (char *restrict str, size_t size, + const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) + _GL_ARG_NONNULL ((3))); +_GL_CXXALIAS_RPL (snprintf, int, + (char *restrict str, size_t size, + const char *restrict format, ...)); +# else +# if !@HAVE_DECL_SNPRINTF@ +_GL_FUNCDECL_SYS (snprintf, int, + (char *restrict str, size_t size, + const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 4) + _GL_ARG_NONNULL ((3))); +# endif +_GL_CXXALIAS_SYS (snprintf, int, + (char *restrict str, size_t size, + const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (snprintf); +# endif +#elif defined GNULIB_POSIXCHECK +# undef snprintf +# if HAVE_RAW_DECL_SNPRINTF +_GL_WARN_ON_USE (snprintf, "snprintf is unportable - " + "use gnulib module snprintf for portability"); +# endif +#endif + +/* Some people would argue that all sprintf uses should be warned about + (for example, OpenBSD issues a link warning for it), + since it can cause security holes due to buffer overruns. + However, we believe that sprintf can be used safely, and is more + efficient than snprintf in those safe cases; and as proof of our + belief, we use sprintf in several gnulib modules. So this header + intentionally avoids adding a warning to sprintf except when + GNULIB_POSIXCHECK is defined. */ + +#if @GNULIB_SPRINTF_POSIX@ +# if @REPLACE_SPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define sprintf rpl_sprintf +# endif +_GL_FUNCDECL_RPL (sprintf, int, + (char *restrict str, const char *restrict format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (sprintf, int, + (char *restrict str, const char *restrict format, ...)); +# else +_GL_CXXALIAS_SYS (sprintf, int, + (char *restrict str, const char *restrict format, ...)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (sprintf); +# endif +#elif defined GNULIB_POSIXCHECK +# undef sprintf +/* Assume sprintf is always declared. */ +_GL_WARN_ON_USE (sprintf, "sprintf is not always POSIX compliant - " + "use gnulib module sprintf-posix for portable " + "POSIX compliance"); +#endif + +#if @GNULIB_MDA_TEMPNAM@ +/* On native Windows, map 'tempnam' to '_tempnam', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::tempnam always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tempnam +# define tempnam _tempnam +# endif +_GL_CXXALIAS_MDA (tempnam, char *, (const char *dir, const char *prefix)); +# else +_GL_CXXALIAS_SYS (tempnam, char *, (const char *dir, const char *prefix)); +# endif +_GL_CXXALIASWARN (tempnam); +#endif + +#if @GNULIB_TMPFILE@ +# if @REPLACE_TMPFILE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define tmpfile rpl_tmpfile +# endif +_GL_FUNCDECL_RPL (tmpfile, FILE *, (void)); +_GL_CXXALIAS_RPL (tmpfile, FILE *, (void)); +# else +_GL_CXXALIAS_SYS (tmpfile, FILE *, (void)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (tmpfile); +# endif +#elif defined GNULIB_POSIXCHECK +# undef tmpfile +# if HAVE_RAW_DECL_TMPFILE +_GL_WARN_ON_USE (tmpfile, "tmpfile is not usable on mingw - " + "use gnulib module tmpfile for portability"); +# endif +#endif + +#if @GNULIB_VASPRINTF@ +/* Write formatted output to a string dynamically allocated with malloc(). + If the memory allocation succeeds, store the address of the string in + *RESULT and return the number of resulting bytes, excluding the trailing + NUL. Upon memory allocation error, or some other error, return -1. */ +# if @REPLACE_VASPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define asprintf rpl_asprintf +# endif +_GL_FUNCDECL_RPL (asprintf, int, + (char **result, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (asprintf, int, + (char **result, const char *format, ...)); +# else +# if !@HAVE_VASPRINTF@ +_GL_FUNCDECL_SYS (asprintf, int, + (char **result, const char *format, ...) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 3) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (asprintf, int, + (char **result, const char *format, ...)); +# endif +_GL_CXXALIASWARN (asprintf); +# if @REPLACE_VASPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vasprintf rpl_vasprintf +# endif +_GL_FUNCDECL_RPL (vasprintf, int, + (char **result, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (vasprintf, int, + (char **result, const char *format, va_list args)); +# else +# if !@HAVE_VASPRINTF@ +_GL_FUNCDECL_SYS (vasprintf, int, + (char **result, const char *format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (vasprintf, int, + (char **result, const char *format, va_list args)); +# endif +_GL_CXXALIASWARN (vasprintf); +#endif + +#if @GNULIB_VDPRINTF@ +# if @REPLACE_VDPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vdprintf rpl_vdprintf +# endif +_GL_FUNCDECL_RPL (vdprintf, int, + (int fd, const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (vdprintf, int, + (int fd, const char *restrict format, va_list args)); +# else +# if !@HAVE_VDPRINTF@ +_GL_FUNCDECL_SYS (vdprintf, int, + (int fd, const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((2))); +# endif +/* Need to cast, because on Solaris, the third parameter will likely be + __va_list args. */ +_GL_CXXALIAS_SYS_CAST (vdprintf, int, + (int fd, const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vdprintf); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vdprintf +# if HAVE_RAW_DECL_VDPRINTF +_GL_WARN_ON_USE (vdprintf, "vdprintf is unportable - " + "use gnulib module vdprintf for portability"); +# endif +#endif + +#if @GNULIB_VFPRINTF_POSIX@ || @GNULIB_VFPRINTF@ +# if (@GNULIB_VFPRINTF_POSIX@ && @REPLACE_VFPRINTF@) \ + || (@GNULIB_VFPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vfprintf rpl_vfprintf +# endif +# define GNULIB_overrides_vfprintf 1 +# if @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL (vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +# else +_GL_FUNCDECL_RPL (vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (2, 0) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_RPL (vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args)); +# else +/* Need to cast, because on Solaris, the third parameter is + __va_list args + and GCC's fixincludes did not change this to __gnuc_va_list. */ +_GL_CXXALIAS_SYS_CAST (vfprintf, int, + (FILE *restrict fp, + const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vfprintf); +# endif +#endif +#if !@GNULIB_VFPRINTF_POSIX@ && defined GNULIB_POSIXCHECK +# if !GNULIB_overrides_vfprintf +# undef vfprintf +# endif +/* Assume vfprintf is always declared. */ +_GL_WARN_ON_USE (vfprintf, "vfprintf is not always POSIX compliant - " + "use gnulib module vfprintf-posix for portable " + "POSIX compliance"); +#endif + +#if @GNULIB_VFSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vfscanf +# define vfscanf rpl_vfscanf +# endif +_GL_FUNCDECL_RPL (vfscanf, int, + (FILE *restrict stream, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (vfscanf, int, + (FILE *restrict stream, + const char *restrict format, va_list args)); +# else +_GL_CXXALIAS_SYS (vfscanf, int, + (FILE *restrict stream, + const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vfscanf); +# endif +#endif + +#if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VPRINTF@ +# if (@GNULIB_VPRINTF_POSIX@ && @REPLACE_VPRINTF@) \ + || (@GNULIB_VPRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && (@GNULIB_STDIO_H_NONBLOCKING@ || @GNULIB_STDIO_H_SIGPIPE@)) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vprintf rpl_vprintf +# endif +# define GNULIB_overrides_vprintf 1 +# if @GNULIB_VPRINTF_POSIX@ || @GNULIB_VFPRINTF_POSIX@ +_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (1, 0) + _GL_ARG_NONNULL ((1))); +# else +_GL_FUNCDECL_RPL (vprintf, int, (const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_SYSTEM (1, 0) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_RPL (vprintf, int, (const char *restrict format, va_list args)); +# else +/* Need to cast, because on Solaris, the second parameter is + __va_list args + and GCC's fixincludes did not change this to __gnuc_va_list. */ +_GL_CXXALIAS_SYS_CAST (vprintf, int, + (const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vprintf); +# endif +#endif +#if !@GNULIB_VPRINTF_POSIX@ && defined GNULIB_POSIXCHECK +# if !GNULIB_overrides_vprintf +# undef vprintf +# endif +/* Assume vprintf is always declared. */ +_GL_WARN_ON_USE (vprintf, "vprintf is not always POSIX compliant - " + "use gnulib module vprintf-posix for portable " + "POSIX compliance"); +#endif + +#if @GNULIB_VSCANF@ +# if @REPLACE_STDIO_READ_FUNCS@ && @GNULIB_STDIO_H_NONBLOCKING@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef vscanf +# define vscanf rpl_vscanf +# endif +_GL_FUNCDECL_RPL (vscanf, int, (const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_SCANF_SYSTEM (1, 0) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (vscanf, int, (const char *restrict format, va_list args)); +# else +_GL_CXXALIAS_SYS (vscanf, int, (const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vscanf); +# endif +#endif + +#if @GNULIB_VSNPRINTF@ +# if @REPLACE_VSNPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vsnprintf rpl_vsnprintf +# endif +_GL_FUNCDECL_RPL (vsnprintf, int, + (char *restrict str, size_t size, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) + _GL_ARG_NONNULL ((3))); +_GL_CXXALIAS_RPL (vsnprintf, int, + (char *restrict str, size_t size, + const char *restrict format, va_list args)); +# else +# if !@HAVE_DECL_VSNPRINTF@ +_GL_FUNCDECL_SYS (vsnprintf, int, + (char *restrict str, size_t size, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (3, 0) + _GL_ARG_NONNULL ((3))); +# endif +_GL_CXXALIAS_SYS (vsnprintf, int, + (char *restrict str, size_t size, + const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vsnprintf); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vsnprintf +# if HAVE_RAW_DECL_VSNPRINTF +_GL_WARN_ON_USE (vsnprintf, "vsnprintf is unportable - " + "use gnulib module vsnprintf for portability"); +# endif +#endif + +#if @GNULIB_VSPRINTF_POSIX@ +# if @REPLACE_VSPRINTF@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define vsprintf rpl_vsprintf +# endif +_GL_FUNCDECL_RPL (vsprintf, int, + (char *restrict str, + const char *restrict format, va_list args) + _GL_ATTRIBUTE_FORMAT_PRINTF_STANDARD (2, 0) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (vsprintf, int, + (char *restrict str, + const char *restrict format, va_list args)); +# else +/* Need to cast, because on Solaris, the third parameter is + __va_list args + and GCC's fixincludes did not change this to __gnuc_va_list. */ +_GL_CXXALIAS_SYS_CAST (vsprintf, int, + (char *restrict str, + const char *restrict format, va_list args)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (vsprintf); +# endif +#elif defined GNULIB_POSIXCHECK +# undef vsprintf +/* Assume vsprintf is always declared. */ +_GL_WARN_ON_USE (vsprintf, "vsprintf is not always POSIX compliant - " + "use gnulib module vsprintf-posix for portable " + "POSIX compliance"); +#endif + +#endif /* _@GUARD_PREFIX@_STDIO_H */ +#endif /* _@GUARD_PREFIX@_STDIO_H */ +#endif diff --git a/gnulib-lib/stdnoreturn.in.h b/gnulib-lib/stdnoreturn.in.h new file mode 100644 index 0000000..4b6cbcd --- /dev/null +++ b/gnulib-lib/stdnoreturn.in.h @@ -0,0 +1,60 @@ +/* A substitute for ISO C11 . + + Copyright 2012-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Paul Eggert. */ + +#ifndef noreturn + +/* ISO C11 for platforms that lack it. + + References: + ISO C11 (latest free draft + ) + section 7.23 */ + +/* The definition of _Noreturn is copied here. */ + +#if 1200 <= _MSC_VER || defined __CYGWIN__ +/* On MSVC, standard include files contain declarations like + __declspec (noreturn) void abort (void); + "#define noreturn _Noreturn" would cause this declaration to be rewritten + to the invalid + __declspec (__declspec (noreturn)) void abort (void); + + Similarly, on Cygwin, standard include files contain declarations like + void __cdecl abort (void) __attribute__ ((noreturn)); + "#define noreturn _Noreturn" would cause this declaration to be rewritten + to the invalid + void __cdecl abort (void) __attribute__ ((__attribute__ ((__noreturn__)))); + + Instead, define noreturn to empty, so that such declarations are rewritten to + __declspec () void abort (void); + or + void __cdecl abort (void) __attribute__ (()); + respectively. This gives up on noreturn's advice to the compiler but at + least it is valid code. */ +# define noreturn /*empty*/ +#else +# define noreturn _Noreturn +#endif + +/* Did he ever return? + No he never returned + And his fate is still unlearn'd ... + -- Steiner J, Hawes BL. M.T.A. (1949) */ + +#endif /* noreturn */ diff --git a/gnulib-lib/strerror-override.c b/gnulib-lib/strerror-override.c new file mode 100644 index 0000000..172a1d3 --- /dev/null +++ b/gnulib-lib/strerror-override.c @@ -0,0 +1,302 @@ +/* strerror-override.c --- POSIX compatible system error routine + + Copyright (C) 2010-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2010. */ + +#include + +#include "strerror-override.h" + +#include + +#if GNULIB_defined_EWINSOCK /* native Windows platforms */ +# if HAVE_WINSOCK2_H +# include +# endif +#endif + +/* If ERRNUM maps to an errno value defined by gnulib, return a string + describing the error. Otherwise return NULL. */ +const char * +strerror_override (int errnum) +{ + /* These error messages are taken from glibc/sysdeps/gnu/errlist.c. */ + switch (errnum) + { +#if REPLACE_STRERROR_0 + case 0: + return "Success"; +#endif + +#if GNULIB_defined_ESOCK /* native Windows platforms with older */ + case EINPROGRESS: + return "Operation now in progress"; + case EALREADY: + return "Operation already in progress"; + case ENOTSOCK: + return "Socket operation on non-socket"; + case EDESTADDRREQ: + return "Destination address required"; + case EMSGSIZE: + return "Message too long"; + case EPROTOTYPE: + return "Protocol wrong type for socket"; + case ENOPROTOOPT: + return "Protocol not available"; + case EPROTONOSUPPORT: + return "Protocol not supported"; + case EOPNOTSUPP: + return "Operation not supported"; + case EAFNOSUPPORT: + return "Address family not supported by protocol"; + case EADDRINUSE: + return "Address already in use"; + case EADDRNOTAVAIL: + return "Cannot assign requested address"; + case ENETDOWN: + return "Network is down"; + case ENETUNREACH: + return "Network is unreachable"; + case ECONNRESET: + return "Connection reset by peer"; + case ENOBUFS: + return "No buffer space available"; + case EISCONN: + return "Transport endpoint is already connected"; + case ENOTCONN: + return "Transport endpoint is not connected"; + case ETIMEDOUT: + return "Connection timed out"; + case ECONNREFUSED: + return "Connection refused"; + case ELOOP: + return "Too many levels of symbolic links"; + case EHOSTUNREACH: + return "No route to host"; + case EWOULDBLOCK: + return "Operation would block"; +#endif +#if GNULIB_defined_ESTREAMS /* native Windows platforms with older */ + case ETXTBSY: + return "Text file busy"; + case ENODATA: + return "No data available"; + case ENOSR: + return "Out of streams resources"; + case ENOSTR: + return "Device not a stream"; + case ETIME: + return "Timer expired"; + case EOTHER: + return "Other error"; +#endif +#if GNULIB_defined_EWINSOCK /* native Windows platforms */ + case ESOCKTNOSUPPORT: + return "Socket type not supported"; + case EPFNOSUPPORT: + return "Protocol family not supported"; + case ESHUTDOWN: + return "Cannot send after transport endpoint shutdown"; + case ETOOMANYREFS: + return "Too many references: cannot splice"; + case EHOSTDOWN: + return "Host is down"; + case EPROCLIM: + return "Too many processes"; + case EUSERS: + return "Too many users"; + case EDQUOT: + return "Disk quota exceeded"; + case ESTALE: + return "Stale NFS file handle"; + case EREMOTE: + return "Object is remote"; +# if HAVE_WINSOCK2_H + /* WSA_INVALID_HANDLE maps to EBADF */ + /* WSA_NOT_ENOUGH_MEMORY maps to ENOMEM */ + /* WSA_INVALID_PARAMETER maps to EINVAL */ + case WSA_OPERATION_ABORTED: + return "Overlapped operation aborted"; + case WSA_IO_INCOMPLETE: + return "Overlapped I/O event object not in signaled state"; + case WSA_IO_PENDING: + return "Overlapped operations will complete later"; + /* WSAEINTR maps to EINTR */ + /* WSAEBADF maps to EBADF */ + /* WSAEACCES maps to EACCES */ + /* WSAEFAULT maps to EFAULT */ + /* WSAEINVAL maps to EINVAL */ + /* WSAEMFILE maps to EMFILE */ + /* WSAEWOULDBLOCK maps to EWOULDBLOCK */ + /* WSAEINPROGRESS maps to EINPROGRESS */ + /* WSAEALREADY maps to EALREADY */ + /* WSAENOTSOCK maps to ENOTSOCK */ + /* WSAEDESTADDRREQ maps to EDESTADDRREQ */ + /* WSAEMSGSIZE maps to EMSGSIZE */ + /* WSAEPROTOTYPE maps to EPROTOTYPE */ + /* WSAENOPROTOOPT maps to ENOPROTOOPT */ + /* WSAEPROTONOSUPPORT maps to EPROTONOSUPPORT */ + /* WSAESOCKTNOSUPPORT is ESOCKTNOSUPPORT */ + /* WSAEOPNOTSUPP maps to EOPNOTSUPP */ + /* WSAEPFNOSUPPORT is EPFNOSUPPORT */ + /* WSAEAFNOSUPPORT maps to EAFNOSUPPORT */ + /* WSAEADDRINUSE maps to EADDRINUSE */ + /* WSAEADDRNOTAVAIL maps to EADDRNOTAVAIL */ + /* WSAENETDOWN maps to ENETDOWN */ + /* WSAENETUNREACH maps to ENETUNREACH */ + /* WSAENETRESET maps to ENETRESET */ + /* WSAECONNABORTED maps to ECONNABORTED */ + /* WSAECONNRESET maps to ECONNRESET */ + /* WSAENOBUFS maps to ENOBUFS */ + /* WSAEISCONN maps to EISCONN */ + /* WSAENOTCONN maps to ENOTCONN */ + /* WSAESHUTDOWN is ESHUTDOWN */ + /* WSAETOOMANYREFS is ETOOMANYREFS */ + /* WSAETIMEDOUT maps to ETIMEDOUT */ + /* WSAECONNREFUSED maps to ECONNREFUSED */ + /* WSAELOOP maps to ELOOP */ + /* WSAENAMETOOLONG maps to ENAMETOOLONG */ + /* WSAEHOSTDOWN is EHOSTDOWN */ + /* WSAEHOSTUNREACH maps to EHOSTUNREACH */ + /* WSAENOTEMPTY maps to ENOTEMPTY */ + /* WSAEPROCLIM is EPROCLIM */ + /* WSAEUSERS is EUSERS */ + /* WSAEDQUOT is EDQUOT */ + /* WSAESTALE is ESTALE */ + /* WSAEREMOTE is EREMOTE */ + case WSASYSNOTREADY: + return "Network subsystem is unavailable"; + case WSAVERNOTSUPPORTED: + return "Winsock.dll version out of range"; + case WSANOTINITIALISED: + return "Successful WSAStartup not yet performed"; + case WSAEDISCON: + return "Graceful shutdown in progress"; + case WSAENOMORE: case WSA_E_NO_MORE: + return "No more results"; + case WSAECANCELLED: case WSA_E_CANCELLED: + return "Call was canceled"; + case WSAEINVALIDPROCTABLE: + return "Procedure call table is invalid"; + case WSAEINVALIDPROVIDER: + return "Service provider is invalid"; + case WSAEPROVIDERFAILEDINIT: + return "Service provider failed to initialize"; + case WSASYSCALLFAILURE: + return "System call failure"; + case WSASERVICE_NOT_FOUND: + return "Service not found"; + case WSATYPE_NOT_FOUND: + return "Class type not found"; + case WSAEREFUSED: + return "Database query was refused"; + case WSAHOST_NOT_FOUND: + return "Host not found"; + case WSATRY_AGAIN: + return "Nonauthoritative host not found"; + case WSANO_RECOVERY: + return "Nonrecoverable error"; + case WSANO_DATA: + return "Valid name, no data record of requested type"; + /* WSA_QOS_* omitted */ +# endif +#endif + +#if GNULIB_defined_ENOMSG + case ENOMSG: + return "No message of desired type"; +#endif + +#if GNULIB_defined_EIDRM + case EIDRM: + return "Identifier removed"; +#endif + +#if GNULIB_defined_ENOLINK + case ENOLINK: + return "Link has been severed"; +#endif + +#if GNULIB_defined_EPROTO + case EPROTO: + return "Protocol error"; +#endif + +#if GNULIB_defined_EMULTIHOP + case EMULTIHOP: + return "Multihop attempted"; +#endif + +#if GNULIB_defined_EBADMSG + case EBADMSG: + return "Bad message"; +#endif + +#if GNULIB_defined_EOVERFLOW + case EOVERFLOW: + return "Value too large for defined data type"; +#endif + +#if GNULIB_defined_ENOTSUP + case ENOTSUP: + return "Not supported"; +#endif + +#if GNULIB_defined_ENETRESET + case ENETRESET: + return "Network dropped connection on reset"; +#endif + +#if GNULIB_defined_ECONNABORTED + case ECONNABORTED: + return "Software caused connection abort"; +#endif + +#if GNULIB_defined_ESTALE + case ESTALE: + return "Stale NFS file handle"; +#endif + +#if GNULIB_defined_EDQUOT + case EDQUOT: + return "Disk quota exceeded"; +#endif + +#if GNULIB_defined_ECANCELED + case ECANCELED: + return "Operation canceled"; +#endif + +#if GNULIB_defined_EOWNERDEAD + case EOWNERDEAD: + return "Owner died"; +#endif + +#if GNULIB_defined_ENOTRECOVERABLE + case ENOTRECOVERABLE: + return "State not recoverable"; +#endif + +#if GNULIB_defined_EILSEQ + case EILSEQ: + return "Invalid or incomplete multibyte or wide character"; +#endif + + default: + return NULL; + } +} diff --git a/gnulib-lib/strerror-override.h b/gnulib-lib/strerror-override.h new file mode 100644 index 0000000..03e98e3 --- /dev/null +++ b/gnulib-lib/strerror-override.h @@ -0,0 +1,56 @@ +/* strerror-override.h --- POSIX compatible system error routine + + Copyright (C) 2010-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _GL_STRERROR_OVERRIDE_H +# define _GL_STRERROR_OVERRIDE_H + +# include +# include + +/* Reasonable buffer size that should never trigger ERANGE; if this + proves too small, we intentionally abort(), to remind us to fix + this value. */ +# define STACKBUF_LEN 256 + +/* If ERRNUM maps to an errno value defined by gnulib, return a string + describing the error. Otherwise return NULL. */ +# if REPLACE_STRERROR_0 \ + || GNULIB_defined_ESOCK \ + || GNULIB_defined_ESTREAMS \ + || GNULIB_defined_EWINSOCK \ + || GNULIB_defined_ENOMSG \ + || GNULIB_defined_EIDRM \ + || GNULIB_defined_ENOLINK \ + || GNULIB_defined_EPROTO \ + || GNULIB_defined_EMULTIHOP \ + || GNULIB_defined_EBADMSG \ + || GNULIB_defined_EOVERFLOW \ + || GNULIB_defined_ENOTSUP \ + || GNULIB_defined_ENETRESET \ + || GNULIB_defined_ECONNABORTED \ + || GNULIB_defined_ESTALE \ + || GNULIB_defined_EDQUOT \ + || GNULIB_defined_ECANCELED \ + || GNULIB_defined_EOWNERDEAD \ + || GNULIB_defined_ENOTRECOVERABLE \ + || GNULIB_defined_EILSEQ +extern const char *strerror_override (int errnum) _GL_ATTRIBUTE_CONST; +# else +# define strerror_override(ignored) NULL +# endif + +#endif /* _GL_STRERROR_OVERRIDE_H */ diff --git a/gnulib-lib/strerror.c b/gnulib-lib/strerror.c new file mode 100644 index 0000000..83926df --- /dev/null +++ b/gnulib-lib/strerror.c @@ -0,0 +1,71 @@ +/* strerror.c --- POSIX compatible system error routine + + Copyright (C) 2007-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +/* Specification. */ +#include + +#include +#include +#include +#include + +#include "intprops.h" +#include "strerror-override.h" +#include "verify.h" + +/* Use the system functions, not the gnulib overrides in this file. */ +#undef sprintf + +char * +strerror (int n) +#undef strerror +{ + static char buf[STACKBUF_LEN]; + size_t len; + + /* Cast away const, due to the historical signature of strerror; + callers should not be modifying the string. */ + const char *msg = strerror_override (n); + if (msg) + return (char *) msg; + + msg = strerror (n); + + /* Our strerror_r implementation might use the system's strerror + buffer, so all other clients of strerror have to see the error + copied into a buffer that we manage. This is not thread-safe, + even if the system strerror is, but portable programs shouldn't + be using strerror if they care about thread-safety. */ + if (!msg || !*msg) + { + static char const fmt[] = "Unknown error %d"; + verify (sizeof buf >= sizeof (fmt) + INT_STRLEN_BOUND (n)); + sprintf (buf, fmt, n); + errno = EINVAL; + return buf; + } + + /* Fix STACKBUF_LEN if this ever aborts. */ + len = strlen (msg); + if (sizeof buf <= len) + abort (); + + memcpy (buf, msg, len + 1); + return buf; +} diff --git a/gnulib-lib/string.in.h b/gnulib-lib/string.in.h new file mode 100644 index 0000000..cb964bc --- /dev/null +++ b/gnulib-lib/string.in.h @@ -0,0 +1,1189 @@ +/* A GNU-like . + + Copyright (C) 1995-1996, 2001-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined _GL_ALREADY_INCLUDING_STRING_H +/* Special invocation convention: + - On OS X/NetBSD we have a sequence of nested includes + -> -> "string.h" + In this situation system _chk variants due to -D_FORTIFY_SOURCE + might be used after any replacements defined here. */ + +#@INCLUDE_NEXT@ @NEXT_STRING_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_STRING_H + +#define _GL_ALREADY_INCLUDING_STRING_H + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_STRING_H@ + +#undef _GL_ALREADY_INCLUDING_STRING_H + +#ifndef _@GUARD_PREFIX@_STRING_H +#define _@GUARD_PREFIX@_STRING_H + +/* NetBSD 5.0 mis-defines NULL. */ +#include + +/* MirBSD defines mbslen as a macro. */ +#if @GNULIB_MBSLEN@ && defined __MirBSD__ +# include +#endif + +/* The __attribute__ feature is available in gcc versions 2.5 and later. + The attribute __pure__ was added in gcc 2.96. */ +#ifndef _GL_ATTRIBUTE_PURE +# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) || defined __clang__ +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define _GL_ATTRIBUTE_PURE /* empty */ +# endif +#endif + +/* NetBSD 5.0 declares strsignal in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if (@GNULIB_STRSIGNAL@ || defined GNULIB_POSIXCHECK) && defined __NetBSD__ \ + && ! defined __GLIBC__ +# include +#endif + +/* AIX 7.2 declares ffsl and ffsll in , not in . */ +/* But in any case avoid namespace pollution on glibc systems. */ +#if ((@GNULIB_FFSL@ || @GNULIB_FFSLL@ || defined GNULIB_POSIXCHECK) \ + && defined _AIX) \ + && ! defined __GLIBC__ +# include +#endif + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +/* Clear a block of memory. The compiler will not delete a call to + this function, even if the block is dead after the call. */ +#if @GNULIB_EXPLICIT_BZERO@ +# if ! @HAVE_EXPLICIT_BZERO@ +_GL_FUNCDECL_SYS (explicit_bzero, void, + (void *__dest, size_t __n) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (explicit_bzero, void, (void *__dest, size_t __n)); +_GL_CXXALIASWARN (explicit_bzero); +#elif defined GNULIB_POSIXCHECK +# undef explicit_bzero +# if HAVE_RAW_DECL_EXPLICIT_BZERO +_GL_WARN_ON_USE (explicit_bzero, "explicit_bzero is unportable - " + "use gnulib module explicit_bzero for portability"); +# endif +#endif + +/* Find the index of the least-significant set bit. */ +#if @GNULIB_FFSL@ +# if !@HAVE_FFSL@ +_GL_FUNCDECL_SYS (ffsl, int, (long int i)); +# endif +_GL_CXXALIAS_SYS (ffsl, int, (long int i)); +_GL_CXXALIASWARN (ffsl); +#elif defined GNULIB_POSIXCHECK +# undef ffsl +# if HAVE_RAW_DECL_FFSL +_GL_WARN_ON_USE (ffsl, "ffsl is not portable - use the ffsl module"); +# endif +#endif + + +/* Find the index of the least-significant set bit. */ +#if @GNULIB_FFSLL@ +# if @REPLACE_FFSLL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define ffsll rpl_ffsll +# endif +_GL_FUNCDECL_RPL (ffsll, int, (long long int i)); +_GL_CXXALIAS_RPL (ffsll, int, (long long int i)); +# else +# if !@HAVE_FFSLL@ +_GL_FUNCDECL_SYS (ffsll, int, (long long int i)); +# endif +_GL_CXXALIAS_SYS (ffsll, int, (long long int i)); +# endif +_GL_CXXALIASWARN (ffsll); +#elif defined GNULIB_POSIXCHECK +# undef ffsll +# if HAVE_RAW_DECL_FFSLL +_GL_WARN_ON_USE (ffsll, "ffsll is not portable - use the ffsll module"); +# endif +#endif + + +#if @GNULIB_MDA_MEMCCPY@ +/* On native Windows, map 'memccpy' to '_memccpy', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::memccpy always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef memccpy +# define memccpy _memccpy +# endif +_GL_CXXALIAS_MDA (memccpy, void *, + (void *dest, const void *src, int c, size_t n)); +# else +_GL_CXXALIAS_SYS (memccpy, void *, + (void *dest, const void *src, int c, size_t n)); +# endif +_GL_CXXALIASWARN (memccpy); +#endif + + +/* Return the first instance of C within N bytes of S, or NULL. */ +#if @GNULIB_MEMCHR@ +# if @REPLACE_MEMCHR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef memchr +# define memchr rpl_memchr +# endif +_GL_FUNCDECL_RPL (memchr, void *, (void const *__s, int __c, size_t __n) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (memchr, void *, (void const *__s, int __c, size_t __n)); +# else + /* On some systems, this function is defined as an overloaded function: + extern "C" { const void * std::memchr (const void *, int, size_t); } + extern "C++" { void * std::memchr (void *, int, size_t); } */ +_GL_CXXALIAS_SYS_CAST2 (memchr, + void *, (void const *__s, int __c, size_t __n), + void const *, (void const *__s, int __c, size_t __n)); +# endif +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (memchr, void *, (void *__s, int __c, size_t __n)); +_GL_CXXALIASWARN1 (memchr, void const *, + (void const *__s, int __c, size_t __n)); +# elif __GLIBC__ >= 2 +_GL_CXXALIASWARN (memchr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef memchr +/* Assume memchr is always declared. */ +_GL_WARN_ON_USE (memchr, "memchr has platform-specific bugs - " + "use gnulib module memchr for portability" ); +#endif + +/* Return the first occurrence of NEEDLE in HAYSTACK. */ +#if @GNULIB_MEMMEM@ +# if @REPLACE_MEMMEM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define memmem rpl_memmem +# endif +_GL_FUNCDECL_RPL (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len)); +# else +# if ! @HAVE_DECL_MEMMEM@ +_GL_FUNCDECL_SYS (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 3))); +# endif +_GL_CXXALIAS_SYS (memmem, void *, + (void const *__haystack, size_t __haystack_len, + void const *__needle, size_t __needle_len)); +# endif +_GL_CXXALIASWARN (memmem); +#elif defined GNULIB_POSIXCHECK +# undef memmem +# if HAVE_RAW_DECL_MEMMEM +_GL_WARN_ON_USE (memmem, "memmem is unportable and often quadratic - " + "use gnulib module memmem-simple for portability, " + "and module memmem for speed" ); +# endif +#endif + +/* Copy N bytes of SRC to DEST, return pointer to bytes after the + last written byte. */ +#if @GNULIB_MEMPCPY@ +# if ! @HAVE_MEMPCPY@ +_GL_FUNCDECL_SYS (mempcpy, void *, + (void *restrict __dest, void const *restrict __src, + size_t __n) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (mempcpy, void *, + (void *restrict __dest, void const *restrict __src, + size_t __n)); +_GL_CXXALIASWARN (mempcpy); +#elif defined GNULIB_POSIXCHECK +# undef mempcpy +# if HAVE_RAW_DECL_MEMPCPY +_GL_WARN_ON_USE (mempcpy, "mempcpy is unportable - " + "use gnulib module mempcpy for portability"); +# endif +#endif + +/* Search backwards through a block for a byte (specified as an int). */ +#if @GNULIB_MEMRCHR@ +# if ! @HAVE_DECL_MEMRCHR@ +_GL_FUNCDECL_SYS (memrchr, void *, (void const *, int, size_t) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const void * std::memrchr (const void *, int, size_t); } + extern "C++" { void * std::memrchr (void *, int, size_t); } */ +_GL_CXXALIAS_SYS_CAST2 (memrchr, + void *, (void const *, int, size_t), + void const *, (void const *, int, size_t)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (memrchr, void *, (void *, int, size_t)); +_GL_CXXALIASWARN1 (memrchr, void const *, (void const *, int, size_t)); +# else +_GL_CXXALIASWARN (memrchr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef memrchr +# if HAVE_RAW_DECL_MEMRCHR +_GL_WARN_ON_USE (memrchr, "memrchr is unportable - " + "use gnulib module memrchr for portability"); +# endif +#endif + +/* Find the first occurrence of C in S. More efficient than + memchr(S,C,N), at the expense of undefined behavior if C does not + occur within N bytes. */ +#if @GNULIB_RAWMEMCHR@ +# if ! @HAVE_RAWMEMCHR@ +_GL_FUNCDECL_SYS (rawmemchr, void *, (void const *__s, int __c_in) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const void * std::rawmemchr (const void *, int); } + extern "C++" { void * std::rawmemchr (void *, int); } */ +_GL_CXXALIAS_SYS_CAST2 (rawmemchr, + void *, (void const *__s, int __c_in), + void const *, (void const *__s, int __c_in)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (rawmemchr, void *, (void *__s, int __c_in)); +_GL_CXXALIASWARN1 (rawmemchr, void const *, (void const *__s, int __c_in)); +# else +_GL_CXXALIASWARN (rawmemchr); +# endif +#elif defined GNULIB_POSIXCHECK +# undef rawmemchr +# if HAVE_RAW_DECL_RAWMEMCHR +_GL_WARN_ON_USE (rawmemchr, "rawmemchr is unportable - " + "use gnulib module rawmemchr for portability"); +# endif +#endif + +/* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ +#if @GNULIB_STPCPY@ +# if ! @HAVE_STPCPY@ +_GL_FUNCDECL_SYS (stpcpy, char *, + (char *restrict __dst, char const *restrict __src) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (stpcpy, char *, + (char *restrict __dst, char const *restrict __src)); +_GL_CXXALIASWARN (stpcpy); +#elif defined GNULIB_POSIXCHECK +# undef stpcpy +# if HAVE_RAW_DECL_STPCPY +_GL_WARN_ON_USE (stpcpy, "stpcpy is unportable - " + "use gnulib module stpcpy for portability"); +# endif +#endif + +/* Copy no more than N bytes of SRC to DST, returning a pointer past the + last non-NUL byte written into DST. */ +#if @GNULIB_STPNCPY@ +# if @REPLACE_STPNCPY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef stpncpy +# define stpncpy rpl_stpncpy +# endif +_GL_FUNCDECL_RPL (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n)); +# else +# if ! @HAVE_STPNCPY@ +_GL_FUNCDECL_SYS (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (stpncpy, char *, + (char *restrict __dst, char const *restrict __src, + size_t __n)); +# endif +_GL_CXXALIASWARN (stpncpy); +#elif defined GNULIB_POSIXCHECK +# undef stpncpy +# if HAVE_RAW_DECL_STPNCPY +_GL_WARN_ON_USE (stpncpy, "stpncpy is unportable - " + "use gnulib module stpncpy for portability"); +# endif +#endif + +#if defined GNULIB_POSIXCHECK +/* strchr() does not work with multibyte strings if the locale encoding is + GB18030 and the character to be searched is a digit. */ +# undef strchr +/* Assume strchr is always declared. */ +_GL_WARN_ON_USE_CXX (strchr, + const char *, char *, (const char *, int), + "strchr cannot work correctly on character strings " + "in some multibyte locales - " + "use mbschr if you care about internationalization"); +#endif + +/* Find the first occurrence of C in S or the final NUL byte. */ +#if @GNULIB_STRCHRNUL@ +# if @REPLACE_STRCHRNUL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strchrnul rpl_strchrnul +# endif +_GL_FUNCDECL_RPL (strchrnul, char *, (const char *__s, int __c_in) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strchrnul, char *, + (const char *str, int ch)); +# else +# if ! @HAVE_STRCHRNUL@ +_GL_FUNCDECL_SYS (strchrnul, char *, (char const *__s, int __c_in) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const char * std::strchrnul (const char *, int); } + extern "C++" { char * std::strchrnul (char *, int); } */ +_GL_CXXALIAS_SYS_CAST2 (strchrnul, + char *, (char const *__s, int __c_in), + char const *, (char const *__s, int __c_in)); +# endif +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strchrnul, char *, (char *__s, int __c_in)); +_GL_CXXALIASWARN1 (strchrnul, char const *, (char const *__s, int __c_in)); +# else +_GL_CXXALIASWARN (strchrnul); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strchrnul +# if HAVE_RAW_DECL_STRCHRNUL +_GL_WARN_ON_USE (strchrnul, "strchrnul is unportable - " + "use gnulib module strchrnul for portability"); +# endif +#endif + +/* Duplicate S, returning an identical malloc'd string. */ +#if @GNULIB_STRDUP@ +# if @REPLACE_STRDUP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strdup +# define strdup rpl_strdup +# endif +_GL_FUNCDECL_RPL (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strdup, char *, (char const *__s)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strdup +# define strdup _strdup +# endif +_GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); +# else +# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup + /* strdup exists as a function and as a macro. Get rid of the macro. */ +# undef strdup +# endif +# if !(@HAVE_DECL_STRDUP@ || defined strdup) +_GL_FUNCDECL_SYS (strdup, char *, (char const *__s) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); +# endif +_GL_CXXALIASWARN (strdup); +#elif defined GNULIB_POSIXCHECK +# undef strdup +# if HAVE_RAW_DECL_STRDUP +_GL_WARN_ON_USE (strdup, "strdup is unportable - " + "use gnulib module strdup for portability"); +# endif +#elif @GNULIB_MDA_STRDUP@ +/* On native Windows, map 'creat' to '_creat', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::strdup always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strdup +# define strdup _strdup +# endif +_GL_CXXALIAS_MDA (strdup, char *, (char const *__s)); +# else +# if defined __cplusplus && defined GNULIB_NAMESPACE && defined strdup +# undef strdup +# endif +_GL_CXXALIAS_SYS (strdup, char *, (char const *__s)); +# endif +_GL_CXXALIASWARN (strdup); +#endif + +/* Append no more than N characters from SRC onto DEST. */ +#if @GNULIB_STRNCAT@ +# if @REPLACE_STRNCAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strncat +# define strncat rpl_strncat +# endif +_GL_FUNCDECL_RPL (strncat, char *, + (char *restrict dest, const char *restrict src, size_t n) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strncat, char *, + (char *restrict dest, const char *restrict src, size_t n)); +# else +_GL_CXXALIAS_SYS (strncat, char *, + (char *restrict dest, const char *restrict src, size_t n)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strncat); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strncat +# if HAVE_RAW_DECL_STRNCAT +_GL_WARN_ON_USE (strncat, "strncat is unportable - " + "use gnulib module strncat for portability"); +# endif +#endif + +/* Return a newly allocated copy of at most N bytes of STRING. */ +#if @GNULIB_STRNDUP@ +# if @REPLACE_STRNDUP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strndup +# define strndup rpl_strndup +# endif +_GL_FUNCDECL_RPL (strndup, char *, (char const *__s, size_t __n) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strndup, char *, (char const *__s, size_t __n)); +# else +# if ! @HAVE_DECL_STRNDUP@ +_GL_FUNCDECL_SYS (strndup, char *, (char const *__s, size_t __n) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strndup, char *, (char const *__s, size_t __n)); +# endif +_GL_CXXALIASWARN (strndup); +#elif defined GNULIB_POSIXCHECK +# undef strndup +# if HAVE_RAW_DECL_STRNDUP +_GL_WARN_ON_USE (strndup, "strndup is unportable - " + "use gnulib module strndup for portability"); +# endif +#endif + +/* Find the length (number of bytes) of STRING, but scan at most + MAXLEN bytes. If no '\0' terminator is found in that many bytes, + return MAXLEN. */ +#if @GNULIB_STRNLEN@ +# if @REPLACE_STRNLEN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strnlen +# define strnlen rpl_strnlen +# endif +_GL_FUNCDECL_RPL (strnlen, size_t, (char const *__s, size_t __maxlen) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (strnlen, size_t, (char const *__s, size_t __maxlen)); +# else +# if ! @HAVE_DECL_STRNLEN@ +_GL_FUNCDECL_SYS (strnlen, size_t, (char const *__s, size_t __maxlen) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (strnlen, size_t, (char const *__s, size_t __maxlen)); +# endif +_GL_CXXALIASWARN (strnlen); +#elif defined GNULIB_POSIXCHECK +# undef strnlen +# if HAVE_RAW_DECL_STRNLEN +_GL_WARN_ON_USE (strnlen, "strnlen is unportable - " + "use gnulib module strnlen for portability"); +# endif +#endif + +#if defined GNULIB_POSIXCHECK +/* strcspn() assumes the second argument is a list of single-byte characters. + Even in this simple case, it does not work with multibyte strings if the + locale encoding is GB18030 and one of the characters to be searched is a + digit. */ +# undef strcspn +/* Assume strcspn is always declared. */ +_GL_WARN_ON_USE (strcspn, "strcspn cannot work correctly on character strings " + "in multibyte locales - " + "use mbscspn if you care about internationalization"); +#endif + +/* Find the first occurrence in S of any character in ACCEPT. */ +#if @GNULIB_STRPBRK@ +# if ! @HAVE_STRPBRK@ +_GL_FUNCDECL_SYS (strpbrk, char *, (char const *__s, char const *__accept) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C" { const char * strpbrk (const char *, const char *); } + extern "C++" { char * strpbrk (char *, const char *); } */ +_GL_CXXALIAS_SYS_CAST2 (strpbrk, + char *, (char const *__s, char const *__accept), + const char *, (char const *__s, char const *__accept)); +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strpbrk, char *, (char *__s, char const *__accept)); +_GL_CXXALIASWARN1 (strpbrk, char const *, + (char const *__s, char const *__accept)); +# elif __GLIBC__ >= 2 +_GL_CXXALIASWARN (strpbrk); +# endif +# if defined GNULIB_POSIXCHECK +/* strpbrk() assumes the second argument is a list of single-byte characters. + Even in this simple case, it does not work with multibyte strings if the + locale encoding is GB18030 and one of the characters to be searched is a + digit. */ +# undef strpbrk +_GL_WARN_ON_USE_CXX (strpbrk, + const char *, char *, (const char *, const char *), + "strpbrk cannot work correctly on character strings " + "in multibyte locales - " + "use mbspbrk if you care about internationalization"); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strpbrk +# if HAVE_RAW_DECL_STRPBRK +_GL_WARN_ON_USE_CXX (strpbrk, + const char *, char *, (const char *, const char *), + "strpbrk is unportable - " + "use gnulib module strpbrk for portability"); +# endif +#endif + +#if defined GNULIB_POSIXCHECK +/* strspn() assumes the second argument is a list of single-byte characters. + Even in this simple case, it cannot work with multibyte strings. */ +# undef strspn +/* Assume strspn is always declared. */ +_GL_WARN_ON_USE (strspn, "strspn cannot work correctly on character strings " + "in multibyte locales - " + "use mbsspn if you care about internationalization"); +#endif + +#if defined GNULIB_POSIXCHECK +/* strrchr() does not work with multibyte strings if the locale encoding is + GB18030 and the character to be searched is a digit. */ +# undef strrchr +/* Assume strrchr is always declared. */ +_GL_WARN_ON_USE_CXX (strrchr, + const char *, char *, (const char *, int), + "strrchr cannot work correctly on character strings " + "in some multibyte locales - " + "use mbsrchr if you care about internationalization"); +#endif + +/* Search the next delimiter (char listed in DELIM) starting at *STRINGP. + If one is found, overwrite it with a NUL, and advance *STRINGP + to point to the next char after it. Otherwise, set *STRINGP to NULL. + If *STRINGP was already NULL, nothing happens. + Return the old value of *STRINGP. + + This is a variant of strtok() that is multithread-safe and supports + empty fields. + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + Caveat: It doesn't work with multibyte strings unless all of the delimiter + characters are ASCII characters < 0x30. + + See also strtok_r(). */ +#if @GNULIB_STRSEP@ +# if ! @HAVE_STRSEP@ +_GL_FUNCDECL_SYS (strsep, char *, + (char **restrict __stringp, char const *restrict __delim) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (strsep, char *, + (char **restrict __stringp, char const *restrict __delim)); +_GL_CXXALIASWARN (strsep); +# if defined GNULIB_POSIXCHECK +# undef strsep +_GL_WARN_ON_USE (strsep, "strsep cannot work correctly on character strings " + "in multibyte locales - " + "use mbssep if you care about internationalization"); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strsep +# if HAVE_RAW_DECL_STRSEP +_GL_WARN_ON_USE (strsep, "strsep is unportable - " + "use gnulib module strsep for portability"); +# endif +#endif + +#if @GNULIB_STRSTR@ +# if @REPLACE_STRSTR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strstr rpl_strstr +# endif +_GL_FUNCDECL_RPL (strstr, char *, (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strstr, char *, (const char *haystack, const char *needle)); +# else + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const char * strstr (const char *, const char *); } + extern "C++" { char * strstr (char *, const char *); } */ +_GL_CXXALIAS_SYS_CAST2 (strstr, + char *, (const char *haystack, const char *needle), + const char *, (const char *haystack, const char *needle)); +# endif +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strstr, char *, (char *haystack, const char *needle)); +_GL_CXXALIASWARN1 (strstr, const char *, + (const char *haystack, const char *needle)); +# elif __GLIBC__ >= 2 +_GL_CXXALIASWARN (strstr); +# endif +#elif defined GNULIB_POSIXCHECK +/* strstr() does not work with multibyte strings if the locale encoding is + different from UTF-8: + POSIX says that it operates on "strings", and "string" in POSIX is defined + as a sequence of bytes, not of characters. */ +# undef strstr +/* Assume strstr is always declared. */ +_GL_WARN_ON_USE (strstr, "strstr is quadratic on many systems, and cannot " + "work correctly on character strings in most " + "multibyte locales - " + "use mbsstr if you care about internationalization, " + "or use strstr if you care about speed"); +#endif + +/* Find the first occurrence of NEEDLE in HAYSTACK, using case-insensitive + comparison. */ +#if @GNULIB_STRCASESTR@ +# if @REPLACE_STRCASESTR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strcasestr rpl_strcasestr +# endif +_GL_FUNCDECL_RPL (strcasestr, char *, + (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (strcasestr, char *, + (const char *haystack, const char *needle)); +# else +# if ! @HAVE_STRCASESTR@ +_GL_FUNCDECL_SYS (strcasestr, char *, + (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +# endif + /* On some systems, this function is defined as an overloaded function: + extern "C++" { const char * strcasestr (const char *, const char *); } + extern "C++" { char * strcasestr (char *, const char *); } */ +_GL_CXXALIAS_SYS_CAST2 (strcasestr, + char *, (const char *haystack, const char *needle), + const char *, (const char *haystack, const char *needle)); +# endif +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 10) && !defined __UCLIBC__) \ + && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) +_GL_CXXALIASWARN1 (strcasestr, char *, (char *haystack, const char *needle)); +_GL_CXXALIASWARN1 (strcasestr, const char *, + (const char *haystack, const char *needle)); +# else +_GL_CXXALIASWARN (strcasestr); +# endif +#elif defined GNULIB_POSIXCHECK +/* strcasestr() does not work with multibyte strings: + It is a glibc extension, and glibc implements it only for unibyte + locales. */ +# undef strcasestr +# if HAVE_RAW_DECL_STRCASESTR +_GL_WARN_ON_USE (strcasestr, "strcasestr does work correctly on character " + "strings in multibyte locales - " + "use mbscasestr if you care about " + "internationalization, or use c-strcasestr if you want " + "a locale independent function"); +# endif +#endif + +/* Parse S into tokens separated by characters in DELIM. + If S is NULL, the saved pointer in SAVE_PTR is used as + the next starting point. For example: + char s[] = "-abc-=-def"; + char *sp; + x = strtok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = strtok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = strtok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" + + This is a variant of strtok() that is multithread-safe. + + For the POSIX documentation for this function, see: + https://pubs.opengroup.org/onlinepubs/9699919799/functions/strtok.html + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + Caveat: It doesn't work with multibyte strings unless all of the delimiter + characters are ASCII characters < 0x30. + + See also strsep(). */ +#if @GNULIB_STRTOK_R@ +# if @REPLACE_STRTOK_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strtok_r +# define strtok_r rpl_strtok_r +# endif +_GL_FUNCDECL_RPL (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr) + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr)); +# else +# if @UNDEFINE_STRTOK_R@ || defined GNULIB_POSIXCHECK +# undef strtok_r +# endif +# if ! @HAVE_DECL_STRTOK_R@ +_GL_FUNCDECL_SYS (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr) + _GL_ARG_NONNULL ((2, 3))); +# endif +_GL_CXXALIAS_SYS (strtok_r, char *, + (char *restrict s, char const *restrict delim, + char **restrict save_ptr)); +# endif +_GL_CXXALIASWARN (strtok_r); +# if defined GNULIB_POSIXCHECK +_GL_WARN_ON_USE (strtok_r, "strtok_r cannot work correctly on character " + "strings in multibyte locales - " + "use mbstok_r if you care about internationalization"); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtok_r +# if HAVE_RAW_DECL_STRTOK_R +_GL_WARN_ON_USE (strtok_r, "strtok_r is unportable - " + "use gnulib module strtok_r for portability"); +# endif +#endif + + +/* The following functions are not specified by POSIX. They are gnulib + extensions. */ + +#if @GNULIB_MBSLEN@ +/* Return the number of multibyte characters in the character string STRING. + This considers multibyte characters, unlike strlen, which counts bytes. */ +# ifdef __MirBSD__ /* MirBSD defines mbslen as a macro. Override it. */ +# undef mbslen +# endif +# if @HAVE_MBSLEN@ /* AIX, OSF/1, MirBSD define mbslen already in libc. */ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbslen rpl_mbslen +# endif +_GL_FUNCDECL_RPL (mbslen, size_t, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mbslen, size_t, (const char *string)); +# else +_GL_FUNCDECL_SYS (mbslen, size_t, (const char *string) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (mbslen, size_t, (const char *string)); +# endif +_GL_CXXALIASWARN (mbslen); +#endif + +#if @GNULIB_MBSNLEN@ +/* Return the number of multibyte characters in the character string starting + at STRING and ending at STRING + LEN. */ +_GL_EXTERN_C size_t mbsnlen (const char *string, size_t len) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1)); +#endif + +#if @GNULIB_MBSCHR@ +/* Locate the first single-byte character C in the character string STRING, + and return a pointer to it. Return NULL if C is not found in STRING. + Unlike strchr(), this function works correctly in multibyte locales with + encodings such as GB18030. */ +# if defined __hpux +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbschr rpl_mbschr /* avoid collision with HP-UX function */ +# endif +_GL_FUNCDECL_RPL (mbschr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mbschr, char *, (const char *string, int c)); +# else +_GL_FUNCDECL_SYS (mbschr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (mbschr, char *, (const char *string, int c)); +# endif +_GL_CXXALIASWARN (mbschr); +#endif + +#if @GNULIB_MBSRCHR@ +/* Locate the last single-byte character C in the character string STRING, + and return a pointer to it. Return NULL if C is not found in STRING. + Unlike strrchr(), this function works correctly in multibyte locales with + encodings such as GB18030. */ +# if defined __hpux || defined __INTERIX +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbsrchr rpl_mbsrchr /* avoid collision with system function */ +# endif +_GL_FUNCDECL_RPL (mbsrchr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mbsrchr, char *, (const char *string, int c)); +# else +_GL_FUNCDECL_SYS (mbsrchr, char *, (const char *string, int c) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (mbsrchr, char *, (const char *string, int c)); +# endif +_GL_CXXALIASWARN (mbsrchr); +#endif + +#if @GNULIB_MBSSTR@ +/* Find the first occurrence of the character string NEEDLE in the character + string HAYSTACK. Return NULL if NEEDLE is not found in HAYSTACK. + Unlike strstr(), this function works correctly in multibyte locales with + encodings different from UTF-8. */ +_GL_EXTERN_C char * mbsstr (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSCASECMP@ +/* Compare the character strings S1 and S2, ignoring case, returning less than, + equal to or greater than zero if S1 is lexicographically less than, equal to + or greater than S2. + Note: This function may, in multibyte locales, return 0 for strings of + different lengths! + Unlike strcasecmp(), this function works correctly in multibyte locales. */ +_GL_EXTERN_C int mbscasecmp (const char *s1, const char *s2) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSNCASECMP@ +/* Compare the initial segment of the character string S1 consisting of at most + N characters with the initial segment of the character string S2 consisting + of at most N characters, ignoring case, returning less than, equal to or + greater than zero if the initial segment of S1 is lexicographically less + than, equal to or greater than the initial segment of S2. + Note: This function may, in multibyte locales, return 0 for initial segments + of different lengths! + Unlike strncasecmp(), this function works correctly in multibyte locales. + But beware that N is not a byte count but a character count! */ +_GL_EXTERN_C int mbsncasecmp (const char *s1, const char *s2, size_t n) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSPCASECMP@ +/* Compare the initial segment of the character string STRING consisting of + at most mbslen (PREFIX) characters with the character string PREFIX, + ignoring case. If the two match, return a pointer to the first byte + after this prefix in STRING. Otherwise, return NULL. + Note: This function may, in multibyte locales, return non-NULL if STRING + is of smaller length than PREFIX! + Unlike strncasecmp(), this function works correctly in multibyte + locales. */ +_GL_EXTERN_C char * mbspcasecmp (const char *string, const char *prefix) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSCASESTR@ +/* Find the first occurrence of the character string NEEDLE in the character + string HAYSTACK, using case-insensitive comparison. + Note: This function may, in multibyte locales, return success even if + strlen (haystack) < strlen (needle) ! + Unlike strcasestr(), this function works correctly in multibyte locales. */ +_GL_EXTERN_C char * mbscasestr (const char *haystack, const char *needle) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSCSPN@ +/* Find the first occurrence in the character string STRING of any character + in the character string ACCEPT. Return the number of bytes from the + beginning of the string to this occurrence, or to the end of the string + if none exists. + Unlike strcspn(), this function works correctly in multibyte locales. */ +_GL_EXTERN_C size_t mbscspn (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSPBRK@ +/* Find the first occurrence in the character string STRING of any character + in the character string ACCEPT. Return the pointer to it, or NULL if none + exists. + Unlike strpbrk(), this function works correctly in multibyte locales. */ +# if defined __hpux +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mbspbrk rpl_mbspbrk /* avoid collision with HP-UX function */ +# endif +_GL_FUNCDECL_RPL (mbspbrk, char *, (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (mbspbrk, char *, (const char *string, const char *accept)); +# else +_GL_FUNCDECL_SYS (mbspbrk, char *, (const char *string, const char *accept) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_SYS (mbspbrk, char *, (const char *string, const char *accept)); +# endif +_GL_CXXALIASWARN (mbspbrk); +#endif + +#if @GNULIB_MBSSPN@ +/* Find the first occurrence in the character string STRING of any character + not in the character string REJECT. Return the number of bytes from the + beginning of the string to this occurrence, or to the end of the string + if none exists. + Unlike strspn(), this function works correctly in multibyte locales. */ +_GL_EXTERN_C size_t mbsspn (const char *string, const char *reject) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSSEP@ +/* Search the next delimiter (multibyte character listed in the character + string DELIM) starting at the character string *STRINGP. + If one is found, overwrite it with a NUL, and advance *STRINGP to point + to the next multibyte character after it. Otherwise, set *STRINGP to NULL. + If *STRINGP was already NULL, nothing happens. + Return the old value of *STRINGP. + + This is a variant of mbstok_r() that supports empty fields. + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + + See also mbstok_r(). */ +_GL_EXTERN_C char * mbssep (char **stringp, const char *delim) + _GL_ARG_NONNULL ((1, 2)); +#endif + +#if @GNULIB_MBSTOK_R@ +/* Parse the character string STRING into tokens separated by characters in + the character string DELIM. + If STRING is NULL, the saved pointer in SAVE_PTR is used as + the next starting point. For example: + char s[] = "-abc-=-def"; + char *sp; + x = mbstok_r(s, "-", &sp); // x = "abc", sp = "=-def" + x = mbstok_r(NULL, "-=", &sp); // x = "def", sp = NULL + x = mbstok_r(NULL, "=", &sp); // x = NULL + // s = "abc\0-def\0" + + Caveat: It modifies the original string. + Caveat: These functions cannot be used on constant strings. + Caveat: The identity of the delimiting character is lost. + + See also mbssep(). */ +_GL_EXTERN_C char * mbstok_r (char *restrict string, const char *delim, + char **save_ptr) + _GL_ARG_NONNULL ((2, 3)); +#endif + +/* Map any int, typically from errno, into an error message. */ +#if @GNULIB_STRERROR@ +# if @REPLACE_STRERROR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strerror +# define strerror rpl_strerror +# endif +_GL_FUNCDECL_RPL (strerror, char *, (int)); +_GL_CXXALIAS_RPL (strerror, char *, (int)); +# else +_GL_CXXALIAS_SYS (strerror, char *, (int)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strerror); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strerror +/* Assume strerror is always declared. */ +_GL_WARN_ON_USE (strerror, "strerror is unportable - " + "use gnulib module strerror to guarantee non-NULL result"); +#endif + +/* Map any int, typically from errno, into an error message. Multithread-safe. + Uses the POSIX declaration, not the glibc declaration. */ +#if @GNULIB_STRERROR_R@ +# if @REPLACE_STRERROR_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strerror_r +# define strerror_r rpl_strerror_r +# endif +_GL_FUNCDECL_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (strerror_r, int, (int errnum, char *buf, size_t buflen)); +# else +# if !@HAVE_DECL_STRERROR_R@ +_GL_FUNCDECL_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (strerror_r, int, (int errnum, char *buf, size_t buflen)); +# endif +# if @HAVE_DECL_STRERROR_R@ +_GL_CXXALIASWARN (strerror_r); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strerror_r +# if HAVE_RAW_DECL_STRERROR_R +_GL_WARN_ON_USE (strerror_r, "strerror_r is unportable - " + "use gnulib module strerror_r-posix for portability"); +# endif +#endif + +/* Return the name of the system error code ERRNUM. */ +#if @GNULIB_STRERRORNAME_NP@ +# if @REPLACE_STRERRORNAME_NP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef strerrorname_np +# define strerrorname_np rpl_strerrorname_np +# endif +_GL_FUNCDECL_RPL (strerrorname_np, const char *, (int errnum)); +_GL_CXXALIAS_RPL (strerrorname_np, const char *, (int errnum)); +# else +# if !@HAVE_STRERRORNAME_NP@ +_GL_FUNCDECL_SYS (strerrorname_np, const char *, (int errnum)); +# endif +_GL_CXXALIAS_SYS (strerrorname_np, const char *, (int errnum)); +# endif +_GL_CXXALIASWARN (strerrorname_np); +#elif defined GNULIB_POSIXCHECK +# undef strerrorname_np +# if HAVE_RAW_DECL_STRERRORNAME_NP +_GL_WARN_ON_USE (strerrorname_np, "strerrorname_np is unportable - " + "use gnulib module strerrorname_np for portability"); +# endif +#endif + +/* Return an abbreviation string for the signal number SIG. */ +#if @GNULIB_SIGABBREV_NP@ +# if ! @HAVE_SIGABBREV_NP@ +_GL_FUNCDECL_SYS (sigabbrev_np, const char *, (int sig)); +# endif +_GL_CXXALIAS_SYS (sigabbrev_np, const char *, (int sig)); +_GL_CXXALIASWARN (sigabbrev_np); +#elif defined GNULIB_POSIXCHECK +# undef sigabbrev_np +# if HAVE_RAW_DECL_SIGABBREV_NP +_GL_WARN_ON_USE (sigabbrev_np, "sigabbrev_np is unportable - " + "use gnulib module sigabbrev_np for portability"); +# endif +#endif + +/* Return an English description string for the signal number SIG. */ +#if @GNULIB_SIGDESCR_NP@ +# if ! @HAVE_SIGDESCR_NP@ +_GL_FUNCDECL_SYS (sigdescr_np, const char *, (int sig)); +# endif +_GL_CXXALIAS_SYS (sigdescr_np, const char *, (int sig)); +_GL_CXXALIASWARN (sigdescr_np); +#elif defined GNULIB_POSIXCHECK +# undef sigdescr_np +# if HAVE_RAW_DECL_SIGDESCR_NP +_GL_WARN_ON_USE (sigdescr_np, "sigdescr_np is unportable - " + "use gnulib module sigdescr_np for portability"); +# endif +#endif + +#if @GNULIB_STRSIGNAL@ +# if @REPLACE_STRSIGNAL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strsignal rpl_strsignal +# endif +_GL_FUNCDECL_RPL (strsignal, char *, (int __sig)); +_GL_CXXALIAS_RPL (strsignal, char *, (int __sig)); +# else +# if ! @HAVE_DECL_STRSIGNAL@ +_GL_FUNCDECL_SYS (strsignal, char *, (int __sig)); +# endif +/* Need to cast, because on Cygwin 1.5.x systems, the return type is + 'const char *'. */ +_GL_CXXALIAS_SYS_CAST (strsignal, char *, (int __sig)); +# endif +_GL_CXXALIASWARN (strsignal); +#elif defined GNULIB_POSIXCHECK +# undef strsignal +# if HAVE_RAW_DECL_STRSIGNAL +_GL_WARN_ON_USE (strsignal, "strsignal is unportable - " + "use gnulib module strsignal for portability"); +# endif +#endif + +#if @GNULIB_STRVERSCMP@ +# if !@HAVE_STRVERSCMP@ +_GL_FUNCDECL_SYS (strverscmp, int, (const char *, const char *) + _GL_ATTRIBUTE_PURE + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (strverscmp, int, (const char *, const char *)); +_GL_CXXALIASWARN (strverscmp); +#elif defined GNULIB_POSIXCHECK +# undef strverscmp +# if HAVE_RAW_DECL_STRVERSCMP +_GL_WARN_ON_USE (strverscmp, "strverscmp is unportable - " + "use gnulib module strverscmp for portability"); +# endif +#endif + + +#endif /* _@GUARD_PREFIX@_STRING_H */ +#endif /* _@GUARD_PREFIX@_STRING_H */ +#endif diff --git a/gnulib-lib/sys_stat.in.h b/gnulib-lib/sys_stat.in.h new file mode 100644 index 0000000..babe3db --- /dev/null +++ b/gnulib-lib/sys_stat.in.h @@ -0,0 +1,928 @@ +/* Provide a more complete sys/stat.h header file. + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ + +/* This file is supposed to be used on platforms where is + incomplete. It is intended to provide definitions and prototypes + needed by an application. Start with what the system provides. */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_system_sys_stat_h +/* Special invocation convention. */ + +#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_SYS_STAT_H + +/* Get nlink_t. + May also define off_t to a 64-bit type on native Windows. */ +#include + +/* Get struct timespec. */ +#include + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ + +#ifndef _@GUARD_PREFIX@_SYS_STAT_H +#define _@GUARD_PREFIX@_SYS_STAT_H + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* Before doing "#define mknod rpl_mknod" below, we need to include all + headers that may declare mknod(). OS/2 kLIBC declares mknod() in + , not in . */ +#ifdef __KLIBC__ +# include +#endif + +/* Before doing "#define mkdir rpl_mkdir" below, we need to include all + headers that may declare mkdir(). Native Windows platforms declare mkdir + in and/or , not in . */ +#if defined _WIN32 && ! defined __CYGWIN__ +# include /* mingw32, mingw64 */ +# include /* mingw64, MSVC 9 */ +#endif + +/* Native Windows platforms declare umask() in . */ +#if 0 && (defined _WIN32 && ! defined __CYGWIN__) +# include +#endif + +/* Large File Support on native Windows. */ +#if @WINDOWS_64_BIT_ST_SIZE@ +# define stat _stati64 +#endif + +/* Optionally, override 'struct stat' on native Windows. */ +#if @GNULIB_OVERRIDES_STRUCT_STAT@ + +# undef stat +# if @GNULIB_STAT@ +# define stat rpl_stat +# else + /* Provoke a clear link error if stat() is used as a function and + module 'stat' is not in use. */ +# define stat stat_used_without_requesting_gnulib_module_stat +# endif + +# if !GNULIB_defined_struct_stat +struct stat +{ + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; +# if 0 + uid_t st_uid; +# else /* uid_t is not defined by default on native Windows. */ + short st_uid; +# endif +# if 0 + gid_t st_gid; +# else /* gid_t is not defined by default on native Windows. */ + short st_gid; +# endif + dev_t st_rdev; + off_t st_size; +# if 0 + blksize_t st_blksize; + blkcnt_t st_blocks; +# endif + +# if @WINDOWS_STAT_TIMESPEC@ + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; +# else + time_t st_atime; + time_t st_mtime; + time_t st_ctime; +# endif +}; +# if @WINDOWS_STAT_TIMESPEC@ +# define st_atime st_atim.tv_sec +# define st_mtime st_mtim.tv_sec +# define st_ctime st_ctim.tv_sec + /* Indicator, for gnulib internal purposes. */ +# define _GL_WINDOWS_STAT_TIMESPEC 1 +# endif +# define GNULIB_defined_struct_stat 1 +# endif + +/* Other possible values of st_mode. */ +# if 0 +# define _S_IFBLK 0x6000 +# endif +# if 0 +# define _S_IFLNK 0xA000 +# endif +# if 0 +# define _S_IFSOCK 0xC000 +# endif + +#endif + +#ifndef S_IFIFO +# ifdef _S_IFIFO +# define S_IFIFO _S_IFIFO +# endif +#endif + +#ifndef S_IFMT +# define S_IFMT 0170000 +#endif + +#if STAT_MACROS_BROKEN +# undef S_ISBLK +# undef S_ISCHR +# undef S_ISDIR +# undef S_ISFIFO +# undef S_ISLNK +# undef S_ISNAM +# undef S_ISMPB +# undef S_ISMPC +# undef S_ISNWK +# undef S_ISREG +# undef S_ISSOCK +#endif + +#ifndef S_ISBLK +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) 0 +# endif +#endif + +#ifndef S_ISCHR +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) 0 +# endif +#endif + +#ifndef S_ISDIR +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) 0 +# endif +#endif + +#ifndef S_ISDOOR /* Solaris 2.5 and up */ +# define S_ISDOOR(m) 0 +#endif + +#ifndef S_ISFIFO +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) 0 +# endif +#endif + +#ifndef S_ISLNK +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) 0 +# endif +#endif + +#ifndef S_ISMPB /* V7 */ +# ifdef S_IFMPB +# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) +# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) +# else +# define S_ISMPB(m) 0 +# define S_ISMPC(m) 0 +# endif +#endif + +#ifndef S_ISMPX /* AIX */ +# define S_ISMPX(m) 0 +#endif + +#ifndef S_ISNAM /* Xenix */ +# ifdef S_IFNAM +# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) +# else +# define S_ISNAM(m) 0 +# endif +#endif + +#ifndef S_ISNWK /* HP/UX */ +# ifdef S_IFNWK +# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) +# else +# define S_ISNWK(m) 0 +# endif +#endif + +#ifndef S_ISPORT /* Solaris 10 and up */ +# define S_ISPORT(m) 0 +#endif + +#ifndef S_ISREG +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) 0 +# endif +#endif + +#ifndef S_ISSOCK +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) 0 +# endif +#endif + + +#ifndef S_TYPEISMQ +# define S_TYPEISMQ(p) 0 +#endif + +#ifndef S_TYPEISTMO +# define S_TYPEISTMO(p) 0 +#endif + + +#ifndef S_TYPEISSEM +# ifdef S_INSEM +# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) +# else +# define S_TYPEISSEM(p) 0 +# endif +#endif + +#ifndef S_TYPEISSHM +# ifdef S_INSHD +# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) +# else +# define S_TYPEISSHM(p) 0 +# endif +#endif + +/* high performance ("contiguous data") */ +#ifndef S_ISCTG +# define S_ISCTG(p) 0 +#endif + +/* Cray DMF (data migration facility): off line, with data */ +#ifndef S_ISOFD +# define S_ISOFD(p) 0 +#endif + +/* Cray DMF (data migration facility): off line, with no data */ +#ifndef S_ISOFL +# define S_ISOFL(p) 0 +#endif + +/* 4.4BSD whiteout */ +#ifndef S_ISWHT +# define S_ISWHT(m) 0 +#endif + +/* If any of the following are undefined, + define them to their de facto standard values. */ +#if !S_ISUID +# define S_ISUID 04000 +#endif +#if !S_ISGID +# define S_ISGID 02000 +#endif + +/* S_ISVTX is a common extension to POSIX. */ +#ifndef S_ISVTX +# define S_ISVTX 01000 +#endif + +#if !S_IRUSR && S_IREAD +# define S_IRUSR S_IREAD +#endif +#if !S_IRUSR +# define S_IRUSR 00400 +#endif +#if !S_IRGRP +# define S_IRGRP (S_IRUSR >> 3) +#endif +#if !S_IROTH +# define S_IROTH (S_IRUSR >> 6) +#endif + +#if !S_IWUSR && S_IWRITE +# define S_IWUSR S_IWRITE +#endif +#if !S_IWUSR +# define S_IWUSR 00200 +#endif +#if !S_IWGRP +# define S_IWGRP (S_IWUSR >> 3) +#endif +#if !S_IWOTH +# define S_IWOTH (S_IWUSR >> 6) +#endif + +#if !S_IXUSR && S_IEXEC +# define S_IXUSR S_IEXEC +#endif +#if !S_IXUSR +# define S_IXUSR 00100 +#endif +#if !S_IXGRP +# define S_IXGRP (S_IXUSR >> 3) +#endif +#if !S_IXOTH +# define S_IXOTH (S_IXUSR >> 6) +#endif + +#if !S_IRWXU +# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) +#endif +#if !S_IRWXG +# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) +#endif +#if !S_IRWXO +# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) +#endif + +/* Although S_IXUGO and S_IRWXUGO are not specified by POSIX and are + not implemented in GNU/Linux, some Gnulib-using apps use the macros. */ +#if !S_IXUGO +# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) +#endif +#ifndef S_IRWXUGO +# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) +#endif + +/* Macros for futimens and utimensat. */ +#ifndef UTIME_NOW +# define UTIME_NOW (-1) +# define UTIME_OMIT (-2) +#endif + + +#if @GNULIB_MDA_CHMOD@ +/* On native Windows, map 'chmod' to '_chmod', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::chmod always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef chmod +# define chmod _chmod +# endif +/* Need to cast, because in mingw the last argument is 'int mode'. */ +_GL_CXXALIAS_MDA_CAST (chmod, int, (const char *filename, mode_t mode)); +# else +_GL_CXXALIAS_SYS (chmod, int, (const char *filename, mode_t mode)); +# endif +_GL_CXXALIASWARN (chmod); +#endif + + +#if @GNULIB_FCHMODAT@ +# if @REPLACE_FCHMODAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fchmodat +# define fchmodat rpl_fchmodat +# endif +_GL_FUNCDECL_RPL (fchmodat, int, + (int fd, char const *file, mode_t mode, int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (fchmodat, int, + (int fd, char const *file, mode_t mode, int flag)); +# else +# if !@HAVE_FCHMODAT@ +_GL_FUNCDECL_SYS (fchmodat, int, + (int fd, char const *file, mode_t mode, int flag) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (fchmodat, int, + (int fd, char const *file, mode_t mode, int flag)); +# endif +_GL_CXXALIASWARN (fchmodat); +#elif defined GNULIB_POSIXCHECK +# undef fchmodat +# if HAVE_RAW_DECL_FCHMODAT +_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " + "use gnulib module openat for portability"); +# endif +#endif + + +#if @GNULIB_FSTAT@ +# if @REPLACE_FSTAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fstat +# define fstat rpl_fstat +# endif +_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); +# else +_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (fstat); +# endif +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +# undef fstat +# define fstat fstat_used_without_requesting_gnulib_module_fstat +#elif @WINDOWS_64_BIT_ST_SIZE@ +/* Above, we define stat to _stati64. */ +# define fstat _fstati64 +#elif defined GNULIB_POSIXCHECK +# undef fstat +# if HAVE_RAW_DECL_FSTAT +_GL_WARN_ON_USE (fstat, "fstat has portability problems - " + "use gnulib module fstat for portability"); +# endif +#endif + + +#if @GNULIB_FSTATAT@ +# if @REPLACE_FSTATAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fstatat +# define fstatat rpl_fstatat +# endif +_GL_FUNCDECL_RPL (fstatat, int, + (int fd, char const *restrict name, struct stat *restrict st, + int flags) + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (fstatat, int, + (int fd, char const *restrict name, struct stat *restrict st, + int flags)); +# else +# if !@HAVE_FSTATAT@ +_GL_FUNCDECL_SYS (fstatat, int, + (int fd, char const *restrict name, struct stat *restrict st, + int flags) + _GL_ARG_NONNULL ((2, 3))); +# endif +_GL_CXXALIAS_SYS (fstatat, int, + (int fd, char const *restrict name, struct stat *restrict st, + int flags)); +# endif +_GL_CXXALIASWARN (fstatat); +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +# undef fstatat +# define fstatat fstatat_used_without_requesting_gnulib_module_fstatat +#elif defined GNULIB_POSIXCHECK +# undef fstatat +# if HAVE_RAW_DECL_FSTATAT +_GL_WARN_ON_USE (fstatat, "fstatat is not portable - " + "use gnulib module openat for portability"); +# endif +#endif + + +#if @GNULIB_FUTIMENS@ +/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our futimens + implementation relies on futimesat, which on Solaris 10 makes an invocation + to futimens that is meant to invoke the libc's futimens(), not gnulib's + futimens(). */ +# if @REPLACE_FUTIMENS@ || (!@HAVE_FUTIMENS@ && defined __sun) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef futimens +# define futimens rpl_futimens +# endif +_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); +_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); +# else +# if !@HAVE_FUTIMENS@ +_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); +# endif +_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); +# endif +# if @HAVE_FUTIMENS@ +_GL_CXXALIASWARN (futimens); +# endif +#elif defined GNULIB_POSIXCHECK +# undef futimens +# if HAVE_RAW_DECL_FUTIMENS +_GL_WARN_ON_USE (futimens, "futimens is not portable - " + "use gnulib module futimens for portability"); +# endif +#endif + + +#if @GNULIB_GETUMASK@ +# if !@HAVE_GETUMASK@ +_GL_FUNCDECL_SYS (getumask, mode_t, (void)); +# endif +_GL_CXXALIAS_SYS (getumask, mode_t, (void)); +# if @HAVE_GETUMASK@ +_GL_CXXALIASWARN (getumask); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getumask +# if HAVE_RAW_DECL_GETUMASK +_GL_WARN_ON_USE (getumask, "getumask is not portable - " + "use gnulib module getumask for portability"); +# endif +#endif + + +#if @GNULIB_LCHMOD@ +/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME + denotes a symbolic link. */ +# if !@HAVE_LCHMOD@ || defined __hpux +_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); +_GL_CXXALIASWARN (lchmod); +#elif defined GNULIB_POSIXCHECK +# undef lchmod +# if HAVE_RAW_DECL_LCHMOD +_GL_WARN_ON_USE (lchmod, "lchmod is unportable - " + "use gnulib module lchmod for portability"); +# endif +#endif + + +#if @GNULIB_LSTAT@ +# if ! @HAVE_LSTAT@ +/* mingw does not support symlinks, therefore it does not have lstat. But + without links, stat does just fine. */ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define lstat stat +# endif +_GL_CXXALIAS_RPL_1 (lstat, stat, int, + (const char *restrict name, struct stat *restrict buf)); +# elif @REPLACE_LSTAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef lstat +# define lstat rpl_lstat +# endif +_GL_FUNCDECL_RPL (lstat, int, + (const char *restrict name, struct stat *restrict buf) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (lstat, int, + (const char *restrict name, struct stat *restrict buf)); +# else +_GL_CXXALIAS_SYS (lstat, int, + (const char *restrict name, struct stat *restrict buf)); +# endif +# if @HAVE_LSTAT@ +_GL_CXXALIASWARN (lstat); +# endif +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +# undef lstat +# define lstat lstat_used_without_requesting_gnulib_module_lstat +#elif defined GNULIB_POSIXCHECK +# undef lstat +# if HAVE_RAW_DECL_LSTAT +_GL_WARN_ON_USE (lstat, "lstat is unportable - " + "use gnulib module lstat for portability"); +# endif +#endif + + +#if @GNULIB_MKDIR@ +# if @REPLACE_MKDIR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mkdir +# define mkdir rpl_mkdir +# endif +_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); +# elif defined _WIN32 && !defined __CYGWIN__ +/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. + Additionally, it declares _mkdir (and depending on compile flags, an + alias mkdir), only in the nonstandard includes and , + which are included above. */ +# if !GNULIB_defined_rpl_mkdir +static int +rpl_mkdir (char const *name, mode_t mode) +{ + return _mkdir (name); +} +# define GNULIB_defined_rpl_mkdir 1 +# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mkdir +# define mkdir rpl_mkdir +# endif +_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); +# else +_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); +# endif +_GL_CXXALIASWARN (mkdir); +#elif defined GNULIB_POSIXCHECK +# undef mkdir +# if HAVE_RAW_DECL_MKDIR +_GL_WARN_ON_USE (mkdir, "mkdir does not always support two parameters - " + "use gnulib module mkdir for portability"); +# endif +#elif @GNULIB_MDA_MKDIR@ +/* On native Windows, map 'mkdir' to '_mkdir', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::mkdir always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !GNULIB_defined_rpl_mkdir +static int +rpl_mkdir (char const *name, mode_t mode) +{ + return _mkdir (name); +} +# define GNULIB_defined_rpl_mkdir 1 +# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mkdir +# define mkdir rpl_mkdir +# endif +_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); +# else +_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); +# endif +_GL_CXXALIASWARN (mkdir); +#endif + + +#if @GNULIB_MKDIRAT@ +# if !@HAVE_MKDIRAT@ +_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); +_GL_CXXALIASWARN (mkdirat); +#elif defined GNULIB_POSIXCHECK +# undef mkdirat +# if HAVE_RAW_DECL_MKDIRAT +_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " + "use gnulib module openat for portability"); +# endif +#endif + + +#if @GNULIB_MKFIFO@ +# if @REPLACE_MKFIFO@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mkfifo +# define mkfifo rpl_mkfifo +# endif +_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); +# else +# if !@HAVE_MKFIFO@ +_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); +# endif +_GL_CXXALIASWARN (mkfifo); +#elif defined GNULIB_POSIXCHECK +# undef mkfifo +# if HAVE_RAW_DECL_MKFIFO +_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " + "use gnulib module mkfifo for portability"); +# endif +#endif + + +#if @GNULIB_MKFIFOAT@ +# if @REPLACE_MKFIFOAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mkfifoat +# define mkfifoat rpl_mkfifoat +# endif +_GL_FUNCDECL_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (mkfifoat, int, (int fd, char const *file, mode_t mode)); +# else +# if !@HAVE_MKFIFOAT@ +_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); +# endif +_GL_CXXALIASWARN (mkfifoat); +#elif defined GNULIB_POSIXCHECK +# undef mkfifoat +# if HAVE_RAW_DECL_MKFIFOAT +_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " + "use gnulib module mkfifoat for portability"); +# endif +#endif + + +#if @GNULIB_MKNOD@ +# if @REPLACE_MKNOD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mknod +# define mknod rpl_mknod +# endif +_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); +# else +# if !@HAVE_MKNOD@ +_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) + _GL_ARG_NONNULL ((1))); +# endif +/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ +_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev)); +# endif +_GL_CXXALIASWARN (mknod); +#elif defined GNULIB_POSIXCHECK +# undef mknod +# if HAVE_RAW_DECL_MKNOD +_GL_WARN_ON_USE (mknod, "mknod is not portable - " + "use gnulib module mknod for portability"); +# endif +#endif + + +#if @GNULIB_MKNODAT@ +# if @REPLACE_MKNODAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mknodat +# define mknodat rpl_mknodat +# endif +_GL_FUNCDECL_RPL (mknodat, int, + (int fd, char const *file, mode_t mode, dev_t dev) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (mknodat, int, + (int fd, char const *file, mode_t mode, dev_t dev)); +# else +# if !@HAVE_MKNODAT@ +_GL_FUNCDECL_SYS (mknodat, int, + (int fd, char const *file, mode_t mode, dev_t dev) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mknodat, int, + (int fd, char const *file, mode_t mode, dev_t dev)); +# endif +_GL_CXXALIASWARN (mknodat); +#elif defined GNULIB_POSIXCHECK +# undef mknodat +# if HAVE_RAW_DECL_MKNODAT +_GL_WARN_ON_USE (mknodat, "mknodat is not portable - " + "use gnulib module mkfifoat for portability"); +# endif +#endif + + +#if @GNULIB_STAT@ +# if @REPLACE_STAT@ +# if !@GNULIB_OVERRIDES_STRUCT_STAT@ + /* We can't use the object-like #define stat rpl_stat, because of + struct stat. This means that rpl_stat will not be used if the user + does (stat)(a,b). Oh well. */ +# if defined _AIX && defined stat && defined _LARGE_FILES + /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, + so we have to replace stat64() instead of stat(). */ +# undef stat64 +# define stat64(name, st) rpl_stat (name, st) +# elif @WINDOWS_64_BIT_ST_SIZE@ + /* Above, we define stat to _stati64. */ +# if defined __MINGW32__ && defined _stati64 +# ifndef _USE_32BIT_TIME_T + /* The system headers define _stati64 to _stat64. */ +# undef _stat64 +# define _stat64(name, st) rpl_stat (name, st) +# endif +# elif defined _MSC_VER && defined _stati64 +# ifdef _USE_32BIT_TIME_T + /* The system headers define _stati64 to _stat32i64. */ +# undef _stat32i64 +# define _stat32i64(name, st) rpl_stat (name, st) +# else + /* The system headers define _stati64 to _stat64. */ +# undef _stat64 +# define _stat64(name, st) rpl_stat (name, st) +# endif +# else +# undef _stati64 +# define _stati64(name, st) rpl_stat (name, st) +# endif +# elif defined __MINGW32__ && defined stat +# ifdef _USE_32BIT_TIME_T + /* The system headers define stat to _stat32i64. */ +# undef _stat32i64 +# define _stat32i64(name, st) rpl_stat (name, st) +# else + /* The system headers define stat to _stat64. */ +# undef _stat64 +# define _stat64(name, st) rpl_stat (name, st) +# endif +# elif defined _MSC_VER && defined stat +# ifdef _USE_32BIT_TIME_T + /* The system headers define stat to _stat32. */ +# undef _stat32 +# define _stat32(name, st) rpl_stat (name, st) +# else + /* The system headers define stat to _stat64i32. */ +# undef _stat64i32 +# define _stat64i32(name, st) rpl_stat (name, st) +# endif +# else /* !(_AIX || __MINGW32__ || _MSC_VER) */ +# undef stat +# define stat(name, st) rpl_stat (name, st) +# endif /* !_LARGE_FILES */ +# endif /* !@GNULIB_OVERRIDES_STRUCT_STAT@ */ +_GL_EXTERN_C int stat (const char *restrict name, struct stat *restrict buf) + _GL_ARG_NONNULL ((1, 2)); +# endif +#elif @GNULIB_OVERRIDES_STRUCT_STAT@ +/* see above: + #define stat stat_used_without_requesting_gnulib_module_stat + */ +#elif defined GNULIB_POSIXCHECK +# undef stat +# if HAVE_RAW_DECL_STAT +_GL_WARN_ON_USE (stat, "stat is unportable - " + "use gnulib module stat for portability"); +# endif +#endif + + +#if @GNULIB_MDA_UMASK@ +/* On native Windows, map 'umask' to '_umask', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::umask always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef umask +# define umask _umask +# endif +/* Need to cast, because in mingw the last argument is 'int mode'. */ +_GL_CXXALIAS_MDA_CAST (umask, mode_t, (mode_t mask)); +# else +_GL_CXXALIAS_SYS (umask, mode_t, (mode_t mask)); +# endif +_GL_CXXALIASWARN (umask); +#endif + + +#if @GNULIB_UTIMENSAT@ +/* Use the rpl_ prefix also on Solaris <= 9, because on Solaris 9 our utimensat + implementation relies on futimesat, which on Solaris 10 makes an invocation + to utimensat that is meant to invoke the libc's utimensat(), not gnulib's + utimensat(). */ +# if @REPLACE_UTIMENSAT@ || (!@HAVE_UTIMENSAT@ && defined __sun) +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef utimensat +# define utimensat rpl_utimensat +# endif +_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, + struct timespec const times[2], int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, + struct timespec const times[2], int flag)); +# else +# if !@HAVE_UTIMENSAT@ +_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, + struct timespec const times[2], int flag) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, + struct timespec const times[2], int flag)); +# endif +# if @HAVE_UTIMENSAT@ +_GL_CXXALIASWARN (utimensat); +# endif +#elif defined GNULIB_POSIXCHECK +# undef utimensat +# if HAVE_RAW_DECL_UTIMENSAT +_GL_WARN_ON_USE (utimensat, "utimensat is not portable - " + "use gnulib module utimensat for portability"); +# endif +#endif + + +#endif /* _@GUARD_PREFIX@_SYS_STAT_H */ +#endif /* _@GUARD_PREFIX@_SYS_STAT_H */ +#endif diff --git a/gnulib-lib/sys_types.in.h b/gnulib-lib/sys_types.in.h new file mode 100644 index 0000000..2079d72 --- /dev/null +++ b/gnulib-lib/sys_types.in.h @@ -0,0 +1,106 @@ +/* Provide a more complete sys/types.h. + + Copyright (C) 2011-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined _WIN32 && !defined __CYGWIN__ \ + && (defined __need_off_t || defined __need___off64_t \ + || defined __need_ssize_t || defined __need_time_t) + +/* Special invocation convention inside mingw header files. */ + +#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _@GUARD_PREFIX@_SYS_TYPES_H + +/* The include_next requires a split double-inclusion guard. */ +# define _GL_INCLUDING_SYS_TYPES_H +#@INCLUDE_NEXT@ @NEXT_SYS_TYPES_H@ +# undef _GL_INCLUDING_SYS_TYPES_H + +#ifndef _@GUARD_PREFIX@_SYS_TYPES_H +#define _@GUARD_PREFIX@_SYS_TYPES_H + +/* Override off_t if Large File Support is requested on native Windows. */ +#if @WINDOWS_64_BIT_OFF_T@ +/* Same as int64_t in . */ +# if defined _MSC_VER +# define off_t __int64 +# else +# define off_t long long int +# endif +/* Indicator, for gnulib internal purposes. */ +# define _GL_WINDOWS_64_BIT_OFF_T 1 +#endif + +/* Override dev_t and ino_t if distinguishable inodes support is requested + on native Windows. */ +#if @WINDOWS_STAT_INODES@ + +# if @WINDOWS_STAT_INODES@ == 2 +/* Experimental, not useful in Windows 10. */ + +/* Define dev_t to a 64-bit type. */ +# if !defined GNULIB_defined_dev_t +typedef unsigned long long int rpl_dev_t; +# undef dev_t +# define dev_t rpl_dev_t +# define GNULIB_defined_dev_t 1 +# endif + +/* Define ino_t to a 128-bit type. */ +# if !defined GNULIB_defined_ino_t +/* MSVC does not have a 128-bit integer type. + GCC has a 128-bit integer type __int128, but only on 64-bit targets. */ +typedef struct { unsigned long long int _gl_ino[2]; } rpl_ino_t; +# undef ino_t +# define ino_t rpl_ino_t +# define GNULIB_defined_ino_t 1 +# endif + +# else /* @WINDOWS_STAT_INODES@ == 1 */ + +/* Define ino_t to a 64-bit type. */ +# if !defined GNULIB_defined_ino_t +typedef unsigned long long int rpl_ino_t; +# undef ino_t +# define ino_t rpl_ino_t +# define GNULIB_defined_ino_t 1 +# endif + +# endif + +/* Indicator, for gnulib internal purposes. */ +# define _GL_WINDOWS_STAT_INODES @WINDOWS_STAT_INODES@ + +#endif + +/* MSVC 9 defines size_t in , not in . */ +/* But avoid namespace pollution on glibc systems. */ +#if (defined _WIN32 && ! defined __CYGWIN__) && ! defined __GLIBC__ +# include +#endif + +#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ +#endif /* _@GUARD_PREFIX@_SYS_TYPES_H */ +#endif /* __need_XXX */ diff --git a/gnulib-lib/thread-optim.h b/gnulib-lib/thread-optim.h new file mode 100644 index 0000000..0a4ba16 --- /dev/null +++ b/gnulib-lib/thread-optim.h @@ -0,0 +1,60 @@ +/* Optimization of multithreaded code. + + Copyright (C) 2020-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2020. */ + +#ifndef _THREAD_OPTIM_H +#define _THREAD_OPTIM_H + +/* This file defines a way to optimize multithreaded code for the single-thread + case, based on the variable '__libc_single_threaded', defined in + glibc >= 2.32. */ + +/* Typical use: In a block or function, use + + bool mt = gl_multithreaded (); + ... + if (mt) + if (pthread_mutex_lock (&lock)) abort (); + ... + if (mt) + if (pthread_mutex_unlock (&lock)) abort (); + + The gl_multithreaded () invocation determines whether the program currently + is multithreaded. + + if (mt) STATEMENT executes STATEMENT in the multithreaded case, and skips + it in the single-threaded case. + + The code between the gl_multithreaded () invocation and any use of the + variable 'mt' must not create threads or invoke functions that may + indirectly create threads (e.g. 'dlopen' may, indirectly through C++ + initializers of global variables in the shared library being opened, + create threads). + + The lock here is meant to synchronize threads in the same process. The + same optimization cannot be applied to locks that synchronize different + processes (e.g. through shared memory mappings). */ + +#if HAVE_SYS_SINGLE_THREADED_H /* glibc >= 2.32 */ +# include +# define gl_multithreaded() !__libc_single_threaded +#else +# define gl_multithreaded() 1 +#endif + +#endif /* _THREAD_OPTIM_H */ diff --git a/gnulib-lib/time.in.h b/gnulib-lib/time.in.h new file mode 100644 index 0000000..a73fe59 --- /dev/null +++ b/gnulib-lib/time.in.h @@ -0,0 +1,441 @@ +/* A more-standard . + + Copyright (C) 2007-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* Don't get in the way of glibc when it includes time.h merely to + declare a few standard symbols, rather than to declare all the + symbols. (However, skip this for MinGW as it treats __need_time_t + incompatibly.) Also, Solaris 8 eventually includes itself + recursively; if that is happening, just include the system + without adding our own declarations. */ +#if (((defined __need_time_t || defined __need_clock_t \ + || defined __need_timespec) \ + && !defined __MINGW32__) \ + || defined _@GUARD_PREFIX@_TIME_H) + +# @INCLUDE_NEXT@ @NEXT_TIME_H@ + +#else + +# define _@GUARD_PREFIX@_TIME_H + +/* mingw's provides the functions asctime_r, ctime_r, gmtime_r, + localtime_r only if or has been included before. */ +# if defined __MINGW32__ +# include +# endif + +# @INCLUDE_NEXT@ @NEXT_TIME_H@ + +/* NetBSD 5.0 mis-defines NULL. */ +# include + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* Some systems don't define struct timespec (e.g., AIX 4.1). + Or they define it with the wrong member names or define it in + (e.g., FreeBSD circa 1997). Stock Mingw prior to 3.0 does not define it, + but the pthreads-win32 library defines it in . */ +# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@ +# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@ +# include +# elif @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@ +# include +# elif @UNISTD_H_DEFINES_STRUCT_TIMESPEC@ +# include +# else + +# ifdef __cplusplus +extern "C" { +# endif + +# if !GNULIB_defined_struct_timespec +# undef timespec +# define timespec rpl_timespec +struct timespec +{ + time_t tv_sec; + long int tv_nsec; +}; +# define GNULIB_defined_struct_timespec 1 +# endif + +# ifdef __cplusplus +} +# endif + +# endif +# endif + +# if !GNULIB_defined_struct_time_t_must_be_integral +/* https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html + requires time_t to be an integer type, even though C99 permits floating + point. We don't know of any implementation that uses floating + point, and it is much easier to write code that doesn't have to + worry about that corner case, so we force the issue. */ +struct __time_t_must_be_integral { + unsigned int __floating_time_t_unsupported : (time_t) 1; +}; +# define GNULIB_defined_struct_time_t_must_be_integral 1 +# endif + +/* Define TIME_UTC, a positive integer constant used for timespec_get(). */ +# if ! @TIME_H_DEFINES_TIME_UTC@ +# if !GNULIB_defined_TIME_UTC +# define TIME_UTC 1 +# define GNULIB_defined_TIME_UTC 1 +# endif +# endif + +/* Set *TS to the current time, and return BASE. + Upon failure, return 0. */ +# if @GNULIB_TIMESPEC_GET@ +# if ! @HAVE_TIMESPEC_GET@ +_GL_FUNCDECL_SYS (timespec_get, int, (struct timespec *ts, int base) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base)); +_GL_CXXALIASWARN (timespec_get); +# endif + +/* Sleep for at least RQTP seconds unless interrupted, If interrupted, + return -1 and store the remaining time into RMTP. See + . */ +# if @GNULIB_NANOSLEEP@ +# if @REPLACE_NANOSLEEP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define nanosleep rpl_nanosleep +# endif +_GL_FUNCDECL_RPL (nanosleep, int, + (struct timespec const *__rqtp, struct timespec *__rmtp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (nanosleep, int, + (struct timespec const *__rqtp, struct timespec *__rmtp)); +# else +# if ! @HAVE_NANOSLEEP@ +_GL_FUNCDECL_SYS (nanosleep, int, + (struct timespec const *__rqtp, struct timespec *__rmtp) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (nanosleep, int, + (struct timespec const *__rqtp, struct timespec *__rmtp)); +# endif +_GL_CXXALIASWARN (nanosleep); +# endif + +/* Initialize time conversion information. */ +# if @GNULIB_TZSET@ +# if @REPLACE_TZSET@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tzset +# define tzset rpl_tzset +# endif +_GL_FUNCDECL_RPL (tzset, void, (void)); +_GL_CXXALIAS_RPL (tzset, void, (void)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tzset +# define tzset _tzset +# endif +_GL_CXXALIAS_MDA (tzset, void, (void)); +# else +_GL_CXXALIAS_SYS (tzset, void, (void)); +# endif +_GL_CXXALIASWARN (tzset); +# elif @GNULIB_MDA_TZSET@ +/* On native Windows, map 'tzset' to '_tzset', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::tzset always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef tzset +# define tzset _tzset +# endif +_GL_CXXALIAS_MDA (tzset, void, (void)); +# else +_GL_CXXALIAS_SYS (tzset, void, (void)); +# endif +_GL_CXXALIASWARN (tzset); +# endif + +/* Return the 'time_t' representation of TP and normalize TP. */ +# if @GNULIB_MKTIME@ +# if @REPLACE_MKTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mktime rpl_mktime +# endif +_GL_FUNCDECL_RPL (mktime, time_t, (struct tm *__tp) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mktime, time_t, (struct tm *__tp)); +# else +_GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (mktime); +# endif +# endif + +/* Convert TIMER to RESULT, assuming local time and UTC respectively. See + and + . */ +# if @GNULIB_TIME_R@ +# if @REPLACE_LOCALTIME_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef localtime_r +# define localtime_r rpl_localtime_r +# endif +_GL_FUNCDECL_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, + struct tm *restrict __result) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (localtime_r, struct tm *, (time_t const *restrict __timer, + struct tm *restrict __result)); +# else +# if ! @HAVE_DECL_LOCALTIME_R@ +_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, + struct tm *restrict __result) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (localtime_r, struct tm *, (time_t const *restrict __timer, + struct tm *restrict __result)); +# endif +# if @HAVE_DECL_LOCALTIME_R@ +_GL_CXXALIASWARN (localtime_r); +# endif +# if @REPLACE_LOCALTIME_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gmtime_r +# define gmtime_r rpl_gmtime_r +# endif +_GL_FUNCDECL_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, + struct tm *restrict __result) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (gmtime_r, struct tm *, (time_t const *restrict __timer, + struct tm *restrict __result)); +# else +# if ! @HAVE_DECL_LOCALTIME_R@ +_GL_FUNCDECL_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, + struct tm *restrict __result) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer, + struct tm *restrict __result)); +# endif +# if @HAVE_DECL_LOCALTIME_R@ +_GL_CXXALIASWARN (gmtime_r); +# endif +# endif + +/* Convert TIMER to RESULT, assuming local time and UTC respectively. See + and + . */ +# if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@ +# if @REPLACE_LOCALTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef localtime +# define localtime rpl_localtime +# endif +_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer)); +# else +_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (localtime); +# endif +# endif + +# if 0 || @REPLACE_GMTIME@ +# if @REPLACE_GMTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gmtime +# define gmtime rpl_gmtime +# endif +_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer)); +# else +_GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer)); +# endif +_GL_CXXALIASWARN (gmtime); +# endif + +/* Parse BUF as a timestamp, assuming FORMAT specifies its layout, and store + the resulting broken-down time into TM. See + . */ +# if @GNULIB_STRPTIME@ +# if ! @HAVE_STRPTIME@ +_GL_FUNCDECL_SYS (strptime, char *, (char const *restrict __buf, + char const *restrict __format, + struct tm *restrict __tm) + _GL_ARG_NONNULL ((1, 2, 3))); +# endif +_GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf, + char const *restrict __format, + struct tm *restrict __tm)); +_GL_CXXALIASWARN (strptime); +# endif + +/* Convert *TP to a date and time string. See + . */ +# if @GNULIB_CTIME@ +# if @REPLACE_CTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define ctime rpl_ctime +# endif +_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp)); +# else +_GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (ctime); +# endif +# endif + +/* Convert *TP to a date and time string. See + . */ +# if @GNULIB_STRFTIME@ +# if @REPLACE_STRFTIME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define strftime rpl_strftime +# endif +_GL_FUNCDECL_RPL (strftime, size_t, + (char *restrict __buf, size_t __bufsize, + const char *restrict __fmt, const struct tm *restrict __tp) + _GL_ARG_NONNULL ((1, 3, 4))); +_GL_CXXALIAS_RPL (strftime, size_t, + (char *restrict __buf, size_t __bufsize, + const char *restrict __fmt, const struct tm *restrict __tp)); +# else +_GL_CXXALIAS_SYS (strftime, size_t, + (char *restrict __buf, size_t __bufsize, + const char *restrict __fmt, const struct tm *restrict __tp)); +# endif +# if __GLIBC__ >= 2 +_GL_CXXALIASWARN (strftime); +# endif +# endif + +# if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@ +/* Functions that use a first-class time zone data type, instead of + relying on an implicit global time zone. + Inspired by NetBSD. */ + +/* Represents a time zone. + (timezone_t) NULL stands for UTC. */ +typedef struct tm_zone *timezone_t; + +/* tzalloc (name) + Returns a time zone object for the given time zone NAME. This object + represents the time zone that other functions would use it the TZ + environment variable was set to NAME. + If NAME is NULL, the result represents the time zone that other functions + would use it the TZ environment variable was unset. + May return NULL if NAME is invalid (this is platform dependent) or + upon memory allocation failure. */ +_GL_FUNCDECL_SYS (tzalloc, timezone_t, (char const *__name)); +_GL_CXXALIAS_SYS (tzalloc, timezone_t, (char const *__name)); + +/* tzfree (tz) + Frees a time zone object. + The argument must have been returned by tzalloc(). */ +_GL_FUNCDECL_SYS (tzfree, void, (timezone_t __tz)); +_GL_CXXALIAS_SYS (tzfree, void, (timezone_t __tz)); + +/* localtime_rz (tz, &t, &result) + Converts an absolute time T to a broken-down time RESULT, assuming the + time zone TZ. + This function is like 'localtime_r', but relies on the argument TZ instead + of an implicit global time zone. */ +_GL_FUNCDECL_SYS (localtime_rz, struct tm *, + (timezone_t __tz, time_t const *restrict __timer, + struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_SYS (localtime_rz, struct tm *, + (timezone_t __tz, time_t const *restrict __timer, + struct tm *restrict __result)); + +/* mktime_z (tz, &tm) + Normalizes the broken-down time TM and converts it to an absolute time, + assuming the time zone TZ. Returns the absolute time. + This function is like 'mktime', but relies on the argument TZ instead + of an implicit global time zone. */ +_GL_FUNCDECL_SYS (mktime_z, time_t, + (timezone_t __tz, struct tm *restrict __tm) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_SYS (mktime_z, time_t, + (timezone_t __tz, struct tm *restrict __tm)); + +/* Time zone abbreviation strings (returned by 'localtime_rz' or 'mktime_z' + in the 'tm_zone' member of 'struct tm') are valid as long as + - the 'struct tm' argument is not destroyed or overwritten, + and + - the 'timezone_t' argument is not freed through tzfree(). */ + +# endif + +/* Convert TM to a time_t value, assuming UTC. */ +# if @GNULIB_TIMEGM@ +# if @REPLACE_TIMEGM@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef timegm +# define timegm rpl_timegm +# endif +_GL_FUNCDECL_RPL (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (timegm, time_t, (struct tm *__tm)); +# else +# if ! @HAVE_TIMEGM@ +_GL_FUNCDECL_SYS (timegm, time_t, (struct tm *__tm) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm)); +# endif +_GL_CXXALIASWARN (timegm); +# endif + +/* Encourage applications to avoid unsafe functions that can overrun + buffers when given outlandish struct tm values. Portable + applications should use strftime (or even sprintf) instead. */ +# if defined GNULIB_POSIXCHECK +# undef asctime +_GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - " + "better use strftime (or even sprintf) instead"); +# endif +# if defined GNULIB_POSIXCHECK +# undef asctime_r +_GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - " + "better use strftime (or even sprintf) instead"); +# endif +# if defined GNULIB_POSIXCHECK +# undef ctime +_GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - " + "better use strftime (or even sprintf) instead"); +# endif +# if defined GNULIB_POSIXCHECK +# undef ctime_r +_GL_WARN_ON_USE (ctime_r, "ctime_r can overrun buffers in some cases - " + "better use strftime (or even sprintf) instead"); +# endif + +#endif diff --git a/gnulib-lib/unistd.c b/gnulib-lib/unistd.c new file mode 100644 index 0000000..0763456 --- /dev/null +++ b/gnulib-lib/unistd.c @@ -0,0 +1,22 @@ +/* Inline functions for . + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +#define _GL_UNISTD_INLINE _GL_EXTERN_INLINE +#include "unistd.h" +typedef int dummy; diff --git a/gnulib-lib/unistd.in.h b/gnulib-lib/unistd.in.h new file mode 100644 index 0000000..35abbde --- /dev/null +++ b/gnulib-lib/unistd.in.h @@ -0,0 +1,2303 @@ +/* Substitute for and wrapper around . + Copyright (C) 2003-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _@GUARD_PREFIX@_UNISTD_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if @HAVE_UNISTD_H@ && defined _GL_INCLUDING_UNISTD_H +/* Special invocation convention: + - On Mac OS X 10.3.9 we have a sequence of nested includes + -> -> -> + In this situation, the functions are not yet declared, therefore we cannot + provide the C++ aliases. */ + +#@INCLUDE_NEXT@ @NEXT_UNISTD_H@ + +#else +/* Normal invocation convention. */ + +/* The include_next requires a split double-inclusion guard. */ +#if @HAVE_UNISTD_H@ +# define _GL_INCLUDING_UNISTD_H +# @INCLUDE_NEXT@ @NEXT_UNISTD_H@ +# undef _GL_INCLUDING_UNISTD_H +#endif + +/* Get all possible declarations of gethostname(). */ +#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ \ + && !defined _GL_INCLUDING_WINSOCK2_H +# define _GL_INCLUDING_WINSOCK2_H +# include +# undef _GL_INCLUDING_WINSOCK2_H +#endif + +#if !defined _@GUARD_PREFIX@_UNISTD_H && !defined _GL_INCLUDING_WINSOCK2_H +#define _@GUARD_PREFIX@_UNISTD_H + +/* NetBSD 5.0 mis-defines NULL. Also get size_t. */ +/* But avoid namespace pollution on glibc systems. */ +#ifndef __GLIBC__ +# include +#endif + +/* mingw doesn't define the SEEK_* or *_FILENO macros in . */ +/* MSVC declares 'unlink' in , not in . We must include + it before we #define unlink rpl_unlink. */ +/* Cygwin 1.7.1 declares symlinkat in , not in . */ +/* But avoid namespace pollution on glibc systems. */ +#if (!(defined SEEK_CUR && defined SEEK_END && defined SEEK_SET) \ + || ((@GNULIB_UNLINK@ || defined GNULIB_POSIXCHECK) \ + && (defined _WIN32 && ! defined __CYGWIN__)) \ + || ((@GNULIB_SYMLINKAT@ || defined GNULIB_POSIXCHECK) \ + && defined __CYGWIN__)) \ + && ! defined __GLIBC__ +# include +#endif + +/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in , not in + . */ +/* But avoid namespace pollution on glibc systems. */ +#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \ + && (defined __CYGWIN__ || defined __ANDROID__) \ + && ! defined __GLIBC__ +# include +#endif + +/* mingw fails to declare _exit in . */ +/* mingw, MSVC, BeOS, Haiku declare environ in , not in + . */ +/* Solaris declares getcwd not only in but also in . */ +/* OSF Tru64 Unix cannot see gnulib rpl_strtod when system is + included here. */ +/* But avoid namespace pollution on glibc systems. */ +#if !defined __GLIBC__ && !defined __osf__ +# define __need_system_stdlib_h +# include +# undef __need_system_stdlib_h +#endif + +/* Native Windows platforms declare _chdir, _getcwd, _rmdir in + and/or , not in . + They also declare _access(), _chmod(), _close(), _dup(), _dup2(), _isatty(), + _lseek(), _read(), _unlink(), _write() in . */ +#if defined _WIN32 && !defined __CYGWIN__ +# include +# include +#endif + +/* Native Windows platforms declare _execl*, _execv* in . */ +#if defined _WIN32 && !defined __CYGWIN__ +# include +#endif + +/* AIX and OSF/1 5.1 declare getdomainname in , not in . + NonStop Kernel declares gethostname in , not in . */ +/* But avoid namespace pollution on glibc systems. */ +#if ((@GNULIB_GETDOMAINNAME@ && (defined _AIX || defined __osf__)) \ + || (@GNULIB_GETHOSTNAME@ && defined __TANDEM)) \ + && !defined __GLIBC__ +# include +#endif + +/* Mac OS X 10.13, Solaris 11.4, and Android 9.0 declare getentropy in + , not in . */ +/* But avoid namespace pollution on glibc systems. */ +#if (@GNULIB_GETENTROPY@ || defined GNULIB_POSIXCHECK) \ + && ((defined __APPLE__ && defined __MACH__) || defined __sun \ + || defined __ANDROID__) \ + && @UNISTD_H_HAVE_SYS_RANDOM_H@ \ + && !defined __GLIBC__ +# include +#endif + +/* Android 4.3 declares fchownat in , not in . */ +/* But avoid namespace pollution on glibc systems. */ +#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \ + && !defined __GLIBC__ +# include +#endif + +/* MSVC defines off_t in . + May also define off_t to a 64-bit type on native Windows. */ +/* Get off_t, ssize_t, mode_t. */ +#include + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + + +/* Get getopt(), optarg, optind, opterr, optopt. */ +#if @GNULIB_GETOPT_POSIX@ && @GNULIB_UNISTD_H_GETOPT@ && !defined _GL_SYSTEM_GETOPT +# include +# include +#endif + +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif +_GL_INLINE_HEADER_BEGIN +#ifndef _GL_UNISTD_INLINE +# define _GL_UNISTD_INLINE _GL_INLINE +#endif + +/* Hide some function declarations from . */ + +#if @GNULIB_GETHOSTNAME@ && @UNISTD_H_HAVE_WINSOCK2_H@ +# if !defined _@GUARD_PREFIX@_SYS_SOCKET_H +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef socket +# define socket socket_used_without_including_sys_socket_h +# undef connect +# define connect connect_used_without_including_sys_socket_h +# undef accept +# define accept accept_used_without_including_sys_socket_h +# undef bind +# define bind bind_used_without_including_sys_socket_h +# undef getpeername +# define getpeername getpeername_used_without_including_sys_socket_h +# undef getsockname +# define getsockname getsockname_used_without_including_sys_socket_h +# undef getsockopt +# define getsockopt getsockopt_used_without_including_sys_socket_h +# undef listen +# define listen listen_used_without_including_sys_socket_h +# undef recv +# define recv recv_used_without_including_sys_socket_h +# undef send +# define send send_used_without_including_sys_socket_h +# undef recvfrom +# define recvfrom recvfrom_used_without_including_sys_socket_h +# undef sendto +# define sendto sendto_used_without_including_sys_socket_h +# undef setsockopt +# define setsockopt setsockopt_used_without_including_sys_socket_h +# undef shutdown +# define shutdown shutdown_used_without_including_sys_socket_h +# else + _GL_WARN_ON_USE (socket, + "socket() used without including "); + _GL_WARN_ON_USE (connect, + "connect() used without including "); + _GL_WARN_ON_USE (accept, + "accept() used without including "); + _GL_WARN_ON_USE (bind, + "bind() used without including "); + _GL_WARN_ON_USE (getpeername, + "getpeername() used without including "); + _GL_WARN_ON_USE (getsockname, + "getsockname() used without including "); + _GL_WARN_ON_USE (getsockopt, + "getsockopt() used without including "); + _GL_WARN_ON_USE (listen, + "listen() used without including "); + _GL_WARN_ON_USE (recv, + "recv() used without including "); + _GL_WARN_ON_USE (send, + "send() used without including "); + _GL_WARN_ON_USE (recvfrom, + "recvfrom() used without including "); + _GL_WARN_ON_USE (sendto, + "sendto() used without including "); + _GL_WARN_ON_USE (setsockopt, + "setsockopt() used without including "); + _GL_WARN_ON_USE (shutdown, + "shutdown() used without including "); +# endif +# endif +# if !defined _@GUARD_PREFIX@_SYS_SELECT_H +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef select +# define select select_used_without_including_sys_select_h +# else + _GL_WARN_ON_USE (select, + "select() used without including "); +# endif +# endif +#endif + + +/* OS/2 EMX lacks these macros. */ +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif +#ifndef STDOUT_FILENO +# define STDOUT_FILENO 1 +#endif +#ifndef STDERR_FILENO +# define STDERR_FILENO 2 +#endif + +/* Ensure *_OK macros exist. */ +#ifndef F_OK +# define F_OK 0 +# define X_OK 1 +# define W_OK 2 +# define R_OK 4 +#endif + + +/* Declare overridden functions. */ + + +#if @GNULIB_ACCESS@ +# if @REPLACE_ACCESS@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef access +# define access rpl_access +# endif +_GL_FUNCDECL_RPL (access, int, (const char *file, int mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (access, int, (const char *file, int mode)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef access +# define access _access +# endif +_GL_CXXALIAS_MDA (access, int, (const char *file, int mode)); +# else +_GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); +# endif +_GL_CXXALIASWARN (access); +#elif defined GNULIB_POSIXCHECK +# undef access +# if HAVE_RAW_DECL_ACCESS +/* The access() function is a security risk. */ +_GL_WARN_ON_USE (access, "access does not always support X_OK - " + "use gnulib module access for portability; " + "also, this function is a security risk - " + "use the gnulib module faccessat instead"); +# endif +#elif @GNULIB_MDA_ACCESS@ +/* On native Windows, map 'access' to '_access', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::access always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef access +# define access _access +# endif +_GL_CXXALIAS_MDA (access, int, (const char *file, int mode)); +# else +_GL_CXXALIAS_SYS (access, int, (const char *file, int mode)); +# endif +_GL_CXXALIASWARN (access); +#endif + + +#if @GNULIB_CHDIR@ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef chdir +# define chdir _chdir +# endif +_GL_CXXALIAS_MDA (chdir, int, (const char *file)); +# else +_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIASWARN (chdir); +#elif defined GNULIB_POSIXCHECK +# undef chdir +# if HAVE_RAW_DECL_CHDIR +_GL_WARN_ON_USE (chown, "chdir is not always in - " + "use gnulib module chdir for portability"); +# endif +#elif @GNULIB_MDA_CHDIR@ +/* On native Windows, map 'chdir' to '_chdir', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::chdir always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef chdir +# define chdir _chdir +# endif +_GL_CXXALIAS_MDA (chdir, int, (const char *file)); +# else +_GL_CXXALIAS_SYS (chdir, int, (const char *file) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIASWARN (chdir); +#endif + + +#if @GNULIB_CHOWN@ +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE + to GID (if GID is not -1). Follow symbolic links. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2008 specification + . */ +# if @REPLACE_DUP2@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define dup2 rpl_dup2 +# endif +_GL_FUNCDECL_RPL (dup2, int, (int oldfd, int newfd)); +_GL_CXXALIAS_RPL (dup2, int, (int oldfd, int newfd)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef dup2 +# define dup2 _dup2 +# endif +_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd)); +# else +_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); +# endif +_GL_CXXALIASWARN (dup2); +#elif defined GNULIB_POSIXCHECK +# undef dup2 +# if HAVE_RAW_DECL_DUP2 +_GL_WARN_ON_USE (dup2, "dup2 is unportable - " + "use gnulib module dup2 for portability"); +# endif +#elif @GNULIB_MDA_DUP2@ +/* On native Windows, map 'dup2' to '_dup2', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::dup2 always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef dup2 +# define dup2 _dup2 +# endif +_GL_CXXALIAS_MDA (dup2, int, (int oldfd, int newfd)); +# else +_GL_CXXALIAS_SYS (dup2, int, (int oldfd, int newfd)); +# endif +_GL_CXXALIASWARN (dup2); +#endif + + +#if @GNULIB_DUP3@ +/* Copy the file descriptor OLDFD into file descriptor NEWFD, with the + specified flags. + The flags are a bitmask, possibly including O_CLOEXEC (defined in ) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + Close NEWFD first if it is open. + Return newfd if successful, otherwise -1 and errno set. + See the Linux man page at + . */ +# if @HAVE_DUP3@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define dup3 rpl_dup3 +# endif +_GL_FUNCDECL_RPL (dup3, int, (int oldfd, int newfd, int flags)); +_GL_CXXALIAS_RPL (dup3, int, (int oldfd, int newfd, int flags)); +# else +_GL_FUNCDECL_SYS (dup3, int, (int oldfd, int newfd, int flags)); +_GL_CXXALIAS_SYS (dup3, int, (int oldfd, int newfd, int flags)); +# endif +_GL_CXXALIASWARN (dup3); +#elif defined GNULIB_POSIXCHECK +# undef dup3 +# if HAVE_RAW_DECL_DUP3 +_GL_WARN_ON_USE (dup3, "dup3 is unportable - " + "use gnulib module dup3 for portability"); +# endif +#endif + + +#if @GNULIB_ENVIRON@ +# if defined __CYGWIN__ && !defined __i386__ +/* The 'environ' variable is defined in a DLL. Therefore its declaration needs + the '__declspec(dllimport)' attribute, but the system's lacks it. + This leads to a link error on 64-bit Cygwin when the option + -Wl,--disable-auto-import is in use. */ +_GL_EXTERN_C __declspec(dllimport) char **environ; +# endif +# if !@HAVE_DECL_ENVIRON@ +/* Set of environment variables and values. An array of strings of the form + "VARIABLE=VALUE", terminated with a NULL. */ +# if defined __APPLE__ && defined __MACH__ +# include +# if !TARGET_OS_IPHONE && !TARGET_IPHONE_SIMULATOR +# define _GL_USE_CRT_EXTERNS +# endif +# endif +# ifdef _GL_USE_CRT_EXTERNS +# include +# define environ (*_NSGetEnviron ()) +# else +# ifdef __cplusplus +extern "C" { +# endif +extern char **environ; +# ifdef __cplusplus +} +# endif +# endif +# endif +#elif defined GNULIB_POSIXCHECK +# if HAVE_RAW_DECL_ENVIRON +_GL_UNISTD_INLINE char *** +_GL_WARN_ON_USE_ATTRIBUTE ("environ is unportable - " + "use gnulib module environ for portability") +rpl_environ (void) +{ + return &environ; +} +# undef environ +# define environ (*rpl_environ ()) +# endif +#endif + + +#if @GNULIB_EUIDACCESS@ +/* Like access(), except that it uses the effective user id and group id of + the current process. */ +# if !@HAVE_EUIDACCESS@ +_GL_FUNCDECL_SYS (euidaccess, int, (const char *filename, int mode) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (euidaccess, int, (const char *filename, int mode)); +_GL_CXXALIASWARN (euidaccess); +# if defined GNULIB_POSIXCHECK +/* Like access(), this function is a security risk. */ +_GL_WARN_ON_USE (euidaccess, "the euidaccess function is a security risk - " + "use the gnulib module faccessat instead"); +# endif +#elif defined GNULIB_POSIXCHECK +# undef euidaccess +# if HAVE_RAW_DECL_EUIDACCESS +_GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - " + "use gnulib module euidaccess for portability"); +# endif +#endif + + +#if @GNULIB_EXECL@ +# if @REPLACE_EXECL@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execl +# define execl rpl_execl +# endif +_GL_FUNCDECL_RPL (execl, int, (const char *program, const char *arg, ...) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (execl, int, (const char *program, const char *arg, ...)); +# else +_GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...)); +# endif +_GL_CXXALIASWARN (execl); +#elif defined GNULIB_POSIXCHECK +# undef execl +# if HAVE_RAW_DECL_EXECL +_GL_WARN_ON_USE (execl, "execl behaves very differently on mingw - " + "use gnulib module execl for portability"); +# endif +#elif @GNULIB_MDA_EXECL@ +/* On native Windows, map 'execl' to '_execl', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::execl always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execl +# define execl _execl +# endif +_GL_CXXALIAS_MDA (execl, intptr_t, (const char *program, const char *arg, ...)); +# else +_GL_CXXALIAS_SYS (execl, int, (const char *program, const char *arg, ...)); +# endif +_GL_CXXALIASWARN (execl); +#endif + +#if @GNULIB_EXECLE@ +# if @REPLACE_EXECLE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execle +# define execle rpl_execle +# endif +_GL_FUNCDECL_RPL (execle, int, (const char *program, const char *arg, ...) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (execle, int, (const char *program, const char *arg, ...)); +# else +_GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...)); +# endif +_GL_CXXALIASWARN (execle); +#elif defined GNULIB_POSIXCHECK +# undef execle +# if HAVE_RAW_DECL_EXECLE +_GL_WARN_ON_USE (execle, "execle behaves very differently on mingw - " + "use gnulib module execle for portability"); +# endif +#elif @GNULIB_MDA_EXECLE@ +/* On native Windows, map 'execle' to '_execle', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::execle always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execle +# define execle _execle +# endif +_GL_CXXALIAS_MDA (execle, intptr_t, + (const char *program, const char *arg, ...)); +# else +_GL_CXXALIAS_SYS (execle, int, (const char *program, const char *arg, ...)); +# endif +_GL_CXXALIASWARN (execle); +#endif + +#if @GNULIB_EXECLP@ +# if @REPLACE_EXECLP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execlp +# define execlp rpl_execlp +# endif +_GL_FUNCDECL_RPL (execlp, int, (const char *program, const char *arg, ...) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (execlp, int, (const char *program, const char *arg, ...)); +# else +_GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...)); +# endif +_GL_CXXALIASWARN (execlp); +#elif defined GNULIB_POSIXCHECK +# undef execlp +# if HAVE_RAW_DECL_EXECLP +_GL_WARN_ON_USE (execlp, "execlp behaves very differently on mingw - " + "use gnulib module execlp for portability"); +# endif +#elif @GNULIB_MDA_EXECLP@ +/* On native Windows, map 'execlp' to '_execlp', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::execlp always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execlp +# define execlp _execlp +# endif +_GL_CXXALIAS_MDA (execlp, intptr_t, + (const char *program, const char *arg, ...)); +# else +_GL_CXXALIAS_SYS (execlp, int, (const char *program, const char *arg, ...)); +# endif +_GL_CXXALIASWARN (execlp); +#endif + + +#if @GNULIB_EXECV@ +# if @REPLACE_EXECV@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execv +# define execv rpl_execv +# endif +_GL_FUNCDECL_RPL (execv, int, (const char *program, char * const *argv) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (execv, int, (const char *program, char * const *argv)); +# else +_GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv)); +# endif +_GL_CXXALIASWARN (execv); +#elif defined GNULIB_POSIXCHECK +# undef execv +# if HAVE_RAW_DECL_EXECV +_GL_WARN_ON_USE (execv, "execv behaves very differently on mingw - " + "use gnulib module execv for portability"); +# endif +#elif @GNULIB_MDA_EXECV@ +/* On native Windows, map 'execv' to '_execv', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::execv always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execv +# define execv _execv +# endif +_GL_CXXALIAS_MDA_CAST (execv, intptr_t, + (const char *program, char * const *argv)); +# else +_GL_CXXALIAS_SYS (execv, int, (const char *program, char * const *argv)); +# endif +_GL_CXXALIASWARN (execv); +#endif + +#if @GNULIB_EXECVE@ +# if @REPLACE_EXECVE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execve +# define execve rpl_execve +# endif +_GL_FUNCDECL_RPL (execve, int, + (const char *program, char * const *argv, char * const *env) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (execve, int, + (const char *program, char * const *argv, char * const *env)); +# else +_GL_CXXALIAS_SYS (execve, int, + (const char *program, char * const *argv, char * const *env)); +# endif +_GL_CXXALIASWARN (execve); +#elif defined GNULIB_POSIXCHECK +# undef execve +# if HAVE_RAW_DECL_EXECVE +_GL_WARN_ON_USE (execve, "execve behaves very differently on mingw - " + "use gnulib module execve for portability"); +# endif +#elif @GNULIB_MDA_EXECVE@ +/* On native Windows, map 'execve' to '_execve', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::execve always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execve +# define execve _execve +# endif +_GL_CXXALIAS_MDA_CAST (execve, intptr_t, + (const char *program, char * const *argv, + char * const *env)); +# else +_GL_CXXALIAS_SYS (execve, int, + (const char *program, char * const *argv, char * const *env)); +# endif +_GL_CXXALIASWARN (execve); +#endif + +#if @GNULIB_EXECVP@ +# if @REPLACE_EXECVP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execvp +# define execvp rpl_execvp +# endif +_GL_FUNCDECL_RPL (execvp, int, (const char *program, char * const *argv) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (execvp, int, (const char *program, char * const *argv)); +# else +_GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv)); +# endif +_GL_CXXALIASWARN (execvp); +#elif defined GNULIB_POSIXCHECK +# undef execvp +# if HAVE_RAW_DECL_EXECVP +_GL_WARN_ON_USE (execvp, "execvp behaves very differently on mingw - " + "use gnulib module execvp for portability"); +# endif +#elif @GNULIB_MDA_EXECVP@ +/* On native Windows, map 'execvp' to '_execvp', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::execvp always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execvp +# define execvp _execvp +# endif +_GL_CXXALIAS_MDA_CAST (execvp, intptr_t, + (const char *program, char * const *argv)); +# else +_GL_CXXALIAS_SYS (execvp, int, (const char *program, char * const *argv)); +# endif +_GL_CXXALIASWARN (execvp); +#endif + +#if @GNULIB_EXECVPE@ +# if @REPLACE_EXECVPE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execvpe +# define execvpe rpl_execvpe +# endif +_GL_FUNCDECL_RPL (execvpe, int, + (const char *program, char * const *argv, char * const *env) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (execvpe, int, + (const char *program, char * const *argv, char * const *env)); +# else +# if !@HAVE_DECL_EXECVPE@ +_GL_FUNCDECL_SYS (execvpe, int, + (const char *program, char * const *argv, char * const *env) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (execvpe, int, + (const char *program, char * const *argv, char * const *env)); +# endif +_GL_CXXALIASWARN (execvpe); +#elif defined GNULIB_POSIXCHECK +# undef execvpe +# if HAVE_RAW_DECL_EXECVPE +_GL_WARN_ON_USE (execvpe, "execvpe behaves very differently on mingw - " + "use gnulib module execvpe for portability"); +# endif +#elif @GNULIB_MDA_EXECVPE@ +/* On native Windows, map 'execvpe' to '_execvpe', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::execvpe on all platforms that have + it. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef execvpe +# define execvpe _execvpe +# endif +_GL_CXXALIAS_MDA_CAST (execvpe, intptr_t, + (const char *program, char * const *argv, + char * const *env)); +# elif @HAVE_EXECVPE@ +# if !@HAVE_DECL_EXECVPE@ +_GL_FUNCDECL_SYS (execvpe, int, + (const char *program, char * const *argv, char * const *env) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (execvpe, int, + (const char *program, char * const *argv, char * const *env)); +# endif +# if (defined _WIN32 && !defined __CYGWIN__) || @HAVE_EXECVPE@ +_GL_CXXALIASWARN (execvpe); +# endif +#endif + + +#if @GNULIB_FACCESSAT@ +# if @REPLACE_FACCESSAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef faccessat +# define faccessat rpl_faccessat +# endif +_GL_FUNCDECL_RPL (faccessat, int, + (int fd, char const *name, int mode, int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (faccessat, int, + (int fd, char const *name, int mode, int flag)); +# else +# if !@HAVE_FACCESSAT@ +_GL_FUNCDECL_SYS (faccessat, int, + (int fd, char const *file, int mode, int flag) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (faccessat, int, + (int fd, char const *file, int mode, int flag)); +# endif +_GL_CXXALIASWARN (faccessat); +#elif defined GNULIB_POSIXCHECK +# undef faccessat +# if HAVE_RAW_DECL_FACCESSAT +_GL_WARN_ON_USE (faccessat, "faccessat is not portable - " + "use gnulib module faccessat for portability"); +# endif +#endif + + +#if @GNULIB_FCHDIR@ +/* Change the process' current working directory to the directory on which + the given file descriptor is open. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2008 specification + . */ +# if ! @HAVE_FCHDIR@ +_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); + +/* Gnulib internal hooks needed to maintain the fchdir metadata. */ +_GL_EXTERN_C int _gl_register_fd (int fd, const char *filename) + _GL_ARG_NONNULL ((2)); +_GL_EXTERN_C void _gl_unregister_fd (int fd); +_GL_EXTERN_C int _gl_register_dup (int oldfd, int newfd); +_GL_EXTERN_C const char *_gl_directory_name (int fd); + +# else +# if !@HAVE_DECL_FCHDIR@ +_GL_FUNCDECL_SYS (fchdir, int, (int /*fd*/)); +# endif +# endif +_GL_CXXALIAS_SYS (fchdir, int, (int /*fd*/)); +_GL_CXXALIASWARN (fchdir); +#elif defined GNULIB_POSIXCHECK +# undef fchdir +# if HAVE_RAW_DECL_FCHDIR +_GL_WARN_ON_USE (fchdir, "fchdir is unportable - " + "use gnulib module fchdir for portability"); +# endif +#endif + + +#if @GNULIB_FCHOWNAT@ +# if @REPLACE_FCHOWNAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fchownat +# define fchownat rpl_fchownat +# endif +_GL_FUNCDECL_RPL (fchownat, int, (int fd, char const *file, + uid_t owner, gid_t group, int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (fchownat, int, (int fd, char const *file, + uid_t owner, gid_t group, int flag)); +# else +# if !@HAVE_FCHOWNAT@ +_GL_FUNCDECL_SYS (fchownat, int, (int fd, char const *file, + uid_t owner, gid_t group, int flag) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (fchownat, int, (int fd, char const *file, + uid_t owner, gid_t group, int flag)); +# endif +_GL_CXXALIASWARN (fchownat); +#elif defined GNULIB_POSIXCHECK +# undef fchownat +# if HAVE_RAW_DECL_FCHOWNAT +_GL_WARN_ON_USE (fchownat, "fchownat is not portable - " + "use gnulib module fchownat for portability"); +# endif +#endif + + +#if @GNULIB_FDATASYNC@ +/* Synchronize changes to a file. + Return 0 if successful, otherwise -1 and errno set. + See POSIX:2008 specification + . */ +# if !@HAVE_FDATASYNC@ || !@HAVE_DECL_FDATASYNC@ +_GL_FUNCDECL_SYS (fdatasync, int, (int fd)); +# endif +_GL_CXXALIAS_SYS (fdatasync, int, (int fd)); +_GL_CXXALIASWARN (fdatasync); +#elif defined GNULIB_POSIXCHECK +# undef fdatasync +# if HAVE_RAW_DECL_FDATASYNC +_GL_WARN_ON_USE (fdatasync, "fdatasync is unportable - " + "use gnulib module fdatasync for portability"); +# endif +#endif + + +#if @GNULIB_FSYNC@ +/* Synchronize changes, including metadata, to a file. + Return 0 if successful, otherwise -1 and errno set. + See POSIX:2008 specification + . */ +# if !@HAVE_FSYNC@ +_GL_FUNCDECL_SYS (fsync, int, (int fd)); +# endif +_GL_CXXALIAS_SYS (fsync, int, (int fd)); +_GL_CXXALIASWARN (fsync); +#elif defined GNULIB_POSIXCHECK +# undef fsync +# if HAVE_RAW_DECL_FSYNC +_GL_WARN_ON_USE (fsync, "fsync is unportable - " + "use gnulib module fsync for portability"); +# endif +#endif + + +#if @GNULIB_FTRUNCATE@ +/* Change the size of the file to which FD is opened to become equal to LENGTH. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2008 specification + . */ +# if @REPLACE_FTRUNCATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ftruncate +# define ftruncate rpl_ftruncate +# endif +_GL_FUNCDECL_RPL (ftruncate, int, (int fd, off_t length)); +_GL_CXXALIAS_RPL (ftruncate, int, (int fd, off_t length)); +# else +# if !@HAVE_FTRUNCATE@ +_GL_FUNCDECL_SYS (ftruncate, int, (int fd, off_t length)); +# endif +_GL_CXXALIAS_SYS (ftruncate, int, (int fd, off_t length)); +# endif +_GL_CXXALIASWARN (ftruncate); +#elif defined GNULIB_POSIXCHECK +# undef ftruncate +# if HAVE_RAW_DECL_FTRUNCATE +_GL_WARN_ON_USE (ftruncate, "ftruncate is unportable - " + "use gnulib module ftruncate for portability"); +# endif +#endif + + +#if @GNULIB_GETCWD@ +/* Get the name of the current working directory, and put it in SIZE bytes + of BUF. + Return BUF if successful, or NULL if the directory couldn't be determined + or SIZE was too small. + See the POSIX:2008 specification + . + Additionally, the gnulib module 'getcwd' guarantees the following GNU + extension: If BUF is NULL, an array is allocated with 'malloc'; the array + is SIZE bytes long, unless SIZE == 0, in which case it is as big as + necessary. */ +# if @REPLACE_GETCWD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getcwd rpl_getcwd +# endif +_GL_FUNCDECL_RPL (getcwd, char *, (char *buf, size_t size)); +_GL_CXXALIAS_RPL (getcwd, char *, (char *buf, size_t size)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getcwd +# define getcwd _getcwd +# endif +_GL_CXXALIAS_MDA (getcwd, char *, (char *buf, size_t size)); +# else +/* Need to cast, because on mingw, the second parameter is + int size. */ +_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); +# endif +_GL_CXXALIASWARN (getcwd); +#elif defined GNULIB_POSIXCHECK +# undef getcwd +# if HAVE_RAW_DECL_GETCWD +_GL_WARN_ON_USE (getcwd, "getcwd is unportable - " + "use gnulib module getcwd for portability"); +# endif +#elif @GNULIB_MDA_GETCWD@ +/* On native Windows, map 'getcwd' to '_getcwd', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::getcwd always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getcwd +# define getcwd _getcwd +# endif +/* Need to cast, because on mingw, the second parameter is either + 'int size' or 'size_t size'. */ +_GL_CXXALIAS_MDA_CAST (getcwd, char *, (char *buf, size_t size)); +# else +_GL_CXXALIAS_SYS_CAST (getcwd, char *, (char *buf, size_t size)); +# endif +_GL_CXXALIASWARN (getcwd); +#endif + + +#if @GNULIB_GETDOMAINNAME@ +/* Return the NIS domain name of the machine. + WARNING! The NIS domain name is unrelated to the fully qualified host name + of the machine. It is also unrelated to email addresses. + WARNING! The NIS domain name is usually the empty string or "(none)" when + not using NIS. + + Put up to LEN bytes of the NIS domain name into NAME. + Null terminate it if the name is shorter than LEN. + If the NIS domain name is longer than LEN, set errno = EINVAL and return -1. + Return 0 if successful, otherwise set errno and return -1. */ +# if @REPLACE_GETDOMAINNAME@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getdomainname +# define getdomainname rpl_getdomainname +# endif +_GL_FUNCDECL_RPL (getdomainname, int, (char *name, size_t len) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (getdomainname, int, (char *name, size_t len)); +# else +# if !@HAVE_DECL_GETDOMAINNAME@ +_GL_FUNCDECL_SYS (getdomainname, int, (char *name, size_t len) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (getdomainname, int, (char *name, size_t len)); +# endif +_GL_CXXALIASWARN (getdomainname); +#elif defined GNULIB_POSIXCHECK +# undef getdomainname +# if HAVE_RAW_DECL_GETDOMAINNAME +_GL_WARN_ON_USE (getdomainname, "getdomainname is unportable - " + "use gnulib module getdomainname for portability"); +# endif +#endif + + +#if @GNULIB_GETDTABLESIZE@ +/* Return the maximum number of file descriptors in the current process. + In POSIX, this is same as sysconf (_SC_OPEN_MAX). */ +# if @REPLACE_GETDTABLESIZE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getdtablesize +# define getdtablesize rpl_getdtablesize +# endif +_GL_FUNCDECL_RPL (getdtablesize, int, (void)); +_GL_CXXALIAS_RPL (getdtablesize, int, (void)); +# else +# if !@HAVE_GETDTABLESIZE@ +_GL_FUNCDECL_SYS (getdtablesize, int, (void)); +# endif +/* Need to cast, because on AIX, the parameter list is + (...). */ +_GL_CXXALIAS_SYS_CAST (getdtablesize, int, (void)); +# endif +_GL_CXXALIASWARN (getdtablesize); +#elif defined GNULIB_POSIXCHECK +# undef getdtablesize +# if HAVE_RAW_DECL_GETDTABLESIZE +_GL_WARN_ON_USE (getdtablesize, "getdtablesize is unportable - " + "use gnulib module getdtablesize for portability"); +# endif +#endif + + +#if @GNULIB_GETENTROPY@ +/* Fill a buffer with random bytes. */ +# if !@HAVE_GETENTROPY@ +_GL_FUNCDECL_SYS (getentropy, int, (void *buffer, size_t length)); +# endif +_GL_CXXALIAS_SYS (getentropy, int, (void *buffer, size_t length)); +_GL_CXXALIASWARN (getentropy); +#elif defined GNULIB_POSIXCHECK +# undef getentropy +# if HAVE_RAW_DECL_GETENTROPY +_GL_WARN_ON_USE (getentropy, "getentropy is unportable - " + "use gnulib module getentropy for portability"); +# endif +#endif + + +#if @GNULIB_GETGROUPS@ +/* Return the supplemental groups that the current process belongs to. + It is unspecified whether the effective group id is in the list. + If N is 0, return the group count; otherwise, N describes how many + entries are available in GROUPS. Return -1 and set errno if N is + not 0 and not large enough. Fails with ENOSYS on some systems. */ +# if @REPLACE_GETGROUPS@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getgroups +# define getgroups rpl_getgroups +# endif +_GL_FUNCDECL_RPL (getgroups, int, (int n, gid_t *groups)); +_GL_CXXALIAS_RPL (getgroups, int, (int n, gid_t *groups)); +# else +# if !@HAVE_GETGROUPS@ +_GL_FUNCDECL_SYS (getgroups, int, (int n, gid_t *groups)); +# endif +_GL_CXXALIAS_SYS (getgroups, int, (int n, gid_t *groups)); +# endif +_GL_CXXALIASWARN (getgroups); +#elif defined GNULIB_POSIXCHECK +# undef getgroups +# if HAVE_RAW_DECL_GETGROUPS +_GL_WARN_ON_USE (getgroups, "getgroups is unportable - " + "use gnulib module getgroups for portability"); +# endif +#endif + + +#if @GNULIB_GETHOSTNAME@ +/* Return the standard host name of the machine. + WARNING! The host name may or may not be fully qualified. + + Put up to LEN bytes of the host name into NAME. + Null terminate it if the name is shorter than LEN. + If the host name is longer than LEN, set errno = EINVAL and return -1. + Return 0 if successful, otherwise set errno and return -1. */ +# if @UNISTD_H_HAVE_WINSOCK2_H@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef gethostname +# define gethostname rpl_gethostname +# endif +_GL_FUNCDECL_RPL (gethostname, int, (char *name, size_t len) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (gethostname, int, (char *name, size_t len)); +# else +# if !@HAVE_GETHOSTNAME@ +_GL_FUNCDECL_SYS (gethostname, int, (char *name, size_t len) + _GL_ARG_NONNULL ((1))); +# endif +/* Need to cast, because on Solaris 10 and OSF/1 5.1 systems, the second + parameter is + int len. */ +_GL_CXXALIAS_SYS_CAST (gethostname, int, (char *name, size_t len)); +# endif +_GL_CXXALIASWARN (gethostname); +#elif @UNISTD_H_HAVE_WINSOCK2_H@ +# undef gethostname +# define gethostname gethostname_used_without_requesting_gnulib_module_gethostname +#elif defined GNULIB_POSIXCHECK +# undef gethostname +# if HAVE_RAW_DECL_GETHOSTNAME +_GL_WARN_ON_USE (gethostname, "gethostname is unportable - " + "use gnulib module gethostname for portability"); +# endif +#endif + + +#if @GNULIB_GETLOGIN@ +/* Returns the user's login name, or NULL if it cannot be found. Upon error, + returns NULL with errno set. + + See . + + Most programs don't need to use this function, because the information is + available through environment variables: + ${LOGNAME-$USER} on Unix platforms, + $USERNAME on native Windows platforms. + */ +# if !@HAVE_DECL_GETLOGIN@ +_GL_FUNCDECL_SYS (getlogin, char *, (void)); +# endif +_GL_CXXALIAS_SYS (getlogin, char *, (void)); +_GL_CXXALIASWARN (getlogin); +#elif defined GNULIB_POSIXCHECK +# undef getlogin +# if HAVE_RAW_DECL_GETLOGIN +_GL_WARN_ON_USE (getlogin, "getlogin is unportable - " + "use gnulib module getlogin for portability"); +# endif +#endif + + +#if @GNULIB_GETLOGIN_R@ +/* Copies the user's login name to NAME. + The array pointed to by NAME has room for SIZE bytes. + + Returns 0 if successful. Upon error, an error number is returned, or -1 in + the case that the login name cannot be found but no specific error is + provided (this case is hopefully rare but is left open by the POSIX spec). + + See . + + Most programs don't need to use this function, because the information is + available through environment variables: + ${LOGNAME-$USER} on Unix platforms, + $USERNAME on native Windows platforms. + */ +# if @REPLACE_GETLOGIN_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getlogin_r rpl_getlogin_r +# endif +_GL_FUNCDECL_RPL (getlogin_r, int, (char *name, size_t size) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (getlogin_r, int, (char *name, size_t size)); +# else +# if !@HAVE_DECL_GETLOGIN_R@ +_GL_FUNCDECL_SYS (getlogin_r, int, (char *name, size_t size) + _GL_ARG_NONNULL ((1))); +# endif +/* Need to cast, because on Solaris 10 systems, the second argument is + int size. */ +_GL_CXXALIAS_SYS_CAST (getlogin_r, int, (char *name, size_t size)); +# endif +_GL_CXXALIASWARN (getlogin_r); +#elif defined GNULIB_POSIXCHECK +# undef getlogin_r +# if HAVE_RAW_DECL_GETLOGIN_R +_GL_WARN_ON_USE (getlogin_r, "getlogin_r is unportable - " + "use gnulib module getlogin_r for portability"); +# endif +#endif + + +#if @GNULIB_GETPAGESIZE@ +# if @REPLACE_GETPAGESIZE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getpagesize rpl_getpagesize +# endif +_GL_FUNCDECL_RPL (getpagesize, int, (void)); +_GL_CXXALIAS_RPL (getpagesize, int, (void)); +# else +/* On HP-UX, getpagesize exists, but it is not declared in even if + the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ +# if defined __hpux +_GL_FUNCDECL_SYS (getpagesize, int, (void)); +# endif +# if !@HAVE_GETPAGESIZE@ +# if !defined getpagesize +/* This is for POSIX systems. */ +# if !defined _gl_getpagesize && defined _SC_PAGESIZE +# if ! (defined __VMS && __VMS_VER < 70000000) +# define _gl_getpagesize() sysconf (_SC_PAGESIZE) +# endif +# endif +/* This is for older VMS. */ +# if !defined _gl_getpagesize && defined __VMS +# ifdef __ALPHA +# define _gl_getpagesize() 8192 +# else +# define _gl_getpagesize() 512 +# endif +# endif +/* This is for BeOS. */ +# if !defined _gl_getpagesize && @HAVE_OS_H@ +# include +# if defined B_PAGE_SIZE +# define _gl_getpagesize() B_PAGE_SIZE +# endif +# endif +/* This is for AmigaOS4.0. */ +# if !defined _gl_getpagesize && defined __amigaos4__ +# define _gl_getpagesize() 2048 +# endif +/* This is for older Unix systems. */ +# if !defined _gl_getpagesize && @HAVE_SYS_PARAM_H@ +# include +# ifdef EXEC_PAGESIZE +# define _gl_getpagesize() EXEC_PAGESIZE +# else +# ifdef NBPG +# ifndef CLSIZE +# define CLSIZE 1 +# endif +# define _gl_getpagesize() (NBPG * CLSIZE) +# else +# ifdef NBPC +# define _gl_getpagesize() NBPC +# endif +# endif +# endif +# endif +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define getpagesize() _gl_getpagesize () +# else +# if !GNULIB_defined_getpagesize_function +_GL_UNISTD_INLINE int +getpagesize () +{ + return _gl_getpagesize (); +} +# define GNULIB_defined_getpagesize_function 1 +# endif +# endif +# endif +# endif +/* Need to cast, because on Cygwin 1.5.x systems, the return type is size_t. */ +_GL_CXXALIAS_SYS_CAST (getpagesize, int, (void)); +# endif +# if @HAVE_DECL_GETPAGESIZE@ +_GL_CXXALIASWARN (getpagesize); +# endif +#elif defined GNULIB_POSIXCHECK +# undef getpagesize +# if HAVE_RAW_DECL_GETPAGESIZE +_GL_WARN_ON_USE (getpagesize, "getpagesize is unportable - " + "use gnulib module getpagesize for portability"); +# endif +#endif + + +#if @GNULIB_GETPASS@ +/* Function getpass() from module 'getpass': + Read a password from /dev/tty or stdin. + Function getpass() from module 'getpass-gnu': + Read a password of arbitrary length from /dev/tty or stdin. */ +# if @REPLACE_GETPASS@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getpass +# define getpass rpl_getpass +# endif +_GL_FUNCDECL_RPL (getpass, char *, (const char *prompt) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (getpass, char *, (const char *prompt)); +# else +# if !@HAVE_GETPASS@ +_GL_FUNCDECL_SYS (getpass, char *, (const char *prompt) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (getpass, char *, (const char *prompt)); +# endif +_GL_CXXALIASWARN (getpass); +#elif defined GNULIB_POSIXCHECK +# undef getpass +# if HAVE_RAW_DECL_GETPASS +_GL_WARN_ON_USE (getpass, "getpass is unportable - " + "use gnulib module getpass or getpass-gnu for portability"); +# endif +#endif + + +#if @GNULIB_MDA_GETPID@ +/* On native Windows, map 'getpid' to '_getpid', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::getpid always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef getpid +# define getpid _getpid +# endif +_GL_CXXALIAS_MDA (getpid, int, (void)); +# else +_GL_CXXALIAS_SYS (getpid, pid_t, (void)); +# endif +_GL_CXXALIASWARN (getpid); +#endif + + +#if @GNULIB_GETUSERSHELL@ +/* Return the next valid login shell on the system, or NULL when the end of + the list has been reached. */ +# if !@HAVE_DECL_GETUSERSHELL@ +_GL_FUNCDECL_SYS (getusershell, char *, (void)); +# endif +_GL_CXXALIAS_SYS (getusershell, char *, (void)); +_GL_CXXALIASWARN (getusershell); +#elif defined GNULIB_POSIXCHECK +# undef getusershell +# if HAVE_RAW_DECL_GETUSERSHELL +_GL_WARN_ON_USE (getusershell, "getusershell is unportable - " + "use gnulib module getusershell for portability"); +# endif +#endif + +#if @GNULIB_GETUSERSHELL@ +/* Rewind to pointer that is advanced at each getusershell() call. */ +# if !@HAVE_DECL_GETUSERSHELL@ +_GL_FUNCDECL_SYS (setusershell, void, (void)); +# endif +_GL_CXXALIAS_SYS (setusershell, void, (void)); +_GL_CXXALIASWARN (setusershell); +#elif defined GNULIB_POSIXCHECK +# undef setusershell +# if HAVE_RAW_DECL_SETUSERSHELL +_GL_WARN_ON_USE (setusershell, "setusershell is unportable - " + "use gnulib module getusershell for portability"); +# endif +#endif + +#if @GNULIB_GETUSERSHELL@ +/* Free the pointer that is advanced at each getusershell() call and + associated resources. */ +# if !@HAVE_DECL_GETUSERSHELL@ +_GL_FUNCDECL_SYS (endusershell, void, (void)); +# endif +_GL_CXXALIAS_SYS (endusershell, void, (void)); +_GL_CXXALIASWARN (endusershell); +#elif defined GNULIB_POSIXCHECK +# undef endusershell +# if HAVE_RAW_DECL_ENDUSERSHELL +_GL_WARN_ON_USE (endusershell, "endusershell is unportable - " + "use gnulib module getusershell for portability"); +# endif +#endif + + +#if @GNULIB_GROUP_MEMBER@ +/* Determine whether group id is in calling user's group list. */ +# if !@HAVE_GROUP_MEMBER@ +_GL_FUNCDECL_SYS (group_member, int, (gid_t gid)); +# endif +_GL_CXXALIAS_SYS (group_member, int, (gid_t gid)); +_GL_CXXALIASWARN (group_member); +#elif defined GNULIB_POSIXCHECK +# undef group_member +# if HAVE_RAW_DECL_GROUP_MEMBER +_GL_WARN_ON_USE (group_member, "group_member is unportable - " + "use gnulib module group-member for portability"); +# endif +#endif + + +#if @GNULIB_ISATTY@ +# if @REPLACE_ISATTY@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef isatty +# define isatty rpl_isatty +# endif +_GL_FUNCDECL_RPL (isatty, int, (int fd)); +_GL_CXXALIAS_RPL (isatty, int, (int fd)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef isatty +# define isatty _isatty +# endif +_GL_CXXALIAS_MDA (isatty, int, (int fd)); +# else +_GL_CXXALIAS_SYS (isatty, int, (int fd)); +# endif +_GL_CXXALIASWARN (isatty); +#elif defined GNULIB_POSIXCHECK +# undef isatty +# if HAVE_RAW_DECL_ISATTY +_GL_WARN_ON_USE (isatty, "isatty has portability problems on native Windows - " + "use gnulib module isatty for portability"); +# endif +#elif @GNULIB_MDA_ISATTY@ +/* On native Windows, map 'isatty' to '_isatty', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::isatty always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef isatty +# define isatty _isatty +# endif +_GL_CXXALIAS_MDA (isatty, int, (int fd)); +# else +_GL_CXXALIAS_SYS (isatty, int, (int fd)); +# endif +_GL_CXXALIASWARN (isatty); +#endif + + +#if @GNULIB_LCHOWN@ +/* Change the owner of FILE to UID (if UID is not -1) and the group of FILE + to GID (if GID is not -1). Do not follow symbolic links. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2008 specification + . */ +# if @REPLACE_LCHOWN@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef lchown +# define lchown rpl_lchown +# endif +_GL_FUNCDECL_RPL (lchown, int, (char const *file, uid_t owner, gid_t group) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (lchown, int, (char const *file, uid_t owner, gid_t group)); +# else +# if !@HAVE_LCHOWN@ +_GL_FUNCDECL_SYS (lchown, int, (char const *file, uid_t owner, gid_t group) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (lchown, int, (char const *file, uid_t owner, gid_t group)); +# endif +_GL_CXXALIASWARN (lchown); +#elif defined GNULIB_POSIXCHECK +# undef lchown +# if HAVE_RAW_DECL_LCHOWN +_GL_WARN_ON_USE (lchown, "lchown is unportable to pre-POSIX.1-2001 systems - " + "use gnulib module lchown for portability"); +# endif +#endif + + +#if @GNULIB_LINK@ +/* Create a new hard link for an existing file. + Return 0 if successful, otherwise -1 and errno set. + See POSIX:2008 specification + . */ +# if @REPLACE_LINK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define link rpl_link +# endif +_GL_FUNCDECL_RPL (link, int, (const char *path1, const char *path2) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (link, int, (const char *path1, const char *path2)); +# else +# if !@HAVE_LINK@ +_GL_FUNCDECL_SYS (link, int, (const char *path1, const char *path2) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (link, int, (const char *path1, const char *path2)); +# endif +_GL_CXXALIASWARN (link); +#elif defined GNULIB_POSIXCHECK +# undef link +# if HAVE_RAW_DECL_LINK +_GL_WARN_ON_USE (link, "link is unportable - " + "use gnulib module link for portability"); +# endif +#endif + + +#if @GNULIB_LINKAT@ +/* Create a new hard link for an existing file, relative to two + directories. FLAG controls whether symlinks are followed. + Return 0 if successful, otherwise -1 and errno set. */ +# if @REPLACE_LINKAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef linkat +# define linkat rpl_linkat +# endif +_GL_FUNCDECL_RPL (linkat, int, + (int fd1, const char *path1, int fd2, const char *path2, + int flag) + _GL_ARG_NONNULL ((2, 4))); +_GL_CXXALIAS_RPL (linkat, int, + (int fd1, const char *path1, int fd2, const char *path2, + int flag)); +# else +# if !@HAVE_LINKAT@ +_GL_FUNCDECL_SYS (linkat, int, + (int fd1, const char *path1, int fd2, const char *path2, + int flag) + _GL_ARG_NONNULL ((2, 4))); +# endif +_GL_CXXALIAS_SYS (linkat, int, + (int fd1, const char *path1, int fd2, const char *path2, + int flag)); +# endif +_GL_CXXALIASWARN (linkat); +#elif defined GNULIB_POSIXCHECK +# undef linkat +# if HAVE_RAW_DECL_LINKAT +_GL_WARN_ON_USE (linkat, "linkat is unportable - " + "use gnulib module linkat for portability"); +# endif +#endif + + +#if @GNULIB_LSEEK@ +/* Set the offset of FD relative to SEEK_SET, SEEK_CUR, or SEEK_END. + Return the new offset if successful, otherwise -1 and errno set. + See the POSIX:2008 specification + . */ +# if @REPLACE_LSEEK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define lseek rpl_lseek +# endif +_GL_FUNCDECL_RPL (lseek, off_t, (int fd, off_t offset, int whence)); +_GL_CXXALIAS_RPL (lseek, off_t, (int fd, off_t offset, int whence)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef lseek +# define lseek _lseek +# endif +_GL_CXXALIAS_MDA (lseek, off_t, (int fd, off_t offset, int whence)); +# else +_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); +# endif +_GL_CXXALIASWARN (lseek); +#elif defined GNULIB_POSIXCHECK +# undef lseek +# if HAVE_RAW_DECL_LSEEK +_GL_WARN_ON_USE (lseek, "lseek does not fail with ESPIPE on pipes on some " + "systems - use gnulib module lseek for portability"); +# endif +#elif @GNULIB_MDA_LSEEK@ +/* On native Windows, map 'lseek' to '_lseek', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::lseek always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef lseek +# define lseek _lseek +# endif +_GL_CXXALIAS_MDA (lseek, long, (int fd, long offset, int whence)); +# else +_GL_CXXALIAS_SYS (lseek, off_t, (int fd, off_t offset, int whence)); +# endif +_GL_CXXALIASWARN (lseek); +#endif + + +#if @GNULIB_PIPE@ +/* Create a pipe, defaulting to O_BINARY mode. + Store the read-end as fd[0] and the write-end as fd[1]. + Return 0 upon success, or -1 with errno set upon failure. */ +# if !@HAVE_PIPE@ +_GL_FUNCDECL_SYS (pipe, int, (int fd[2]) _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (pipe, int, (int fd[2])); +_GL_CXXALIASWARN (pipe); +#elif defined GNULIB_POSIXCHECK +# undef pipe +# if HAVE_RAW_DECL_PIPE +_GL_WARN_ON_USE (pipe, "pipe is unportable - " + "use gnulib module pipe-posix for portability"); +# endif +#endif + + +#if @GNULIB_PIPE2@ +/* Create a pipe, applying the given flags when opening the read-end of the + pipe and the write-end of the pipe. + The flags are a bitmask, possibly including O_CLOEXEC (defined in ) + and O_TEXT, O_BINARY (defined in "binary-io.h"). + Store the read-end as fd[0] and the write-end as fd[1]. + Return 0 upon success, or -1 with errno set upon failure. + See also the Linux man page at + . */ +# if @HAVE_PIPE2@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define pipe2 rpl_pipe2 +# endif +_GL_FUNCDECL_RPL (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (pipe2, int, (int fd[2], int flags)); +# else +_GL_FUNCDECL_SYS (pipe2, int, (int fd[2], int flags) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_SYS (pipe2, int, (int fd[2], int flags)); +# endif +_GL_CXXALIASWARN (pipe2); +#elif defined GNULIB_POSIXCHECK +# undef pipe2 +# if HAVE_RAW_DECL_PIPE2 +_GL_WARN_ON_USE (pipe2, "pipe2 is unportable - " + "use gnulib module pipe2 for portability"); +# endif +#endif + + +#if @GNULIB_PREAD@ +/* Read at most BUFSIZE bytes from FD into BUF, starting at OFFSET. + Return the number of bytes placed into BUF if successful, otherwise + set errno and return -1. 0 indicates EOF. + See the POSIX:2008 specification + . */ +# if @REPLACE_PREAD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pread +# define pread rpl_pread +# endif +_GL_FUNCDECL_RPL (pread, ssize_t, + (int fd, void *buf, size_t bufsize, off_t offset) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (pread, ssize_t, + (int fd, void *buf, size_t bufsize, off_t offset)); +# else +# if !@HAVE_PREAD@ +_GL_FUNCDECL_SYS (pread, ssize_t, + (int fd, void *buf, size_t bufsize, off_t offset) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (pread, ssize_t, + (int fd, void *buf, size_t bufsize, off_t offset)); +# endif +_GL_CXXALIASWARN (pread); +#elif defined GNULIB_POSIXCHECK +# undef pread +# if HAVE_RAW_DECL_PREAD +_GL_WARN_ON_USE (pread, "pread is unportable - " + "use gnulib module pread for portability"); +# endif +#endif + + +#if @GNULIB_PWRITE@ +/* Write at most BUFSIZE bytes from BUF into FD, starting at OFFSET. + Return the number of bytes written if successful, otherwise + set errno and return -1. 0 indicates nothing written. See the + POSIX:2008 specification + . */ +# if @REPLACE_PWRITE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef pwrite +# define pwrite rpl_pwrite +# endif +_GL_FUNCDECL_RPL (pwrite, ssize_t, + (int fd, const void *buf, size_t bufsize, off_t offset) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (pwrite, ssize_t, + (int fd, const void *buf, size_t bufsize, off_t offset)); +# else +# if !@HAVE_PWRITE@ +_GL_FUNCDECL_SYS (pwrite, ssize_t, + (int fd, const void *buf, size_t bufsize, off_t offset) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (pwrite, ssize_t, + (int fd, const void *buf, size_t bufsize, off_t offset)); +# endif +_GL_CXXALIASWARN (pwrite); +#elif defined GNULIB_POSIXCHECK +# undef pwrite +# if HAVE_RAW_DECL_PWRITE +_GL_WARN_ON_USE (pwrite, "pwrite is unportable - " + "use gnulib module pwrite for portability"); +# endif +#endif + + +#if @GNULIB_READ@ +/* Read up to COUNT bytes from file descriptor FD into the buffer starting + at BUF. See the POSIX:2008 specification + . */ +# if @REPLACE_READ@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef read +# define read rpl_read +# endif +_GL_FUNCDECL_RPL (read, ssize_t, (int fd, void *buf, size_t count) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (read, ssize_t, (int fd, void *buf, size_t count)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef read +# define read _read +# endif +_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, size_t count)); +# else +_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); +# endif +_GL_CXXALIASWARN (read); +#elif @GNULIB_MDA_READ@ +/* On native Windows, map 'read' to '_read', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::read always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef read +# define read _read +# endif +# ifdef __MINGW32__ +_GL_CXXALIAS_MDA (read, int, (int fd, void *buf, unsigned int count)); +# else +_GL_CXXALIAS_MDA (read, ssize_t, (int fd, void *buf, unsigned int count)); +# endif +# else +_GL_CXXALIAS_SYS (read, ssize_t, (int fd, void *buf, size_t count)); +# endif +_GL_CXXALIASWARN (read); +#endif + + +#if @GNULIB_READLINK@ +/* Read the contents of the symbolic link FILE and place the first BUFSIZE + bytes of it into BUF. Return the number of bytes placed into BUF if + successful, otherwise -1 and errno set. + See the POSIX:2008 specification + . */ +# if @REPLACE_READLINK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define readlink rpl_readlink +# endif +_GL_FUNCDECL_RPL (readlink, ssize_t, + (const char *restrict file, + char *restrict buf, size_t bufsize) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (readlink, ssize_t, + (const char *restrict file, + char *restrict buf, size_t bufsize)); +# else +# if !@HAVE_READLINK@ +_GL_FUNCDECL_SYS (readlink, ssize_t, + (const char *restrict file, + char *restrict buf, size_t bufsize) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (readlink, ssize_t, + (const char *restrict file, + char *restrict buf, size_t bufsize)); +# endif +_GL_CXXALIASWARN (readlink); +#elif defined GNULIB_POSIXCHECK +# undef readlink +# if HAVE_RAW_DECL_READLINK +_GL_WARN_ON_USE (readlink, "readlink is unportable - " + "use gnulib module readlink for portability"); +# endif +#endif + + +#if @GNULIB_READLINKAT@ +# if @REPLACE_READLINKAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define readlinkat rpl_readlinkat +# endif +_GL_FUNCDECL_RPL (readlinkat, ssize_t, + (int fd, char const *restrict file, + char *restrict buf, size_t len) + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (readlinkat, ssize_t, + (int fd, char const *restrict file, + char *restrict buf, size_t len)); +# else +# if !@HAVE_READLINKAT@ +_GL_FUNCDECL_SYS (readlinkat, ssize_t, + (int fd, char const *restrict file, + char *restrict buf, size_t len) + _GL_ARG_NONNULL ((2, 3))); +# endif +_GL_CXXALIAS_SYS (readlinkat, ssize_t, + (int fd, char const *restrict file, + char *restrict buf, size_t len)); +# endif +_GL_CXXALIASWARN (readlinkat); +#elif defined GNULIB_POSIXCHECK +# undef readlinkat +# if HAVE_RAW_DECL_READLINKAT +_GL_WARN_ON_USE (readlinkat, "readlinkat is not portable - " + "use gnulib module readlinkat for portability"); +# endif +#endif + + +#if @GNULIB_RMDIR@ +/* Remove the directory DIR. */ +# if @REPLACE_RMDIR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define rmdir rpl_rmdir +# endif +_GL_FUNCDECL_RPL (rmdir, int, (char const *name) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (rmdir, int, (char const *name)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef rmdir +# define rmdir _rmdir +# endif +_GL_CXXALIAS_MDA (rmdir, int, (char const *name)); +# else +_GL_CXXALIAS_SYS (rmdir, int, (char const *name)); +# endif +_GL_CXXALIASWARN (rmdir); +#elif defined GNULIB_POSIXCHECK +# undef rmdir +# if HAVE_RAW_DECL_RMDIR +_GL_WARN_ON_USE (rmdir, "rmdir is unportable - " + "use gnulib module rmdir for portability"); +# endif +#elif @GNULIB_MDA_RMDIR@ +/* On native Windows, map 'rmdir' to '_rmdir', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::rmdir always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef rmdir +# define rmdir _rmdir +# endif +_GL_CXXALIAS_MDA (rmdir, int, (char const *name)); +# else +_GL_CXXALIAS_SYS (rmdir, int, (char const *name)); +# endif +_GL_CXXALIASWARN (rmdir); +#endif + + +#if @GNULIB_SETHOSTNAME@ +/* Set the host name of the machine. + The host name may or may not be fully qualified. + + Put LEN bytes of NAME into the host name. + Return 0 if successful, otherwise, set errno and return -1. + + Platforms with no ability to set the hostname return -1 and set + errno = ENOSYS. */ +# if !@HAVE_SETHOSTNAME@ || !@HAVE_DECL_SETHOSTNAME@ +_GL_FUNCDECL_SYS (sethostname, int, (const char *name, size_t len) + _GL_ARG_NONNULL ((1))); +# endif +/* Need to cast, because on Solaris 11 2011-10, Mac OS X 10.5, IRIX 6.5 + and FreeBSD 6.4 the second parameter is int. On Solaris 11 + 2011-10, the first parameter is not const. */ +_GL_CXXALIAS_SYS_CAST (sethostname, int, (const char *name, size_t len)); +_GL_CXXALIASWARN (sethostname); +#elif defined GNULIB_POSIXCHECK +# undef sethostname +# if HAVE_RAW_DECL_SETHOSTNAME +_GL_WARN_ON_USE (sethostname, "sethostname is unportable - " + "use gnulib module sethostname for portability"); +# endif +#endif + + +#if @GNULIB_SLEEP@ +/* Pause the execution of the current thread for N seconds. + Returns the number of seconds left to sleep. + See the POSIX:2008 specification + . */ +# if @REPLACE_SLEEP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef sleep +# define sleep rpl_sleep +# endif +_GL_FUNCDECL_RPL (sleep, unsigned int, (unsigned int n)); +_GL_CXXALIAS_RPL (sleep, unsigned int, (unsigned int n)); +# else +# if !@HAVE_SLEEP@ +_GL_FUNCDECL_SYS (sleep, unsigned int, (unsigned int n)); +# endif +_GL_CXXALIAS_SYS (sleep, unsigned int, (unsigned int n)); +# endif +_GL_CXXALIASWARN (sleep); +#elif defined GNULIB_POSIXCHECK +# undef sleep +# if HAVE_RAW_DECL_SLEEP +_GL_WARN_ON_USE (sleep, "sleep is unportable - " + "use gnulib module sleep for portability"); +# endif +#endif + + +#if @GNULIB_MDA_SWAB@ +/* On native Windows, map 'swab' to '_swab', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::swab always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef swab +# define swab _swab +# endif +_GL_CXXALIAS_MDA (swab, void, (char *from, char *to, int n)); +# else +_GL_CXXALIAS_SYS (swab, void, (const void *from, void *to, ssize_t n)); +# endif +_GL_CXXALIASWARN (swab); +#endif + + +#if @GNULIB_SYMLINK@ +# if @REPLACE_SYMLINK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef symlink +# define symlink rpl_symlink +# endif +_GL_FUNCDECL_RPL (symlink, int, (char const *contents, char const *file) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (symlink, int, (char const *contents, char const *file)); +# else +# if !@HAVE_SYMLINK@ +_GL_FUNCDECL_SYS (symlink, int, (char const *contents, char const *file) + _GL_ARG_NONNULL ((1, 2))); +# endif +_GL_CXXALIAS_SYS (symlink, int, (char const *contents, char const *file)); +# endif +_GL_CXXALIASWARN (symlink); +#elif defined GNULIB_POSIXCHECK +# undef symlink +# if HAVE_RAW_DECL_SYMLINK +_GL_WARN_ON_USE (symlink, "symlink is not portable - " + "use gnulib module symlink for portability"); +# endif +#endif + + +#if @GNULIB_SYMLINKAT@ +# if @REPLACE_SYMLINKAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef symlinkat +# define symlinkat rpl_symlinkat +# endif +_GL_FUNCDECL_RPL (symlinkat, int, + (char const *contents, int fd, char const *file) + _GL_ARG_NONNULL ((1, 3))); +_GL_CXXALIAS_RPL (symlinkat, int, + (char const *contents, int fd, char const *file)); +# else +# if !@HAVE_SYMLINKAT@ +_GL_FUNCDECL_SYS (symlinkat, int, + (char const *contents, int fd, char const *file) + _GL_ARG_NONNULL ((1, 3))); +# endif +_GL_CXXALIAS_SYS (symlinkat, int, + (char const *contents, int fd, char const *file)); +# endif +_GL_CXXALIASWARN (symlinkat); +#elif defined GNULIB_POSIXCHECK +# undef symlinkat +# if HAVE_RAW_DECL_SYMLINKAT +_GL_WARN_ON_USE (symlinkat, "symlinkat is not portable - " + "use gnulib module symlinkat for portability"); +# endif +#endif + + +#if @GNULIB_TRUNCATE@ +/* Change the size of the file designated by FILENAME to become equal to LENGTH. + Return 0 if successful, otherwise -1 and errno set. + See the POSIX:2008 specification + . */ +# if @REPLACE_TRUNCATE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef truncate +# define truncate rpl_truncate +# endif +_GL_FUNCDECL_RPL (truncate, int, (const char *filename, off_t length) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (truncate, int, (const char *filename, off_t length)); +# else +# if !@HAVE_DECL_TRUNCATE@ +_GL_FUNCDECL_SYS (truncate, int, (const char *filename, off_t length) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (truncate, int, (const char *filename, off_t length)); +# endif +_GL_CXXALIASWARN (truncate); +#elif defined GNULIB_POSIXCHECK +# undef truncate +# if HAVE_RAW_DECL_TRUNCATE +_GL_WARN_ON_USE (truncate, "truncate is unportable - " + "use gnulib module truncate for portability"); +# endif +#endif + + +#if @GNULIB_TTYNAME_R@ +/* Store at most BUFLEN characters of the pathname of the terminal FD is + open on in BUF. Return 0 on success, otherwise an error number. */ +# if @REPLACE_TTYNAME_R@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef ttyname_r +# define ttyname_r rpl_ttyname_r +# endif +_GL_FUNCDECL_RPL (ttyname_r, int, + (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (ttyname_r, int, + (int fd, char *buf, size_t buflen)); +# else +# if !@HAVE_DECL_TTYNAME_R@ +_GL_FUNCDECL_SYS (ttyname_r, int, + (int fd, char *buf, size_t buflen) _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (ttyname_r, int, + (int fd, char *buf, size_t buflen)); +# endif +_GL_CXXALIASWARN (ttyname_r); +#elif defined GNULIB_POSIXCHECK +# undef ttyname_r +# if HAVE_RAW_DECL_TTYNAME_R +_GL_WARN_ON_USE (ttyname_r, "ttyname_r is not portable - " + "use gnulib module ttyname_r for portability"); +# endif +#endif + + +#if @GNULIB_UNLINK@ +# if @REPLACE_UNLINK@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef unlink +# define unlink rpl_unlink +# endif +_GL_FUNCDECL_RPL (unlink, int, (char const *file) _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (unlink, int, (char const *file)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef unlink +# define unlink _unlink +# endif +_GL_CXXALIAS_MDA (unlink, int, (char const *file)); +# else +_GL_CXXALIAS_SYS (unlink, int, (char const *file)); +# endif +_GL_CXXALIASWARN (unlink); +#elif defined GNULIB_POSIXCHECK +# undef unlink +# if HAVE_RAW_DECL_UNLINK +_GL_WARN_ON_USE (unlink, "unlink is not portable - " + "use gnulib module unlink for portability"); +# endif +#elif @GNULIB_MDA_UNLINK@ +/* On native Windows, map 'unlink' to '_unlink', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::unlink always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef unlink +# define unlink _unlink +# endif +_GL_CXXALIAS_MDA (unlink, int, (char const *file)); +# else +_GL_CXXALIAS_SYS (unlink, int, (char const *file)); +# endif +_GL_CXXALIASWARN (unlink); +#endif + + +#if @GNULIB_UNLINKAT@ +# if @REPLACE_UNLINKAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef unlinkat +# define unlinkat rpl_unlinkat +# endif +_GL_FUNCDECL_RPL (unlinkat, int, (int fd, char const *file, int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (unlinkat, int, (int fd, char const *file, int flag)); +# else +# if !@HAVE_UNLINKAT@ +_GL_FUNCDECL_SYS (unlinkat, int, (int fd, char const *file, int flag) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (unlinkat, int, (int fd, char const *file, int flag)); +# endif +_GL_CXXALIASWARN (unlinkat); +#elif defined GNULIB_POSIXCHECK +# undef unlinkat +# if HAVE_RAW_DECL_UNLINKAT +_GL_WARN_ON_USE (unlinkat, "unlinkat is not portable - " + "use gnulib module unlinkat for portability"); +# endif +#endif + + +#if @GNULIB_USLEEP@ +/* Pause the execution of the current thread for N microseconds. + Returns 0 on completion, or -1 on range error. + See the POSIX:2001 specification + . */ +# if @REPLACE_USLEEP@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef usleep +# define usleep rpl_usleep +# endif +_GL_FUNCDECL_RPL (usleep, int, (useconds_t n)); +_GL_CXXALIAS_RPL (usleep, int, (useconds_t n)); +# else +# if !@HAVE_USLEEP@ +_GL_FUNCDECL_SYS (usleep, int, (useconds_t n)); +# endif +/* Need to cast, because on Haiku, the first parameter is + unsigned int n. */ +_GL_CXXALIAS_SYS_CAST (usleep, int, (useconds_t n)); +# endif +_GL_CXXALIASWARN (usleep); +#elif defined GNULIB_POSIXCHECK +# undef usleep +# if HAVE_RAW_DECL_USLEEP +_GL_WARN_ON_USE (usleep, "usleep is unportable - " + "use gnulib module usleep for portability"); +# endif +#endif + + +#if @GNULIB_WRITE@ +/* Write up to COUNT bytes starting at BUF to file descriptor FD. + See the POSIX:2008 specification + . */ +# if @REPLACE_WRITE@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef write +# define write rpl_write +# endif +_GL_FUNCDECL_RPL (write, ssize_t, (int fd, const void *buf, size_t count) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (write, ssize_t, (int fd, const void *buf, size_t count)); +# elif defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef write +# define write _write +# endif +_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, size_t count)); +# else +_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); +# endif +_GL_CXXALIASWARN (write); +#elif @GNULIB_MDA_WRITE@ +/* On native Windows, map 'write' to '_write', so that -loldnames is not + required. In C++ with GNULIB_NAMESPACE, avoid differences between + platforms by defining GNULIB_NAMESPACE::write always. */ +# if defined _WIN32 && !defined __CYGWIN__ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef write +# define write _write +# endif +# ifdef __MINGW32__ +_GL_CXXALIAS_MDA (write, int, (int fd, const void *buf, unsigned int count)); +# else +_GL_CXXALIAS_MDA (write, ssize_t, (int fd, const void *buf, unsigned int count)); +# endif +# else +_GL_CXXALIAS_SYS (write, ssize_t, (int fd, const void *buf, size_t count)); +# endif +_GL_CXXALIASWARN (write); +#endif + +_GL_INLINE_HEADER_END + +#endif /* _@GUARD_PREFIX@_UNISTD_H */ +#endif /* _GL_INCLUDING_UNISTD_H */ +#endif /* _@GUARD_PREFIX@_UNISTD_H */ diff --git a/gnulib-lib/verify.h b/gnulib-lib/verify.h new file mode 100644 index 0000000..3485a7e --- /dev/null +++ b/gnulib-lib/verify.h @@ -0,0 +1,315 @@ +/* Compile-time assert-like macros. + + Copyright (C) 2005-2006, 2009-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Paul Eggert, Bruno Haible, and Jim Meyering. */ + +#ifndef _GL_VERIFY_H +#define _GL_VERIFY_H + + +/* Define _GL_HAVE__STATIC_ASSERT to 1 if _Static_assert (R, DIAGNOSTIC) + works as per C11. This is supported by GCC 4.6.0+ and by clang 4+. + + Define _GL_HAVE__STATIC_ASSERT1 to 1 if _Static_assert (R) works as + per C2X. This is supported by GCC 9.1+. + + Support compilers claiming conformance to the relevant standard, + and also support GCC when not pedantic. If we were willing to slow + 'configure' down we could also use it with other compilers, but + since this affects only the quality of diagnostics, why bother? */ +#ifndef __cplusplus +# if (201112L <= __STDC_VERSION__ \ + || (!defined __STRICT_ANSI__ \ + && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 4 <= __clang_major__))) +# define _GL_HAVE__STATIC_ASSERT 1 +# endif +# if (202000L <= __STDC_VERSION__ \ + || (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) +# define _GL_HAVE__STATIC_ASSERT1 1 +# endif +#endif + +/* FreeBSD 9.1 , included by and lots of other + system headers, defines a conflicting _Static_assert that is no + better than ours; override it. */ +#ifndef _GL_HAVE__STATIC_ASSERT +# include +# undef _Static_assert +#endif + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + If _Static_assert works, verify (R) uses it directly. Similarly, + _GL_VERIFY_TRUE works by packaging a _Static_assert inside a struct + that is an operand of sizeof. + + The code below uses several ideas for C++ compilers, and for C + compilers that do not support _Static_assert: + + * The first step is ((R) ? 1 : -1). Given an expression R, of + integral or boolean or floating-point type, this yields an + expression of integral type, whose value is later verified to be + constant and nonnegative. + + * Next this expression W is wrapped in a type + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: W; + }. + If W is negative, this yields a compile-time error. No compiler can + deal with a bit-field of negative size. + + One might think that an array size check would have the same + effect, that is, that the type struct { unsigned int dummy[W]; } + would work as well. However, inside a function, some compilers + (such as C++ compilers and GNU C) allow local parameters and + variables inside array size expressions. With these compilers, + an array size check would not properly diagnose this misuse of + the verify macro: + + void function (int n) { verify (n < 0); } + + * For the verify macro, the struct _gl_verify_type will need to + somehow be embedded into a declaration. To be portable, this + declaration must declare an object, a constant, a function, or a + typedef name. If the declared entity uses the type directly, + such as in + + struct dummy {...}; + typedef struct {...} dummy; + extern struct {...} *dummy; + extern void dummy (struct {...} *); + extern struct {...} *dummy (void); + + two uses of the verify macro would yield colliding declarations + if the entity names are not disambiguated. A workaround is to + attach the current line number to the entity name: + + #define _GL_CONCAT0(x, y) x##y + #define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) + extern struct {...} * _GL_CONCAT (dummy, __LINE__); + + But this has the problem that two invocations of verify from + within the same macro would collide, since the __LINE__ value + would be the same for both invocations. (The GCC __COUNTER__ + macro solves this problem, but is not portable.) + + A solution is to use the sizeof operator. It yields a number, + getting rid of the identity of the type. Declarations like + + extern int dummy [sizeof (struct {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + + can be repeated. + + * Should the implementation use a named struct or an unnamed struct? + Which of the following alternatives can be used? + + extern int dummy [sizeof (struct {...})]; + extern int dummy [sizeof (struct _gl_verify_type {...})]; + extern void dummy (int [sizeof (struct {...})]); + extern void dummy (int [sizeof (struct _gl_verify_type {...})]); + extern int (*dummy (void)) [sizeof (struct {...})]; + extern int (*dummy (void)) [sizeof (struct _gl_verify_type {...})]; + + In the second and sixth case, the struct type is exported to the + outer scope; two such declarations therefore collide. GCC warns + about the first, third, and fourth cases. So the only remaining + possibility is the fifth case: + + extern int (*dummy (void)) [sizeof (struct {...})]; + + * GCC warns about duplicate declarations of the dummy function if + -Wredundant-decls is used. GCC 4.3 and later have a builtin + __COUNTER__ macro that can let us generate unique identifiers for + each dummy function, to suppress this warning. + + * This implementation exploits the fact that older versions of GCC, + which do not support _Static_assert, also do not warn about the + last declaration mentioned above. + + * GCC warns if -Wnested-externs is enabled and 'verify' is used + within a function body; but inside a function, you can always + arrange to use verify_expr instead. + + * In C++, any struct definition inside sizeof is invalid. + Use a template type to work around the problem. */ + +/* Concatenate two preprocessor tokens. */ +#define _GL_CONCAT(x, y) _GL_CONCAT0 (x, y) +#define _GL_CONCAT0(x, y) x##y + +/* _GL_COUNTER is an integer, preferably one that changes each time we + use it. Use __COUNTER__ if it works, falling back on __LINE__ + otherwise. __LINE__ isn't perfect, but it's better than a + constant. */ +#if defined __COUNTER__ && __COUNTER__ != __COUNTER__ +# define _GL_COUNTER __COUNTER__ +#else +# define _GL_COUNTER __LINE__ +#endif + +/* Generate a symbol with the given prefix, making it unique if + possible. */ +#define _GL_GENSYM(prefix) _GL_CONCAT (prefix, _GL_COUNTER) + +/* Verify requirement R at compile-time, as an integer constant expression + that returns 1. If R is false, fail at compile-time, preferably + with a diagnostic that includes the string-literal DIAGNOSTIC. */ + +#define _GL_VERIFY_TRUE(R, DIAGNOSTIC) \ + (!!sizeof (_GL_VERIFY_TYPE (R, DIAGNOSTIC))) + +#ifdef __cplusplus +# if !GNULIB_defined_struct__gl_verify_type +template + struct _gl_verify_type { + unsigned int _gl_verify_error_if_negative: w; + }; +# define GNULIB_defined_struct__gl_verify_type 1 +# endif +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + _gl_verify_type<(R) ? 1 : -1> +#elif defined _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { \ + _Static_assert (R, DIAGNOSTIC); \ + int _gl_dummy; \ + } +#else +# define _GL_VERIFY_TYPE(R, DIAGNOSTIC) \ + struct { unsigned int _gl_verify_error_if_negative: (R) ? 1 : -1; } +#endif + +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. If R is false, fail at compile-time. + + This macro requires three or more arguments but uses at most the first + two, so that the _Static_assert macro optionally defined below supports + both the C11 two-argument syntax and the C2X one-argument syntax. + + Unfortunately, unlike C11, this implementation must appear as an + ordinary declaration, and cannot appear inside struct { ... }. */ + +#if 200410 <= __cpp_static_assert +# define _GL_VERIFY(R, DIAGNOSTIC, ...) static_assert (R, DIAGNOSTIC) +#elif defined _GL_HAVE__STATIC_ASSERT +# define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC) +#else +# define _GL_VERIFY(R, DIAGNOSTIC, ...) \ + extern int (*_GL_GENSYM (_gl_verify_function) (void)) \ + [_GL_VERIFY_TRUE (R, DIAGNOSTIC)] +#endif + +/* _GL_STATIC_ASSERT_H is defined if this code is copied into assert.h. */ +#ifdef _GL_STATIC_ASSERT_H +# if !defined _GL_HAVE__STATIC_ASSERT1 && !defined _Static_assert +# define _Static_assert(...) \ + _GL_VERIFY (__VA_ARGS__, "static assertion failed", -) +# endif +# if __cpp_static_assert < 201411 && !defined static_assert +# define static_assert _Static_assert /* C11 requires this #define. */ +# endif +#endif + +/* @assert.h omit start@ */ + +#if 3 < __GNUC__ + (3 < __GNUC_MINOR__ + (4 <= __GNUC_PATCHLEVEL__)) +# define _GL_HAS_BUILTIN_TRAP 1 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_TRAP __has_builtin (__builtin_trap) +#else +# define _GL_HAS_BUILTIN_TRAP 0 +#endif + +#if 4 < __GNUC__ + (5 <= __GNUC_MINOR__) +# define _GL_HAS_BUILTIN_UNREACHABLE 1 +#elif defined __has_builtin +# define _GL_HAS_BUILTIN_UNREACHABLE __has_builtin (__builtin_unreachable) +#else +# define _GL_HAS_BUILTIN_UNREACHABLE 0 +#endif + +/* Each of these macros verifies that its argument R is nonzero. To + be portable, R should be an integer constant expression. Unlike + assert (R), there is no run-time overhead. + + There are two macros, since no single macro can be used in all + contexts in C. verify_expr (R, E) is for scalar contexts, including + integer constant expression contexts. verify (R) is for declaration + contexts, e.g., the top level. */ + +/* Verify requirement R at compile-time. Return the value of the + expression E. */ + +#define verify_expr(R, E) \ + (_GL_VERIFY_TRUE (R, "verify_expr (" #R ", " #E ")") ? (E) : (E)) + +/* Verify requirement R at compile-time, as a declaration without a + trailing ';'. verify (R) acts like static_assert (R) except that + it is portable to C11/C++14 and earlier, it can issue better + diagnostics, and its name is shorter and may be more convenient. */ + +#ifdef __PGI +/* PGI barfs if R is long. */ +# define verify(R) _GL_VERIFY (R, "verify (...)", -) +#else +# define verify(R) _GL_VERIFY (R, "verify (" #R ")", -) +#endif + +/* Assume that R always holds. Behavior is undefined if R is false, + fails to evaluate, or has side effects. + + 'assume (R)' is a directive from the programmer telling the + compiler that R is true so the compiler needn't generate code to + test R. This is why 'assume' is in verify.h: it's related to + static checking (in this case, static checking done by the + programmer), not dynamic checking. + + 'assume (R)' can affect compilation of all the code, not just code + that happens to be executed after the assume (R) is "executed". + For example, if the code mistakenly does 'assert (R); assume (R);' + the compiler is entitled to optimize away the 'assert (R)'. + + Although assuming R can help a compiler generate better code or + diagnostics, performance can suffer if R uses hard-to-optimize + features such as function calls not inlined by the compiler. + + Avoid Clang's __builtin_assume, as it breaks GNU Emacs master + as of 2020-08-23T21:09:49Z!eggert@cs.ucla.edu; see + . It's not known whether this breakage + is a Clang bug or an Emacs bug; play it safe for now. */ + +#if _GL_HAS_BUILTIN_UNREACHABLE +# define assume(R) ((R) ? (void) 0 : __builtin_unreachable ()) +#elif 1200 <= _MSC_VER +# define assume(R) __assume (R) +#elif (defined GCC_LINT || defined lint) && _GL_HAS_BUILTIN_TRAP + /* Doing it this way helps various packages when configured with + --enable-gcc-warnings, which compiles with -Dlint. It's nicer + when 'assume' silences warnings even with older GCCs. */ +# define assume(R) ((R) ? (void) 0 : __builtin_trap ()) +#else + /* Some tools grok NOTREACHED, e.g., Oracle Studio 12.6. */ +# define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0) +#endif + +/* @assert.h omit end@ */ + +#endif diff --git a/gnulib-lib/warn-on-use.h b/gnulib-lib/warn-on-use.h new file mode 100644 index 0000000..612937a --- /dev/null +++ b/gnulib-lib/warn-on-use.h @@ -0,0 +1,149 @@ +/* A C macro for emitting warnings if a function is used. + Copyright (C) 2010-2021 Free Software Foundation, Inc. + + This program 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 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with this program. If not, see . */ + +/* _GL_WARN_ON_USE (function, "literal string") issues a declaration + for FUNCTION which will then trigger a compiler warning containing + the text of "literal string" anywhere that function is called, if + supported by the compiler. If the compiler does not support this + feature, the macro expands to an unused extern declaration. + + _GL_WARN_ON_USE_ATTRIBUTE ("literal string") expands to the + attribute used in _GL_WARN_ON_USE. If the compiler does not support + this feature, it expands to empty. + + These macros are useful for marking a function as a potential + portability trap, with the intent that "literal string" include + instructions on the replacement function that should be used + instead. + _GL_WARN_ON_USE is for functions with 'extern' linkage. + _GL_WARN_ON_USE_ATTRIBUTE is for functions with 'static' or 'inline' + linkage. + + However, one of the reasons that a function is a portability trap is + if it has the wrong signature. Declaring FUNCTION with a different + signature in C is a compilation error, so this macro must use the + same type as any existing declaration so that programs that avoid + the problematic FUNCTION do not fail to compile merely because they + included a header that poisoned the function. But this implies that + _GL_WARN_ON_USE is only safe to use if FUNCTION is known to already + have a declaration. Use of this macro implies that there must not + be any other macro hiding the declaration of FUNCTION; but + undefining FUNCTION first is part of the poisoning process anyway + (although for symbols that are provided only via a macro, the result + is a compilation error rather than a warning containing + "literal string"). Also note that in C++, it is only safe to use if + FUNCTION has no overloads. + + For an example, it is possible to poison 'getline' by: + - adding a call to gl_WARN_ON_USE_PREPARE([[#include ]], + [getline]) in configure.ac, which potentially defines + HAVE_RAW_DECL_GETLINE + - adding this code to a header that wraps the system : + #undef getline + #if HAVE_RAW_DECL_GETLINE + _GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but" + "not universally present; use the gnulib module getline"); + #endif + + It is not possible to directly poison global variables. But it is + possible to write a wrapper accessor function, and poison that + (less common usage, like &environ, will cause a compilation error + rather than issue the nice warning, but the end result of informing + the developer about their portability problem is still achieved): + #if HAVE_RAW_DECL_ENVIRON + static char *** + rpl_environ (void) { return &environ; } + _GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared"); + # undef environ + # define environ (*rpl_environ ()) + #endif + or better (avoiding contradictory use of 'static' and 'extern'): + #if HAVE_RAW_DECL_ENVIRON + static char *** + _GL_WARN_ON_USE_ATTRIBUTE ("environ is not always properly declared") + rpl_environ (void) { return &environ; } + # undef environ + # define environ (*rpl_environ ()) + #endif + */ +#ifndef _GL_WARN_ON_USE + +# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE(function, message) \ +extern __typeof__ (function) function __attribute__ ((__warning__ (message))) +# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ + __attribute__ ((__warning__ (message))) +# elif __clang_major__ >= 4 +/* Another compiler attribute is available in clang. */ +# define _GL_WARN_ON_USE(function, message) \ +extern __typeof__ (function) function \ + __attribute__ ((__diagnose_if__ (1, message, "warning"))) +# define _GL_WARN_ON_USE_ATTRIBUTE(message) \ + __attribute__ ((__diagnose_if__ (1, message, "warning"))) +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE(function, message) \ +extern __typeof__ (function) function +# define _GL_WARN_ON_USE_ATTRIBUTE(message) +# else /* Unsupported. */ +# define _GL_WARN_ON_USE(function, message) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# define _GL_WARN_ON_USE_ATTRIBUTE(message) +# endif +#endif + +/* _GL_WARN_ON_USE_CXX (function, rettype_gcc, rettype_clang, parameters_and_attributes, "message") + is like _GL_WARN_ON_USE (function, "message"), except that in C++ mode the + function is declared with the given prototype, consisting of return type, + parameters, and attributes. + This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does + not work in this case. */ +#ifndef _GL_WARN_ON_USE_CXX +# if !defined __cplusplus +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ + _GL_WARN_ON_USE (function, msg) +# else +# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) +/* A compiler attribute is available in gcc versions 4.3.0 and later. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_gcc function parameters_and_attributes \ + __attribute__ ((__warning__ (msg))) +# elif __clang_major__ >= 4 +/* Another compiler attribute is available in clang. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_clang function parameters_and_attributes \ + __attribute__ ((__diagnose_if__ (1, msg, "warning"))) +# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING +/* Verify the existence of the function. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +extern rettype_gcc function parameters_and_attributes +# else /* Unsupported. */ +# define _GL_WARN_ON_USE_CXX(function,rettype_gcc,rettype_clang,parameters_and_attributes,msg) \ +_GL_WARN_EXTERN_C int _gl_warn_on_use +# endif +# endif +#endif + +/* _GL_WARN_EXTERN_C declaration; + performs the declaration with C linkage. */ +#ifndef _GL_WARN_EXTERN_C +# if defined __cplusplus +# define _GL_WARN_EXTERN_C extern "C" +# else +# define _GL_WARN_EXTERN_C extern +# endif +#endif diff --git a/gnulib-lib/windows-initguard.h b/gnulib-lib/windows-initguard.h new file mode 100644 index 0000000..7999b23 --- /dev/null +++ b/gnulib-lib/windows-initguard.h @@ -0,0 +1,35 @@ +/* Init guards, somewhat like spinlocks (native Windows implementation). + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-win32.h. */ + +#ifndef _WINDOWS_INITGUARD_H +#define _WINDOWS_INITGUARD_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include + +typedef struct + { + volatile int done; + volatile LONG started; + } + glwthread_initguard_t; + +#define GLWTHREAD_INITGUARD_INIT { 0, -1 } + +#endif /* _WINDOWS_INITGUARD_H */ diff --git a/gnulib-lib/windows-mutex.c b/gnulib-lib/windows-mutex.c new file mode 100644 index 0000000..2edfeaa --- /dev/null +++ b/gnulib-lib/windows-mutex.c @@ -0,0 +1,95 @@ +/* Plain mutexes (native Windows implementation). + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-win32.h. */ + +#include + +/* Specification. */ +#include "windows-mutex.h" + +#include + +void +glwthread_mutex_init (glwthread_mutex_t *mutex) +{ + InitializeCriticalSection (&mutex->lock); + mutex->guard.done = 1; +} + +int +glwthread_mutex_lock (glwthread_mutex_t *mutex) +{ + if (!mutex->guard.done) + { + if (InterlockedIncrement (&mutex->guard.started) == 0) + /* This thread is the first one to need this mutex. Initialize it. */ + glwthread_mutex_init (mutex); + else + { + /* Don't let mutex->guard.started grow and wrap around. */ + InterlockedDecrement (&mutex->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this mutex. */ + while (!mutex->guard.done) + Sleep (0); + } + } + EnterCriticalSection (&mutex->lock); + return 0; +} + +int +glwthread_mutex_trylock (glwthread_mutex_t *mutex) +{ + if (!mutex->guard.done) + { + if (InterlockedIncrement (&mutex->guard.started) == 0) + /* This thread is the first one to need this mutex. Initialize it. */ + glwthread_mutex_init (mutex); + else + { + /* Don't let mutex->guard.started grow and wrap around. */ + InterlockedDecrement (&mutex->guard.started); + /* Let another thread finish initializing this mutex, and let it also + lock this mutex. */ + return EBUSY; + } + } + if (!TryEnterCriticalSection (&mutex->lock)) + return EBUSY; + return 0; +} + +int +glwthread_mutex_unlock (glwthread_mutex_t *mutex) +{ + if (!mutex->guard.done) + return EINVAL; + LeaveCriticalSection (&mutex->lock); + return 0; +} + +int +glwthread_mutex_destroy (glwthread_mutex_t *mutex) +{ + if (!mutex->guard.done) + return EINVAL; + DeleteCriticalSection (&mutex->lock); + mutex->guard.done = 0; + return 0; +} diff --git a/gnulib-lib/windows-mutex.h b/gnulib-lib/windows-mutex.h new file mode 100644 index 0000000..5ecf9f8 --- /dev/null +++ b/gnulib-lib/windows-mutex.h @@ -0,0 +1,51 @@ +/* Plain mutexes (native Windows implementation). + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-win32.h. */ + +#ifndef _WINDOWS_MUTEX_H +#define _WINDOWS_MUTEX_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include + +#include "windows-initguard.h" + +typedef struct + { + glwthread_initguard_t guard; /* protects the initialization */ + CRITICAL_SECTION lock; + } + glwthread_mutex_t; + +#define GLWTHREAD_MUTEX_INIT { GLWTHREAD_INITGUARD_INIT } + +#ifdef __cplusplus +extern "C" { +#endif + +extern void glwthread_mutex_init (glwthread_mutex_t *mutex); +extern int glwthread_mutex_lock (glwthread_mutex_t *mutex); +extern int glwthread_mutex_trylock (glwthread_mutex_t *mutex); +extern int glwthread_mutex_unlock (glwthread_mutex_t *mutex); +extern int glwthread_mutex_destroy (glwthread_mutex_t *mutex); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINDOWS_MUTEX_H */ diff --git a/gnulib-lib/windows-once.c b/gnulib-lib/windows-once.c new file mode 100644 index 0000000..8dcd37c --- /dev/null +++ b/gnulib-lib/windows-once.c @@ -0,0 +1,62 @@ +/* Once-only control (native Windows implementation). + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-win32.h. */ + +#include + +/* Specification. */ +#include "windows-once.h" + +#include + +void +glwthread_once (glwthread_once_t *once_control, void (*initfunction) (void)) +{ + if (once_control->inited <= 0) + { + if (InterlockedIncrement (&once_control->started) == 0) + { + /* This thread is the first one to come to this once_control. */ + InitializeCriticalSection (&once_control->lock); + EnterCriticalSection (&once_control->lock); + once_control->inited = 0; + initfunction (); + once_control->inited = 1; + LeaveCriticalSection (&once_control->lock); + } + else + { + /* Don't let once_control->started grow and wrap around. */ + InterlockedDecrement (&once_control->started); + /* Some other thread has already started the initialization. + Yield the CPU while waiting for the other thread to finish + initializing and taking the lock. */ + while (once_control->inited < 0) + Sleep (0); + if (once_control->inited <= 0) + { + /* Take the lock. This blocks until the other thread has + finished calling the initfunction. */ + EnterCriticalSection (&once_control->lock); + LeaveCriticalSection (&once_control->lock); + if (!(once_control->inited > 0)) + abort (); + } + } + } +} diff --git a/gnulib-lib/windows-once.h b/gnulib-lib/windows-once.h new file mode 100644 index 0000000..58632f9 --- /dev/null +++ b/gnulib-lib/windows-once.h @@ -0,0 +1,47 @@ +/* Once-only control (native Windows implementation). + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-win32.h. */ + +#ifndef _WINDOWS_ONCE_H +#define _WINDOWS_ONCE_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include + +typedef struct + { + volatile int inited; + volatile LONG started; + CRITICAL_SECTION lock; + } + glwthread_once_t; + +#define GLWTHREAD_ONCE_INIT { -1, -1 } + +#ifdef __cplusplus +extern "C" { +#endif + +extern void glwthread_once (glwthread_once_t *once_control, + void (*initfunction) (void)); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINDOWS_ONCE_H */ diff --git a/gnulib-lib/windows-recmutex.c b/gnulib-lib/windows-recmutex.c new file mode 100644 index 0000000..cfc94b4 --- /dev/null +++ b/gnulib-lib/windows-recmutex.c @@ -0,0 +1,127 @@ +/* Plain recursive mutexes (native Windows implementation). + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-win32.h. */ + +#include + +/* Specification. */ +#include "windows-recmutex.h" + +#include + +void +glwthread_recmutex_init (glwthread_recmutex_t *mutex) +{ + mutex->owner = 0; + mutex->depth = 0; + InitializeCriticalSection (&mutex->lock); + mutex->guard.done = 1; +} + +int +glwthread_recmutex_lock (glwthread_recmutex_t *mutex) +{ + if (!mutex->guard.done) + { + if (InterlockedIncrement (&mutex->guard.started) == 0) + /* This thread is the first one to need this mutex. Initialize it. */ + glwthread_recmutex_init (mutex); + else + { + /* Don't let mutex->guard.started grow and wrap around. */ + InterlockedDecrement (&mutex->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this mutex. */ + while (!mutex->guard.done) + Sleep (0); + } + } + { + DWORD self = GetCurrentThreadId (); + if (mutex->owner != self) + { + EnterCriticalSection (&mutex->lock); + mutex->owner = self; + } + if (++(mutex->depth) == 0) /* wraparound? */ + { + mutex->depth--; + return EAGAIN; + } + } + return 0; +} + +int +glwthread_recmutex_trylock (glwthread_recmutex_t *mutex) +{ + if (!mutex->guard.done) + { + if (InterlockedIncrement (&mutex->guard.started) == 0) + /* This thread is the first one to need this mutex. Initialize it. */ + glwthread_recmutex_init (mutex); + else + { + /* Don't let mutex->guard.started grow and wrap around. */ + InterlockedDecrement (&mutex->guard.started); + /* Let another thread finish initializing this mutex, and let it also + lock this mutex. */ + return EBUSY; + } + } + { + DWORD self = GetCurrentThreadId (); + if (mutex->owner != self) + { + if (!TryEnterCriticalSection (&mutex->lock)) + return EBUSY; + mutex->owner = self; + } + if (++(mutex->depth) == 0) /* wraparound? */ + { + mutex->depth--; + return EAGAIN; + } + } + return 0; +} + +int +glwthread_recmutex_unlock (glwthread_recmutex_t *mutex) +{ + if (mutex->owner != GetCurrentThreadId ()) + return EPERM; + if (mutex->depth == 0) + return EINVAL; + if (--(mutex->depth) == 0) + { + mutex->owner = 0; + LeaveCriticalSection (&mutex->lock); + } + return 0; +} + +int +glwthread_recmutex_destroy (glwthread_recmutex_t *mutex) +{ + if (mutex->owner != 0) + return EBUSY; + DeleteCriticalSection (&mutex->lock); + mutex->guard.done = 0; + return 0; +} diff --git a/gnulib-lib/windows-recmutex.h b/gnulib-lib/windows-recmutex.h new file mode 100644 index 0000000..174fe73 --- /dev/null +++ b/gnulib-lib/windows-recmutex.h @@ -0,0 +1,57 @@ +/* Plain recursive mutexes (native Windows implementation). + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-win32.h. */ + +#ifndef _WINDOWS_RECMUTEX_H +#define _WINDOWS_RECMUTEX_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include + +#include "windows-initguard.h" + +/* The native Windows documentation says that CRITICAL_SECTION already + implements a recursive lock. But we need not rely on it: It's easy to + implement a recursive lock without this assumption. */ + +typedef struct + { + glwthread_initguard_t guard; /* protects the initialization */ + DWORD owner; + unsigned long depth; + CRITICAL_SECTION lock; + } + glwthread_recmutex_t; + +#define GLWTHREAD_RECMUTEX_INIT { GLWTHREAD_INITGUARD_INIT, 0, 0 } + +#ifdef __cplusplus +extern "C" { +#endif + +extern void glwthread_recmutex_init (glwthread_recmutex_t *mutex); +extern int glwthread_recmutex_lock (glwthread_recmutex_t *mutex); +extern int glwthread_recmutex_trylock (glwthread_recmutex_t *mutex); +extern int glwthread_recmutex_unlock (glwthread_recmutex_t *mutex); +extern int glwthread_recmutex_destroy (glwthread_recmutex_t *mutex); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINDOWS_RECMUTEX_H */ diff --git a/gnulib-lib/windows-rwlock.c b/gnulib-lib/windows-rwlock.c new file mode 100644 index 0000000..d63936c --- /dev/null +++ b/gnulib-lib/windows-rwlock.c @@ -0,0 +1,377 @@ +/* Read-write locks (native Windows implementation). + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-win32.h. */ + +#include + +/* Specification. */ +#include "windows-rwlock.h" + +#include +#include + +/* Don't assume that UNICODE is not defined. */ +#undef CreateEvent +#define CreateEvent CreateEventA + +/* In this file, the waitqueues are implemented as circular arrays. */ +#define glwthread_waitqueue_t glwthread_carray_waitqueue_t + +static void +glwthread_waitqueue_init (glwthread_waitqueue_t *wq) +{ + wq->array = NULL; + wq->count = 0; + wq->alloc = 0; + wq->offset = 0; +} + +/* Enqueues the current thread, represented by an event, in a wait queue. + Returns INVALID_HANDLE_VALUE if an allocation failure occurs. */ +static HANDLE +glwthread_waitqueue_add (glwthread_waitqueue_t *wq) +{ + HANDLE event; + unsigned int index; + + if (wq->count == wq->alloc) + { + unsigned int new_alloc = 2 * wq->alloc + 1; + HANDLE *new_array = + (HANDLE *) realloc (wq->array, new_alloc * sizeof (HANDLE)); + if (new_array == NULL) + /* No more memory. */ + return INVALID_HANDLE_VALUE; + /* Now is a good opportunity to rotate the array so that its contents + starts at offset 0. */ + if (wq->offset > 0) + { + unsigned int old_count = wq->count; + unsigned int old_alloc = wq->alloc; + unsigned int old_offset = wq->offset; + unsigned int i; + if (old_offset + old_count > old_alloc) + { + unsigned int limit = old_offset + old_count - old_alloc; + for (i = 0; i < limit; i++) + new_array[old_alloc + i] = new_array[i]; + } + for (i = 0; i < old_count; i++) + new_array[i] = new_array[old_offset + i]; + wq->offset = 0; + } + wq->array = new_array; + wq->alloc = new_alloc; + } + /* Whether the created event is a manual-reset one or an auto-reset one, + does not matter, since we will wait on it only once. */ + event = CreateEvent (NULL, TRUE, FALSE, NULL); + if (event == INVALID_HANDLE_VALUE) + /* No way to allocate an event. */ + return INVALID_HANDLE_VALUE; + index = wq->offset + wq->count; + if (index >= wq->alloc) + index -= wq->alloc; + wq->array[index] = event; + wq->count++; + return event; +} + +/* Notifies the first thread from a wait queue and dequeues it. */ +static void +glwthread_waitqueue_notify_first (glwthread_waitqueue_t *wq) +{ + SetEvent (wq->array[wq->offset + 0]); + wq->offset++; + wq->count--; + if (wq->count == 0 || wq->offset == wq->alloc) + wq->offset = 0; +} + +/* Notifies all threads from a wait queue and dequeues them all. */ +static void +glwthread_waitqueue_notify_all (glwthread_waitqueue_t *wq) +{ + unsigned int i; + + for (i = 0; i < wq->count; i++) + { + unsigned int index = wq->offset + i; + if (index >= wq->alloc) + index -= wq->alloc; + SetEvent (wq->array[index]); + } + wq->count = 0; + wq->offset = 0; +} + +void +glwthread_rwlock_init (glwthread_rwlock_t *lock) +{ + InitializeCriticalSection (&lock->lock); + glwthread_waitqueue_init (&lock->waiting_readers); + glwthread_waitqueue_init (&lock->waiting_writers); + lock->runcount = 0; + lock->guard.done = 1; +} + +int +glwthread_rwlock_rdlock (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glwthread_rwlock_init (lock); + else + { + /* Don't let lock->guard.started grow and wrap around. */ + InterlockedDecrement (&lock->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + } + EnterCriticalSection (&lock->lock); + /* Test whether only readers are currently running, and whether the runcount + field will not overflow, and whether no writer is waiting. The latter + condition is because POSIX recommends that "write locks shall take + precedence over read locks", to avoid "writer starvation". */ + if (!(lock->runcount + 1 > 0 && lock->waiting_writers.count == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_readers. */ + HANDLE event = glwthread_waitqueue_add (&lock->waiting_readers); + if (event != INVALID_HANDLE_VALUE) + { + DWORD result; + LeaveCriticalSection (&lock->lock); + /* Wait until another thread signals this event. */ + result = WaitForSingleObject (event, INFINITE); + if (result == WAIT_FAILED || result == WAIT_TIMEOUT) + abort (); + CloseHandle (event); + /* The thread which signalled the event already did the bookkeeping: + removed us from the waiting_readers, incremented lock->runcount. */ + if (!(lock->runcount > 0)) + abort (); + return 0; + } + else + { + /* Allocation failure. Weird. */ + do + { + LeaveCriticalSection (&lock->lock); + Sleep (1); + EnterCriticalSection (&lock->lock); + } + while (!(lock->runcount + 1 > 0)); + } + } + lock->runcount++; + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glwthread_rwlock_wrlock (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glwthread_rwlock_init (lock); + else + { + /* Don't let lock->guard.started grow and wrap around. */ + InterlockedDecrement (&lock->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + } + EnterCriticalSection (&lock->lock); + /* Test whether no readers or writers are currently running. */ + if (!(lock->runcount == 0)) + { + /* This thread has to wait for a while. Enqueue it among the + waiting_writers. */ + HANDLE event = glwthread_waitqueue_add (&lock->waiting_writers); + if (event != INVALID_HANDLE_VALUE) + { + DWORD result; + LeaveCriticalSection (&lock->lock); + /* Wait until another thread signals this event. */ + result = WaitForSingleObject (event, INFINITE); + if (result == WAIT_FAILED || result == WAIT_TIMEOUT) + abort (); + CloseHandle (event); + /* The thread which signalled the event already did the bookkeeping: + removed us from the waiting_writers, set lock->runcount = -1. */ + if (!(lock->runcount == -1)) + abort (); + return 0; + } + else + { + /* Allocation failure. Weird. */ + do + { + LeaveCriticalSection (&lock->lock); + Sleep (1); + EnterCriticalSection (&lock->lock); + } + while (!(lock->runcount == 0)); + } + } + lock->runcount--; /* runcount becomes -1 */ + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glwthread_rwlock_tryrdlock (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glwthread_rwlock_init (lock); + else + { + /* Don't let lock->guard.started grow and wrap around. */ + InterlockedDecrement (&lock->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + } + /* It's OK to wait for this critical section, because it is never taken for a + long time. */ + EnterCriticalSection (&lock->lock); + /* Test whether only readers are currently running, and whether the runcount + field will not overflow, and whether no writer is waiting. The latter + condition is because POSIX recommends that "write locks shall take + precedence over read locks", to avoid "writer starvation". */ + if (!(lock->runcount + 1 > 0 && lock->waiting_writers.count == 0)) + { + /* This thread would have to wait for a while. Return instead. */ + LeaveCriticalSection (&lock->lock); + return EBUSY; + } + lock->runcount++; + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glwthread_rwlock_trywrlock (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + { + if (InterlockedIncrement (&lock->guard.started) == 0) + /* This thread is the first one to need this lock. Initialize it. */ + glwthread_rwlock_init (lock); + else + { + /* Don't let lock->guard.started grow and wrap around. */ + InterlockedDecrement (&lock->guard.started); + /* Yield the CPU while waiting for another thread to finish + initializing this lock. */ + while (!lock->guard.done) + Sleep (0); + } + } + /* It's OK to wait for this critical section, because it is never taken for a + long time. */ + EnterCriticalSection (&lock->lock); + /* Test whether no readers or writers are currently running. */ + if (!(lock->runcount == 0)) + { + /* This thread would have to wait for a while. Return instead. */ + LeaveCriticalSection (&lock->lock); + return EBUSY; + } + lock->runcount--; /* runcount becomes -1 */ + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glwthread_rwlock_unlock (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + return EINVAL; + EnterCriticalSection (&lock->lock); + if (lock->runcount < 0) + { + /* Drop a writer lock. */ + if (!(lock->runcount == -1)) + abort (); + lock->runcount = 0; + } + else + { + /* Drop a reader lock. */ + if (!(lock->runcount > 0)) + { + LeaveCriticalSection (&lock->lock); + return EPERM; + } + lock->runcount--; + } + if (lock->runcount == 0) + { + /* POSIX recommends that "write locks shall take precedence over read + locks", to avoid "writer starvation". */ + if (lock->waiting_writers.count > 0) + { + /* Wake up one of the waiting writers. */ + lock->runcount--; + glwthread_waitqueue_notify_first (&lock->waiting_writers); + } + else + { + /* Wake up all waiting readers. */ + lock->runcount += lock->waiting_readers.count; + glwthread_waitqueue_notify_all (&lock->waiting_readers); + } + } + LeaveCriticalSection (&lock->lock); + return 0; +} + +int +glwthread_rwlock_destroy (glwthread_rwlock_t *lock) +{ + if (!lock->guard.done) + return EINVAL; + if (lock->runcount != 0) + return EBUSY; + DeleteCriticalSection (&lock->lock); + if (lock->waiting_readers.array != NULL) + free (lock->waiting_readers.array); + if (lock->waiting_writers.array != NULL) + free (lock->waiting_writers.array); + lock->guard.done = 0; + return 0; +} diff --git a/gnulib-lib/windows-rwlock.h b/gnulib-lib/windows-rwlock.h new file mode 100644 index 0000000..280c9f2 --- /dev/null +++ b/gnulib-lib/windows-rwlock.h @@ -0,0 +1,68 @@ +/* Read-write locks (native Windows implementation). + Copyright (C) 2005-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2005. + Based on GCC's gthr-win32.h. */ + +#ifndef _WINDOWS_RWLOCK_H +#define _WINDOWS_RWLOCK_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include + +#include "windows-initguard.h" + +/* It is impossible to implement read-write locks using plain locks, without + introducing an extra thread dedicated to managing read-write locks. + Therefore here we need to use the low-level Event type. */ + +typedef struct + { + HANDLE *array; /* array of waiting threads, each represented by an event */ + unsigned int count; /* number of waiting threads */ + unsigned int alloc; /* length of allocated array */ + unsigned int offset; /* index of first waiting thread in array */ + } + glwthread_carray_waitqueue_t; +typedef struct + { + glwthread_initguard_t guard; /* protects the initialization */ + CRITICAL_SECTION lock; /* protects the remaining fields */ + glwthread_carray_waitqueue_t waiting_readers; /* waiting readers */ + glwthread_carray_waitqueue_t waiting_writers; /* waiting writers */ + int runcount; /* number of readers running, or -1 when a writer runs */ + } + glwthread_rwlock_t; + +#define GLWTHREAD_RWLOCK_INIT { GLWTHREAD_INITGUARD_INIT } + +#ifdef __cplusplus +extern "C" { +#endif + +extern void glwthread_rwlock_init (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_rdlock (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_wrlock (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_tryrdlock (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_trywrlock (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_unlock (glwthread_rwlock_t *lock); +extern int glwthread_rwlock_destroy (glwthread_rwlock_t *lock); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINDOWS_RWLOCK_H */ diff --git a/gnulib-lib/windows-spin.c b/gnulib-lib/windows-spin.c new file mode 100644 index 0000000..0e9975c --- /dev/null +++ b/gnulib-lib/windows-spin.c @@ -0,0 +1,70 @@ +/* Spin locks (native Windows implementation). + Copyright (C) 2019-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2019. */ + +#include + +/* Specification. */ +#include "windows-spin.h" + +#include + +void +glwthread_spin_init (glwthread_spinlock_t *lock) +{ + lock->word = 0; + MemoryBarrier (); +} + +int +glwthread_spin_lock (glwthread_spinlock_t *lock) +{ + /* Wait until lock->word becomes 0, then replace it with 1. */ + /* InterlockedCompareExchange + */ + while (InterlockedCompareExchange (&lock->word, 1, 0)) + ; + return 0; +} + +int +glwthread_spin_trylock (glwthread_spinlock_t *lock) +{ + /* If lock->word is 0, then replace it with 1. */ + /* InterlockedCompareExchange + */ + if (InterlockedCompareExchange (&lock->word, 1, 0)) + return EBUSY; + return 0; +} + +int +glwthread_spin_unlock (glwthread_spinlock_t *lock) +{ + /* If lock->word is 1, then replace it with 0. */ + /* InterlockedCompareExchange + */ + if (!InterlockedCompareExchange (&lock->word, 0, 1)) + return EINVAL; + return 0; +} + +int +glwthread_spin_destroy (glwthread_spinlock_t *lock) +{ + return 0; +} diff --git a/gnulib-lib/windows-spin.h b/gnulib-lib/windows-spin.h new file mode 100644 index 0000000..4ef6008 --- /dev/null +++ b/gnulib-lib/windows-spin.h @@ -0,0 +1,47 @@ +/* Spin locks (native Windows implementation). + Copyright (C) 2019-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +/* Written by Bruno Haible , 2019. */ + +#ifndef _WINDOWS_SPIN_H +#define _WINDOWS_SPIN_H + +#define WIN32_LEAN_AND_MEAN /* avoid including junk */ +#include + +typedef struct + { + LONG volatile word; + } + glwthread_spinlock_t; + +#define GLWTHREAD_SPIN_INIT { 0 } + +#ifdef __cplusplus +extern "C" { +#endif + +extern void glwthread_spin_init (glwthread_spinlock_t *lock); +extern int glwthread_spin_lock (glwthread_spinlock_t *lock); +extern int glwthread_spin_trylock (glwthread_spinlock_t *lock); +extern int glwthread_spin_unlock (glwthread_spinlock_t *lock); +extern int glwthread_spin_destroy (glwthread_spinlock_t *lock); + +#ifdef __cplusplus +} +#endif + +#endif /* _WINDOWS_SPIN_H */ diff --git a/gnulib-lib/xalloc-oversized.h b/gnulib-lib/xalloc-oversized.h new file mode 100644 index 0000000..4184f33 --- /dev/null +++ b/gnulib-lib/xalloc-oversized.h @@ -0,0 +1,65 @@ +/* xalloc-oversized.h -- memory allocation size checking + + Copyright (C) 1990-2000, 2003-2004, 2006-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef XALLOC_OVERSIZED_H_ +#define XALLOC_OVERSIZED_H_ + +#include +#include + +/* True if N * S does not fit into both ptrdiff_t and size_t. + N and S should be nonnegative and free of side effects. + This expands to a constant expression if N and S are both constants. + By gnulib convention, SIZE_MAX represents overflow in size_t + calculations, so the conservative size_t-based dividend to use here + is SIZE_MAX - 1. */ +#define __xalloc_oversized(n, s) \ + ((s) != 0 \ + && ((size_t) (PTRDIFF_MAX < SIZE_MAX ? PTRDIFF_MAX : SIZE_MAX - 1) / (s) \ + < (n))) + +/* Return 1 if and only if an array of N objects, each of size S, + cannot exist reliably because its total size in bytes would exceed + MIN (PTRDIFF_MAX, SIZE_MAX - 1). + + N and S should be nonnegative and free of side effects. + + Warning: (xalloc_oversized (N, S) ? NULL : malloc (N * S)) can + misbehave if N and S are both narrower than ptrdiff_t and size_t, + and can be rewritten as (xalloc_oversized (N, S) ? NULL + : malloc (N * (size_t) S)). + + This is a macro, not a function, so that it works even if an + argument exceeds MAX (PTRDIFF_MAX, SIZE_MAX). */ +#if 7 <= __GNUC__ && !defined __clang__ && PTRDIFF_MAX < SIZE_MAX +# define xalloc_oversized(n, s) \ + __builtin_mul_overflow_p (n, s, (ptrdiff_t) 1) +#elif (5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ \ + && PTRDIFF_MAX < SIZE_MAX) +# define xalloc_oversized(n, s) \ + (__builtin_constant_p (n) && __builtin_constant_p (s) \ + ? __xalloc_oversized (n, s) \ + : ({ ptrdiff_t __xalloc_count; \ + __builtin_mul_overflow (n, s, &__xalloc_count); })) + +/* Other compilers use integer division; this may be slower but is + more portable. */ +#else +# define xalloc_oversized(n, s) __xalloc_oversized (n, s) +#endif + +#endif /* !XALLOC_OVERSIZED_H_ */ diff --git a/gnulib-lib/xsize.c b/gnulib-lib/xsize.c new file mode 100644 index 0000000..b3d73a2 --- /dev/null +++ b/gnulib-lib/xsize.c @@ -0,0 +1,21 @@ +/* Checked size_t computations. + + Copyright (C) 2012-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#include + +#define XSIZE_INLINE _GL_EXTERN_INLINE +#include "xsize.h" diff --git a/gnulib-lib/xsize.h b/gnulib-lib/xsize.h new file mode 100644 index 0000000..91fa877 --- /dev/null +++ b/gnulib-lib/xsize.h @@ -0,0 +1,108 @@ +/* xsize.h -- Checked size_t computations. + + Copyright (C) 2003, 2008-2021 Free Software Foundation, Inc. + + This file 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. + + This file 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 this program. If not, see . */ + +#ifndef _XSIZE_H +#define _XSIZE_H + +/* Get size_t. */ +#include + +/* Get SIZE_MAX. */ +#include +#if HAVE_STDINT_H +# include +#endif + +/* Get ATTRIBUTE_PURE. */ +#include "attribute.h" + +#ifndef _GL_INLINE_HEADER_BEGIN + #error "Please include config.h first." +#endif +_GL_INLINE_HEADER_BEGIN +#ifndef XSIZE_INLINE +# define XSIZE_INLINE _GL_INLINE +#endif + +/* The size of memory objects is often computed through expressions of + type size_t. Example: + void* p = malloc (header_size + n * element_size). + These computations can lead to overflow. When this happens, malloc() + returns a piece of memory that is way too small, and the program then + crashes while attempting to fill the memory. + To avoid this, the functions and macros in this file check for overflow. + The convention is that SIZE_MAX represents overflow. + malloc (SIZE_MAX) is not guaranteed to fail -- think of a malloc + implementation that uses mmap --, it's recommended to use size_overflow_p() + or size_in_bounds_p() before invoking malloc(). + The example thus becomes: + size_t size = xsum (header_size, xtimes (n, element_size)); + void *p = (size_in_bounds_p (size) ? malloc (size) : NULL); +*/ + +/* Convert an arbitrary value >= 0 to type size_t. */ +#define xcast_size_t(N) \ + ((N) <= SIZE_MAX ? (size_t) (N) : SIZE_MAX) + +/* Sum of two sizes, with overflow check. */ +XSIZE_INLINE size_t ATTRIBUTE_PURE +xsum (size_t size1, size_t size2) +{ + size_t sum = size1 + size2; + return (sum >= size1 ? sum : SIZE_MAX); +} + +/* Sum of three sizes, with overflow check. */ +XSIZE_INLINE size_t ATTRIBUTE_PURE +xsum3 (size_t size1, size_t size2, size_t size3) +{ + return xsum (xsum (size1, size2), size3); +} + +/* Sum of four sizes, with overflow check. */ +XSIZE_INLINE size_t ATTRIBUTE_PURE +xsum4 (size_t size1, size_t size2, size_t size3, size_t size4) +{ + return xsum (xsum (xsum (size1, size2), size3), size4); +} + +/* Maximum of two sizes, with overflow check. */ +XSIZE_INLINE size_t ATTRIBUTE_PURE +xmax (size_t size1, size_t size2) +{ + /* No explicit check is needed here, because for any n: + max (SIZE_MAX, n) == SIZE_MAX and max (n, SIZE_MAX) == SIZE_MAX. */ + return (size1 >= size2 ? size1 : size2); +} + +/* Multiplication of a count with an element size, with overflow check. + The count must be >= 0 and the element size must be > 0. + This is a macro, not a function, so that it works correctly even + when N is of a wider type and N > SIZE_MAX. */ +#define xtimes(N, ELSIZE) \ + ((N) <= SIZE_MAX / (ELSIZE) ? (size_t) (N) * (ELSIZE) : SIZE_MAX) + +/* Check for overflow. */ +#define size_overflow_p(SIZE) \ + ((SIZE) == SIZE_MAX) +/* Check against overflow. */ +#define size_in_bounds_p(SIZE) \ + ((SIZE) != SIZE_MAX) + +_GL_INLINE_HEADER_END + +#endif /* _XSIZE_H */ diff --git a/gnulib-m4/00gnulib.m4 b/gnulib-m4/00gnulib.m4 new file mode 100644 index 0000000..9ba1743 --- /dev/null +++ b/gnulib-m4/00gnulib.m4 @@ -0,0 +1,85 @@ +# 00gnulib.m4 serial 8 +dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This file must be named something that sorts before all other +dnl gnulib-provided .m4 files. It is needed until the clang fix has +dnl been included in Autoconf. + +# The following definitions arrange to use a compiler option +# -Werror=implicit-function-declaration in AC_CHECK_DECL, when the +# compiler is clang. Without it, clang implicitly declares "known" +# library functions in C mode, but not in C++ mode, which would cause +# Gnulib to omit a declaration and thus later produce an error in C++ +# mode. As of clang 9.0, these "known" functions are identified through +# LIBBUILTIN invocations in the LLVM source file +# llvm/tools/clang/include/clang/Basic/Builtins.def. +# It's not possible to AC_REQUIRE the extra tests from AC_CHECK_DECL, +# because AC_CHECK_DECL, like other Autoconf built-ins, is not supposed +# to AC_REQUIRE anything: some configure.ac files have their first +# AC_CHECK_DECL executed conditionally. Therefore append the extra tests +# to AC_PROG_CC. +AC_DEFUN([gl_COMPILER_CLANG], +[ +dnl AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([whether the compiler is clang], + [gl_cv_compiler_clang], + [dnl Use _AC_COMPILE_IFELSE instead of AC_EGREP_CPP, to avoid error + dnl "circular dependency of AC_LANG_COMPILER(C)" if AC_PROG_CC has + dnl not yet been invoked. + _AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #ifdef __clang__ + barfbarf + #endif + ]],[[]]) + ], + [gl_cv_compiler_clang=no], + [gl_cv_compiler_clang=yes]) + ]) +]) +AC_DEFUN([gl_COMPILER_PREPARE_CHECK_DECL], +[ +dnl AC_REQUIRE([AC_PROG_CC]) +dnl AC_REQUIRE([gl_COMPILER_CLANG]) + AC_CACHE_CHECK([for compiler option needed when checking for declarations], + [gl_cv_compiler_check_decl_option], + [if test $gl_cv_compiler_clang = yes; then + dnl Test whether the compiler supports the option + dnl '-Werror=implicit-function-declaration'. + save_ac_compile="$ac_compile" + ac_compile="$ac_compile -Werror=implicit-function-declaration" + dnl Use _AC_COMPILE_IFELSE instead of AC_COMPILE_IFELSE, to avoid a + dnl warning "AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS". + _AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],[[]])], + [gl_cv_compiler_check_decl_option='-Werror=implicit-function-declaration'], + [gl_cv_compiler_check_decl_option=none]) + ac_compile="$save_ac_compile" + else + gl_cv_compiler_check_decl_option=none + fi + ]) + if test "x$gl_cv_compiler_check_decl_option" != xnone; then + ac_compile_for_check_decl="$ac_compile $gl_cv_compiler_check_decl_option" + else + ac_compile_for_check_decl="$ac_compile" + fi +]) +dnl Redefine _AC_CHECK_DECL_BODY so that it references ac_compile_for_check_decl +dnl instead of ac_compile. If, for whatever reason, the override of AC_PROG_CC +dnl in zzgnulib.m4 is inactive, use the original ac_compile. +m4_define([_AC_CHECK_DECL_BODY], +[ ac_save_ac_compile="$ac_compile" + if test -n "$ac_compile_for_check_decl"; then + ac_compile="$ac_compile_for_check_decl" + fi] +m4_defn([_AC_CHECK_DECL_BODY])[ ac_compile="$ac_save_ac_compile" +]) + +# gl_00GNULIB +# ----------- +# Witness macro that this file has been included. Needed to force +# Automake to include this file prior to all other gnulib .m4 files. +AC_DEFUN([gl_00GNULIB]) diff --git a/gnulib-m4/absolute-header.m4 b/gnulib-m4/absolute-header.m4 new file mode 100644 index 0000000..52d80d0 --- /dev/null +++ b/gnulib-m4/absolute-header.m4 @@ -0,0 +1,100 @@ +# absolute-header.m4 serial 17 +dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Derek Price. + +# gl_ABSOLUTE_HEADER(HEADER1 HEADER2 ...) +# --------------------------------------- +# Find the absolute name of a header file, testing first if the header exists. +# If the header were sys/inttypes.h, this macro would define +# ABSOLUTE_SYS_INTTYPES_H to the '""' quoted absolute name of sys/inttypes.h +# in config.h +# (e.g. '#define ABSOLUTE_SYS_INTTYPES_H "///usr/include/sys/inttypes.h"'). +# The three "///" are to pacify Sun C 5.8, which otherwise would say +# "warning: #include of /usr/include/... may be non-portable". +# Use '""', not '<>', so that the /// cannot be confused with a C99 comment. +# Note: This macro assumes that the header file is not empty after +# preprocessing, i.e. it does not only define preprocessor macros but also +# provides some type/enum definitions or function/variable declarations. +AC_DEFUN([gl_ABSOLUTE_HEADER], +[AC_REQUIRE([AC_CANONICAL_HOST]) +AC_LANG_PREPROC_REQUIRE()dnl +m4_foreach_w([gl_HEADER_NAME], [$1], + [AS_VAR_PUSHDEF([gl_absolute_header], + [gl_cv_absolute_]m4_defn([gl_HEADER_NAME]))dnl + AC_CACHE_CHECK([absolute name of <]m4_defn([gl_HEADER_NAME])[>], + [gl_absolute_header], + [AS_VAR_PUSHDEF([ac_header_exists], + [ac_cv_header_]m4_defn([gl_HEADER_NAME]))dnl + AC_CHECK_HEADERS_ONCE(m4_defn([gl_HEADER_NAME]))dnl + if test AS_VAR_GET([ac_header_exists]) = yes; then + gl_ABSOLUTE_HEADER_ONE(m4_defn([gl_HEADER_NAME])) + fi + AS_VAR_POPDEF([ac_header_exists])dnl + ])dnl + AC_DEFINE_UNQUOTED(AS_TR_CPP([ABSOLUTE_]m4_defn([gl_HEADER_NAME])), + ["AS_VAR_GET([gl_absolute_header])"], + [Define this to an absolute name of <]m4_defn([gl_HEADER_NAME])[>.]) + AS_VAR_POPDEF([gl_absolute_header])dnl +])dnl +])# gl_ABSOLUTE_HEADER + +# gl_ABSOLUTE_HEADER_ONE(HEADER) +# ------------------------------ +# Like gl_ABSOLUTE_HEADER, except that: +# - it assumes that the header exists, +# - it uses the current CPPFLAGS, +# - it does not cache the result, +# - it is silent. +AC_DEFUN([gl_ABSOLUTE_HEADER_ONE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote([$1])[[>]])]) + dnl AIX "xlc -E" and "cc -E" omit #line directives for header files + dnl that contain only a #include of other header files and no + dnl non-comment tokens of their own. This leads to a failure to + dnl detect the absolute name of , , + dnl and others. The workaround is to force preservation of comments + dnl through option -C. This ensures all necessary #line directives + dnl are present. GCC supports option -C as well. + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac +changequote(,) + case "$host_os" in + mingw*) + dnl For the sake of native Windows compilers (excluding gcc), + dnl treat backslash as a directory separator, like /. + dnl Actually, these compilers use a double-backslash as + dnl directory separator, inside the + dnl # line "filename" + dnl directives. + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + dnl A sed expression that turns a string into a basic regular + dnl expression, for use within "/.../". + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + gl_header_literal_regex=`echo '$1' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' +changequote([,]) + dnl eval is necessary to expand gl_absname_cpp. + dnl Ultrix and Pyramid sh refuse to redirect output of eval, + dnl so use subshell. + AS_VAR_SET([gl_cv_absolute_]AS_TR_SH([[$1]]), +[`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD | + sed -n "$gl_absolute_header_sed"`]) +]) diff --git a/gnulib-m4/alloca.m4 b/gnulib-m4/alloca.m4 new file mode 100644 index 0000000..ba2f679 --- /dev/null +++ b/gnulib-m4/alloca.m4 @@ -0,0 +1,108 @@ +# alloca.m4 serial 20 +dnl Copyright (C) 2002-2004, 2006-2007, 2009-2021 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_ALLOCA], +[ + AC_REQUIRE([AC_FUNC_ALLOCA]) + if test $ac_cv_func_alloca_works = no; then + gl_PREREQ_ALLOCA + fi + + # Define an additional variable used in the Makefile substitution. + if test $ac_cv_working_alloca_h = yes; then + AC_CACHE_CHECK([for alloca as a compiler built-in], [gl_cv_rpl_alloca], [ + AC_EGREP_CPP([Need own alloca], [ +#if defined __GNUC__ || defined _AIX || defined _MSC_VER + Need own alloca +#endif + ], [gl_cv_rpl_alloca=yes], [gl_cv_rpl_alloca=no]) + ]) + if test $gl_cv_rpl_alloca = yes; then + dnl OK, alloca can be implemented through a compiler built-in. + AC_DEFINE([HAVE_ALLOCA], [1], + [Define to 1 if you have 'alloca' after including , + a header that may be supplied by this distribution.]) + ALLOCA_H=alloca.h + else + dnl alloca exists as a library function, i.e. it is slow and probably + dnl a memory leak. Don't define HAVE_ALLOCA in this case. + ALLOCA_H= + fi + else + ALLOCA_H=alloca.h + fi + AC_SUBST([ALLOCA_H]) + AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"]) + + if test $ac_cv_working_alloca_h = yes; then + HAVE_ALLOCA_H=1 + else + HAVE_ALLOCA_H=0 + fi + AC_SUBST([HAVE_ALLOCA_H]) +]) + +# Prerequisites of lib/alloca.c. +# STACK_DIRECTION is already handled by AC_FUNC_ALLOCA. +AC_DEFUN([gl_PREREQ_ALLOCA], [:]) + +m4_version_prereq([2.70], [], [ + +# This works around a bug in autoconf <= 2.68 and has simplifications +# from 2.70. See: +# https://lists.gnu.org/r/bug-gnulib/2011-06/msg00277.html +# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=6cd9f12520b0d6f76d3230d7565feba1ecf29497 +# https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=15edf7fd8094fd14a89d9891dd72a9624762597a + +# _AC_LIBOBJ_ALLOCA +# ----------------- +# Set up the LIBOBJ replacement of 'alloca'. Well, not exactly +# AC_LIBOBJ since we actually set the output variable 'ALLOCA'. +# Nevertheless, for Automake, AC_LIBSOURCES it. +m4_define([_AC_LIBOBJ_ALLOCA], +[# The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. +AC_LIBSOURCES(alloca.c) +AC_SUBST([ALLOCA], [\${LIBOBJDIR}alloca.$ac_objext])dnl +AC_DEFINE(C_ALLOCA, 1, [Define to 1 if using 'alloca.c'.]) + +AC_CACHE_CHECK([stack direction for C alloca], + [ac_cv_c_stack_direction], +[AC_RUN_IFELSE([AC_LANG_SOURCE( +[AC_INCLUDES_DEFAULT +int +find_stack_direction (int *addr, int depth) +{ + int dir, dummy = 0; + if (! addr) + addr = &dummy; + *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; + dir = depth ? find_stack_direction (addr, depth - 1) : 0; + return dir + dummy; +} + +int +main (int argc, char **argv) +{ + return find_stack_direction (0, argc + !argv + 20) < 0; +}])], + [ac_cv_c_stack_direction=1], + [ac_cv_c_stack_direction=-1], + [ac_cv_c_stack_direction=0])]) +AH_VERBATIM([STACK_DIRECTION], +[/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION])dnl +AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) +])# _AC_LIBOBJ_ALLOCA +]) diff --git a/gnulib-m4/ansi-c++.m4 b/gnulib-m4/ansi-c++.m4 new file mode 100644 index 0000000..31f140a --- /dev/null +++ b/gnulib-m4/ansi-c++.m4 @@ -0,0 +1,152 @@ +# ansi-c++.m4 serial 12 +dnl Copyright (C) 2002-2003, 2005, 2010-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +# Sets CXX_CHOICE to 'yes' or 'no', depending on the preferred use of C++. +# The default is 'yes'. If the configure.ac contains a definition of the +# macro gl_CXX_CHOICE_DEFAULT_NO, then the default is 'no'. In both cases, +# the user can change the value by passing the option --disable-cxx or +# --enable-cxx, respectively. + +AC_DEFUN([gl_CXX_CHOICE], +[ + AC_MSG_CHECKING([whether to use C++]) + dnl Plus signs are supported in AC_ARG_ENABLE starting with autoconf-2.66. + m4_version_prereq([2.66], + [m4_ifdef([gl_CXX_CHOICE_DEFAULT_NO], + [AC_ARG_ENABLE([c++], + [ --enable-c++ also build C++ sources], + [CXX_CHOICE="$enableval"], + [CXX_CHOICE=no])], + [AC_ARG_ENABLE([c++], + [ --disable-c++ do not build C++ sources], + [CXX_CHOICE="$enableval"], + [CXX_CHOICE=yes])])], + [m4_ifdef([gl_CXX_CHOICE_DEFAULT_NO], + [AC_ARG_ENABLE([cxx], + [ --enable-cxx also build C++ sources], + [CXX_CHOICE="$enableval"], + [CXX_CHOICE=no])], + [AC_ARG_ENABLE([cxx], + [ --disable-cxx do not build C++ sources], + [CXX_CHOICE="$enableval"], + [CXX_CHOICE=yes])])]) + AC_MSG_RESULT([$CXX_CHOICE]) + AC_SUBST([CXX_CHOICE]) +]) + +# gl_PROG_ANSI_CXX([ANSICXX_VARIABLE], [ANSICXX_CONDITIONAL]) +# Sets ANSICXX_VARIABLE to the name of a sufficiently ANSI C++ compliant +# compiler, or to "no" if none is found. +# Defines the Automake condition ANSICXX_CONDITIONAL to true if such a compiler +# was found, or to false if not. + +AC_DEFUN([gl_PROG_ANSI_CXX], +[ + AC_REQUIRE([gl_CXX_CHOICE]) + m4_if([$1], [CXX], [], + [gl_save_CXX="$CXX"]) + if test "$CXX_CHOICE" = no; then + CXX=no + fi + if test -z "$CXX"; then + if test -n "$CCC"; then + CXX="$CCC" + else + AC_CHECK_TOOLS([CXX], + [g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC], + [:]) + fi + fi + if test "$CXX" != no; then + dnl Use a modified version of AC_PROG_CXX_WORKS that does not exit + dnl upon failure. + AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works]) + AC_LANG_PUSH([C++]) + AC_ARG_VAR([CXX], [C++ compiler command]) + AC_ARG_VAR([CXXFLAGS], [C++ compiler flags]) + echo 'int main () { return 0; }' > conftest.$ac_ext + if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then + gl_cv_prog_ansicxx_works=yes + if (./conftest; exit) 2>/dev/null; then + gl_cv_prog_ansicxx_cross=no + else + gl_cv_prog_ansicxx_cross=yes + fi + else + gl_cv_prog_ansicxx_works=no + fi + rm -fr conftest* + AC_LANG_POP([C++]) + AC_MSG_RESULT([$gl_cv_prog_ansicxx_works]) + if test $gl_cv_prog_ansicxx_works = no; then + CXX=no + else + dnl Test for namespaces. + dnl We don't bother supporting pre-ANSI-C++ compilers. + AC_MSG_CHECKING([whether the C++ compiler supports namespaces]) + AC_LANG_PUSH([C++]) + cat < conftest.$ac_ext +#include +namespace test { using namespace std; } +std::ostream* ptr; +int main () { return 0; } +EOF + if AC_TRY_EVAL([ac_link]) && test -s conftest$ac_exeext; then + gl_cv_prog_ansicxx_namespaces=yes + else + gl_cv_prog_ansicxx_namespaces=no + fi + rm -fr conftest* + AC_LANG_POP([C++]) + AC_MSG_RESULT([$gl_cv_prog_ansicxx_namespaces]) + if test $gl_cv_prog_ansicxx_namespaces = no; then + CXX=no + fi + fi + fi + m4_if([$1], [CXX], [], + [$1="$CXX" + CXX="$gl_save_CXX"]) + AC_SUBST([$1]) + + AM_CONDITIONAL([$2], [test "$$1" != no]) + + if test "$$1" != no; then + dnl This macro invocation resolves an automake error: + dnl /usr/local/share/automake-1.11/am/depend2.am: am__fastdepCXX does not appear in AM_CONDITIONAL + dnl /usr/local/share/automake-1.11/am/depend2.am: The usual way to define 'am__fastdepCXX' is to add 'AC_PROG_CXX' + dnl /usr/local/share/automake-1.11/am/depend2.am: to 'configure.ac' and run 'aclocal' and 'autoconf' again. + _AM_DEPENDENCIES([CXX]) + dnl Determine a good default for the CXXFLAGS variable. + AC_LANG_PUSH([C++]) + _AC_LANG_COMPILER_GNU + if test $ac_compiler_gnu = yes; then + GXX=yes + else + GXX= + fi + _AC_PROG_CXX_G + AC_LANG_POP([C++]) + else + AM_CONDITIONAL([am__fastdepCXX], [false]) + fi +]) + +# gl_ANSI_CXX +# Sets CXX to the name of a sufficiently ANSI C++ compliant compiler, or to +# "no" if none is found. +# Defines the Automake condition ANSICXX to true if such a compiler was found, +# or to false if not. +AC_DEFUN([gl_ANSI_CXX], +[ + gl_PROG_ANSI_CXX([CXX], [ANSICXX]) + dnl This line is needed in order to avoid trouble with Autoconf. It makes + dnl sure that Autoconf does not insert expansions of AC_PROG_CXX at random + dnl places. See . + m4_provide([AC_PROG_CXX]) +]) diff --git a/gnulib-m4/asm-underscore.m4 b/gnulib-m4/asm-underscore.m4 new file mode 100644 index 0000000..93b98be --- /dev/null +++ b/gnulib-m4/asm-underscore.m4 @@ -0,0 +1,83 @@ +# asm-underscore.m4 serial 5 +dnl Copyright (C) 2010-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. Based on as-underscore.m4 in GNU clisp. + +# gl_ASM_SYMBOL_PREFIX +# Tests for the prefix of C symbols at the assembly language level and the +# linker level. This prefix is either an underscore or empty. Defines the +# C macro USER_LABEL_PREFIX to this prefix, and sets ASM_SYMBOL_PREFIX to +# a stringified variant of this prefix. + +AC_DEFUN([gl_ASM_SYMBOL_PREFIX], +[ + AC_REQUIRE([AC_PROG_EGREP]) + dnl We don't use GCC's __USER_LABEL_PREFIX__ here, because + dnl 1. It works only for GCC. + dnl 2. It is incorrectly defined on some platforms, in some GCC versions. + AC_REQUIRE([gl_C_ASM]) + AC_CACHE_CHECK( + [whether C symbols are prefixed with underscore at the linker level], + [gl_cv_prog_as_underscore], + [cat > conftest.c </dev/null 2>&1 + if LC_ALL=C $EGREP '(^|[[^a-zA-Z0-9_]])_foo([[^a-zA-Z0-9_]]|$)' conftest.$gl_asmext >/dev/null; then + gl_cv_prog_as_underscore=yes + else + gl_cv_prog_as_underscore=no + fi + rm -f conftest* + ]) + if test $gl_cv_prog_as_underscore = yes; then + USER_LABEL_PREFIX=_ + else + USER_LABEL_PREFIX= + fi + AC_DEFINE_UNQUOTED([USER_LABEL_PREFIX], [$USER_LABEL_PREFIX], + [Define to the prefix of C symbols at the assembler and linker level, + either an underscore or empty.]) + ASM_SYMBOL_PREFIX='"'${USER_LABEL_PREFIX}'"' + AC_SUBST([ASM_SYMBOL_PREFIX]) +]) + +# gl_C_ASM +# Determines how to produce an assembly language file from C source code. +# Sets the variables: +# gl_asmext - the extension of assembly language output, +# gl_c_asm_opt - the C compiler option that produces assembly language output. + +AC_DEFUN([gl_C_ASM], +[ + AC_EGREP_CPP([MicrosoftCompiler], + [ +#ifdef _MSC_VER +MicrosoftCompiler +#endif + ], + [dnl Microsoft's 'cl' and 'clang-cl' produce an .asm file, whereas 'clang' + dnl produces a .s file. Need to distinguish 'clang' and 'clang-cl'. + rm -f conftest* + echo 'int dummy;' > conftest.c + AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c) >/dev/null 2>&1 + if test -f conftest.o; then + gl_asmext='s' + gl_c_asm_opt='-S' + else + gl_asmext='asm' + gl_c_asm_opt='-c -Fa' + fi + rm -f conftest* + ], + [gl_asmext='s' + gl_c_asm_opt='-S' + ]) +]) diff --git a/gnulib-m4/close.m4 b/gnulib-m4/close.m4 new file mode 100644 index 0000000..77a5047 --- /dev/null +++ b/gnulib-m4/close.m4 @@ -0,0 +1,35 @@ +# close.m4 serial 9 +dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_CLOSE], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + m4_ifdef([gl_MSVC_INVAL], [ + AC_REQUIRE([gl_MSVC_INVAL]) + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_CLOSE=1 + fi + ]) + m4_ifdef([gl_PREREQ_SYS_H_WINSOCK2], [ + gl_PREREQ_SYS_H_WINSOCK2 + if test $UNISTD_H_HAVE_WINSOCK2_H = 1; then + dnl Even if the 'socket' module is not used here, another part of the + dnl application may use it and pass file descriptors that refer to + dnl sockets to the close() function. So enable the support for sockets. + REPLACE_CLOSE=1 + fi + ]) + dnl Replace close() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + if test $REPLACE_CLOSE = 0; then + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + REPLACE_CLOSE=1 + fi + fi + ]) +]) diff --git a/gnulib-m4/double-slash-root.m4 b/gnulib-m4/double-slash-root.m4 new file mode 100644 index 0000000..c9bbcef --- /dev/null +++ b/gnulib-m4/double-slash-root.m4 @@ -0,0 +1,38 @@ +# double-slash-root.m4 serial 4 -*- Autoconf -*- +dnl Copyright (C) 2006, 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_DOUBLE_SLASH_ROOT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether // is distinct from /], [gl_cv_double_slash_root], + [ if test x"$cross_compiling" = xyes ; then + # When cross-compiling, there is no way to tell whether // is special + # short of a list of hosts. However, the only known hosts to date + # that have a distinct // are Apollo DomainOS (too old to port to), + # Cygwin, and z/OS. If anyone knows of another system for which // has + # special semantics and is distinct from /, please report it to + # . + case $host in + *-cygwin | i370-ibm-openedition) + gl_cv_double_slash_root=yes ;; + *) + # Be optimistic and assume that / and // are the same when we + # don't know. + gl_cv_double_slash_root='unknown, assuming no' ;; + esac + else + set x `ls -di / // 2>/dev/null` + if test "$[2]" = "$[4]" && wc //dev/null >/dev/null 2>&1; then + gl_cv_double_slash_root=no + else + gl_cv_double_slash_root=yes + fi + fi]) + if test "$gl_cv_double_slash_root" = yes; then + AC_DEFINE([DOUBLE_SLASH_IS_DISTINCT_ROOT], [1], + [Define to 1 if // is a file system root distinct from /.]) + fi +]) diff --git a/gnulib-m4/dup2.m4 b/gnulib-m4/dup2.m4 new file mode 100644 index 0000000..0753a32 --- /dev/null +++ b/gnulib-m4/dup2.m4 @@ -0,0 +1,105 @@ +#serial 27 +dnl Copyright (C) 2002, 2005, 2007, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_DUP2], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether dup2 works], [gl_cv_func_dup2_works], + [AC_RUN_IFELSE([ + AC_LANG_PROGRAM( + [[#include + #include + #include + #include + #include + ]GL_MDA_DEFINES[ + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + ]], + [[int result = 0; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + #ifdef FD_CLOEXEC + if (fcntl (1, F_SETFD, FD_CLOEXEC) == -1) + result |= 1; + #endif + if (dup2 (1, 1) != 1) + result |= 2; + #ifdef FD_CLOEXEC + if (fcntl (1, F_GETFD) != FD_CLOEXEC) + result |= 4; + #endif + close (0); + if (dup2 (0, 0) != -1) + result |= 8; + /* Many gnulib modules require POSIX conformance of EBADF. */ + if (dup2 (2, bad_fd) == -1 && errno != EBADF) + result |= 16; + /* Flush out some cygwin core dumps. */ + if (dup2 (2, -1) != -1 || errno != EBADF) + result |= 32; + dup2 (2, 255); + dup2 (2, 256); + /* On OS/2 kLIBC, dup2() does not work on a directory fd. */ + { + int fd = open (".", O_RDONLY); + if (fd == -1) + result |= 64; + else if (dup2 (fd, fd + 1) == -1) + result |= 128; + close (fd); + } + return result;]]) + ], + [gl_cv_func_dup2_works=yes], [gl_cv_func_dup2_works=no], + [case "$host_os" in + mingw*) # on this platform, dup2 always returns 0 for success + gl_cv_func_dup2_works="guessing no" ;; + cygwin*) # on cygwin 1.5.x, dup2(1,1) returns 0 + gl_cv_func_dup2_works="guessing no" ;; + aix* | freebsd*) + # on AIX 7.1 and FreeBSD 6.1, dup2 (1,toobig) gives EMFILE, + # not EBADF. + gl_cv_func_dup2_works="guessing no" ;; + haiku*) # on Haiku alpha 2, dup2(1, 1) resets FD_CLOEXEC. + gl_cv_func_dup2_works="guessing no" ;; + *-android*) # implemented using dup3(), which fails if oldfd == newfd + gl_cv_func_dup2_works="guessing no" ;; + os2*) # on OS/2 kLIBC, dup2() does not work on a directory fd. + gl_cv_func_dup2_works="guessing no" ;; + *) gl_cv_func_dup2_works="guessing yes" ;; + esac]) + ]) + case "$gl_cv_func_dup2_works" in + *yes) ;; + *) + REPLACE_DUP2=1 + AC_CHECK_FUNCS([setdtablesize]) + ;; + esac + dnl Replace dup2() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + REPLACE_DUP2=1 + fi + ]) +]) + +# Prerequisites of lib/dup2.c. +AC_DEFUN([gl_PREREQ_DUP2], []) diff --git a/gnulib-m4/eealloc.m4 b/gnulib-m4/eealloc.m4 new file mode 100644 index 0000000..002f0c8 --- /dev/null +++ b/gnulib-m4/eealloc.m4 @@ -0,0 +1,31 @@ +# eealloc.m4 serial 3 +dnl Copyright (C) 2003, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_EEALLOC], +[ + AC_REQUIRE([gl_EEMALLOC]) + AC_REQUIRE([gl_EEREALLOC]) +]) + +AC_DEFUN([gl_EEMALLOC], +[ + _AC_FUNC_MALLOC_IF( + [gl_cv_func_malloc_0_nonnull=1], + [gl_cv_func_malloc_0_nonnull=0]) + AC_DEFINE_UNQUOTED([MALLOC_0_IS_NONNULL], [$gl_cv_func_malloc_0_nonnull], + [If malloc(0) is != NULL, define this to 1. Otherwise define this + to 0.]) +]) + +AC_DEFUN([gl_EEREALLOC], +[ + _AC_FUNC_REALLOC_IF( + [gl_cv_func_realloc_0_nonnull=1], + [gl_cv_func_realloc_0_nonnull=0]) + AC_DEFINE_UNQUOTED([REALLOC_0_IS_NONNULL], [$gl_cv_func_realloc_0_nonnull], + [If realloc(NULL,0) is != NULL, define this to 1. Otherwise define this + to 0.]) +]) diff --git a/gnulib-m4/errno_h.m4 b/gnulib-m4/errno_h.m4 new file mode 100644 index 0000000..51dfe92 --- /dev/null +++ b/gnulib-m4/errno_h.m4 @@ -0,0 +1,133 @@ +# errno_h.m4 serial 13 +dnl Copyright (C) 2004, 2006, 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_PREREQ([2.61]) + +AC_DEFUN_ONCE([gl_HEADER_ERRNO_H], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [ + AC_EGREP_CPP([booboo],[ +#include +#if !defined ETXTBSY +booboo +#endif +#if !defined ENOMSG +booboo +#endif +#if !defined EIDRM +booboo +#endif +#if !defined ENOLINK +booboo +#endif +#if !defined EPROTO +booboo +#endif +#if !defined EMULTIHOP +booboo +#endif +#if !defined EBADMSG +booboo +#endif +#if !defined EOVERFLOW +booboo +#endif +#if !defined ENOTSUP +booboo +#endif +#if !defined ENETRESET +booboo +#endif +#if !defined ECONNABORTED +booboo +#endif +#if !defined ESTALE +booboo +#endif +#if !defined EDQUOT +booboo +#endif +#if !defined ECANCELED +booboo +#endif +#if !defined EOWNERDEAD +booboo +#endif +#if !defined ENOTRECOVERABLE +booboo +#endif +#if !defined EILSEQ +booboo +#endif + ], + [gl_cv_header_errno_h_complete=no], + [gl_cv_header_errno_h_complete=yes]) + ]) + if test $gl_cv_header_errno_h_complete = yes; then + ERRNO_H='' + else + gl_NEXT_HEADERS([errno.h]) + ERRNO_H='errno.h' + fi + AC_SUBST([ERRNO_H]) + AM_CONDITIONAL([GL_GENERATE_ERRNO_H], [test -n "$ERRNO_H"]) + gl_REPLACE_ERRNO_VALUE([EMULTIHOP]) + gl_REPLACE_ERRNO_VALUE([ENOLINK]) + gl_REPLACE_ERRNO_VALUE([EOVERFLOW]) +]) + +# Assuming $1 = EOVERFLOW. +# The EOVERFLOW errno value ought to be defined in , according to +# POSIX. But some systems (like OpenBSD 4.0 or AIX 3) don't define it, and +# some systems (like OSF/1) define it when _XOPEN_SOURCE_EXTENDED is defined. +# Check for the value of EOVERFLOW. +# Set the variables EOVERFLOW_HIDDEN and EOVERFLOW_VALUE. +AC_DEFUN([gl_REPLACE_ERRNO_VALUE], +[ + if test -n "$ERRNO_H"; then + AC_CACHE_CHECK([for ]$1[ value], [gl_cv_header_errno_h_]$1, [ + AC_EGREP_CPP([yes],[ +#include +#ifdef ]$1[ +yes +#endif + ], + [gl_cv_header_errno_h_]$1[=yes], + [gl_cv_header_errno_h_]$1[=no]) + if test $gl_cv_header_errno_h_]$1[ = no; then + AC_EGREP_CPP([yes],[ +#define _XOPEN_SOURCE_EXTENDED 1 +#include +#ifdef ]$1[ +yes +#endif + ], [gl_cv_header_errno_h_]$1[=hidden]) + if test $gl_cv_header_errno_h_]$1[ = hidden; then + dnl The macro exists but is hidden. + dnl Define it to the same value. + AC_COMPUTE_INT([gl_cv_header_errno_h_]$1, $1, [ +#define _XOPEN_SOURCE_EXTENDED 1 +#include +/* The following two lines are a workaround against an autoconf-2.52 bug. */ +#include +#include +]) + fi + fi + ]) + case $gl_cv_header_errno_h_]$1[ in + yes | no) + ]$1[_HIDDEN=0; ]$1[_VALUE= + ;; + *) + ]$1[_HIDDEN=1; ]$1[_VALUE="$gl_cv_header_errno_h_]$1[" + ;; + esac + AC_SUBST($1[_HIDDEN]) + AC_SUBST($1[_VALUE]) + fi +]) diff --git a/gnulib-m4/error.m4 b/gnulib-m4/error.m4 new file mode 100644 index 0000000..77f67f7 --- /dev/null +++ b/gnulib-m4/error.m4 @@ -0,0 +1,27 @@ +#serial 14 + +# Copyright (C) 1996-1998, 2001-2004, 2009-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_ERROR], +[ + dnl We don't use AC_FUNC_ERROR_AT_LINE any more, because it is no longer + dnl maintained in Autoconf and because it invokes AC_LIBOBJ. + AC_CACHE_CHECK([for error_at_line], [ac_cv_lib_error_at_line], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[error_at_line (0, 0, "", 0, "an error occurred");]])], + [ac_cv_lib_error_at_line=yes], + [ac_cv_lib_error_at_line=no])]) +]) + +# Prerequisites of lib/error.c. +AC_DEFUN([gl_PREREQ_ERROR], +[ + AC_REQUIRE([AC_FUNC_STRERROR_R]) + : +]) diff --git a/gnulib-m4/extensions.m4 b/gnulib-m4/extensions.m4 new file mode 100644 index 0000000..5792a95 --- /dev/null +++ b/gnulib-m4/extensions.m4 @@ -0,0 +1,227 @@ +# serial 22 -*- Autoconf -*- +# Enable extensions on systems that normally disable them. + +# Copyright (C) 2003, 2006-2021 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl Define to empty for the benefit of Autoconf 2.69 and earlier, so that +dnl AC_USE_SYSTEM_EXTENSIONS (below) can be used unchanged from Autoconf 2.70+. +m4_ifndef([AC_CHECK_INCLUDES_DEFAULT], + [AC_DEFUN([AC_CHECK_INCLUDES_DEFAULT], [])]) + +# This definition of AC_USE_SYSTEM_EXTENSIONS is stolen from git +# Autoconf. Perhaps we can remove this once we can assume Autoconf +# is recent-enough everywhere, but since Autoconf mutates rapidly +# enough in this area it's likely we'll need to redefine +# AC_USE_SYSTEM_EXTENSIONS for quite some time. + +# If autoconf reports a warning +# warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS +# or warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS +# the fix is +# 1) to ensure that AC_USE_SYSTEM_EXTENSIONS is never directly invoked +# but always AC_REQUIREd, +# 2) to ensure that for each occurrence of +# AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) +# or +# AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) +# the corresponding gnulib module description has 'extensions' among +# its dependencies. This will ensure that the gl_USE_SYSTEM_EXTENSIONS +# invocation occurs in gl_EARLY, not in gl_INIT. + +m4_version_prereq([2.70.1], [], [ + +# AC_USE_SYSTEM_EXTENSIONS +# ------------------------ +# Enable extensions on systems that normally disable them, +# typically due to standards-conformance issues. +# We unconditionally define as many of the known feature-enabling +# as possible, reserving conditional behavior for macros that are +# known to cause problems on some platforms (such as __EXTENSIONS__). +AC_DEFUN_ONCE([AC_USE_SYSTEM_EXTENSIONS], +[AC_BEFORE([$0], [AC_PREPROC_IFELSE])dnl +AC_BEFORE([$0], [AC_COMPILE_IFELSE])dnl +AC_BEFORE([$0], [AC_LINK_IFELSE])dnl +AC_BEFORE([$0], [AC_RUN_IFELSE])dnl +AC_BEFORE([$0], [AC_CHECK_INCLUDES_DEFAULT])dnl +dnl #undef in AH_VERBATIM gets replaced with #define by AC_DEFINE. +dnl Use a different key than __EXTENSIONS__, as that name broke existing +dnl configure.ac when using autoheader 2.62. +dnl The macros below are in alphabetical order ignoring leading _ or __ +dnl prefixes. +AH_VERBATIM([USE_SYSTEM_EXTENSIONS], +[/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# undef _ALL_SOURCE +#endif +/* Enable general extensions on macOS. */ +#ifndef _DARWIN_C_SOURCE +# undef _DARWIN_C_SOURCE +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# undef __EXTENSIONS__ +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# undef _GNU_SOURCE +#endif +/* Enable X/Open compliant socket functions that do not require linking + with -lxnet on HP-UX 11.11. */ +#ifndef _HPUX_ALT_XOPEN_SOCKET_API +# undef _HPUX_ALT_XOPEN_SOCKET_API +#endif +/* Identify the host operating system as Minix. + This macro does not affect the system headers' behavior. + A future release of Autoconf may stop defining this macro. */ +#ifndef _MINIX +# undef _MINIX +#endif +/* Enable general extensions on NetBSD. + Enable NetBSD compatibility extensions on Minix. */ +#ifndef _NETBSD_SOURCE +# undef _NETBSD_SOURCE +#endif +/* Enable OpenBSD compatibility extensions on NetBSD. + Oddly enough, this does nothing on OpenBSD. */ +#ifndef _OPENBSD_SOURCE +# undef _OPENBSD_SOURCE +#endif +/* Define to 1 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_SOURCE +# undef _POSIX_SOURCE +#endif +/* Define to 2 if needed for POSIX-compatible behavior. */ +#ifndef _POSIX_1_SOURCE +# undef _POSIX_1_SOURCE +#endif +/* Enable POSIX-compatible threading on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# undef _POSIX_PTHREAD_SEMANTICS +#endif +/* Enable extensions specified by ISO/IEC TS 18661-5:2014. */ +#ifndef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +# undef __STDC_WANT_IEC_60559_ATTRIBS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-1:2014. */ +#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ +# undef __STDC_WANT_IEC_60559_BFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-2:2015. */ +#ifndef __STDC_WANT_IEC_60559_DFP_EXT__ +# undef __STDC_WANT_IEC_60559_DFP_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-4:2015. */ +#ifndef __STDC_WANT_IEC_60559_FUNCS_EXT__ +# undef __STDC_WANT_IEC_60559_FUNCS_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TS 18661-3:2015. */ +#ifndef __STDC_WANT_IEC_60559_TYPES_EXT__ +# undef __STDC_WANT_IEC_60559_TYPES_EXT__ +#endif +/* Enable extensions specified by ISO/IEC TR 24731-2:2010. */ +#ifndef __STDC_WANT_LIB_EXT2__ +# undef __STDC_WANT_LIB_EXT2__ +#endif +/* Enable extensions specified by ISO/IEC 24747:2009. */ +#ifndef __STDC_WANT_MATH_SPEC_FUNCS__ +# undef __STDC_WANT_MATH_SPEC_FUNCS__ +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# undef _TANDEM_SOURCE +#endif +/* Enable X/Open extensions. Define to 500 only if necessary + to make mbstate_t available. */ +#ifndef _XOPEN_SOURCE +# undef _XOPEN_SOURCE +#endif +])dnl + + AC_REQUIRE([AC_CHECK_INCLUDES_DEFAULT])dnl + _AC_CHECK_HEADER_ONCE([wchar.h]) + _AC_CHECK_HEADER_ONCE([minix/config.h]) + +dnl Defining __EXTENSIONS__ may break the system headers on some systems. +dnl (FIXME: Which ones?) + AC_CACHE_CHECK([whether it is safe to define __EXTENSIONS__], + [ac_cv_safe_to_define___extensions__], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ +# define __EXTENSIONS__ 1 + ]AC_INCLUDES_DEFAULT])], + [ac_cv_safe_to_define___extensions__=yes], + [ac_cv_safe_to_define___extensions__=no])]) + +dnl HP-UX 11.11 defines mbstate_t only if _XOPEN_SOURCE is defined to +dnl 500, regardless of whether compiling with -Ae or -D_HPUX_SOURCE=1. +dnl But defining _XOPEN_SOURCE may turn *off* extensions on platforms +dnl not covered by turn-on-extensions macros (notably Dragonfly, Free, +dnl and OpenBSD, which don't have any equivalent of _NETBSD_SOURCE) so +dnl it should only be defined when necessary. + AC_CACHE_CHECK([whether _XOPEN_SOURCE should be defined], + [ac_cv_should_define__xopen_source], + [ac_cv_should_define__xopen_source=no + AS_IF([test $ac_cv_header_wchar_h = yes], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #include + mbstate_t x;]])], + [], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #define _XOPEN_SOURCE 500 + #include + mbstate_t x;]])], + [ac_cv_should_define__xopen_source=yes])])])]) + + AC_DEFINE([_ALL_SOURCE]) + AC_DEFINE([_DARWIN_C_SOURCE]) + AC_DEFINE([_GNU_SOURCE]) + AC_DEFINE([_HPUX_ALT_XOPEN_SOCKET_API]) + AC_DEFINE([_NETBSD_SOURCE]) + AC_DEFINE([_OPENBSD_SOURCE]) + AC_DEFINE([_POSIX_PTHREAD_SEMANTICS]) + AC_DEFINE([__STDC_WANT_IEC_60559_ATTRIBS_EXT__]) + AC_DEFINE([__STDC_WANT_IEC_60559_BFP_EXT__]) + AC_DEFINE([__STDC_WANT_IEC_60559_DFP_EXT__]) + AC_DEFINE([__STDC_WANT_IEC_60559_FUNCS_EXT__]) + AC_DEFINE([__STDC_WANT_IEC_60559_TYPES_EXT__]) + AC_DEFINE([__STDC_WANT_LIB_EXT2__]) + AC_DEFINE([__STDC_WANT_MATH_SPEC_FUNCS__]) + AC_DEFINE([_TANDEM_SOURCE]) + AS_IF([test $ac_cv_header_minix_config_h = yes], + [MINIX=yes + AC_DEFINE([_MINIX]) + AC_DEFINE([_POSIX_SOURCE]) + AC_DEFINE([_POSIX_1_SOURCE], [2])], + [MINIX=]) + AS_IF([test $ac_cv_safe_to_define___extensions__ = yes], + [AC_DEFINE([__EXTENSIONS__])]) + AS_IF([test $ac_cv_should_define__xopen_source = yes], + [AC_DEFINE([_XOPEN_SOURCE], [500])]) +])# AC_USE_SYSTEM_EXTENSIONS +]) + +# gl_USE_SYSTEM_EXTENSIONS +# ------------------------ +# Enable extensions on systems that normally disable them, +# typically due to standards-conformance issues. +AC_DEFUN_ONCE([gl_USE_SYSTEM_EXTENSIONS], +[ + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + dnl On OpenBSD 6.8 with GCC, the include files contain a couple of + dnl definitions that are only activated with an explicit -D_ISOC11_SOURCE. + dnl That's because this version of GCC (4.2.1) supports the option + dnl '-std=gnu99' but not the option '-std=gnu11'. + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + openbsd*) + AC_DEFINE([_ISOC11_SOURCE], [1], + [Define to enable the declarations of ISO C 11 types and functions.]) + ;; + esac +]) diff --git a/gnulib-m4/extern-inline.m4 b/gnulib-m4/extern-inline.m4 new file mode 100644 index 0000000..a2acf12 --- /dev/null +++ b/gnulib-m4/extern-inline.m4 @@ -0,0 +1,114 @@ +dnl 'extern inline' a la ISO C99. + +dnl Copyright 2012-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_EXTERN_INLINE], +[ + AH_VERBATIM([extern_inline], +[/* Please see the Gnulib manual for how to use these macros. + + Suppress extern inline with HP-UX cc, as it appears to be broken; see + . + + Suppress extern inline with Sun C in standards-conformance mode, as it + mishandles inline functions that call each other. E.g., for 'inline void f + (void) { } inline void g (void) { f (); }', c99 incorrectly complains + 'reference to static identifier "f" in extern inline function'. + This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. + + Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) + on configurations that mistakenly use 'static inline' to implement + functions or macros in standard C headers like . For example, + if isdigit is mistakenly implemented via a static inline function, + a program containing an extern inline function that calls isdigit + may not work since the C standard prohibits extern inline functions + from calling static functions (ISO C 99 section 6.7.4.(3). + This bug is known to occur on: + + OS X 10.8 and earlier; see: + https://lists.gnu.org/r/bug-gnulib/2012-12/msg00023.html + + DragonFly; see + http://muscles.dragonflybsd.org/bulk/clang-master-potential/20141111_102002/logs/ah-tty-0.3.12.log + + FreeBSD; see: + https://lists.gnu.org/r/bug-gnulib/2014-07/msg00104.html + + OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and + for clang but remains for g++; see . + Assume DragonFly and FreeBSD will be similar. + + GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99 + inline semantics, unless -fgnu89-inline is used. It defines a macro + __GNUC_STDC_INLINE__ to indicate this situation or a macro + __GNUC_GNU_INLINE__ to indicate the opposite situation. + GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline + semantics but warns, unless -fgnu89-inline is used: + warning: C99 inline functions are not supported; using GNU89 + warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute + It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. + */ +#if (((defined __APPLE__ && defined __MACH__) \ + || defined __DragonFly__ || defined __FreeBSD__) \ + && (defined __header_inline \ + ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ + && ! defined __clang__) \ + : ((! defined _DONT_USE_CTYPE_INLINE_ \ + && (defined __GNUC__ || defined __cplusplus)) \ + || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ + && defined __GNUC__ && ! defined __cplusplus)))) +# define _GL_EXTERN_INLINE_STDHEADER_BUG +#endif +#if ((__GNUC__ \ + ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ + : (199901L <= __STDC_VERSION__ \ + && !defined __HP_cc \ + && !defined __PGI \ + && !(defined __SUNPRO_C && __STDC__))) \ + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) +# define _GL_INLINE inline +# define _GL_EXTERN_INLINE extern inline +# define _GL_EXTERN_INLINE_IN_USE +#elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ + && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) +# if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ + /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ +# define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) +# else +# define _GL_INLINE extern inline +# endif +# define _GL_EXTERN_INLINE extern +# define _GL_EXTERN_INLINE_IN_USE +#else +# define _GL_INLINE static _GL_UNUSED +# define _GL_EXTERN_INLINE static _GL_UNUSED +#endif + +/* In GCC 4.6 (inclusive) to 5.1 (exclusive), + suppress bogus "no previous prototype for 'FOO'" + and "no previous declaration for 'FOO'" diagnostics, + when FOO is an inline function in the header; see + and + . */ +#if __GNUC__ == 4 && 6 <= __GNUC_MINOR__ +# if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ +# define _GL_INLINE_HEADER_CONST_PRAGMA +# else +# define _GL_INLINE_HEADER_CONST_PRAGMA \ + _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") +# endif +# define _GL_INLINE_HEADER_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ + _GL_INLINE_HEADER_CONST_PRAGMA +# define _GL_INLINE_HEADER_END \ + _Pragma ("GCC diagnostic pop") +#else +# define _GL_INLINE_HEADER_BEGIN +# define _GL_INLINE_HEADER_END +#endif]) +]) diff --git a/gnulib-m4/fatal-signal.m4 b/gnulib-m4/fatal-signal.m4 new file mode 100644 index 0000000..7c69c69 --- /dev/null +++ b/gnulib-m4/fatal-signal.m4 @@ -0,0 +1,12 @@ +# fatal-signal.m4 serial 9 +dnl Copyright (C) 2003-2004, 2006, 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FATAL_SIGNAL], +[ + AC_REQUIRE([gt_TYPE_SIG_ATOMIC_T]) + AC_CHECK_HEADERS_ONCE([unistd.h]) + gl_PREREQ_SIG_HANDLER_H +]) diff --git a/gnulib-m4/fcntl-o.m4 b/gnulib-m4/fcntl-o.m4 new file mode 100644 index 0000000..7c459ad --- /dev/null +++ b/gnulib-m4/fcntl-o.m4 @@ -0,0 +1,140 @@ +# fcntl-o.m4 serial 7 +dnl Copyright (C) 2006, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Paul Eggert. + +AC_PREREQ([2.60]) + +# Test whether the flags O_NOATIME and O_NOFOLLOW actually work. +# Define HAVE_WORKING_O_NOATIME to 1 if O_NOATIME works, or to 0 otherwise. +# Define HAVE_WORKING_O_NOFOLLOW to 1 if O_NOFOLLOW works, or to 0 otherwise. +AC_DEFUN([gl_FCNTL_O_FLAGS], +[ + dnl Persuade glibc to define O_NOATIME and O_NOFOLLOW. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CHECK_FUNCS_ONCE([symlink]) + AC_CACHE_CHECK([for working fcntl.h], [gl_cv_header_working_fcntl_h], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #if HAVE_UNISTD_H + # include + #else /* on Windows with MSVC */ + # include + # include + # defined sleep(n) _sleep ((n) * 1000) + #endif + #include + ]GL_MDA_DEFINES[ + #ifndef O_NOATIME + #define O_NOATIME 0 + #endif + #ifndef O_NOFOLLOW + #define O_NOFOLLOW 0 + #endif + static int const constants[] = + { + O_CREAT, O_EXCL, O_NOCTTY, O_TRUNC, O_APPEND, + O_NONBLOCK, O_SYNC, O_ACCMODE, O_RDONLY, O_RDWR, O_WRONLY + }; + ]], + [[ + int result = !constants; + #if HAVE_SYMLINK + { + static char const sym[] = "conftest.sym"; + if (symlink ("/dev/null", sym) != 0) + result |= 2; + else + { + int fd = open (sym, O_WRONLY | O_NOFOLLOW | O_CREAT, 0); + if (fd >= 0) + { + close (fd); + result |= 4; + } + } + if (unlink (sym) != 0 || symlink (".", sym) != 0) + result |= 2; + else + { + int fd = open (sym, O_RDONLY | O_NOFOLLOW); + if (fd >= 0) + { + close (fd); + result |= 4; + } + } + unlink (sym); + } + #endif + { + static char const file[] = "confdefs.h"; + int fd = open (file, O_RDONLY | O_NOATIME); + if (fd < 0) + result |= 8; + else + { + struct stat st0; + if (fstat (fd, &st0) != 0) + result |= 16; + else + { + char c; + sleep (1); + if (read (fd, &c, 1) != 1) + result |= 24; + else + { + if (close (fd) != 0) + result |= 32; + else + { + struct stat st1; + if (stat (file, &st1) != 0) + result |= 40; + else + if (st0.st_atime != st1.st_atime) + result |= 64; + } + } + } + } + } + return result;]])], + [gl_cv_header_working_fcntl_h=yes], + [case $? in #( + 4) gl_cv_header_working_fcntl_h='no (bad O_NOFOLLOW)';; #( + 64) gl_cv_header_working_fcntl_h='no (bad O_NOATIME)';; #( + 68) gl_cv_header_working_fcntl_h='no (bad O_NOATIME, O_NOFOLLOW)';; #( + *) gl_cv_header_working_fcntl_h='no';; + esac], + [case "$host_os" in + # Guess 'no' on native Windows. + mingw*) gl_cv_header_working_fcntl_h='no' ;; + *) gl_cv_header_working_fcntl_h=cross-compiling ;; + esac + ]) + ]) + + case $gl_cv_header_working_fcntl_h in #( + *O_NOATIME* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOATIME], [$ac_val], + [Define to 1 if O_NOATIME works.]) + + case $gl_cv_header_working_fcntl_h in #( + *O_NOFOLLOW* | no | cross-compiling) ac_val=0;; #( + *) ac_val=1;; + esac + AC_DEFINE_UNQUOTED([HAVE_WORKING_O_NOFOLLOW], [$ac_val], + [Define to 1 if O_NOFOLLOW works.]) +]) diff --git a/gnulib-m4/fcntl.m4 b/gnulib-m4/fcntl.m4 new file mode 100644 index 0000000..f626434 --- /dev/null +++ b/gnulib-m4/fcntl.m4 @@ -0,0 +1,151 @@ +# fcntl.m4 serial 11 +dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# For now, this module ensures that fcntl() +# - supports F_DUPFD correctly +# - supports or emulates F_DUPFD_CLOEXEC +# - supports F_GETFD +# Still to be ported to mingw: +# - F_SETFD +# - F_GETFL, F_SETFL +# - F_GETOWN, F_SETOWN +# - F_GETLK, F_SETLK, F_SETLKW +AC_DEFUN([gl_FUNC_FCNTL], +[ + dnl Persuade glibc to expose F_DUPFD_CLOEXEC. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS_ONCE([fcntl]) + if test $ac_cv_func_fcntl = no; then + gl_REPLACE_FCNTL + else + dnl cygwin 1.5.x F_DUPFD has wrong errno, and allows negative target + dnl haiku alpha 2 F_DUPFD has wrong errno + AC_CACHE_CHECK([whether fcntl handles F_DUPFD correctly], + [gl_cv_func_fcntl_f_dupfd_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #include + #include + #include + ]GL_MDA_DEFINES[ + #ifndef RLIM_SAVED_CUR + # define RLIM_SAVED_CUR RLIM_INFINITY + #endif + #ifndef RLIM_SAVED_MAX + # define RLIM_SAVED_MAX RLIM_INFINITY + #endif + ]], + [[int result = 0; + int bad_fd = INT_MAX; + struct rlimit rlim; + if (getrlimit (RLIMIT_NOFILE, &rlim) == 0 + && 0 <= rlim.rlim_cur && rlim.rlim_cur <= INT_MAX + && rlim.rlim_cur != RLIM_INFINITY + && rlim.rlim_cur != RLIM_SAVED_MAX + && rlim.rlim_cur != RLIM_SAVED_CUR) + bad_fd = rlim.rlim_cur; + if (fcntl (0, F_DUPFD, -1) != -1) result |= 1; + if (errno != EINVAL) result |= 2; + if (fcntl (0, F_DUPFD, bad_fd) != -1) result |= 4; + if (errno != EINVAL) result |= 8; + /* On OS/2 kLIBC, F_DUPFD does not work on a directory fd */ + { + int fd; + fd = open (".", O_RDONLY); + if (fd == -1) + result |= 16; + else if (fcntl (fd, F_DUPFD, STDERR_FILENO + 1) == -1) + result |= 32; + + close (fd); + } + return result;]])], + [gl_cv_func_fcntl_f_dupfd_works=yes], + [gl_cv_func_fcntl_f_dupfd_works=no], + [case $host_os in + aix* | cygwin* | haiku*) + gl_cv_func_fcntl_f_dupfd_works="guessing no" ;; + *) gl_cv_func_fcntl_f_dupfd_works="guessing yes" ;; + esac])]) + case $gl_cv_func_fcntl_f_dupfd_works in + *yes) ;; + *) gl_REPLACE_FCNTL + AC_DEFINE([FCNTL_DUPFD_BUGGY], [1], [Define this to 1 if F_DUPFD + behavior does not match POSIX]) ;; + esac + + dnl Many systems lack F_DUPFD_CLOEXEC. + dnl NetBSD 9.0 declares F_DUPFD_CLOEXEC but it works only like F_DUPFD. + AC_CACHE_CHECK([whether fcntl understands F_DUPFD_CLOEXEC], + [gl_cv_func_fcntl_f_dupfd_cloexec], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE( + [[#include + #include + int main (int argc, char *argv[]) + { + if (argc == 1) + /* parent process */ + { + if (fcntl (1, F_DUPFD_CLOEXEC, 10) < 0) + return 1; + return execl ("./conftest", "./conftest", "child", NULL); + } + else + /* child process */ + return (fcntl (10, F_GETFL) < 0 ? 0 : 42); + } + ]]) + ], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#ifdef __linux__ +/* The Linux kernel only added F_DUPFD_CLOEXEC in 2.6.24, so we always replace + it to support the semantics on older kernels that failed with EINVAL. */ +choke me +#endif + ]])], + [gl_cv_func_fcntl_f_dupfd_cloexec=yes], + [gl_cv_func_fcntl_f_dupfd_cloexec="needs runtime check"]) + ], + [gl_cv_func_fcntl_f_dupfd_cloexec=no], + [case "$host_os" in + # Guess no on NetBSD. + netbsd*) gl_cv_func_fcntl_f_dupfd_cloexec="guessing no" ;; + *) gl_cv_func_fcntl_f_dupfd_cloexec="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_fcntl_f_dupfd_cloexec" in + *yes) ;; + *) gl_REPLACE_FCNTL + dnl No witness macro needed for this bug. + ;; + esac + fi + dnl Replace fcntl() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + gl_REPLACE_FCNTL + fi + ]) +]) + +AC_DEFUN([gl_REPLACE_FCNTL], +[ + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([fcntl]) + if test $ac_cv_func_fcntl = no; then + HAVE_FCNTL=0 + else + REPLACE_FCNTL=1 + fi +]) diff --git a/gnulib-m4/fcntl_h.m4 b/gnulib-m4/fcntl_h.m4 new file mode 100644 index 0000000..aba4473 --- /dev/null +++ b/gnulib-m4/fcntl_h.m4 @@ -0,0 +1,70 @@ +# serial 20 +# Configure fcntl.h. +dnl Copyright (C) 2006-2007, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Paul Eggert. + +AC_DEFUN_ONCE([gl_FCNTL_H], +[ + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) + AC_REQUIRE([gl_FCNTL_O_FLAGS]) + gl_NEXT_HEADERS([fcntl.h]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, if it is not common + dnl enough to be declared everywhere. + gl_WARN_ON_USE_PREPARE([[#include + ]], [fcntl openat]) +]) + +# gl_FCNTL_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_FCNTL_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_FCNTL_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_FCNTL_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CREAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCNTL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NONBLOCKING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OPENAT]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CREAT], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_OPEN], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_FCNTL_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_FCNTL_H_DEFAULTS]) +]) + +AC_DEFUN([gl_FCNTL_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FCNTL=1; AC_SUBST([HAVE_FCNTL]) + HAVE_OPENAT=1; AC_SUBST([HAVE_OPENAT]) + REPLACE_CREAT=0; AC_SUBST([REPLACE_CREAT]) + REPLACE_FCNTL=0; AC_SUBST([REPLACE_FCNTL]) + REPLACE_OPEN=0; AC_SUBST([REPLACE_OPEN]) + REPLACE_OPENAT=0; AC_SUBST([REPLACE_OPENAT]) +]) diff --git a/gnulib-m4/fstat.m4 b/gnulib-m4/fstat.m4 new file mode 100644 index 0000000..cdaca80 --- /dev/null +++ b/gnulib-m4/fstat.m4 @@ -0,0 +1,40 @@ +# fstat.m4 serial 8 +dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_FSTAT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + + case "$host_os" in + mingw* | solaris*) + dnl On MinGW, the original stat() returns st_atime, st_mtime, + dnl st_ctime values that are affected by the time zone. + dnl Solaris stat can return a negative tv_nsec. + REPLACE_FSTAT=1 + ;; + esac + + dnl Replace fstat() for supporting the gnulib-defined open() on directories. + m4_ifdef([gl_FUNC_FCHDIR], [ + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + case "$gl_cv_func_open_directory_works" in + *yes) ;; + *) + REPLACE_FSTAT=1 + ;; + esac + fi + ]) +]) + +# Prerequisites of lib/fstat.c and lib/stat-w32.c. +AC_DEFUN([gl_PREREQ_FSTAT], [ + AC_REQUIRE([gl_SYS_STAT_H]) + AC_REQUIRE([gl_PREREQ_STAT_W32]) + : +]) diff --git a/gnulib-m4/getdtablesize.m4 b/gnulib-m4/getdtablesize.m4 new file mode 100644 index 0000000..8fbc941 --- /dev/null +++ b/gnulib-m4/getdtablesize.m4 @@ -0,0 +1,63 @@ +# getdtablesize.m4 serial 8 +dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_GETDTABLESIZE], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS_ONCE([getdtablesize]) + AC_CHECK_DECLS_ONCE([getdtablesize]) + if test $ac_cv_func_getdtablesize = yes && + test $ac_cv_have_decl_getdtablesize = yes; then + AC_CACHE_CHECK([whether getdtablesize works], + [gl_cv_func_getdtablesize_works], + [dnl There are two concepts: the "maximum possible file descriptor value + 1" + dnl and the "maximum number of open file descriptors in a process". + dnl Per SUSv2 and POSIX, getdtablesize() should return the first one. + dnl On most platforms, the first and the second concept are the same. + dnl On OpenVMS, however, they are different and getdtablesize() returns + dnl the second one; thus the test below fails. But we don't care + dnl because there's no good way to write a replacement getdtablesize(). + case "$host_os" in + vms*) gl_cv_func_getdtablesize_works="no (limitation)" ;; + *) + dnl Cygwin 1.7.25 automatically increases the RLIMIT_NOFILE soft + dnl limit up to an unchangeable hard limit; all other platforms + dnl correctly require setrlimit before getdtablesize() can report + dnl a larger value. + AC_RUN_IFELSE([ + AC_LANG_PROGRAM( + [[#include ] + GL_MDA_DEFINES + ], + [[int size = getdtablesize(); + if (dup2 (0, getdtablesize()) != -1) + return 1; + if (size != getdtablesize()) + return 2; + ]])], + [gl_cv_func_getdtablesize_works=yes], + [gl_cv_func_getdtablesize_works=no], + [case "$host_os" in + cygwin*) # on cygwin 1.5.25, getdtablesize() automatically grows + gl_cv_func_getdtablesize_works="guessing no" ;; + *) gl_cv_func_getdtablesize_works="guessing yes" ;; + esac + ]) + ;; + esac + ]) + case "$gl_cv_func_getdtablesize_works" in + *yes | "no (limitation)") ;; + *) REPLACE_GETDTABLESIZE=1 ;; + esac + else + HAVE_GETDTABLESIZE=0 + fi +]) + +# Prerequisites of lib/getdtablesize.c. +AC_DEFUN([gl_PREREQ_GETDTABLESIZE], [:]) diff --git a/gnulib-m4/getprogname.m4 b/gnulib-m4/getprogname.m4 new file mode 100644 index 0000000..65917d6 --- /dev/null +++ b/gnulib-m4/getprogname.m4 @@ -0,0 +1,43 @@ +# getprogname.m4 - check for getprogname or replacements for it + +# Copyright (C) 2016-2021 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +AC_DEFUN([gl_FUNC_GETPROGNAME], +[ + AC_CHECK_FUNCS_ONCE([getprogname getexecname]) + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + ac_found=0 + AC_CHECK_DECLS([program_invocation_name], [ac_found=1], [], + [#include ]) + AC_CHECK_DECLS([program_invocation_short_name], [ac_found=1], [], + [#include ]) + AC_CHECK_DECLS([__argv], [ac_found=1], [], [#include ]) + + # Incur the cost of this test only if none of the above worked. + if test $ac_found = 0; then + # On OpenBSD 5.1, using the global __progname variable appears to be + # the only way to implement getprogname. + AC_CACHE_CHECK([whether __progname is defined in default libraries], + [gl_cv_var___progname], + [ + gl_cv_var___progname= + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[extern char *__progname;]], + [[return *__progname;]] + )], + [gl_cv_var___progname=yes] + ) + ] + ) + if test "$gl_cv_var___progname" = yes; then + AC_DEFINE([HAVE_VAR___PROGNAME], 1, + [Define if you have a global __progname variable]) + fi + fi +]) diff --git a/gnulib-m4/gnulib-cache.m4 b/gnulib-m4/gnulib-cache.m4 new file mode 100644 index 0000000..01c01f2 --- /dev/null +++ b/gnulib-m4/gnulib-cache.m4 @@ -0,0 +1,70 @@ +# Copyright (C) 2002-2021 Free Software Foundation, Inc. +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This file 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 file. If not, see . +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. +# +# This file represents the specification of how gnulib-tool is used. +# It acts as a cache: It is written and read by gnulib-tool. +# In projects that use version control, this file is meant to be put under +# version control, like the configure.ac and various Makefile.am files. + + +# Specification in the form of a command-line invocation: +# gnulib-tool --import \ +# --lib=libgnu \ +# --source-base=gnulib-lib \ +# --m4-base=gnulib-m4 \ +# --doc-base=doc \ +# --tests-base=tests \ +# --aux-dir=build-aux \ +# --no-conditional-dependencies \ +# --libtool \ +# --macro-prefix=gl \ +# ansi-c++-opt \ +# clean-temp-simple \ +# host-cpu-c-abi \ +# lock \ +# nocrash \ +# stdint \ +# stdnoreturn + +# Specification in the form of a few gnulib-tool.m4 macro invocations: +gl_LOCAL_DIR([]) +gl_MODULES([ + ansi-c++-opt + clean-temp-simple + host-cpu-c-abi + lock + nocrash + stdint + stdnoreturn +]) +gl_AVOID([]) +gl_SOURCE_BASE([gnulib-lib]) +gl_M4_BASE([gnulib-m4]) +gl_PO_BASE([]) +gl_DOC_BASE([doc]) +gl_TESTS_BASE([tests]) +gl_LIB([libgnu]) +gl_MAKEFILE_NAME([]) +gl_LIBTOOL +gl_MACRO_PREFIX([gl]) +gl_PO_DOMAIN([]) +gl_WITNESS_C_MACRO([]) diff --git a/gnulib-m4/gnulib-common.m4 b/gnulib-m4/gnulib-common.m4 new file mode 100644 index 0000000..bfa1645 --- /dev/null +++ b/gnulib-m4/gnulib-common.m4 @@ -0,0 +1,803 @@ +# gnulib-common.m4 serial 66 +dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_PREREQ([2.62]) + +# gl_COMMON +# is expanded unconditionally through gnulib-tool magic. +AC_DEFUN([gl_COMMON], [ + dnl Use AC_REQUIRE here, so that the code is expanded once only. + AC_REQUIRE([gl_00GNULIB]) + AC_REQUIRE([gl_COMMON_BODY]) + AC_REQUIRE([gl_ZZGNULIB]) +]) +AC_DEFUN([gl_COMMON_BODY], [ + AH_VERBATIM([_GL_GNUC_PREREQ], +[/* True if the compiler says it groks GNU C version MAJOR.MINOR. */ +#if defined __GNUC__ && defined __GNUC_MINOR__ +# define _GL_GNUC_PREREQ(major, minor) \ + ((major) < __GNUC__ + ((minor) <= __GNUC_MINOR__)) +#else +# define _GL_GNUC_PREREQ(major, minor) 0 +#endif +]) + AH_VERBATIM([_Noreturn], +[/* The _Noreturn keyword of C11. */ +#ifndef _Noreturn +# if (defined __cplusplus \ + && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \ + || (defined _MSC_VER && 1900 <= _MSC_VER)) \ + && 0) + /* [[noreturn]] is not practically usable, because with it the syntax + extern _Noreturn void func (...); + would not be valid; such a declaration would only be valid with 'extern' + and '_Noreturn' swapped, or without the 'extern' keyword. However, some + AIX system header files and several gnulib header files use precisely + this syntax with 'extern'. */ +# define _Noreturn [[noreturn]] +# elif ((!defined __cplusplus || defined __clang__) \ + && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) \ + || (!defined __STRICT_ANSI__ \ + && (_GL_GNUC_PREREQ (4, 7) \ + || (defined __apple_build_version__ \ + ? 6000000 <= __apple_build_version__ \ + : 3 < __clang_major__ + (5 <= __clang_minor__)))))) + /* _Noreturn works as-is. */ +# elif _GL_GNUC_PREREQ (2, 8) || defined __clang__ || 0x5110 <= __SUNPRO_C +# define _Noreturn __attribute__ ((__noreturn__)) +# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0) +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn +# endif +#endif +]) + AH_VERBATIM([isoc99_inline], +[/* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports + the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of + earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. + __APPLE__ && __MACH__ test for Mac OS X. + __APPLE_CC__ tests for the Apple compiler and its version. + __STDC_VERSION__ tests for the C99 mode. */ +#if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ +# define __GNUC_STDC_INLINE__ 1 +#endif]) + AH_VERBATIM([attribute], +[/* Attributes. */ +#if (defined __has_attribute \ + && (!defined __clang_minor__ \ + || 3 < __clang_major__ + (5 <= __clang_minor__))) +# define _GL_HAS_ATTRIBUTE(attr) __has_attribute (__##attr##__) +#else +# define _GL_HAS_ATTRIBUTE(attr) _GL_ATTR_##attr +# define _GL_ATTR_alloc_size _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_always_inline _GL_GNUC_PREREQ (3, 2) +# define _GL_ATTR_artificial _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_cold _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_const _GL_GNUC_PREREQ (2, 95) +# define _GL_ATTR_deprecated _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_diagnose_if 0 +# define _GL_ATTR_error _GL_GNUC_PREREQ (4, 3) +# define _GL_ATTR_externally_visible _GL_GNUC_PREREQ (4, 1) +# define _GL_ATTR_fallthrough _GL_GNUC_PREREQ (7, 0) +# define _GL_ATTR_format _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_leaf _GL_GNUC_PREREQ (4, 6) +# ifdef _ICC +# define _GL_ATTR_may_alias 0 +# else +# define _GL_ATTR_may_alias _GL_GNUC_PREREQ (3, 3) +# endif +# define _GL_ATTR_malloc _GL_GNUC_PREREQ (3, 0) +# define _GL_ATTR_noinline _GL_GNUC_PREREQ (3, 1) +# define _GL_ATTR_nonnull _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_nonstring _GL_GNUC_PREREQ (8, 0) +# define _GL_ATTR_nothrow _GL_GNUC_PREREQ (3, 3) +# define _GL_ATTR_packed _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_pure _GL_GNUC_PREREQ (2, 96) +# define _GL_ATTR_returns_nonnull _GL_GNUC_PREREQ (4, 9) +# define _GL_ATTR_sentinel _GL_GNUC_PREREQ (4, 0) +# define _GL_ATTR_unused _GL_GNUC_PREREQ (2, 7) +# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4) +#endif + +]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's _Alignas instead. +[ +#if _GL_HAS_ATTRIBUTE (alloc_size) +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) __attribute__ ((__alloc_size__ args)) +#else +# define _GL_ATTRIBUTE_ALLOC_SIZE(args) +#endif + +#if _GL_HAS_ATTRIBUTE (always_inline) +# define _GL_ATTRIBUTE_ALWAYS_INLINE __attribute__ ((__always_inline__)) +#else +# define _GL_ATTRIBUTE_ALWAYS_INLINE +#endif + +#if _GL_HAS_ATTRIBUTE (artificial) +# define _GL_ATTRIBUTE_ARTIFICIAL __attribute__ ((__artificial__)) +#else +# define _GL_ATTRIBUTE_ARTIFICIAL +#endif + +/* Avoid __attribute__ ((cold)) on MinGW; see thread starting at + . + Also, Oracle Studio 12.6 requires 'cold' not '__cold__'. */ +#if _GL_HAS_ATTRIBUTE (cold) && !defined __MINGW32__ +# ifndef __SUNPRO_C +# define _GL_ATTRIBUTE_COLD __attribute__ ((__cold__)) +# else +# define _GL_ATTRIBUTE_COLD __attribute__ ((cold)) +# endif +#else +# define _GL_ATTRIBUTE_COLD +#endif + +#if _GL_HAS_ATTRIBUTE (const) +# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) +#else +# define _GL_ATTRIBUTE_CONST +#endif + +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]] +#elif _GL_HAS_ATTRIBUTE (deprecated) +# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__)) +#else +# define _GL_ATTRIBUTE_DEPRECATED +#endif + +#if _GL_HAS_ATTRIBUTE (error) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__error__ (msg))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__warning__ (msg))) +#elif _GL_HAS_ATTRIBUTE (diagnose_if) +# define _GL_ATTRIBUTE_ERROR(msg) __attribute__ ((__diagnose_if__ (1, msg, "error"))) +# define _GL_ATTRIBUTE_WARNING(msg) __attribute__ ((__diagnose_if__ (1, msg, "warning"))) +#else +# define _GL_ATTRIBUTE_ERROR(msg) +# define _GL_ATTRIBUTE_WARNING(msg) +#endif + +#if _GL_HAS_ATTRIBUTE (externally_visible) +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE __attribute__ ((externally_visible)) +#else +# define _GL_ATTRIBUTE_EXTERNALLY_VISIBLE +#endif + +/* FALLTHROUGH is special, because it always expands to something. */ +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]] +#elif _GL_HAS_ATTRIBUTE (fallthrough) +# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__)) +#else +# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0) +#endif + +#if _GL_HAS_ATTRIBUTE (format) +# define _GL_ATTRIBUTE_FORMAT(spec) __attribute__ ((__format__ spec)) +#else +# define _GL_ATTRIBUTE_FORMAT(spec) +#endif + +#if _GL_HAS_ATTRIBUTE (leaf) +# define _GL_ATTRIBUTE_LEAF __attribute__ ((__leaf__)) +#else +# define _GL_ATTRIBUTE_LEAF +#endif + +/* Oracle Studio 12.6 mishandles may_alias despite __has_attribute OK. */ +#if _GL_HAS_ATTRIBUTE (may_alias) && !defined __SUNPRO_C +# define _GL_ATTRIBUTE_MAY_ALIAS __attribute__ ((__may_alias__)) +#else +# define _GL_ATTRIBUTE_MAY_ALIAS +#endif + +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]] +#elif _GL_HAS_ATTRIBUTE (unused) +# define _GL_ATTRIBUTE_MAYBE_UNUSED __attribute__ ((__unused__)) +#else +# define _GL_ATTRIBUTE_MAYBE_UNUSED +#endif +/* Earlier spellings of this macro. */ +#define _GL_UNUSED _GL_ATTRIBUTE_MAYBE_UNUSED +#define _UNUSED_PARAMETER_ _GL_ATTRIBUTE_MAYBE_UNUSED + +#if _GL_HAS_ATTRIBUTE (malloc) +# define _GL_ATTRIBUTE_MALLOC __attribute__ ((__malloc__)) +#else +# define _GL_ATTRIBUTE_MALLOC +#endif + +#if 201710L < __STDC_VERSION__ +# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]] +#elif _GL_HAS_ATTRIBUTE (warn_unused_result) +# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__)) +#else +# define _GL_ATTRIBUTE_NODISCARD +#endif + +#if _GL_HAS_ATTRIBUTE (noinline) +# define _GL_ATTRIBUTE_NOINLINE __attribute__ ((__noinline__)) +#else +# define _GL_ATTRIBUTE_NOINLINE +#endif + +#if _GL_HAS_ATTRIBUTE (nonnull) +# define _GL_ATTRIBUTE_NONNULL(args) __attribute__ ((__nonnull__ args)) +#else +# define _GL_ATTRIBUTE_NONNULL(args) +#endif + +#if _GL_HAS_ATTRIBUTE (nonstring) +# define _GL_ATTRIBUTE_NONSTRING __attribute__ ((__nonstring__)) +#else +# define _GL_ATTRIBUTE_NONSTRING +#endif + +/* There is no _GL_ATTRIBUTE_NORETURN; use _Noreturn instead. */ + +#if _GL_HAS_ATTRIBUTE (nothrow) && !defined __cplusplus +# define _GL_ATTRIBUTE_NOTHROW __attribute__ ((__nothrow__)) +#else +# define _GL_ATTRIBUTE_NOTHROW +#endif + +#if _GL_HAS_ATTRIBUTE (packed) +# define _GL_ATTRIBUTE_PACKED __attribute__ ((__packed__)) +#else +# define _GL_ATTRIBUTE_PACKED +#endif + +#if _GL_HAS_ATTRIBUTE (pure) +# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) +#else +# define _GL_ATTRIBUTE_PURE +#endif + +#if _GL_HAS_ATTRIBUTE (returns_nonnull) +# define _GL_ATTRIBUTE_RETURNS_NONNULL __attribute__ ((__returns_nonnull__)) +#else +# define _GL_ATTRIBUTE_RETURNS_NONNULL +#endif + +#if _GL_HAS_ATTRIBUTE (sentinel) +# define _GL_ATTRIBUTE_SENTINEL(pos) __attribute__ ((__sentinel__ pos)) +#else +# define _GL_ATTRIBUTE_SENTINEL(pos) +#endif + +]dnl There is no _GL_ATTRIBUTE_VISIBILITY; see m4/visibility.m4 instead. +[ +/* To support C++ as well as C, use _GL_UNUSED_LABEL with trailing ';'. */ +#if !defined __cplusplus || _GL_GNUC_PREREQ (4, 5) +# define _GL_UNUSED_LABEL _GL_ATTRIBUTE_MAYBE_UNUSED +#else +# define _GL_UNUSED_LABEL +#endif +]) + AH_VERBATIM([async_safe], +[/* The _GL_ASYNC_SAFE marker should be attached to functions that are + signal handlers (for signals other than SIGABRT, SIGPIPE) or can be + invoked from such signal handlers. Such functions have some restrictions: + * All functions that it calls should be marked _GL_ASYNC_SAFE as well, + or should be listed as async-signal-safe in POSIX + + section 2.4.3. Note that malloc(), sprintf(), and fwrite(), in + particular, are NOT async-signal-safe. + * All memory locations (variables and struct fields) that these functions + access must be marked 'volatile'. This holds for both read and write + accesses. Otherwise the compiler might optimize away stores to and + reads from such locations that occur in the program, depending on its + data flow analysis. For example, when the program contains a loop + that is intended to inspect a variable set from within a signal handler + while (!signal_occurred) + ; + the compiler is allowed to transform this into an endless loop if the + variable 'signal_occurred' is not declared 'volatile'. + Additionally, recall that: + * A signal handler should not modify errno (except if it is a handler + for a fatal signal and ends by raising the same signal again, thus + provoking the termination of the process). If it invokes a function + that may clobber errno, it needs to save and restore the value of + errno. */ +#define _GL_ASYNC_SAFE +]) + AH_VERBATIM([micro_optimizations], +[/* _GL_CMP (n1, n2) performs a three-valued comparison on n1 vs. n2, where + n1 and n2 are expressions without side effects, that evaluate to real + numbers (excluding NaN). + It returns + 1 if n1 > n2 + 0 if n1 == n2 + -1 if n1 < n2 + The naïve code (n1 > n2 ? 1 : n1 < n2 ? -1 : 0) produces a conditional + jump with nearly all GCC versions up to GCC 10. + This variant (n1 < n2 ? -1 : n1 > n2) produces a conditional with many + GCC versions up to GCC 9. + The better code (n1 > n2) - (n1 < n2) from Hacker's Delight § 2-9 + avoids conditional jumps in all GCC versions >= 3.4. */ +#define _GL_CMP(n1, n2) (((n1) > (n2)) - ((n1) < (n2))) +]) + dnl Hint which direction to take regarding cross-compilation guesses: + dnl When a user installs a program on a platform they are not intimately + dnl familiar with, --enable-cross-guesses=conservative is the appropriate + dnl choice. It implements the "If we don't know, assume the worst" principle. + dnl However, when an operating system developer (on a platform which is not + dnl yet known to gnulib) builds packages for their platform, they want to + dnl expose, not hide, possible platform bugs; in this case, + dnl --enable-cross-guesses=risky is the appropriate choice. + dnl Sets the variables + dnl gl_cross_guess_normal (to be used when 'yes' is good and 'no' is bad), + dnl gl_cross_guess_inverted (to be used when 'no' is good and 'yes' is bad). + AC_ARG_ENABLE([cross-guesses], + [AS_HELP_STRING([--enable-cross-guesses={conservative|risky}], + [specify policy for cross-compilation guesses])], + [if test "x$enableval" != xconservative && test "x$enableval" != xrisky; then + AC_MSG_WARN([invalid argument supplied to --enable-cross-guesses]) + enableval=conservative + fi + gl_cross_guesses="$enableval"], + [gl_cross_guesses=conservative]) + if test $gl_cross_guesses = risky; then + gl_cross_guess_normal="guessing yes" + gl_cross_guess_inverted="guessing no" + else + gl_cross_guess_normal="guessing no" + gl_cross_guess_inverted="guessing yes" + fi + dnl Preparation for running test programs: + dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not + dnl to /dev/tty, so they can be redirected to log files. Such diagnostics + dnl arise e.g., in the macros gl_PRINTF_DIRECTIVE_N, gl_SNPRINTF_DIRECTIVE_N. + LIBC_FATAL_STDERR_=1 + export LIBC_FATAL_STDERR_ +]) + +# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename]) +# gl_MODULE_INDICATOR_INIT_VARIABLE([variablename], [initialvalue]) +# initializes the shell variable that indicates the presence of the given module +# as a C preprocessor expression. +AC_DEFUN([gl_MODULE_INDICATOR_INIT_VARIABLE], +[ + GL_MODULE_INDICATOR_PREFIX[]_[$1]=m4_if([$2], , [0], [$2]) + AC_SUBST(GL_MODULE_INDICATOR_PREFIX[]_[$1]) +]) + +# gl_MODULE_INDICATOR_CONDITION +# expands to a C preprocessor expression that evaluates to 1 or 0, depending +# whether a gnulib module that has been requested shall be considered present +# or not. +m4_define([gl_MODULE_INDICATOR_CONDITION], [1]) + +# gl_MODULE_INDICATOR_SET_VARIABLE([modulename]) +# sets the shell variable that indicates the presence of the given module to +# a C preprocessor expression that will evaluate to 1. +AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE], +[ + gl_MODULE_INDICATOR_SET_VARIABLE_AUX( + [GL_MODULE_INDICATOR_PREFIX[]_GNULIB_[]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])], + [gl_MODULE_INDICATOR_CONDITION]) +]) + +# gl_MODULE_INDICATOR_SET_VARIABLE_AUX([variable]) +# modifies the shell variable to include the gl_MODULE_INDICATOR_CONDITION. +# The shell variable's value is a C preprocessor expression that evaluates +# to 0 or 1. +AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX], +[ + m4_if(m4_defn([gl_MODULE_INDICATOR_CONDITION]), [1], + [ + dnl Simplify the expression VALUE || 1 to 1. + $1=1 + ], + [gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([$1], + [gl_MODULE_INDICATOR_CONDITION])]) +]) + +# gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR([variable], [condition]) +# modifies the shell variable to include the given condition. The shell +# variable's value is a C preprocessor expression that evaluates to 0 or 1. +AC_DEFUN([gl_MODULE_INDICATOR_SET_VARIABLE_AUX_OR], +[ + dnl Simplify the expression 1 || CONDITION to 1. + if test "$[]$1" != 1; then + dnl Simplify the expression 0 || CONDITION to CONDITION. + if test "$[]$1" = 0; then + $1=$2 + else + $1="($[]$1 || $2)" + fi + fi +]) + +# gl_MODULE_INDICATOR([modulename]) +# defines a C macro indicating the presence of the given module +# in a location where it can be used. +# | Value | Value | +# | in lib/ | in tests/ | +# --------------------------------------------+---------+-----------+ +# Module present among main modules: | 1 | 1 | +# --------------------------------------------+---------+-----------+ +# Module present among tests-related modules: | 0 | 1 | +# --------------------------------------------+---------+-----------+ +# Module not present at all: | 0 | 0 | +# --------------------------------------------+---------+-----------+ +AC_DEFUN([gl_MODULE_INDICATOR], +[ + AC_DEFINE_UNQUOTED([GNULIB_]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), + [gl_MODULE_INDICATOR_CONDITION], + [Define to a C preprocessor expression that evaluates to 1 or 0, + depending whether the gnulib module $1 shall be considered present.]) +]) + +# gl_MODULE_INDICATOR_FOR_TESTS([modulename]) +# defines a C macro indicating the presence of the given module +# in lib or tests. This is useful to determine whether the module +# should be tested. +# | Value | Value | +# | in lib/ | in tests/ | +# --------------------------------------------+---------+-----------+ +# Module present among main modules: | 1 | 1 | +# --------------------------------------------+---------+-----------+ +# Module present among tests-related modules: | 1 | 1 | +# --------------------------------------------+---------+-----------+ +# Module not present at all: | 0 | 0 | +# --------------------------------------------+---------+-----------+ +AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], +[ + AC_DEFINE([GNULIB_TEST_]m4_translit([[$1]], + [abcdefghijklmnopqrstuvwxyz./-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ___]), [1], + [Define to 1 when the gnulib module $1 should be tested.]) +]) + +# gl_ASSERT_NO_GNULIB_POSIXCHECK +# asserts that there will never be a need to #define GNULIB_POSIXCHECK. +# and thereby enables an optimization of configure and config.h. +# Used by Emacs. +AC_DEFUN([gl_ASSERT_NO_GNULIB_POSIXCHECK], +[ + dnl Override gl_WARN_ON_USE_PREPARE. + dnl But hide this definition from 'aclocal'. + AC_DEFUN([gl_W][ARN_ON_USE_PREPARE], []) +]) + +# gl_ASSERT_NO_GNULIB_TESTS +# asserts that there will be no gnulib tests in the scope of the configure.ac +# and thereby enables an optimization of config.h. +# Used by Emacs. +AC_DEFUN([gl_ASSERT_NO_GNULIB_TESTS], +[ + dnl Override gl_MODULE_INDICATOR_FOR_TESTS. + AC_DEFUN([gl_MODULE_INDICATOR_FOR_TESTS], []) +]) + +# Test whether exists. +# Set HAVE_FEATURES_H. +AC_DEFUN([gl_FEATURES_H], +[ + AC_CHECK_HEADERS_ONCE([features.h]) + if test $ac_cv_header_features_h = yes; then + HAVE_FEATURES_H=1 + else + HAVE_FEATURES_H=0 + fi + AC_SUBST([HAVE_FEATURES_H]) +]) + +# gl_PROG_CC_C99 +# Modifies the value of the shell variable CC in an attempt to make $CC +# understand ISO C99 source code. +AC_DEFUN([gl_PROG_CC_C99], +[ + dnl Just use AC_PROG_CC_C99. + dnl When AC_PROG_CC_C99 and AC_PROG_CC_STDC are used together, the substituted + dnl value of CC will contain the C99 enabling options twice. But this is only + dnl a cosmetic problem. + dnl With Autoconf >= 2.70, use AC_PROG_CC since it implies AC_PROG_CC_C99; + dnl this avoids a "warning: The macro `AC_PROG_CC_C99' is obsolete." + m4_version_prereq([2.70], + [AC_REQUIRE([AC_PROG_CC])], + [AC_REQUIRE([AC_PROG_CC_C99])]) +]) + +# gl_PROG_AR_RANLIB +# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler. +# The user can set the variables AR, ARFLAGS, RANLIB if he wants to override +# the values. +AC_DEFUN([gl_PROG_AR_RANLIB], +[ + dnl Minix 3 comes with two toolchains: The Amsterdam Compiler Kit compiler + dnl as "cc", and GCC as "gcc". They have different object file formats and + dnl library formats. In particular, the GNU binutils programs ar and ranlib + dnl produce libraries that work only with gcc, not with cc. + AC_REQUIRE([AC_PROG_CC]) + dnl The '][' hides this use from 'aclocal'. + AC_BEFORE([$0], [A][M_PROG_AR]) + AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler], + [ + AC_EGREP_CPP([Amsterdam], + [ +#ifdef __ACK__ +Amsterdam +#endif + ], + [gl_cv_c_amsterdam_compiler=yes], + [gl_cv_c_amsterdam_compiler=no]) + ]) + + dnl Don't compete with AM_PROG_AR's decision about AR/ARFLAGS if we are not + dnl building with __ACK__. + if test $gl_cv_c_amsterdam_compiler = yes; then + if test -z "$AR"; then + AR='cc -c.a' + fi + if test -z "$ARFLAGS"; then + ARFLAGS='-o' + fi + else + dnl AM_PROG_AR was added in automake v1.11.2. AM_PROG_AR does not AC_SUBST + dnl ARFLAGS variable (it is filed into Makefile.in directly by automake + dnl script on-demand, if not specified by ./configure of course). + dnl Don't AC_REQUIRE the AM_PROG_AR otherwise the code for __ACK__ above + dnl will be ignored. Also, pay attention to call AM_PROG_AR in else block + dnl because AM_PROG_AR is written so it could re-set AR variable even for + dnl __ACK__. It may seem like its easier to avoid calling the macro here, + dnl but we need to AC_SUBST both AR/ARFLAGS (thus those must have some good + dnl default value and automake should usually know them). + dnl + dnl The '][' hides this use from 'aclocal'. + m4_ifdef([A][M_PROG_AR], [A][M_PROG_AR], [:]) + fi + + dnl In case the code above has not helped with setting AR/ARFLAGS, use + dnl Automake-documented default values for AR and ARFLAGS, but prefer + dnl ${host}-ar over ar (useful for cross-compiling). + AC_CHECK_TOOL([AR], [ar], [ar]) + if test -z "$ARFLAGS"; then + ARFLAGS='cr' + fi + + AC_SUBST([AR]) + AC_SUBST([ARFLAGS]) + if test -z "$RANLIB"; then + if test $gl_cv_c_amsterdam_compiler = yes; then + RANLIB=':' + else + dnl Use the ranlib program if it is available. + AC_PROG_RANLIB + fi + fi + AC_SUBST([RANLIB]) +]) + +# AC_C_RESTRICT +# This definition is copied from post-2.70 Autoconf and overrides the +# AC_C_RESTRICT macro from autoconf 2.60..2.70. +m4_version_prereq([2.70.1], [], [ +AC_DEFUN([AC_C_RESTRICT], +[AC_CACHE_CHECK([for C/C++ restrict keyword], [ac_cv_c_restrict], + [ac_cv_c_restrict=no + # Put '__restrict__' first, to avoid problems with glibc and non-GCC; see: + # https://lists.gnu.org/archive/html/bug-autoconf/2016-02/msg00006.html + # Put 'restrict' last, because C++ lacks it. + for ac_kw in __restrict__ __restrict _Restrict restrict; do + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[typedef int *int_ptr; + int foo (int_ptr $ac_kw ip) { return ip[0]; } + int bar (int [$ac_kw]); /* Catch GCC bug 14050. */ + int bar (int ip[$ac_kw]) { return ip[0]; } + ]], + [[int s[1]; + int *$ac_kw t = s; + t[0] = 0; + return foo (t) + bar (t); + ]])], + [ac_cv_c_restrict=$ac_kw]) + test "$ac_cv_c_restrict" != no && break + done + ]) + AH_VERBATIM([restrict], +[/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported only directly. */ +#undef restrict +/* Work around a bug in older versions of Sun C++, which did not + #define __restrict__ or support _Restrict or __restrict__ + even though the corresponding Sun C compiler ended up with + "#define restrict _Restrict" or "#define restrict __restrict__" + in the previous line. This workaround can be removed once + we assume Oracle Developer Studio 12.5 (2016) or later. */ +#if defined __SUNPRO_CC && !defined __RESTRICT && !defined __restrict__ +# define _Restrict +# define __restrict__ +#endif]) + case $ac_cv_c_restrict in + restrict) ;; + no) AC_DEFINE([restrict], []) ;; + *) AC_DEFINE_UNQUOTED([restrict], [$ac_cv_c_restrict]) ;; + esac +])# AC_C_RESTRICT +]) + +# gl_BIGENDIAN +# is like AC_C_BIGENDIAN, except that it can be AC_REQUIREd. +# Note that AC_REQUIRE([AC_C_BIGENDIAN]) does not work reliably because some +# macros invoke AC_C_BIGENDIAN with arguments. +AC_DEFUN([gl_BIGENDIAN], +[ + AC_C_BIGENDIAN +]) + +# A temporary file descriptor. +# Must be less than 10, because dash 0.5.8 does not support redirections +# with multi-digit file descriptors. +m4_define([GL_TMP_FD], 9) + +# gl_SILENT(command) +# executes command, but without the normal configure output. +# This is useful when you want to invoke AC_CACHE_CHECK (or AC_CHECK_FUNC etc.) +# inside another AC_CACHE_CHECK. +AC_DEFUN([gl_SILENT], +[ + exec GL_TMP_FD>&AS_MESSAGE_FD AS_MESSAGE_FD>/dev/null + $1 + exec AS_MESSAGE_FD>&GL_TMP_FD GL_TMP_FD>&- +]) + +# gl_CACHE_VAL_SILENT(cache-id, command-to-set-it) +# is like AC_CACHE_VAL(cache-id, command-to-set-it), except that it does not +# output a spurious "(cached)" mark in the midst of other configure output. +# This macro should be used instead of AC_CACHE_VAL when it is not surrounded +# by an AC_MSG_CHECKING/AC_MSG_RESULT pair. +AC_DEFUN([gl_CACHE_VAL_SILENT], +[ + gl_SILENT([ + AC_CACHE_VAL([$1], [$2]) + ]) +]) + +# gl_CC_ALLOW_WARNINGS +# sets and substitutes a variable GL_CFLAG_ALLOW_WARNINGS, to a $(CC) option +# that reverts a preceding '-Werror' option, if available. +# This is expected to be '-Wno-error' on gcc, clang (except clang/MSVC), xlclang +# and empty otherwise. +AC_DEFUN([gl_CC_ALLOW_WARNINGS], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([for C compiler option to allow warnings], + [gl_cv_cc_wallow], + [rm -f conftest* + echo 'int dummy;' > conftest.c + AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c 2>conftest1.err]) >/dev/null + AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Wno-error -c conftest.c 2>conftest2.err]) >/dev/null + dnl Test the number of error output lines, because AIX xlc accepts the + dnl option '-Wno-error', just to produce a warning + dnl "Option -Wno-error was incorrectly specified. The option will be ignored." + dnl afterwards. + if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then + gl_cv_cc_wallow='-Wno-error' + else + gl_cv_cc_wallow=none + fi + rm -f conftest* + ]) + case "$gl_cv_cc_wallow" in + none) GL_CFLAG_ALLOW_WARNINGS='' ;; + *) GL_CFLAG_ALLOW_WARNINGS="$gl_cv_cc_wallow" ;; + esac + AC_SUBST([GL_CFLAG_ALLOW_WARNINGS]) +]) + +# gl_CXX_ALLOW_WARNINGS +# sets and substitutes a variable GL_CXXFLAG_ALLOW_WARNINGS, to a $(CC) option +# that reverts a preceding '-Werror' option, if available. +AC_DEFUN([gl_CXX_ALLOW_WARNINGS], +[ + dnl Requires AC_PROG_CXX or gl_PROG_ANSI_CXX. + if test -n "$CXX" && test "$CXX" != no; then + AC_CACHE_CHECK([for C++ compiler option to allow warnings], + [gl_cv_cxx_wallow], + [rm -f conftest* + echo 'int dummy;' > conftest.cc + AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -c conftest.cc 2>conftest1.err]) >/dev/null + AC_TRY_COMMAND([${CXX-c++} $CXXFLAGS $CPPFLAGS -Wno-error -c conftest.cc 2>conftest2.err]) >/dev/null + dnl Test the number of error output lines, because AIX xlC accepts the + dnl option '-Wno-error', just to produce a warning + dnl "Option -Wno-error was incorrectly specified. The option will be ignored." + dnl afterwards. + if test $? = 0 && test `wc -l < conftest1.err` = `wc -l < conftest2.err`; then + gl_cv_cxx_wallow='-Wno-error' + else + gl_cv_cxx_wallow=none + fi + rm -f conftest* + ]) + case "$gl_cv_cxx_wallow" in + none) GL_CXXFLAG_ALLOW_WARNINGS='' ;; + *) GL_CXXFLAG_ALLOW_WARNINGS="$gl_cv_cxx_wallow" ;; + esac + else + GL_CXXFLAG_ALLOW_WARNINGS='' + fi + AC_SUBST([GL_CXXFLAG_ALLOW_WARNINGS]) +]) + +dnl Expands to some code for use in .c programs that, on native Windows, defines +dnl the Microsoft deprecated alias function names to the underscore-prefixed +dnl actual function names. With this macro, these function names are available +dnl without linking with '-loldnames' and without generating warnings. +dnl Usage: Use it after all system header files are included. +dnl #include <...> +dnl #include <...> +dnl ]GL_MDA_DEFINES[ +dnl ... +AC_DEFUN([GL_MDA_DEFINES],[ +AC_REQUIRE([_GL_MDA_DEFINES]) +[$gl_mda_defines] +]) +AC_DEFUN([_GL_MDA_DEFINES], +[gl_mda_defines=' +#if defined _WIN32 && !defined __CYGWIN__ +#define access _access +#define chdir _chdir +#define chmod _chmod +#define close _close +#define creat _creat +#define dup _dup +#define dup2 _dup2 +#define ecvt _ecvt +#define execl _execl +#define execle _execle +#define execlp _execlp +#define execv _execv +#define execve _execve +#define execvp _execvp +#define execvpe _execvpe +#define fcloseall _fcloseall +#define fcvt _fcvt +#define fdopen _fdopen +#define fileno _fileno +#define gcvt _gcvt +#define getcwd _getcwd +#define getpid _getpid +#define getw _getw +#define isatty _isatty +#define j0 _j0 +#define j1 _j1 +#define jn _jn +#define lfind _lfind +#define lsearch _lsearch +#define lseek _lseek +#define memccpy _memccpy +#define mkdir _mkdir +#define mktemp _mktemp +#define open _open +#define putenv _putenv +#define putw _putw +#define read _read +#define rmdir _rmdir +#define strdup _strdup +#define swab _swab +#define tempnam _tempnam +#define tzset _tzset +#define umask _umask +#define unlink _unlink +#define utime _utime +#define wcsdup _wcsdup +#define write _write +#define y0 _y0 +#define y1 _y1 +#define yn _yn +#endif +' +]) diff --git a/gnulib-m4/gnulib-comp.m4 b/gnulib-m4/gnulib-comp.m4 new file mode 100644 index 0000000..1a9c7b8 --- /dev/null +++ b/gnulib-m4/gnulib-comp.m4 @@ -0,0 +1,660 @@ +# DO NOT EDIT! GENERATED AUTOMATICALLY! +# Copyright (C) 2002-2021 Free Software Foundation, Inc. +# +# 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 3 of the License, or +# (at your option) any later version. +# +# This file 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 file. If not, see . +# +# As a special exception to the GNU General Public License, +# this file may be distributed as part of a program that +# contains a configuration script generated by Autoconf, under +# the same distribution terms as the rest of that program. +# +# Generated by gnulib-tool. +# +# This file represents the compiled summary of the specification in +# gnulib-cache.m4. It lists the computed macro invocations that need +# to be invoked from configure.ac. +# In projects that use version control, this file can be treated like +# other built files. + + +# This macro should be invoked from ./configure.ac, in the section +# "Checks for programs", right after AC_PROG_CC, and certainly before +# any checks for libraries, header files, types and library functions. +AC_DEFUN([gl_EARLY], +[ + m4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace + m4_pattern_allow([^gl_ES$])dnl a valid locale name + m4_pattern_allow([^gl_LIBOBJS$])dnl a variable + m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable + + # Pre-early section. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_REQUIRE([gl_PROG_AR_RANLIB]) + + AC_REQUIRE([AM_PROG_CC_C_O]) + # Code from module absolute-header: + # Code from module alloca-opt: + # Code from module ansi-c++-opt: + AC_REQUIRE([gl_ANSI_CXX]) + # Code from module asyncsafe-spin: + # Code from module attribute: + # Code from module basename-lgpl: + # Code from module c99: + # Code from module clean-temp-simple: + # Code from module cloexec: + # Code from module close: + # Code from module double-slash-root: + # Code from module dup2: + # Code from module errno: + # Code from module error: + # Code from module extensions: + # Code from module extern-inline: + # Code from module fatal-signal: + # Code from module fcntl: + # Code from module fcntl-h: + # Code from module fd-hook: + # Code from module filename: + # Code from module fstat: + # Code from module getdtablesize: + # Code from module getprogname: + # Code from module gettext-h: + # Code from module host-cpu-c-abi: + # Code from module idx: + # Code from module include_next: + # Code from module intprops: + # Code from module largefile: + AC_REQUIRE([AC_SYS_LARGEFILE]) + # Code from module limits-h: + # Code from module linkedhash-list: + # Code from module list: + # Code from module lock: + # Code from module malloca: + # Code from module msvc-inval: + # Code from module msvc-nothrow: + # Code from module multiarch: + # Code from module nocrash: + # Code from module open: + # Code from module pathmax: + # Code from module raise: + # Code from module rmdir: + # Code from module sigaction: + # Code from module signal-h: + # Code from module sigprocmask: + # Code from module size_max: + # Code from module snippet/_Noreturn: + # Code from module snippet/arg-nonnull: + # Code from module snippet/c++defs: + # Code from module snippet/warn-on-use: + # Code from module sparcv8+: + gl_SPARC_V8PLUS + # Code from module ssize_t: + # Code from module stat: + # Code from module stat-time: + # Code from module std-gnu11: + # Code from module stdbool: + # Code from module stddef: + # Code from module stdint: + # Code from module stdio: + # Code from module stdnoreturn: + # Code from module strerror: + # Code from module strerror-override: + # Code from module string: + # Code from module sys_stat: + # Code from module sys_types: + # Code from module thread-optim: + # Code from module threadlib: + gl_THREADLIB_EARLY + # Code from module time: + # Code from module unistd: + # Code from module verify: + # Code from module windows-mutex: + # Code from module windows-once: + # Code from module windows-recmutex: + # Code from module windows-rwlock: + # Code from module windows-spin: + # Code from module xalloc-oversized: + # Code from module xsize: +]) + +# This macro should be invoked from ./configure.ac, in the section +# "Check for header files, types and library functions". +AC_DEFUN([gl_INIT], +[ + AM_CONDITIONAL([GL_COND_LIBTOOL], [true]) + gl_cond_libtool=true + gl_m4_base='gnulib-m4' + m4_pushdef([AC_LIBOBJ], m4_defn([gl_LIBOBJ])) + m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gl_REPLACE_FUNCS])) + m4_pushdef([AC_LIBSOURCES], m4_defn([gl_LIBSOURCES])) + m4_pushdef([gl_LIBSOURCES_LIST], []) + m4_pushdef([gl_LIBSOURCES_DIR], []) + m4_pushdef([GL_MACRO_PREFIX], [gl]) + m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) + gl_COMMON + gl_source_base='gnulib-lib' + gl_FUNC_ALLOCA + AC_REQUIRE([AC_C_INLINE]) + AC_CHECK_HEADERS_ONCE([pthread.h]) + AC_DEFINE([SIGNAL_SAFE_LIST], [1], [Define if lists must be signal-safe.]) + gl_MODULE_INDICATOR_FOR_TESTS([cloexec]) + gl_FUNC_CLOSE + if test $REPLACE_CLOSE = 1; then + AC_LIBOBJ([close]) + fi + gl_UNISTD_MODULE_INDICATOR([close]) + gl_DOUBLE_SLASH_ROOT + gl_FUNC_DUP2 + if test $REPLACE_DUP2 = 1; then + AC_LIBOBJ([dup2]) + gl_PREREQ_DUP2 + fi + gl_UNISTD_MODULE_INDICATOR([dup2]) + gl_HEADER_ERRNO_H + gl_ERROR + if test $ac_cv_lib_error_at_line = no; then + AC_LIBOBJ([error]) + gl_PREREQ_ERROR + fi + m4_ifdef([AM_XGETTEXT_OPTION], + [AM_][XGETTEXT_OPTION([--flag=error:3:c-format]) + AM_][XGETTEXT_OPTION([--flag=error_at_line:5:c-format])]) + AC_REQUIRE([gl_EXTERN_INLINE]) + gl_FATAL_SIGNAL + gl_FUNC_FCNTL + if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then + AC_LIBOBJ([fcntl]) + fi + gl_FCNTL_MODULE_INDICATOR([fcntl]) + gl_FCNTL_H + gl_FCNTL_H_REQUIRE_DEFAULTS + gl_FUNC_FSTAT + if test $REPLACE_FSTAT = 1; then + AC_LIBOBJ([fstat]) + case "$host_os" in + mingw*) + AC_LIBOBJ([stat-w32]) + ;; + esac + gl_PREREQ_FSTAT + fi + gl_SYS_STAT_MODULE_INDICATOR([fstat]) + gl_FUNC_GETDTABLESIZE + if test $HAVE_GETDTABLESIZE = 0 || test $REPLACE_GETDTABLESIZE = 1; then + AC_LIBOBJ([getdtablesize]) + gl_PREREQ_GETDTABLESIZE + fi + gl_UNISTD_MODULE_INDICATOR([getdtablesize]) + gl_FUNC_GETPROGNAME + AC_SUBST([LIBINTL]) + AC_SUBST([LTLIBINTL]) + AC_REQUIRE([gl_HOST_CPU_C_ABI]) + AC_REQUIRE([gl_LARGEFILE]) + gl_LIMITS_H + gl_LOCK + gl_MODULE_INDICATOR([lock]) + gl_MALLOCA + AC_REQUIRE([gl_MSVC_INVAL]) + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + AC_LIBOBJ([msvc-inval]) + fi + AC_REQUIRE([gl_MSVC_NOTHROW]) + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + AC_LIBOBJ([msvc-nothrow]) + fi + gl_MODULE_INDICATOR([msvc-nothrow]) + gl_MULTIARCH + gl_FUNC_OPEN + if test $REPLACE_OPEN = 1; then + AC_LIBOBJ([open]) + gl_PREREQ_OPEN + fi + gl_FCNTL_MODULE_INDICATOR([open]) + gl_PATHMAX + gl_FUNC_RAISE + if test $HAVE_RAISE = 0 || test $REPLACE_RAISE = 1; then + AC_LIBOBJ([raise]) + gl_PREREQ_RAISE + fi + gl_SIGNAL_MODULE_INDICATOR([raise]) + gl_FUNC_RMDIR + if test $REPLACE_RMDIR = 1; then + AC_LIBOBJ([rmdir]) + fi + gl_UNISTD_MODULE_INDICATOR([rmdir]) + gl_SIGACTION + if test $HAVE_SIGACTION = 0; then + AC_LIBOBJ([sigaction]) + gl_PREREQ_SIGACTION + fi + gl_SIGNAL_MODULE_INDICATOR([sigaction]) + gl_SIGNAL_H + gl_SIGNAL_H_REQUIRE_DEFAULTS + gl_SIGNALBLOCKING + if test $HAVE_POSIX_SIGNALBLOCKING = 0; then + AC_LIBOBJ([sigprocmask]) + gl_PREREQ_SIGPROCMASK + fi + gl_SIGNAL_MODULE_INDICATOR([sigprocmask]) + gl_SIZE_MAX + gt_TYPE_SSIZE_T + gl_FUNC_STAT + if test $REPLACE_STAT = 1; then + AC_LIBOBJ([stat]) + case "$host_os" in + mingw*) + AC_LIBOBJ([stat-w32]) + ;; + esac + gl_PREREQ_STAT + fi + gl_SYS_STAT_MODULE_INDICATOR([stat]) + gl_STAT_TIME + gl_STAT_BIRTHTIME + AM_STDBOOL_H + gl_STDDEF_H + gl_STDDEF_H_REQUIRE_DEFAULTS + gl_STDINT_H + gl_STDIO_H + gl_STDIO_H_REQUIRE_DEFAULTS + dnl No need to create extra modules for these functions. Everyone who uses + dnl likely needs them. + gl_STDIO_MODULE_INDICATOR([fscanf]) + gl_MODULE_INDICATOR([fscanf]) + gl_STDIO_MODULE_INDICATOR([scanf]) + gl_MODULE_INDICATOR([scanf]) + gl_STDIO_MODULE_INDICATOR([fgetc]) + gl_STDIO_MODULE_INDICATOR([getc]) + gl_STDIO_MODULE_INDICATOR([getchar]) + gl_STDIO_MODULE_INDICATOR([fgets]) + gl_STDIO_MODULE_INDICATOR([fread]) + dnl No need to create extra modules for these functions. Everyone who uses + dnl likely needs them. + gl_STDIO_MODULE_INDICATOR([fprintf]) + gl_STDIO_MODULE_INDICATOR([printf]) + gl_STDIO_MODULE_INDICATOR([vfprintf]) + gl_STDIO_MODULE_INDICATOR([vprintf]) + gl_STDIO_MODULE_INDICATOR([fputc]) + gl_STDIO_MODULE_INDICATOR([putc]) + gl_STDIO_MODULE_INDICATOR([putchar]) + gl_STDIO_MODULE_INDICATOR([fputs]) + gl_STDIO_MODULE_INDICATOR([puts]) + gl_STDIO_MODULE_INDICATOR([fwrite]) + gl_STDNORETURN_H + gl_FUNC_STRERROR + if test $REPLACE_STRERROR = 1; then + AC_LIBOBJ([strerror]) + fi + gl_MODULE_INDICATOR([strerror]) + gl_STRING_MODULE_INDICATOR([strerror]) + AC_REQUIRE([gl_HEADER_ERRNO_H]) + AC_REQUIRE([gl_FUNC_STRERROR_0]) + if test -n "$ERRNO_H" || test $REPLACE_STRERROR_0 = 1; then + AC_LIBOBJ([strerror-override]) + gl_PREREQ_SYS_H_WINSOCK2 + fi + gl_STRING_H + gl_STRING_H_REQUIRE_DEFAULTS + gl_SYS_STAT_H + gl_SYS_STAT_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + gl_SYS_TYPES_H + gl_SYS_TYPES_H_REQUIRE_DEFAULTS + AC_PROG_MKDIR_P + AC_CHECK_HEADERS([sys/single_threaded.h]) + AC_REQUIRE([gl_THREADLIB]) + gl_TIME_H + gl_TIME_H_REQUIRE_DEFAULTS + gl_UNISTD_H + gl_UNISTD_H_REQUIRE_DEFAULTS + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-mutex]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-once]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-recmutex]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-rwlock]) + ;; + esac + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_LIBOBJ([windows-spin]) + ;; + esac + gl_XSIZE + # End of code from modules + m4_ifval(gl_LIBSOURCES_LIST, [ + m4_syscmd([test ! -d ]m4_defn([gl_LIBSOURCES_DIR])[ || + for gl_file in ]gl_LIBSOURCES_LIST[ ; do + if test ! -r ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file ; then + echo "missing file ]m4_defn([gl_LIBSOURCES_DIR])[/$gl_file" >&2 + exit 1 + fi + done])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) + ]) + m4_popdef([GL_MODULE_INDICATOR_PREFIX]) + m4_popdef([GL_MACRO_PREFIX]) + m4_popdef([gl_LIBSOURCES_DIR]) + m4_popdef([gl_LIBSOURCES_LIST]) + m4_popdef([AC_LIBSOURCES]) + m4_popdef([AC_REPLACE_FUNCS]) + m4_popdef([AC_LIBOBJ]) + AC_CONFIG_COMMANDS_PRE([ + gl_libobjs= + gl_ltlibobjs= + if test -n "$gl_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $gl_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do + gl_libobjs="$gl_libobjs $i.$ac_objext" + gl_ltlibobjs="$gl_ltlibobjs $i.lo" + done + fi + AC_SUBST([gl_LIBOBJS], [$gl_libobjs]) + AC_SUBST([gl_LTLIBOBJS], [$gl_ltlibobjs]) + ]) + gltests_libdeps= + gltests_ltlibdeps= + m4_pushdef([AC_LIBOBJ], m4_defn([gltests_LIBOBJ])) + m4_pushdef([AC_REPLACE_FUNCS], m4_defn([gltests_REPLACE_FUNCS])) + m4_pushdef([AC_LIBSOURCES], m4_defn([gltests_LIBSOURCES])) + m4_pushdef([gltests_LIBSOURCES_LIST], []) + m4_pushdef([gltests_LIBSOURCES_DIR], []) + m4_pushdef([GL_MACRO_PREFIX], [gltests]) + m4_pushdef([GL_MODULE_INDICATOR_PREFIX], [GL]) + gl_COMMON + gl_source_base='tests' +changequote(,)dnl + gltests_WITNESS=IN_`echo "${PACKAGE-$PACKAGE_TARNAME}" | LC_ALL=C tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ | LC_ALL=C sed -e 's/[^A-Z0-9_]/_/g'`_GNULIB_TESTS +changequote([, ])dnl + AC_SUBST([gltests_WITNESS]) + gl_module_indicator_condition=$gltests_WITNESS + m4_pushdef([gl_MODULE_INDICATOR_CONDITION], [$gl_module_indicator_condition]) + m4_popdef([gl_MODULE_INDICATOR_CONDITION]) + m4_ifval(gltests_LIBSOURCES_LIST, [ + m4_syscmd([test ! -d ]m4_defn([gltests_LIBSOURCES_DIR])[ || + for gl_file in ]gltests_LIBSOURCES_LIST[ ; do + if test ! -r ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file ; then + echo "missing file ]m4_defn([gltests_LIBSOURCES_DIR])[/$gl_file" >&2 + exit 1 + fi + done])dnl + m4_if(m4_sysval, [0], [], + [AC_FATAL([expected source file, required through AC_LIBSOURCES, not found])]) + ]) + m4_popdef([GL_MODULE_INDICATOR_PREFIX]) + m4_popdef([GL_MACRO_PREFIX]) + m4_popdef([gltests_LIBSOURCES_DIR]) + m4_popdef([gltests_LIBSOURCES_LIST]) + m4_popdef([AC_LIBSOURCES]) + m4_popdef([AC_REPLACE_FUNCS]) + m4_popdef([AC_LIBOBJ]) + AC_CONFIG_COMMANDS_PRE([ + gltests_libobjs= + gltests_ltlibobjs= + if test -n "$gltests_LIBOBJS"; then + # Remove the extension. + sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $gltests_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do + gltests_libobjs="$gltests_libobjs $i.$ac_objext" + gltests_ltlibobjs="$gltests_ltlibobjs $i.lo" + done + fi + AC_SUBST([gltests_LIBOBJS], [$gltests_libobjs]) + AC_SUBST([gltests_LTLIBOBJS], [$gltests_ltlibobjs]) + ]) +]) + +# Like AC_LIBOBJ, except that the module name goes +# into gl_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([gl_LIBOBJ], [ + AS_LITERAL_IF([$1], [gl_LIBSOURCES([$1.c])])dnl + gl_LIBOBJS="$gl_LIBOBJS $1.$ac_objext" +]) + +# Like AC_REPLACE_FUNCS, except that the module name goes +# into gl_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([gl_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [gl_LIBOBJ($ac_func)]) +]) + +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parameterization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([gl_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_define([gl_LIBSOURCES_DIR], [gnulib-lib]) + m4_append([gl_LIBSOURCES_LIST], _gl_NAME, [ ]) + ]) + ]) +]) + +# Like AC_LIBOBJ, except that the module name goes +# into gltests_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([gltests_LIBOBJ], [ + AS_LITERAL_IF([$1], [gltests_LIBSOURCES([$1.c])])dnl + gltests_LIBOBJS="$gltests_LIBOBJS $1.$ac_objext" +]) + +# Like AC_REPLACE_FUNCS, except that the module name goes +# into gltests_LIBOBJS instead of into LIBOBJS. +AC_DEFUN([gltests_REPLACE_FUNCS], [ + m4_foreach_w([gl_NAME], [$1], [AC_LIBSOURCES(gl_NAME[.c])])dnl + AC_CHECK_FUNCS([$1], , [gltests_LIBOBJ($ac_func)]) +]) + +# Like AC_LIBSOURCES, except the directory where the source file is +# expected is derived from the gnulib-tool parameterization, +# and alloca is special cased (for the alloca-opt module). +# We could also entirely rely on EXTRA_lib..._SOURCES. +AC_DEFUN([gltests_LIBSOURCES], [ + m4_foreach([_gl_NAME], [$1], [ + m4_if(_gl_NAME, [alloca.c], [], [ + m4_define([gltests_LIBSOURCES_DIR], [tests]) + m4_append([gltests_LIBSOURCES_LIST], _gl_NAME, [ ]) + ]) + ]) +]) + +# This macro records the list of files which have been installed by +# gnulib-tool and may be removed by future gnulib-tool invocations. +AC_DEFUN([gl_FILE_LIST], [ + lib/_Noreturn.h + lib/alloca.in.h + lib/arg-nonnull.h + lib/asyncsafe-spin.c + lib/asyncsafe-spin.h + lib/attribute.h + lib/basename-lgpl.c + lib/basename-lgpl.h + lib/c++defs.h + lib/clean-temp-private.h + lib/clean-temp-simple.c + lib/clean-temp-simple.h + lib/cloexec.c + lib/cloexec.h + lib/close.c + lib/dup2.c + lib/errno.in.h + lib/error.c + lib/error.h + lib/fatal-signal.c + lib/fatal-signal.h + lib/fcntl.c + lib/fcntl.in.h + lib/fd-hook.c + lib/fd-hook.h + lib/filename.h + lib/fstat.c + lib/getdtablesize.c + lib/getprogname.c + lib/getprogname.h + lib/gettext.h + lib/gl_anyhash1.h + lib/gl_anyhash2.h + lib/gl_anyhash_primes.h + lib/gl_anylinked_list1.h + lib/gl_anylinked_list2.h + lib/gl_linkedhash_list.c + lib/gl_linkedhash_list.h + lib/gl_list.c + lib/gl_list.h + lib/glthread/lock.c + lib/glthread/lock.h + lib/glthread/threadlib.c + lib/idx.h + lib/intprops.h + lib/limits.in.h + lib/malloca.c + lib/malloca.h + lib/msvc-inval.c + lib/msvc-inval.h + lib/msvc-nothrow.c + lib/msvc-nothrow.h + lib/open.c + lib/pathmax.h + lib/raise.c + lib/rmdir.c + lib/sig-handler.c + lib/sig-handler.h + lib/sigaction.c + lib/signal.in.h + lib/sigprocmask.c + lib/size_max.h + lib/stat-time.c + lib/stat-time.h + lib/stat-w32.c + lib/stat-w32.h + lib/stat.c + lib/stdbool.in.h + lib/stddef.in.h + lib/stdint.in.h + lib/stdio.in.h + lib/stdnoreturn.in.h + lib/strerror-override.c + lib/strerror-override.h + lib/strerror.c + lib/string.in.h + lib/sys_stat.in.h + lib/sys_types.in.h + lib/thread-optim.h + lib/time.in.h + lib/unistd.c + lib/unistd.in.h + lib/verify.h + lib/warn-on-use.h + lib/windows-initguard.h + lib/windows-mutex.c + lib/windows-mutex.h + lib/windows-once.c + lib/windows-once.h + lib/windows-recmutex.c + lib/windows-recmutex.h + lib/windows-rwlock.c + lib/windows-rwlock.h + lib/windows-spin.c + lib/windows-spin.h + lib/xalloc-oversized.h + lib/xsize.c + lib/xsize.h + m4/00gnulib.m4 + m4/absolute-header.m4 + m4/alloca.m4 + m4/ansi-c++.m4 + m4/asm-underscore.m4 + m4/close.m4 + m4/double-slash-root.m4 + m4/dup2.m4 + m4/eealloc.m4 + m4/errno_h.m4 + m4/error.m4 + m4/extensions.m4 + m4/extern-inline.m4 + m4/fatal-signal.m4 + m4/fcntl-o.m4 + m4/fcntl.m4 + m4/fcntl_h.m4 + m4/fstat.m4 + m4/getdtablesize.m4 + m4/getprogname.m4 + m4/gnulib-common.m4 + m4/host-cpu-c-abi.m4 + m4/include_next.m4 + m4/largefile.m4 + m4/limits-h.m4 + m4/lock.m4 + m4/malloca.m4 + m4/mode_t.m4 + m4/msvc-inval.m4 + m4/msvc-nothrow.m4 + m4/multiarch.m4 + m4/nocrash.m4 + m4/off_t.m4 + m4/open-cloexec.m4 + m4/open-slash.m4 + m4/open.m4 + m4/pathmax.m4 + m4/pid_t.m4 + m4/pthread_rwlock_rdlock.m4 + m4/raise.m4 + m4/rmdir.m4 + m4/sig_atomic_t.m4 + m4/sigaction.m4 + m4/signal_h.m4 + m4/signalblocking.m4 + m4/size_max.m4 + m4/sparcv8+.m4 + m4/ssize_t.m4 + m4/stat-time.m4 + m4/stat.m4 + m4/std-gnu11.m4 + m4/stdbool.m4 + m4/stddef_h.m4 + m4/stdint.m4 + m4/stdio_h.m4 + m4/stdnoreturn.m4 + m4/strerror.m4 + m4/string_h.m4 + m4/sys_socket_h.m4 + m4/sys_stat_h.m4 + m4/sys_types_h.m4 + m4/threadlib.m4 + m4/time_h.m4 + m4/unistd_h.m4 + m4/warn-on-use.m4 + m4/wchar_t.m4 + m4/wint_t.m4 + m4/xsize.m4 + m4/zzgnulib.m4 +]) diff --git a/gnulib-m4/gnulib-tool.m4 b/gnulib-m4/gnulib-tool.m4 new file mode 100644 index 0000000..3d56d83 --- /dev/null +++ b/gnulib-m4/gnulib-tool.m4 @@ -0,0 +1,57 @@ +# gnulib-tool.m4 serial 2 +dnl Copyright (C) 2004-2005, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl The following macros need not be invoked explicitly. +dnl Invoking them does nothing except to declare default arguments +dnl for "gnulib-tool --import". + +dnl Usage: gl_LOCAL_DIR([DIR]) +AC_DEFUN([gl_LOCAL_DIR], []) + +dnl Usage: gl_MODULES([module1 module2 ...]) +AC_DEFUN([gl_MODULES], []) + +dnl Usage: gl_AVOID([module1 module2 ...]) +AC_DEFUN([gl_AVOID], []) + +dnl Usage: gl_SOURCE_BASE([DIR]) +AC_DEFUN([gl_SOURCE_BASE], []) + +dnl Usage: gl_M4_BASE([DIR]) +AC_DEFUN([gl_M4_BASE], []) + +dnl Usage: gl_PO_BASE([DIR]) +AC_DEFUN([gl_PO_BASE], []) + +dnl Usage: gl_DOC_BASE([DIR]) +AC_DEFUN([gl_DOC_BASE], []) + +dnl Usage: gl_TESTS_BASE([DIR]) +AC_DEFUN([gl_TESTS_BASE], []) + +dnl Usage: gl_WITH_TESTS +AC_DEFUN([gl_WITH_TESTS], []) + +dnl Usage: gl_LIB([LIBNAME]) +AC_DEFUN([gl_LIB], []) + +dnl Usage: gl_LGPL or gl_LGPL([VERSION]) +AC_DEFUN([gl_LGPL], []) + +dnl Usage: gl_MAKEFILE_NAME([FILENAME]) +AC_DEFUN([gl_MAKEFILE_NAME], []) + +dnl Usage: gl_LIBTOOL +AC_DEFUN([gl_LIBTOOL], []) + +dnl Usage: gl_MACRO_PREFIX([PREFIX]) +AC_DEFUN([gl_MACRO_PREFIX], []) + +dnl Usage: gl_PO_DOMAIN([DOMAIN]) +AC_DEFUN([gl_PO_DOMAIN], []) + +dnl Usage: gl_VC_FILES([BOOLEAN]) +AC_DEFUN([gl_VC_FILES], []) diff --git a/gnulib-m4/host-cpu-c-abi.m4 b/gnulib-m4/host-cpu-c-abi.m4 new file mode 100644 index 0000000..64e28b1 --- /dev/null +++ b/gnulib-m4/host-cpu-c-abi.m4 @@ -0,0 +1,675 @@ +# host-cpu-c-abi.m4 serial 14 +dnl Copyright (C) 2002-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible and Sam Steingold. + +dnl Sets the HOST_CPU variable to the canonical name of the CPU. +dnl Sets the HOST_CPU_C_ABI variable to the canonical name of the CPU with its +dnl C language ABI (application binary interface). +dnl Also defines __${HOST_CPU}__ and __${HOST_CPU_C_ABI}__ as C macros in +dnl config.h. +dnl +dnl This canonical name can be used to select a particular assembly language +dnl source file that will interoperate with C code on the given host. +dnl +dnl For example: +dnl * 'i386' and 'sparc' are different canonical names, because code for i386 +dnl will not run on SPARC CPUs and vice versa. They have different +dnl instruction sets. +dnl * 'sparc' and 'sparc64' are different canonical names, because code for +dnl 'sparc' and code for 'sparc64' cannot be linked together: 'sparc' code +dnl contains 32-bit instructions, whereas 'sparc64' code contains 64-bit +dnl instructions. A process on a SPARC CPU can be in 32-bit mode or in 64-bit +dnl mode, but not both. +dnl * 'mips' and 'mipsn32' are different canonical names, because they use +dnl different argument passing and return conventions for C functions, and +dnl although the instruction set of 'mips' is a large subset of the +dnl instruction set of 'mipsn32'. +dnl * 'mipsn32' and 'mips64' are different canonical names, because they use +dnl different sizes for the C types like 'int' and 'void *', and although +dnl the instruction sets of 'mipsn32' and 'mips64' are the same. +dnl * The same canonical name is used for different endiannesses. You can +dnl determine the endianness through preprocessor symbols: +dnl - 'arm': test __ARMEL__. +dnl - 'mips', 'mipsn32', 'mips64': test _MIPSEB vs. _MIPSEL. +dnl - 'powerpc64': test _BIG_ENDIAN vs. _LITTLE_ENDIAN. +dnl * The same name 'i386' is used for CPUs of type i386, i486, i586 +dnl (Pentium), AMD K7, Pentium II, Pentium IV, etc., because +dnl - Instructions that do not exist on all of these CPUs (cmpxchg, +dnl MMX, SSE, SSE2, 3DNow! etc.) are not frequently used. If your +dnl assembly language source files use such instructions, you will +dnl need to make the distinction. +dnl - Speed of execution of the common instruction set is reasonable across +dnl the entire family of CPUs. If you have assembly language source files +dnl that are optimized for particular CPU types (like GNU gmp has), you +dnl will need to make the distinction. +dnl See . +AC_DEFUN([gl_HOST_CPU_C_ABI], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_C_ASM]) + AC_CACHE_CHECK([host CPU and C ABI], [gl_cv_host_cpu_c_abi], + [case "$host_cpu" in + +changequote(,)dnl + i[34567]86 ) +changequote([,])dnl + gl_cv_host_cpu_c_abi=i386 + ;; + + x86_64 ) + # On x86_64 systems, the C compiler may be generating code in one of + # these ABIs: + # - 64-bit instruction set, 64-bit pointers, 64-bit 'long': x86_64. + # - 64-bit instruction set, 64-bit pointers, 32-bit 'long': x86_64 + # with native Windows (mingw, MSVC). + # - 64-bit instruction set, 32-bit pointers, 32-bit 'long': x86_64-x32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': i386. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if (defined __x86_64__ || defined __amd64__ \ + || defined _M_X64 || defined _M_AMD64) + int ok; + #else + error fail + #endif + ]])], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __ILP32__ || defined _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=x86_64-x32], + [gl_cv_host_cpu_c_abi=x86_64])], + [gl_cv_host_cpu_c_abi=i386]) + ;; + +changequote(,)dnl + alphaev[4-8] | alphaev56 | alphapca5[67] | alphaev6[78] ) +changequote([,])dnl + gl_cv_host_cpu_c_abi=alpha + ;; + + arm* | aarch64 ) + # Assume arm with EABI. + # On arm64 systems, the C compiler may be generating code in one of + # these ABIs: + # - aarch64 instruction set, 64-bit pointers, 64-bit 'long': arm64. + # - aarch64 instruction set, 32-bit pointers, 32-bit 'long': arm64-ilp32. + # - 32-bit instruction set, 32-bit pointers, 32-bit 'long': arm or armhf. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef __aarch64__ + int ok; + #else + error fail + #endif + ]])], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __ILP32__ || defined _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=arm64-ilp32], + [gl_cv_host_cpu_c_abi=arm64])], + [# Don't distinguish little-endian and big-endian arm, since they + # don't require different machine code for simple operations and + # since the user can distinguish them through the preprocessor + # defines __ARMEL__ vs. __ARMEB__. + # But distinguish arm which passes floating-point arguments and + # return values in integer registers (r0, r1, ...) - this is + # gcc -mfloat-abi=soft or gcc -mfloat-abi=softfp - from arm which + # passes them in float registers (s0, s1, ...) and double registers + # (d0, d1, ...) - this is gcc -mfloat-abi=hard. GCC 4.6 or newer + # sets the preprocessor defines __ARM_PCS (for the first case) and + # __ARM_PCS_VFP (for the second case), but older GCC does not. + echo 'double ddd; void func (double dd) { ddd = dd; }' > conftest.c + # Look for a reference to the register d0 in the .s file. + AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $gl_c_asm_opt conftest.c) >/dev/null 2>&1 + if LC_ALL=C grep 'd0,' conftest.$gl_asmext >/dev/null; then + gl_cv_host_cpu_c_abi=armhf + else + gl_cv_host_cpu_c_abi=arm + fi + rm -f conftest* + ]) + ;; + + hppa1.0 | hppa1.1 | hppa2.0* | hppa64 ) + # On hppa, the C compiler may be generating 32-bit code or 64-bit + # code. In the latter case, it defines _LP64 and __LP64__. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef __LP64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=hppa64], + [gl_cv_host_cpu_c_abi=hppa]) + ;; + + ia64* ) + # On ia64 on HP-UX, the C compiler may be generating 64-bit code or + # 32-bit code. In the latter case, it defines _ILP32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifdef _ILP32 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=ia64-ilp32], + [gl_cv_host_cpu_c_abi=ia64]) + ;; + + mips* ) + # We should also check for (_MIPS_SZPTR == 64), but gcc keeps this + # at 32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined _MIPS_SZLONG && (_MIPS_SZLONG == 64) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=mips64], + [# In the n32 ABI, _ABIN32 is defined, _ABIO32 is not defined (but + # may later get defined by ), and _MIPS_SIM == _ABIN32. + # In the 32 ABI, _ABIO32 is defined, _ABIN32 is not defined (but + # may later get defined by ), and _MIPS_SIM == _ABIO32. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if (_MIPS_SIM == _ABIN32) + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=mipsn32], + [gl_cv_host_cpu_c_abi=mips])]) + ;; + + powerpc* ) + # Different ABIs are in use on AIX vs. Mac OS X vs. Linux,*BSD. + # No need to distinguish them here; the caller may distinguish + # them based on the OS. + # On powerpc64 systems, the C compiler may still be generating + # 32-bit code. And on powerpc-ibm-aix systems, the C compiler may + # be generating 64-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __powerpc64__ || defined __LP64__ + int ok; + #else + error fail + #endif + ]])], + [# On powerpc64, there are two ABIs on Linux: The AIX compatible + # one and the ELFv2 one. The latter defines _CALL_ELF=2. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined _CALL_ELF && _CALL_ELF == 2 + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=powerpc64-elfv2], + [gl_cv_host_cpu_c_abi=powerpc64]) + ], + [gl_cv_host_cpu_c_abi=powerpc]) + ;; + + rs6000 ) + gl_cv_host_cpu_c_abi=powerpc + ;; + + riscv32 | riscv64 ) + # There are 2 architectures (with variants): rv32* and rv64*. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if __riscv_xlen == 64 + int ok; + #else + error fail + #endif + ]])], + [cpu=riscv64], + [cpu=riscv32]) + # There are 6 ABIs: ilp32, ilp32f, ilp32d, lp64, lp64f, lp64d. + # Size of 'long' and 'void *': + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ + int ok; + #else + error fail + #endif + ]])], + [main_abi=lp64], + [main_abi=ilp32]) + # Float ABIs: + # __riscv_float_abi_double: + # 'float' and 'double' are passed in floating-point registers. + # __riscv_float_abi_single: + # 'float' are passed in floating-point registers. + # __riscv_float_abi_soft: + # No values are passed in floating-point registers. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __riscv_float_abi_double + int ok; + #else + error fail + #endif + ]])], + [float_abi=d], + [AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __riscv_float_abi_single + int ok; + #else + error fail + #endif + ]])], + [float_abi=f], + [float_abi='']) + ]) + gl_cv_host_cpu_c_abi="${cpu}-${main_abi}${float_abi}" + ;; + + s390* ) + # On s390x, the C compiler may be generating 64-bit (= s390x) code + # or 31-bit (= s390) code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __LP64__ || defined __s390x__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=s390x], + [gl_cv_host_cpu_c_abi=s390]) + ;; + + sparc | sparc64 ) + # UltraSPARCs running Linux have `uname -m` = "sparc64", but the + # C compiler still generates 32-bit code. + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#if defined __sparcv9 || defined __arch64__ + int ok; + #else + error fail + #endif + ]])], + [gl_cv_host_cpu_c_abi=sparc64], + [gl_cv_host_cpu_c_abi=sparc]) + ;; + + *) + gl_cv_host_cpu_c_abi="$host_cpu" + ;; + esac + ]) + + dnl In most cases, $HOST_CPU and $HOST_CPU_C_ABI are the same. + HOST_CPU=`echo "$gl_cv_host_cpu_c_abi" | sed -e 's/-.*//'` + HOST_CPU_C_ABI="$gl_cv_host_cpu_c_abi" + AC_SUBST([HOST_CPU]) + AC_SUBST([HOST_CPU_C_ABI]) + + # This was + # AC_DEFINE_UNQUOTED([__${HOST_CPU}__]) + # AC_DEFINE_UNQUOTED([__${HOST_CPU_C_ABI}__]) + # earlier, but KAI C++ 3.2d doesn't like this. + sed -e 's/-/_/g' >> confdefs.h <. + dnl Additionally, with this same compiler, include_next is a no-op when + dnl used in a header file that was included by specifying its absolute + dnl file name. Despite these two bugs, include_next is used in the + dnl compiler's . By virtue of the second bug, we need to use + dnl include_next as well in this case. + cat < conftestd1a/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < conftestd1b/conftest.h +#define DEFINED_IN_CONFTESTD1 +#include +#include_next +#ifdef DEFINED_IN_CONFTESTD2 +int foo; +#else +#error "include_next doesn't work" +#endif +EOF + cat < conftestd2/conftest.h +#ifndef DEFINED_IN_CONFTESTD1 +#error "include_next test doesn't work" +#endif +#define DEFINED_IN_CONFTESTD2 +EOF + gl_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1b -Iconftestd2" +dnl We intentionally avoid using AC_LANG_SOURCE here. + AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include ]], + [gl_cv_have_include_next=yes], + [CPPFLAGS="$gl_save_CPPFLAGS -Iconftestd1a -Iconftestd2" + AC_COMPILE_IFELSE([AC_LANG_DEFINES_PROVIDED[#include ]], + [gl_cv_have_include_next=buggy], + [gl_cv_have_include_next=no]) + ]) + CPPFLAGS="$gl_save_CPPFLAGS" + rm -rf conftestd1a conftestd1b conftestd2 + ]) + PRAGMA_SYSTEM_HEADER= + if test $gl_cv_have_include_next = yes; then + INCLUDE_NEXT=include_next + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + if test -n "$GCC"; then + PRAGMA_SYSTEM_HEADER='#pragma GCC system_header' + fi + else + if test $gl_cv_have_include_next = buggy; then + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include_next + else + INCLUDE_NEXT=include + INCLUDE_NEXT_AS_FIRST_DIRECTIVE=include + fi + fi + AC_SUBST([INCLUDE_NEXT]) + AC_SUBST([INCLUDE_NEXT_AS_FIRST_DIRECTIVE]) + AC_SUBST([PRAGMA_SYSTEM_HEADER]) + + dnl HP NonStop systems, which define __TANDEM, limit the line length + dnl after including some system header files. + AC_CACHE_CHECK([whether source code line length is unlimited], + [gl_cv_source_line_length_unlimited], + [AC_EGREP_CPP([choke me], + [ +#ifdef __TANDEM +choke me +#endif + ], + [gl_cv_source_line_length_unlimited=no], + [gl_cv_source_line_length_unlimited=yes]) + ]) + if test $gl_cv_source_line_length_unlimited = no; then + PRAGMA_COLUMNS="#pragma COLUMNS 10000" + else + PRAGMA_COLUMNS= + fi + AC_SUBST([PRAGMA_COLUMNS]) +]) + +# gl_CHECK_NEXT_HEADERS(HEADER1 HEADER2 ...) +# ------------------------------------------ +# For each arg foo.h, if #include_next works, define NEXT_FOO_H to be +# ''; otherwise define it to be +# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. +# Also, if #include_next works as first preprocessing directive in a file, +# define NEXT_AS_FIRST_DIRECTIVE_FOO_H to be ''; otherwise define it to +# be +# '"///usr/include/foo.h"', or whatever other absolute file name is suitable. +# That way, a header file with the following line: +# #@INCLUDE_NEXT@ @NEXT_FOO_H@ +# or +# #@INCLUDE_NEXT_AS_FIRST_DIRECTIVE@ @NEXT_AS_FIRST_DIRECTIVE_FOO_H@ +# behaves (after sed substitution) as if it contained +# #include_next +# even if the compiler does not support include_next. +# The three "///" are to pacify Sun C 5.8, which otherwise would say +# "warning: #include of /usr/include/... may be non-portable". +# Use '""', not '<>', so that the /// cannot be confused with a C99 comment. +# Note: This macro assumes that the header file is not empty after +# preprocessing, i.e. it does not only define preprocessor macros but also +# provides some type/enum definitions or function/variable declarations. +# +# This macro also checks whether each header exists, by invoking +# AC_CHECK_HEADERS_ONCE or AC_CHECK_HEADERS on each argument. +AC_DEFUN([gl_CHECK_NEXT_HEADERS], +[ + gl_NEXT_HEADERS_INTERNAL([$1], [check]) +]) + +# gl_NEXT_HEADERS(HEADER1 HEADER2 ...) +# ------------------------------------ +# Like gl_CHECK_NEXT_HEADERS, except do not check whether the headers exist. +# This is suitable for headers like that are standardized by C89 +# and therefore can be assumed to exist. +AC_DEFUN([gl_NEXT_HEADERS], +[ + gl_NEXT_HEADERS_INTERNAL([$1], [assume]) +]) + +# The guts of gl_CHECK_NEXT_HEADERS and gl_NEXT_HEADERS. +AC_DEFUN([gl_NEXT_HEADERS_INTERNAL], +[ + AC_REQUIRE([gl_INCLUDE_NEXT]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + m4_if([$2], [check], + [AC_CHECK_HEADERS_ONCE([$1]) + ]) + + m4_foreach_w([gl_HEADER_NAME], [$1], + [AS_VAR_PUSHDEF([gl_next_header], + [gl_cv_next_]m4_defn([gl_HEADER_NAME])) + if test $gl_cv_have_include_next = yes; then + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + else + AC_CACHE_CHECK( + [absolute name of <]m4_defn([gl_HEADER_NAME])[>], + [gl_next_header], + [m4_if([$2], [check], + [AS_VAR_PUSHDEF([gl_header_exists], + [ac_cv_header_]m4_defn([gl_HEADER_NAME])) + if test AS_VAR_GET([gl_header_exists]) = yes; then + AS_VAR_POPDEF([gl_header_exists]) + ]) + gl_ABSOLUTE_HEADER_ONE(gl_HEADER_NAME) + AS_VAR_COPY([gl_header], [gl_cv_absolute_]AS_TR_SH(gl_HEADER_NAME)) + AS_VAR_SET([gl_next_header], ['"'$gl_header'"']) + m4_if([$2], [check], + [else + AS_VAR_SET([gl_next_header], ['<'gl_HEADER_NAME'>']) + fi + ]) + ]) + fi + AC_SUBST( + AS_TR_CPP([NEXT_]m4_defn([gl_HEADER_NAME])), + [AS_VAR_GET([gl_next_header])]) + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'gl_HEADER_NAME'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=AS_VAR_GET([gl_next_header]) + fi + AC_SUBST( + AS_TR_CPP([NEXT_AS_FIRST_DIRECTIVE_]m4_defn([gl_HEADER_NAME])), + [$gl_next_as_first_directive]) + AS_VAR_POPDEF([gl_next_header])]) +]) + +# Autoconf 2.68 added warnings for our use of AC_COMPILE_IFELSE; +# this fallback is safe for all earlier autoconf versions. +m4_define_default([AC_LANG_DEFINES_PROVIDED]) diff --git a/gnulib-m4/largefile.m4 b/gnulib-m4/largefile.m4 new file mode 100644 index 0000000..cadb16d --- /dev/null +++ b/gnulib-m4/largefile.m4 @@ -0,0 +1,178 @@ +# Enable large files on systems where this is not the default. +# Enable support for files on Linux file systems with 64-bit inode numbers. + +# Copyright 1992-1996, 1998-2021 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# The following macro works around a problem in Autoconf's AC_FUNC_FSEEKO: +# It does not set _LARGEFILE_SOURCE=1 on HP-UX/ia64 32-bit, although this +# setting of _LARGEFILE_SOURCE is needed so that declares fseeko +# and ftello in C++ mode as well. +AC_DEFUN([gl_SET_LARGEFILE_SOURCE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_FUNC_FSEEKO + case "$host_os" in + hpux*) + AC_DEFINE([_LARGEFILE_SOURCE], [1], + [Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2).]) + ;; + esac +]) + +# The following implementation works around a problem in autoconf <= 2.69; +# AC_SYS_LARGEFILE does not configure for large inodes on Mac OS X 10.5, +# or configures them incorrectly in some cases. +m4_version_prereq([2.70], [], [ + +# _AC_SYS_LARGEFILE_TEST_INCLUDES +# ------------------------------- +m4_define([_AC_SYS_LARGEFILE_TEST_INCLUDES], +[#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 31 << 31) - 1 + ((off_t) 1 << 31 << 31)) + int off_t_is_large[[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]];[]dnl +]) + + +# _AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, +# CACHE-VAR, +# DESCRIPTION, +# PROLOGUE, [FUNCTION-BODY]) +# -------------------------------------------------------- +m4_define([_AC_SYS_LARGEFILE_MACRO_VALUE], +[AC_CACHE_CHECK([for $1 value needed for large files], [$3], +[while :; do + m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( + [AC_LANG_PROGRAM([$5], [$6])], + [$3=no; break]) + m4_ifval([$6], [AC_LINK_IFELSE], [AC_COMPILE_IFELSE])( + [AC_LANG_PROGRAM([#define $1 $2 +$5], [$6])], + [$3=$2; break]) + $3=unknown + break +done]) +case $$3 in #( + no | unknown) ;; + *) AC_DEFINE_UNQUOTED([$1], [$$3], [$4]);; +esac +rm -rf conftest*[]dnl +])# _AC_SYS_LARGEFILE_MACRO_VALUE + + +# AC_SYS_LARGEFILE +# ---------------- +# By default, many hosts won't let programs access large files; +# one must use special compiler options to get large-file access to work. +# For more details about this brain damage please see: +# http://www.unix.org/version2/whatsnew/lfs20mar.html +# Additionally, on Linux file systems with 64-bit inodes a file that happens +# to have a 64-bit inode number cannot be accessed by 32-bit applications on +# Linux x86/x86_64. This can occur with file systems such as XFS and NFS. +AC_DEFUN([AC_SYS_LARGEFILE], +[AC_ARG_ENABLE(largefile, + [ --disable-largefile omit support for large files]) +if test "$enable_largefile" != no; then + + AC_CACHE_CHECK([for special C compiler options needed for large files], + ac_cv_sys_largefile_CC, + [ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + AC_LANG_CONFTEST([AC_LANG_PROGRAM([_AC_SYS_LARGEFILE_TEST_INCLUDES])]) + AC_COMPILE_IFELSE([], [break]) + CC="$CC -n32" + AC_COMPILE_IFELSE([], [ac_cv_sys_largefile_CC=' -n32'; break]) + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi]) + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + _AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, + ac_cv_sys_file_offset_bits, + [Number of bits in a file offset, on hosts where this is settable.], + [_AC_SYS_LARGEFILE_TEST_INCLUDES]) + if test $ac_cv_sys_file_offset_bits = unknown; then + _AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, + ac_cv_sys_large_files, + [Define for large files, on AIX-style hosts.], + [_AC_SYS_LARGEFILE_TEST_INCLUDES]) + fi +fi +])# AC_SYS_LARGEFILE +])# m4_version_prereq 2.70 + +# Enable large files on systems where this is implemented by Gnulib, not by the +# system headers. +# Set the variables WINDOWS_64_BIT_OFF_T, WINDOWS_64_BIT_ST_SIZE if Gnulib +# overrides ensure that off_t or 'struct size.st_size' are 64-bit, respectively. +AC_DEFUN([gl_LARGEFILE], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + dnl Native Windows. + dnl mingw64 defines off_t to a 64-bit type already, if + dnl _FILE_OFFSET_BITS=64, which is ensured by AC_SYS_LARGEFILE. + AC_CACHE_CHECK([for 64-bit off_t], [gl_cv_type_off_t_64], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int verify_off_t_size[sizeof (off_t) >= 8 ? 1 : -1]; + ]], + [[]])], + [gl_cv_type_off_t_64=yes], [gl_cv_type_off_t_64=no]) + ]) + if test $gl_cv_type_off_t_64 = no; then + WINDOWS_64_BIT_OFF_T=1 + else + WINDOWS_64_BIT_OFF_T=0 + fi + dnl Some mingw versions define, if _FILE_OFFSET_BITS=64, 'struct stat' + dnl to 'struct _stat32i64' or 'struct _stat64' (depending on + dnl _USE_32BIT_TIME_T), which has a 32-bit st_size member. + AC_CACHE_CHECK([for 64-bit st_size], [gl_cv_member_st_size_64], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + struct stat buf; + int verify_st_size_size[sizeof (buf.st_size) >= 8 ? 1 : -1]; + ]], + [[]])], + [gl_cv_member_st_size_64=yes], [gl_cv_member_st_size_64=no]) + ]) + if test $gl_cv_member_st_size_64 = no; then + WINDOWS_64_BIT_ST_SIZE=1 + else + WINDOWS_64_BIT_ST_SIZE=0 + fi + ;; + *) + dnl Nothing to do on gnulib's side. + dnl A 64-bit off_t is + dnl - already the default on Mac OS X, FreeBSD, NetBSD, OpenBSD, IRIX, + dnl OSF/1, Cygwin, + dnl - enabled by _FILE_OFFSET_BITS=64 (ensured by AC_SYS_LARGEFILE) on + dnl glibc, HP-UX, Solaris, + dnl - enabled by _LARGE_FILES=1 (ensured by AC_SYS_LARGEFILE) on AIX, + dnl - impossible to achieve on Minix 3.1.8. + WINDOWS_64_BIT_OFF_T=0 + WINDOWS_64_BIT_ST_SIZE=0 + ;; + esac +]) diff --git a/gnulib-m4/limits-h.m4 b/gnulib-m4/limits-h.m4 new file mode 100644 index 0000000..70dbb7d --- /dev/null +++ b/gnulib-m4/limits-h.m4 @@ -0,0 +1,43 @@ +dnl Check whether limits.h has needed features. + +dnl Copyright 2016-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert. + +AC_DEFUN_ONCE([gl_LIMITS_H], +[ + gl_CHECK_NEXT_HEADERS([limits.h]) + + AC_CACHE_CHECK([whether limits.h has LLONG_MAX, WORD_BIT, ULLONG_WIDTH etc.], + [gl_cv_header_limits_width], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + long long llm = LLONG_MAX; + int wb = WORD_BIT; + int ullw = ULLONG_WIDTH; + ]])], + [gl_cv_header_limits_width=yes], + [gl_cv_header_limits_width=no])]) + if test "$gl_cv_header_limits_width" = yes; then + LIMITS_H= + else + LIMITS_H=limits.h + fi + AC_SUBST([LIMITS_H]) + AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) +]) + +dnl Unconditionally enables the replacement of . +AC_DEFUN([gl_REPLACE_LIMITS_H], +[ + AC_REQUIRE([gl_LIMITS_H]) + LIMITS_H='limits.h' + AM_CONDITIONAL([GL_GENERATE_LIMITS_H], [test -n "$LIMITS_H"]) +]) diff --git a/gnulib-m4/lock.m4 b/gnulib-m4/lock.m4 new file mode 100644 index 0000000..d68c12d --- /dev/null +++ b/gnulib-m4/lock.m4 @@ -0,0 +1,47 @@ +# lock.m4 serial 14 +dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_DEFUN([gl_LOCK], +[ + AC_REQUIRE([gl_THREADLIB]) + if test "$gl_threads_api" = posix; then + # OSF/1 4.0 and Mac OS X 10.1 lack the pthread_rwlock_t type and the + # pthread_rwlock_* functions. + has_rwlock=false + AC_CHECK_TYPE([pthread_rwlock_t], + [has_rwlock=true + AC_DEFINE([HAVE_PTHREAD_RWLOCK], [1], + [Define if the POSIX multithreading library has read/write locks.])], + [], + [#include ]) + if $has_rwlock; then + gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER + fi + # glibc defines PTHREAD_MUTEX_RECURSIVE as enum, not as a macro. + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM( + [[#include ]], + [[ +#if __FreeBSD__ == 4 +error "No, in FreeBSD 4.0 recursive mutexes actually don't work." +#elif (defined __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ \ + && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1070) +error "No, in Mac OS X < 10.7 recursive mutexes actually don't work." +#else +int x = (int)PTHREAD_MUTEX_RECURSIVE; +return !x; +#endif + ]])], + [AC_DEFINE([HAVE_PTHREAD_MUTEX_RECURSIVE], [1], + [Define if the defines PTHREAD_MUTEX_RECURSIVE.])]) + fi + gl_PREREQ_LOCK +]) + +# Prerequisites of lib/glthread/lock.c. +AC_DEFUN([gl_PREREQ_LOCK], [:]) diff --git a/gnulib-m4/malloca.m4 b/gnulib-m4/malloca.m4 new file mode 100644 index 0000000..06ed2c6 --- /dev/null +++ b/gnulib-m4/malloca.m4 @@ -0,0 +1,14 @@ +# malloca.m4 serial 2 +dnl Copyright (C) 2003-2004, 2006-2007, 2009-2021 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MALLOCA], +[ + dnl Use the autoconf tests for alloca(), but not the AC_SUBSTed variables + dnl @ALLOCA@ and @LTALLOCA@. + dnl gl_FUNC_ALLOCA dnl Already brought in by the module dependencies. + AC_REQUIRE([gl_EEMALLOC]) +]) diff --git a/gnulib-m4/mode_t.m4 b/gnulib-m4/mode_t.m4 new file mode 100644 index 0000000..3bd4b89 --- /dev/null +++ b/gnulib-m4/mode_t.m4 @@ -0,0 +1,26 @@ +# mode_t.m4 serial 2 +dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# For using mode_t, it's sufficient to use AC_TYPE_MODE_T and +# include . + +# Define PROMOTED_MODE_T to the type that is the result of "default argument +# promotion" (ISO C 6.5.2.2.(6)) of the type mode_t. +AC_DEFUN([gl_PROMOTED_TYPE_MODE_T], +[ + AC_REQUIRE([AC_TYPE_MODE_T]) + AC_CACHE_CHECK([for promoted mode_t type], [gl_cv_promoted_mode_t], [ + dnl Assume mode_t promotes to 'int' if and only if it is smaller than 'int', + dnl and to itself otherwise. This assumption is not guaranteed by the ISO C + dnl standard, but we don't know of any real-world counterexamples. + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], + [[typedef int array[2 * (sizeof (mode_t) < sizeof (int)) - 1];]])], + [gl_cv_promoted_mode_t='int'], + [gl_cv_promoted_mode_t='mode_t']) + ]) + AC_DEFINE_UNQUOTED([PROMOTED_MODE_T], [$gl_cv_promoted_mode_t], + [Define to the type that is the result of default argument promotions of type mode_t.]) +]) diff --git a/gnulib-m4/msvc-inval.m4 b/gnulib-m4/msvc-inval.m4 new file mode 100644 index 0000000..3ba5b4e --- /dev/null +++ b/gnulib-m4/msvc-inval.m4 @@ -0,0 +1,19 @@ +# msvc-inval.m4 serial 1 +dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MSVC_INVAL], +[ + AC_CHECK_FUNCS_ONCE([_set_invalid_parameter_handler]) + if test $ac_cv_func__set_invalid_parameter_handler = yes; then + HAVE_MSVC_INVALID_PARAMETER_HANDLER=1 + AC_DEFINE([HAVE_MSVC_INVALID_PARAMETER_HANDLER], [1], + [Define to 1 on MSVC platforms that have the "invalid parameter handler" + concept.]) + else + HAVE_MSVC_INVALID_PARAMETER_HANDLER=0 + fi + AC_SUBST([HAVE_MSVC_INVALID_PARAMETER_HANDLER]) +]) diff --git a/gnulib-m4/msvc-nothrow.m4 b/gnulib-m4/msvc-nothrow.m4 new file mode 100644 index 0000000..aae25ce --- /dev/null +++ b/gnulib-m4/msvc-nothrow.m4 @@ -0,0 +1,10 @@ +# msvc-nothrow.m4 serial 1 +dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_MSVC_NOTHROW], +[ + AC_REQUIRE([gl_MSVC_INVAL]) +]) diff --git a/gnulib-m4/multiarch.m4 b/gnulib-m4/multiarch.m4 new file mode 100644 index 0000000..f1678d9 --- /dev/null +++ b/gnulib-m4/multiarch.m4 @@ -0,0 +1,65 @@ +# multiarch.m4 serial 9 +dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Determine whether the compiler is or may be producing universal binaries. +# +# On Mac OS X 10.5 and later systems, the user can create libraries and +# executables that work on multiple system types--known as "fat" or +# "universal" binaries--by specifying multiple '-arch' options to the +# compiler but only a single '-arch' option to the preprocessor. Like +# this: +# +# ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ +# CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ +# CPP="gcc -E" CXXCPP="g++ -E" +# +# Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly. + +AC_DEFUN_ONCE([gl_MULTIARCH], +[ + dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN. + AC_CACHE_CHECK([whether the compiler produces multi-arch binaries], + [gl_cv_c_multiarch], + [gl_cv_c_multiarch=no + AC_COMPILE_IFELSE( + [AC_LANG_SOURCE( + [[#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + ]])], + [ + dnl Check for potential -arch flags. It is not universal unless + dnl there are at least two -arch flags with different values. + arch= + prev= + for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do + if test -n "$prev"; then + case $word in + i?86 | x86_64 | ppc | ppc64 | arm | arm64) + if test -z "$arch" || test "$arch" = "$word"; then + arch="$word" + else + gl_cv_c_multiarch=yes + fi + ;; + esac + prev= + else + if test "x$word" = "x-arch"; then + prev=arch + fi + fi + done + ]) + ]) + if test $gl_cv_c_multiarch = yes; then + APPLE_UNIVERSAL_BUILD=1 + else + APPLE_UNIVERSAL_BUILD=0 + fi + AC_SUBST([APPLE_UNIVERSAL_BUILD]) +]) diff --git a/gnulib-m4/nocrash.m4 b/gnulib-m4/nocrash.m4 new file mode 100644 index 0000000..27412cd --- /dev/null +++ b/gnulib-m4/nocrash.m4 @@ -0,0 +1,131 @@ +# nocrash.m4 serial 5 +dnl Copyright (C) 2005, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Based on libsigsegv, from Bruno Haible and Paolo Bonzini. + +AC_PREREQ([2.13]) + +dnl Expands to some code for use in .c programs that will cause the configure +dnl test to exit instead of crashing. This is useful to avoid triggering +dnl action from a background debugger and to avoid core dumps. +dnl Usage: ... +dnl ]GL_NOCRASH[ +dnl ... +dnl int main() { nocrash_init(); ... } +AC_DEFUN([GL_NOCRASH],[[ +#include +#if defined __MACH__ && defined __APPLE__ +/* Avoid a crash on Mac OS X. */ +#include +#include +#include +#include +#include +#include +/* The exception port on which our thread listens. */ +static mach_port_t our_exception_port; +/* The main function of the thread listening for exceptions of type + EXC_BAD_ACCESS. */ +static void * +mach_exception_thread (void *arg) +{ + /* Buffer for a message to be received. */ + struct { + mach_msg_header_t head; + mach_msg_body_t msgh_body; + char data[1024]; + } msg; + mach_msg_return_t retval; + /* Wait for a message on the exception port. */ + retval = mach_msg (&msg.head, MACH_RCV_MSG | MACH_RCV_LARGE, 0, sizeof (msg), + our_exception_port, MACH_MSG_TIMEOUT_NONE, MACH_PORT_NULL); + if (retval != MACH_MSG_SUCCESS) + abort (); + exit (1); +} +static void +nocrash_init (void) +{ + mach_port_t self = mach_task_self (); + /* Allocate a port on which the thread shall listen for exceptions. */ + if (mach_port_allocate (self, MACH_PORT_RIGHT_RECEIVE, &our_exception_port) + == KERN_SUCCESS) { + /* See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/mach_port_insert_right.html. */ + if (mach_port_insert_right (self, our_exception_port, our_exception_port, + MACH_MSG_TYPE_MAKE_SEND) + == KERN_SUCCESS) { + /* The exceptions we want to catch. Only EXC_BAD_ACCESS is interesting + for us. */ + exception_mask_t mask = EXC_MASK_BAD_ACCESS; + /* Create the thread listening on the exception port. */ + pthread_attr_t attr; + pthread_t thread; + if (pthread_attr_init (&attr) == 0 + && pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED) == 0 + && pthread_create (&thread, &attr, mach_exception_thread, NULL) == 0) { + pthread_attr_destroy (&attr); + /* Replace the exception port info for these exceptions with our own. + Note that we replace the exception port for the entire task, not only + for a particular thread. This has the effect that when our exception + port gets the message, the thread specific exception port has already + been asked, and we don't need to bother about it. + See https://web.mit.edu/darwin/src/modules/xnu/osfmk/man/task_set_exception_ports.html. */ + task_set_exception_ports (self, mask, our_exception_port, + EXCEPTION_DEFAULT, MACHINE_THREAD_STATE); + } + } + } +} +#elif defined _WIN32 && ! defined __CYGWIN__ +/* Avoid a crash on native Windows. */ +#define WIN32_LEAN_AND_MEAN +#include +#include +static LONG WINAPI +exception_filter (EXCEPTION_POINTERS *ExceptionInfo) +{ + switch (ExceptionInfo->ExceptionRecord->ExceptionCode) + { + case EXCEPTION_ACCESS_VIOLATION: + case EXCEPTION_IN_PAGE_ERROR: + case EXCEPTION_STACK_OVERFLOW: + case EXCEPTION_GUARD_PAGE: + case EXCEPTION_PRIV_INSTRUCTION: + case EXCEPTION_ILLEGAL_INSTRUCTION: + case EXCEPTION_DATATYPE_MISALIGNMENT: + case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: + case EXCEPTION_NONCONTINUABLE_EXCEPTION: + exit (1); + } + return EXCEPTION_CONTINUE_SEARCH; +} +static void +nocrash_init (void) +{ + SetUnhandledExceptionFilter ((LPTOP_LEVEL_EXCEPTION_FILTER) exception_filter); +} +#else +/* Avoid a crash on POSIX systems. */ +#include +#include +/* A POSIX signal handler. */ +static void +exception_handler (int sig) +{ + _exit (1); +} +static void +nocrash_init (void) +{ +#ifdef SIGSEGV + signal (SIGSEGV, exception_handler); +#endif +#ifdef SIGBUS + signal (SIGBUS, exception_handler); +#endif +} +#endif +]]) diff --git a/gnulib-m4/off_t.m4 b/gnulib-m4/off_t.m4 new file mode 100644 index 0000000..bdec43c --- /dev/null +++ b/gnulib-m4/off_t.m4 @@ -0,0 +1,18 @@ +# off_t.m4 serial 1 +dnl Copyright (C) 2012-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Check whether to override the 'off_t' type. +dnl Set WINDOWS_64_BIT_OFF_T. + +AC_DEFUN([gl_TYPE_OFF_T], +[ + m4_ifdef([gl_LARGEFILE], [ + AC_REQUIRE([gl_LARGEFILE]) + ], [ + WINDOWS_64_BIT_OFF_T=0 + ]) + AC_SUBST([WINDOWS_64_BIT_OFF_T]) +]) diff --git a/gnulib-m4/open-cloexec.m4 b/gnulib-m4/open-cloexec.m4 new file mode 100644 index 0000000..542a90f --- /dev/null +++ b/gnulib-m4/open-cloexec.m4 @@ -0,0 +1,21 @@ +# Test whether O_CLOEXEC is defined. + +dnl Copyright 2017-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_PREPROC_O_CLOEXEC], +[ + AC_CACHE_CHECK([for O_CLOEXEC], + [gl_cv_macro_O_CLOEXEC], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include + #ifndef O_CLOEXEC + choke me; + #endif + ]], + [[return O_CLOEXEC;]])], + [gl_cv_macro_O_CLOEXEC=yes], + [gl_cv_macro_O_CLOEXEC=no])]) +]) diff --git a/gnulib-m4/open-slash.m4 b/gnulib-m4/open-slash.m4 new file mode 100644 index 0000000..e619039 --- /dev/null +++ b/gnulib-m4/open-slash.m4 @@ -0,0 +1,60 @@ +# open-slash.m4 serial 2 +dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Tests whether open() and creat() recognize a trailing slash. +dnl Sets gl_cv_func_open_slash. +AC_DEFUN([gl_OPEN_TRAILING_SLASH_BUG], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + dnl open("foo/") should not create a file when the file name has a + dnl trailing slash. FreeBSD only has the problem on symlinks. + AC_CHECK_FUNCS_ONCE([lstat]) + AC_CACHE_CHECK([whether open recognizes a trailing slash], + [gl_cv_func_open_slash], + [# Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + touch conftest.tmp + ln -s conftest.tmp conftest.lnk + fi + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#if HAVE_UNISTD_H +# include +#endif +]GL_MDA_DEFINES[ +int main () +{ + int result = 0; +#if HAVE_LSTAT + if (open ("conftest.lnk/", O_RDONLY) != -1) + result |= 1; +#endif + if (open ("conftest.sl/", O_CREAT, 0600) >= 0) + result |= 2; + return result; +}]])], + [gl_cv_func_open_slash=yes], + [gl_cv_func_open_slash=no], + [ +changequote(,)dnl + case "$host_os" in + freebsd* | aix* | hpux* | solaris2.[0-9] | solaris2.[0-9].*) + gl_cv_func_open_slash="guessing no" ;; + *) + gl_cv_func_open_slash="guessing yes" ;; + esac +changequote([,])dnl + ]) + rm -f conftest.sl conftest.tmp conftest.lnk + ]) + case "$gl_cv_func_open_slash" in + *no) + AC_DEFINE([OPEN_TRAILING_SLASH_BUG], [1], + [Define to 1 if open() fails to recognize a trailing slash.]) + ;; + esac +]) diff --git a/gnulib-m4/open.m4 b/gnulib-m4/open.m4 new file mode 100644 index 0000000..c634386 --- /dev/null +++ b/gnulib-m4/open.m4 @@ -0,0 +1,56 @@ +# open.m4 serial 15 +dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_OPEN], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_PREPROC_O_CLOEXEC]) + case "$host_os" in + mingw* | pw*) + REPLACE_OPEN=1 + ;; + *) + dnl open("foo/") should not create a file when the file name has a + dnl trailing slash. FreeBSD only has the problem on symlinks. + AC_CHECK_FUNCS_ONCE([lstat]) + if test "$gl_cv_macro_O_CLOEXEC" != yes; then + REPLACE_OPEN=1 + fi + gl_OPEN_TRAILING_SLASH_BUG + case "$gl_cv_func_open_slash" in + *no) + REPLACE_OPEN=1 + ;; + esac + ;; + esac + dnl Replace open() for supporting the gnulib-defined fchdir() function, + dnl to keep fchdir's bookkeeping up-to-date. + m4_ifdef([gl_FUNC_FCHDIR], [ + if test $REPLACE_OPEN = 0; then + gl_TEST_FCHDIR + if test $HAVE_FCHDIR = 0; then + REPLACE_OPEN=1 + fi + fi + ]) + dnl Replace open() for supporting the gnulib-defined O_NONBLOCK flag. + m4_ifdef([gl_NONBLOCKING_IO], [ + if test $REPLACE_OPEN = 0; then + gl_NONBLOCKING_IO + if test $gl_cv_have_open_O_NONBLOCK != yes; then + REPLACE_OPEN=1 + fi + fi + ]) +]) + +# Prerequisites of lib/open.c. +AC_DEFUN([gl_PREREQ_OPEN], +[ + AC_REQUIRE([gl_PROMOTED_TYPE_MODE_T]) + : +]) diff --git a/gnulib-m4/pathmax.m4 b/gnulib-m4/pathmax.m4 new file mode 100644 index 0000000..e67c656 --- /dev/null +++ b/gnulib-m4/pathmax.m4 @@ -0,0 +1,42 @@ +# pathmax.m4 serial 11 +dnl Copyright (C) 2002-2003, 2005-2006, 2009-2021 Free Software Foundation, +dnl Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_PATHMAX], +[ + dnl Prerequisites of lib/pathmax.h. + AC_CHECK_HEADERS_ONCE([sys/param.h]) +]) + +# Expands to a piece of C program that defines PATH_MAX in the same way as +# "pathmax.h" will do. +AC_DEFUN([gl_PATHMAX_SNIPPET], [[ +/* Arrange to define PATH_MAX, like "pathmax.h" does. */ +#if HAVE_UNISTD_H +# include +#endif +#include +#if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN +# include +#endif +#if !defined PATH_MAX && defined MAXPATHLEN +# define PATH_MAX MAXPATHLEN +#endif +#ifdef __hpux +# undef PATH_MAX +# define PATH_MAX 1024 +#endif +#if defined _WIN32 && ! defined __CYGWIN__ +# undef PATH_MAX +# define PATH_MAX 260 +#endif +]]) + +# Prerequisites of gl_PATHMAX_SNIPPET. +AC_DEFUN([gl_PATHMAX_SNIPPET_PREREQ], +[ + AC_CHECK_HEADERS_ONCE([unistd.h sys/param.h]) +]) diff --git a/gnulib-m4/pid_t.m4 b/gnulib-m4/pid_t.m4 new file mode 100644 index 0000000..b7650a1 --- /dev/null +++ b/gnulib-m4/pid_t.m4 @@ -0,0 +1,38 @@ +# pid_t.m4 serial 4 +dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# The following implementation works around a problem in autoconf <= 2.69. +m4_version_prereq([2.70], [], [ + +dnl Define pid_t if the headers don't define it. +AC_DEFUN([AC_TYPE_PID_T], +[ + AC_CHECK_TYPE([pid_t], + [], + [dnl On 64-bit native Windows, define it to the equivalent of 'intptr_t' + dnl (= 'long long' = '__int64'), because that is the return type + dnl of the _spawnv* functions + dnl + dnl and the argument type of the _cwait function + dnl . + dnl Otherwise (on 32-bit Windows and on old Unix platforms), define it + dnl to 'int'. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + #if defined _WIN64 && !defined __CYGWIN__ + LLP64 + #endif + ]]) + ], + [gl_pid_type='int'], + [gl_pid_type='__int64']) + AC_DEFINE_UNQUOTED([pid_t], [$gl_pid_type], + [Define as a signed integer type capable of holding a process identifier.]) + ], + [AC_INCLUDES_DEFAULT]) +]) + +])# m4_version_prereq 2.70 diff --git a/gnulib-m4/pthread_rwlock_rdlock.m4 b/gnulib-m4/pthread_rwlock_rdlock.m4 new file mode 100644 index 0000000..a5fbead --- /dev/null +++ b/gnulib-m4/pthread_rwlock_rdlock.m4 @@ -0,0 +1,185 @@ +# pthread_rwlock_rdlock.m4 serial 4 +dnl Copyright (C) 2017-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. +dnl Inspired by +dnl https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/pthread_rwlock_rdlock/2-2.c +dnl by Intel Corporation. + +dnl Test whether in a situation where +dnl - an rwlock is taken by a reader and has a writer waiting, +dnl - an additional reader requests the lock, +dnl - the waiting writer and the requesting reader threads have the same +dnl priority, +dnl the requesting reader thread gets blocked, so that at some point the +dnl waiting writer can acquire the lock. +dnl Without such a guarantee, when there a N readers and each of the readers +dnl spends more than 1/Nth of the time with the lock held, there is a high +dnl probability that the waiting writer will not get the lock in a given finite +dnl time, a phenomenon called "writer starvation". +dnl Without such a guarantee, applications have a hard time avoiding writer +dnl starvation. +dnl +dnl POSIX:2017 makes this requirement only for implementations that support TPS +dnl (Thread Priority Scheduling) and only for the scheduling policies SCHED_FIFO +dnl and SCHED_RR, see +dnl https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_rwlock_rdlock.html +dnl but this test verifies the guarantee regardless of TPS and regardless of +dnl scheduling policy. +dnl Glibc does not provide this guarantee (and never will on Linux), see +dnl https://sourceware.org/bugzilla/show_bug.cgi?id=13701 +dnl https://bugzilla.redhat.com/show_bug.cgi?id=1410052 +AC_DEFUN([gl_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], +[ + AC_REQUIRE([gl_THREADLIB_EARLY]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + AC_CACHE_CHECK([whether pthread_rwlock_rdlock prefers a writer to a reader], + [gl_cv_pthread_rwlock_rdlock_prefer_writer], + [save_LIBS="$LIBS" + LIBS="$LIBS $LIBMULTITHREAD" + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +#include +#include + +#define SUCCEED() exit (0) +#define FAILURE() exit (1) +#define UNEXPECTED(n) (exit (10 + (n))) + +/* The main thread creates the waiting writer and the requesting reader threads + in the default way; this guarantees that they have the same priority. + We can reuse the main thread as first reader thread. */ + +static pthread_rwlock_t lock; +static pthread_t reader1; +static pthread_t writer; +static pthread_t reader2; +static pthread_t timer; +/* Used to pass control from writer to reader2 and from reader2 to timer, + as in a relay race. + Passing control from one running thread to another running thread + is most likely faster than to create the second thread. */ +static pthread_mutex_t baton; + +static void * +timer_func (void *ignored) +{ + /* Step 13 (can be before or after step 12): + The timer thread takes the baton, then waits a moment to make sure + it can tell whether the second reader thread is blocked at step 12. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (13); + usleep (100000); + /* By the time we get here, it's clear that the second reader thread is + blocked at step 12. This is the desired behaviour. */ + SUCCEED (); +} + +static void * +reader2_func (void *ignored) +{ + int err; + + /* Step 8 (can be before or after step 7): + The second reader thread takes the baton, then waits a moment to make sure + the writer thread has reached step 7. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (8); + usleep (100000); + /* Step 9: The second reader thread requests the lock. */ + err = pthread_rwlock_tryrdlock (&lock); + if (err == 0) + FAILURE (); + else if (err != EBUSY) + UNEXPECTED (9); + /* Step 10: Launch a timer, to test whether the next call blocks. */ + if (pthread_create (&timer, NULL, timer_func, NULL)) + UNEXPECTED (10); + /* Step 11: Release the baton. */ + if (pthread_mutex_unlock (&baton)) + UNEXPECTED (11); + /* Step 12: The second reader thread requests the lock. */ + err = pthread_rwlock_rdlock (&lock); + if (err == 0) + FAILURE (); + else + UNEXPECTED (12); +} + +static void * +writer_func (void *ignored) +{ + /* Step 4: Take the baton, so that the second reader thread does not go ahead + too early. */ + if (pthread_mutex_lock (&baton)) + UNEXPECTED (4); + /* Step 5: Create the second reader thread. */ + if (pthread_create (&reader2, NULL, reader2_func, NULL)) + UNEXPECTED (5); + /* Step 6: Release the baton. */ + if (pthread_mutex_unlock (&baton)) + UNEXPECTED (6); + /* Step 7: The writer thread requests the lock. */ + if (pthread_rwlock_wrlock (&lock)) + UNEXPECTED (7); + return NULL; +} + +int +main () +{ + reader1 = pthread_self (); + + /* Step 1: The main thread initializes the lock and the baton. */ + if (pthread_rwlock_init (&lock, NULL)) + UNEXPECTED (1); + if (pthread_mutex_init (&baton, NULL)) + UNEXPECTED (1); + /* Step 2: The main thread acquires the lock as a reader. */ + if (pthread_rwlock_rdlock (&lock)) + UNEXPECTED (2); + /* Step 3: Create the writer thread. */ + if (pthread_create (&writer, NULL, writer_func, NULL)) + UNEXPECTED (3); + /* Job done. Go to sleep. */ + for (;;) + { + sleep (1); + } +} +]])], + [gl_cv_pthread_rwlock_rdlock_prefer_writer=yes], + [gl_cv_pthread_rwlock_rdlock_prefer_writer=no], + [case "$host_os" in + # Guess no on glibc systems. + *-gnu* | gnu*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on musl systems. + *-musl*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess no on bionic systems. + *-android*) gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" ;; + # Guess yes on native Windows with the mingw-w64 winpthreads library. + # Guess no on native Windows with the gnulib windows-rwlock module. + mingw*) if test "$gl_use_threads" = yes || test "$gl_use_threads" = posix; then + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing yes" + else + gl_cv_pthread_rwlock_rdlock_prefer_writer="guessing no" + fi + ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_pthread_rwlock_rdlock_prefer_writer="$gl_cross_guess_normal" ;; + esac + ]) + LIBS="$save_LIBS" + ]) + case "$gl_cv_pthread_rwlock_rdlock_prefer_writer" in + *yes) + AC_DEFINE([HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER], [1], + [Define if the 'pthread_rwlock_rdlock' function prefers a writer to a reader.]) + ;; + esac +]) diff --git a/gnulib-m4/raise.m4 b/gnulib-m4/raise.m4 new file mode 100644 index 0000000..4bf0ca9 --- /dev/null +++ b/gnulib-m4/raise.m4 @@ -0,0 +1,36 @@ +# raise.m4 serial 4 +dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_RAISE], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CHECK_FUNCS([raise]) + if test $ac_cv_func_raise = no; then + HAVE_RAISE=0 + else + m4_ifdef([gl_MSVC_INVAL], [ + AC_REQUIRE([gl_MSVC_INVAL]) + if test $HAVE_MSVC_INVALID_PARAMETER_HANDLER = 1; then + REPLACE_RAISE=1 + fi + ]) + m4_ifdef([gl_SIGNALBLOCKING], [ + gl_SIGNALBLOCKING + if test $HAVE_POSIX_SIGNALBLOCKING = 0; then + m4_ifdef([gl_SIGNAL_SIGPIPE], [ + gl_SIGNAL_SIGPIPE + if test $gl_cv_header_signal_h_SIGPIPE != yes; then + REPLACE_RAISE=1 + fi + ], [:]) + fi + ]) + fi +]) + +# Prerequisites of lib/raise.c. +AC_DEFUN([gl_PREREQ_RAISE], [:]) diff --git a/gnulib-m4/rmdir.m4 b/gnulib-m4/rmdir.m4 new file mode 100644 index 0000000..82b9ccc --- /dev/null +++ b/gnulib-m4/rmdir.m4 @@ -0,0 +1,54 @@ +# rmdir.m4 serial 18 +dnl Copyright (C) 2002, 2005, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_RMDIR], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + dnl Detect cygwin 1.5.x bug. + AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CACHE_CHECK([whether rmdir works], [gl_cv_func_rmdir_works], + [mkdir conftest.dir + touch conftest.file + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #if HAVE_UNISTD_H + # include + #else /* on Windows with MSVC */ + # include + #endif + ]GL_MDA_DEFINES], + [[int result = 0; + if (!rmdir ("conftest.file/")) + result |= 1; + else if (errno != ENOTDIR) + result |= 2; + if (!rmdir ("conftest.dir/./")) + result |= 4; + return result; + ]])], + [gl_cv_func_rmdir_works=yes], [gl_cv_func_rmdir_works=no], + [case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_rmdir_works="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_rmdir_works="guessing yes" ;; + # Guess no on native Windows. + mingw*) gl_cv_func_rmdir_works="guessing no" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_rmdir_works="$gl_cross_guess_normal" ;; + esac + ]) + rm -rf conftest.dir conftest.file]) + case "$gl_cv_func_rmdir_works" in + *yes) ;; + *) + REPLACE_RMDIR=1 + ;; + esac +]) diff --git a/gnulib-m4/sig_atomic_t.m4 b/gnulib-m4/sig_atomic_t.m4 new file mode 100644 index 0000000..5940faa --- /dev/null +++ b/gnulib-m4/sig_atomic_t.m4 @@ -0,0 +1,14 @@ +# sig_atomic_t.m4 serial 3 +dnl Copyright (C) 2003, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gt_TYPE_SIG_ATOMIC_T], +[ + AC_CHECK_TYPES([sig_atomic_t], , + [AC_DEFINE([sig_atomic_t], [int], + [Define as an integer type suitable for memory locations that can be + accessed atomically even in the presence of asynchronous signals.])], + [#include ]) +]) diff --git a/gnulib-m4/sigaction.m4 b/gnulib-m4/sigaction.m4 new file mode 100644 index 0000000..a8c1d15 --- /dev/null +++ b/gnulib-m4/sigaction.m4 @@ -0,0 +1,40 @@ +# sigaction.m4 serial 7 +dnl Copyright (C) 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Determine if sigaction interface is present. +AC_DEFUN([gl_SIGACTION], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([sigaction]) + if test $ac_cv_func_sigaction = yes; then + AC_CHECK_MEMBERS([struct sigaction.sa_sigaction], , , + [[#include ]]) + if test $ac_cv_member_struct_sigaction_sa_sigaction = no; then + HAVE_STRUCT_SIGACTION_SA_SIGACTION=0 + fi + else + HAVE_SIGACTION=0 + fi +]) + +# Prerequisites of the part of lib/signal.in.h and of lib/sigaction.c. +AC_DEFUN([gl_PREREQ_SIGACTION], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_REQUIRE([AC_C_RESTRICT]) + AC_REQUIRE([AC_TYPE_UID_T]) + AC_REQUIRE([gl_PREREQ_SIG_HANDLER_H]) + AC_CHECK_FUNCS_ONCE([sigaltstack siginterrupt]) + AC_CHECK_TYPES([siginfo_t], [], [], [[ +#include + ]]) + if test $ac_cv_type_siginfo_t = no; then + HAVE_SIGINFO_T=0 + fi +]) + +# Prerequisites of lib/sig-handler.h. +AC_DEFUN([gl_PREREQ_SIG_HANDLER_H], [:]) diff --git a/gnulib-m4/signal_h.m4 b/gnulib-m4/signal_h.m4 new file mode 100644 index 0000000..8b93880 --- /dev/null +++ b/gnulib-m4/signal_h.m4 @@ -0,0 +1,100 @@ +# signal_h.m4 serial 22 +dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_SIGNAL_H], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) + gl_NEXT_HEADERS([signal.h]) + +# AIX declares sig_atomic_t to already include volatile, and C89 compilers +# then choke on 'volatile sig_atomic_t'. C99 requires that it compile. + AC_CHECK_TYPE([volatile sig_atomic_t], [], + [HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=0], [[ +#include + ]]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + AC_REQUIRE([AC_TYPE_UID_T]) + + dnl Persuade glibc to define sighandler_t. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_TYPE([sighandler_t], [], [HAVE_SIGHANDLER_T=0], [[ +#include + ]]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include + ]], [pthread_sigmask sigaction + sigaddset sigdelset sigemptyset sigfillset sigismember + sigpending sigprocmask]) + + AC_REQUIRE([AC_C_RESTRICT]) +]) + +AC_DEFUN([gl_CHECK_TYPE_SIGSET_T], +[ + AC_CHECK_TYPES([sigset_t], + [gl_cv_type_sigset_t=yes], [gl_cv_type_sigset_t=no], + [[ + #include + /* Mingw defines sigset_t not in , but in . */ + #include + ]]) + if test $gl_cv_type_sigset_t != yes; then + HAVE_SIGSET_T=0 + fi +]) + +# gl_SIGNAL_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SIGNAL_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SIGNAL_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SIGNAL_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PTHREAD_SIGMASK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAISE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGNAL_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGPROCMASK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGACTION]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SIGNAL_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SIGNAL_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_POSIX_SIGNALBLOCKING=1; AC_SUBST([HAVE_POSIX_SIGNALBLOCKING]) + HAVE_PTHREAD_SIGMASK=1; AC_SUBST([HAVE_PTHREAD_SIGMASK]) + HAVE_RAISE=1; AC_SUBST([HAVE_RAISE]) + HAVE_SIGSET_T=1; AC_SUBST([HAVE_SIGSET_T]) + HAVE_SIGINFO_T=1; AC_SUBST([HAVE_SIGINFO_T]) + HAVE_SIGACTION=1; AC_SUBST([HAVE_SIGACTION]) + HAVE_STRUCT_SIGACTION_SA_SIGACTION=1; + AC_SUBST([HAVE_STRUCT_SIGACTION_SA_SIGACTION]) + HAVE_TYPE_VOLATILE_SIG_ATOMIC_T=1; + AC_SUBST([HAVE_TYPE_VOLATILE_SIG_ATOMIC_T]) + HAVE_SIGHANDLER_T=1; AC_SUBST([HAVE_SIGHANDLER_T]) + REPLACE_PTHREAD_SIGMASK=0; AC_SUBST([REPLACE_PTHREAD_SIGMASK]) + REPLACE_RAISE=0; AC_SUBST([REPLACE_RAISE]) +]) diff --git a/gnulib-m4/signalblocking.m4 b/gnulib-m4/signalblocking.m4 new file mode 100644 index 0000000..bfd76b7 --- /dev/null +++ b/gnulib-m4/signalblocking.m4 @@ -0,0 +1,23 @@ +# signalblocking.m4 serial 17 +dnl Copyright (C) 2001-2002, 2006-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Determine available signal blocking primitives. Three different APIs exist: +# 1) POSIX: sigemptyset, sigaddset, sigprocmask +# 2) SYSV: sighold, sigrelse +# 3) BSD: sigblock, sigsetmask +# For simplicity, here we check only for the POSIX signal blocking. +AC_DEFUN([gl_SIGNALBLOCKING], +[ + AC_REQUIRE([gl_SIGNAL_H_DEFAULTS]) + AC_REQUIRE([gl_CHECK_TYPE_SIGSET_T]) + HAVE_POSIX_SIGNALBLOCKING=0 + if test "$gl_cv_type_sigset_t" = yes; then + AC_CHECK_FUNC([sigprocmask], [HAVE_POSIX_SIGNALBLOCKING=1]) + fi +]) + +# Prerequisites of lib/sigprocmask.c. +AC_DEFUN([gl_PREREQ_SIGPROCMASK], [:]) diff --git a/gnulib-m4/size_max.m4 b/gnulib-m4/size_max.m4 new file mode 100644 index 0000000..1d41ce9 --- /dev/null +++ b/gnulib-m4/size_max.m4 @@ -0,0 +1,75 @@ +# size_max.m4 serial 12 +dnl Copyright (C) 2003, 2005-2006, 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_PREREQ([2.61]) + +AC_DEFUN([gl_SIZE_MAX], +[ + AC_CHECK_HEADERS([stdint.h]) + dnl First test whether the system already has SIZE_MAX. + AC_CACHE_CHECK([for SIZE_MAX], [gl_cv_size_max], [ + gl_cv_size_max=no + AC_EGREP_CPP([Found it], [ +#include +#if HAVE_STDINT_H +#include +#endif +#ifdef SIZE_MAX +Found it +#endif +], [gl_cv_size_max=yes]) + if test $gl_cv_size_max != yes; then + dnl Define it ourselves. Here we assume that the type 'size_t' is not wider + dnl than the type 'unsigned long'. Try hard to find a definition that can + dnl be used in a preprocessor #if, i.e. doesn't contain a cast. + AC_COMPUTE_INT([size_t_bits_minus_1], [sizeof (size_t) * CHAR_BIT - 1], + [#include +#include ], [size_t_bits_minus_1=]) + AC_COMPUTE_INT([fits_in_uint], [sizeof (size_t) <= sizeof (unsigned int)], + [#include ], [fits_in_uint=]) + if test -n "$size_t_bits_minus_1" && test -n "$fits_in_uint"; then + if test $fits_in_uint = 1; then + dnl Even though SIZE_MAX fits in an unsigned int, it must be of type + dnl 'unsigned long' if the type 'size_t' is the same as 'unsigned long'. + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + extern size_t foo; + extern unsigned long foo; + ]], + [[]])], + [fits_in_uint=0]) + fi + dnl We cannot use 'expr' to simplify this expression, because 'expr' + dnl works only with 'long' integers in the host environment, while we + dnl might be cross-compiling from a 32-bit platform to a 64-bit platform. + if test $fits_in_uint = 1; then + gl_cv_size_max="(((1U << $size_t_bits_minus_1) - 1) * 2 + 1)" + else + gl_cv_size_max="(((1UL << $size_t_bits_minus_1) - 1) * 2 + 1)" + fi + else + dnl Shouldn't happen, but who knows... + gl_cv_size_max='((size_t)~(size_t)0)' + fi + fi + ]) + if test "$gl_cv_size_max" != yes; then + AC_DEFINE_UNQUOTED([SIZE_MAX], [$gl_cv_size_max], + [Define as the maximum value of type 'size_t', if the system doesn't define it.]) + fi + dnl Don't redefine SIZE_MAX in config.h if config.h is re-included after + dnl . Remember that the #undef in AH_VERBATIM gets replaced with + dnl #define by AC_DEFINE_UNQUOTED. + AH_VERBATIM([SIZE_MAX], +[/* Define as the maximum value of type 'size_t', if the system doesn't define + it. */ +#ifndef SIZE_MAX +# undef SIZE_MAX +#endif]) +]) diff --git a/gnulib-m4/sparcv8+.m4 b/gnulib-m4/sparcv8+.m4 new file mode 100644 index 0000000..373cf60 --- /dev/null +++ b/gnulib-m4/sparcv8+.m4 @@ -0,0 +1,42 @@ +# sparcv8+.m4 serial 1 +dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl When compiling for SPARC in 32-bit mode, make sure that instructions for +dnl SPARC v8+ are accepted. This is necessary for multiprocessing (for +dnl instructions like 'membar' or 'cas'). All SPARC CPUs made since 1993 +dnl support this instruction set. But GCC in its default configuration, in +dnl 32-bit mode (64-bit mode assumes SPARC v9 or newer), still defaults to +dnl SPARC v7 instruction set: "By default (unless configured otherwise), GCC +dnl generates code for the V7 variant of the SPARC architecture." See +dnl +dnl + +AC_DEFUN([gl_SPARC_V8PLUS], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + + case "$host_cpu" in + sparc*) + if test -n "$GCC"; then + AC_CACHE_CHECK([whether SPARC v8+ instructions are supported], + [gl_cv_sparc_v8plus], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[]], + [[asm volatile ("membar 2");]])], + [gl_cv_sparc_v8plus=yes], + [gl_cv_sparc_v8plus=no]) + ]) + if test $gl_cv_sparc_v8plus = no; then + dnl Strangely enough, '-mv8plus' does not have the desired effect. + dnl But '-mcpu=v9' does. + CC="$CC -mcpu=v9" + CXX="$CXX -mcpu=v9" + fi + fi + ;; + esac +]) diff --git a/gnulib-m4/ssize_t.m4 b/gnulib-m4/ssize_t.m4 new file mode 100644 index 0000000..f0ed509 --- /dev/null +++ b/gnulib-m4/ssize_t.m4 @@ -0,0 +1,23 @@ +# ssize_t.m4 serial 5 (gettext-0.18.2) +dnl Copyright (C) 2001-2003, 2006, 2010-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. +dnl Test whether ssize_t is defined. + +AC_DEFUN([gt_TYPE_SSIZE_T], +[ + AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[int x = sizeof (ssize_t *) + sizeof (ssize_t); + return !x;]])], + [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])]) + if test $gt_cv_ssize_t = no; then + AC_DEFINE([ssize_t], [int], + [Define as a signed type of the same size as size_t.]) + fi +]) diff --git a/gnulib-m4/stat-time.m4 b/gnulib-m4/stat-time.m4 new file mode 100644 index 0000000..df1c2a7 --- /dev/null +++ b/gnulib-m4/stat-time.m4 @@ -0,0 +1,83 @@ +# Checks for stat-related time functions. + +# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2021 Free Software +# Foundation, Inc. + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert. + +# st_atim.tv_nsec - Linux, Solaris, Cygwin +# st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE +# st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE +# st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1) + +# st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway) +# st_birthtim - Cygwin 1.7.0+ + +AC_DEFUN([gl_STAT_TIME], +[ + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_HEADERS_ONCE([sys/time.h]) + + AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec], + [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec], + [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[ + #include + #include + #if HAVE_SYS_TIME_H + # include + #endif + #include + struct timespec ts; + struct stat st; + ]], + [[ + st.st_atim = ts; + ]])], + [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes], + [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])]) + if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then + AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1], + [Define to 1 if the type of the st_atim member of a struct stat is + struct timespec.]) + fi], + [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [], + [AC_CHECK_MEMBERS([struct stat.st_atimensec], [], + [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [], + [#include + #include ])], + [#include + #include ])], + [#include + #include ])], + [#include + #include ]) +]) + +# Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.) +# and NTFS (Cygwin). +# There was a time when this field was named st_createtime (21 June +# 2002 to 16 July 2002) But that window is very small and applied only +# to development code, so systems still using that configuration are +# not supported. See revisions 1.10 and 1.11 of FreeBSD's +# src/sys/ufs/ufs/dinode.h. +# +AC_DEFUN([gl_STAT_BIRTHTIME], +[ + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + AC_CHECK_HEADERS_ONCE([sys/time.h]) + AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [], + [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [], + [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [], + [#include + #include ])], + [#include + #include ])], + [#include + #include ]) +]) diff --git a/gnulib-m4/stat.m4 b/gnulib-m4/stat.m4 new file mode 100644 index 0000000..9bcdb72 --- /dev/null +++ b/gnulib-m4/stat.m4 @@ -0,0 +1,85 @@ +# serial 18 + +# Copyright (C) 2009-2021 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STAT], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + AC_CHECK_FUNCS_ONCE([lstat]) + case "$host_os" in + mingw*) + dnl On this platform, the original stat() returns st_atime, st_mtime, + dnl st_ctime values that are affected by the time zone. + REPLACE_STAT=1 + ;; + *) + dnl AIX 7.1, Solaris 9, mingw64 mistakenly succeed on stat("file/"). + dnl (For mingw, this is due to a broken stat() override in libmingwex.a.) + dnl FreeBSD 7.2 mistakenly succeeds on stat("link-to-file/"). + AC_CACHE_CHECK([whether stat handles trailing slashes on files], + [gl_cv_func_stat_file_slash], + [touch conftest.tmp + # Assume that if we have lstat, we can also check symlinks. + if test $ac_cv_func_lstat = yes; then + ln -s conftest.tmp conftest.lnk + fi + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include +]], [[int result = 0; + struct stat st; + if (!stat ("conftest.tmp/", &st)) + result |= 1; +#if HAVE_LSTAT + if (!stat ("conftest.lnk/", &st)) + result |= 2; +#endif + return result; + ]])], + [gl_cv_func_stat_file_slash=yes], [gl_cv_func_stat_file_slash=no], + [case "$host_os" in + # Guess yes on Linux systems. + linux-* | linux) gl_cv_func_stat_file_slash="guessing yes" ;; + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_stat_file_slash="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_stat_file_slash="$gl_cross_guess_normal" ;; + esac + ]) + rm -f conftest.tmp conftest.lnk]) + case $gl_cv_func_stat_file_slash in + *no) + REPLACE_STAT=1 + AC_DEFINE([REPLACE_FUNC_STAT_FILE], [1], [Define to 1 if stat needs + help when passed a file name with a trailing slash]);; + esac + case $host_os in + dnl Solaris stat can return a negative tv_nsec. + solaris*) + REPLACE_FSTAT=1 ;; + esac + ;; + esac +]) + +# Prerequisites of lib/stat.c and lib/stat-w32.c. +AC_DEFUN([gl_PREREQ_STAT], [ + AC_REQUIRE([gl_SYS_STAT_H]) + AC_REQUIRE([gl_PREREQ_STAT_W32]) + : +]) + +# Prerequisites of lib/stat-w32.c. +AC_DEFUN([gl_PREREQ_STAT_W32], [ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + mingw*) + AC_CHECK_HEADERS([sdkddkver.h]) + ;; + esac +]) diff --git a/gnulib-m4/std-gnu11.m4 b/gnulib-m4/std-gnu11.m4 new file mode 100644 index 0000000..7b1a042 --- /dev/null +++ b/gnulib-m4/std-gnu11.m4 @@ -0,0 +1,829 @@ +# Prefer GNU C11 and C++11 to earlier versions. -*- coding: utf-8 -*- + +# This implementation is taken from GNU Autoconf lib/autoconf/c.m4 +# commit 017d5ddd82854911f0119691d91ea8a1438824d6 +# dated Sun Apr 3 13:57:17 2016 -0700 +# This implementation will be obsolete once we can assume Autoconf 2.70 +# or later is installed everywhere a Gnulib program might be developed. + +m4_version_prereq([2.70], [], [ + + +# Copyright (C) 2001-2021 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 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, see . + +# Written by David MacKenzie, with help from +# Akim Demaille, Paul Eggert, +# François Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +# Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +# AC_PROG_CC([COMPILER ...]) +# -------------------------- +# COMPILER ... is a space separated list of C compilers to search for. +# This just gives the user an opportunity to specify an alternative +# search list for the C compiler. +AC_DEFUN_ONCE([AC_PROG_CC], +[AC_LANG_PUSH(C)dnl +AC_ARG_VAR([CC], [C compiler command])dnl +AC_ARG_VAR([CFLAGS], [C compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +_AC_ARG_VAR_LIBS()dnl +_AC_ARG_VAR_CPPFLAGS()dnl +m4_ifval([$1], + [AC_CHECK_TOOLS(CC, [$1])], +[AC_CHECK_TOOL(CC, gcc) +if test -z "$CC"; then + dnl Here we want: + dnl AC_CHECK_TOOL(CC, cc) + dnl but without the check for a tool without the prefix. + dnl Until the check is removed from there, copy the code: + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(CC, [${ac_tool_prefix}cc], [${ac_tool_prefix}cc]) + fi +fi +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) +fi +if test -z "$CC"; then + AC_CHECK_TOOLS(CC, cl.exe) +fi +if test -z "$CC"; then + AC_CHECK_TOOL(CC, clang) +fi +]) + +test -z "$CC" && AC_MSG_FAILURE([no acceptable C compiler found in \$PATH]) + +# Provide some information about the compiler. +_AS_ECHO_LOG([checking for _AC_LANG compiler version]) +set X $ac_compile +ac_compiler=$[2] +for ac_option in --version -v -V -qversion -version; do + _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) +done + +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl +_AC_LANG_COMPILER_GNU +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +_AC_PROG_CC_G +dnl +dnl Set ac_prog_cc_stdc to the supported C version. +dnl Also set the documented variable ac_cv_prog_cc_stdc; +dnl its name was chosen when it was cached, but it is no longer cached. +_AC_PROG_CC_C11([ac_prog_cc_stdc=c11 + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c11], + [_AC_PROG_CC_C99([ac_prog_cc_stdc=c99 + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99], + [_AC_PROG_CC_C89([ac_prog_cc_stdc=c89 + ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89], + [ac_prog_cc_stdc=no + ac_cv_prog_cc_stdc=no])])]) +dnl +AC_LANG_POP(C)dnl +])# AC_PROG_CC + + + +# AC_PROG_CXX([LIST-OF-COMPILERS]) +# -------------------------------- +# LIST-OF-COMPILERS is a space separated list of C++ compilers to search +# for (if not specified, a default list is used). This just gives the +# user an opportunity to specify an alternative search list for the C++ +# compiler. +# aCC HP-UX C++ compiler much better than `CC', so test before. +# FCC Fujitsu C++ compiler +# KCC KAI C++ compiler +# RCC Rational C++ +# xlC_r AIX C Set++ (with support for reentrant code) +# xlC AIX C Set++ +AC_DEFUN([AC_PROG_CXX], +[AC_LANG_PUSH(C++)dnl +AC_ARG_VAR([CXX], [C++ compiler command])dnl +AC_ARG_VAR([CXXFLAGS], [C++ compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +_AC_ARG_VAR_LIBS()dnl +_AC_ARG_VAR_CPPFLAGS()dnl +_AC_ARG_VAR_PRECIOUS([CCC])dnl +if test -z "$CXX"; then + if test -n "$CCC"; then + CXX=$CCC + else + AC_CHECK_TOOLS(CXX, + [m4_default([$1], + [g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC clang++])], + g++) + fi +fi +# Provide some information about the compiler. +_AS_ECHO_LOG([checking for _AC_LANG compiler version]) +set X $ac_compile +ac_compiler=$[2] +for ac_option in --version -v -V -qversion; do + _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD]) +done + +m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl +m4_expand_once([_AC_COMPILER_OBJEXT])[]dnl +_AC_LANG_COMPILER_GNU +if test $ac_compiler_gnu = yes; then + GXX=yes +else + GXX= +fi +_AC_PROG_CXX_G +_AC_PROG_CXX_CXX11([ac_prog_cxx_stdcxx=cxx11 + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx11 + ac_cv_prog_cxx_cxx98=$ac_cv_prog_cxx_cxx11], + [_AC_PROG_CXX_CXX98([ac_prog_cxx_stdcxx=cxx98 + ac_cv_prog_cxx_stdcxx=$ac_cv_prog_cxx_cxx98], + [ac_prog_cxx_stdcxx=no + ac_cv_prog_cxx_stdcxx=no])]) +AC_LANG_POP(C++)dnl +])# AC_PROG_CXX + + +# _AC_C_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, +# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) +# -------------------------------------------------------------- +# Check whether the C compiler accepts features of STANDARD (e.g `c89', `c99') +# by trying to compile a program of TEST-PROLOGUE and TEST-BODY. If this fails, +# try again with each compiler option in the space-separated OPTION-LIST; if one +# helps, append it to CC. If eventually successful, run ACTION-IF-AVAILABLE, +# else ACTION-IF-UNAVAILABLE. +AC_DEFUN([_AC_C_STD_TRY], +[AC_MSG_CHECKING([for $CC option to enable ]m4_translit($1, [c], [C])[ features]) +AC_CACHE_VAL(ac_cv_prog_cc_$1, +[ac_cv_prog_cc_$1=no +ac_save_CC=$CC +AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) +for ac_arg in '' $4 +do + CC="$ac_save_CC $ac_arg" + _AC_COMPILE_IFELSE([], [ac_cv_prog_cc_$1=$ac_arg]) + test "x$ac_cv_prog_cc_$1" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC +])# AC_CACHE_VAL +ac_prog_cc_stdc_options= +case "x$ac_cv_prog_cc_$1" in + x) + AC_MSG_RESULT([none needed]) ;; + xno) + AC_MSG_RESULT([unsupported]) ;; + *) + ac_prog_cc_stdc_options=" $ac_cv_prog_cc_$1" + CC=$CC$ac_prog_cc_stdc_options + AC_MSG_RESULT([$ac_cv_prog_cc_$1]) ;; +esac +AS_IF([test "x$ac_cv_prog_cc_$1" != xno], [$5], [$6]) +])# _AC_C_STD_TRY + +# _AC_C_C99_TEST_HEADER +# --------------------- +# A C header suitable for testing for C99. +AC_DEFUN([_AC_C_C99_TEST_HEADER], +[[#include +#include +#include +#include +#include +#include + +// Check varargs macros. These examples are taken from C99 6.10.3.5. +#define debug(...) fprintf (stderr, __VA_ARGS__) +#define showlist(...) puts (#__VA_ARGS__) +#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) +static void +test_varargs_macros (void) +{ + int x = 1234; + int y = 5678; + debug ("Flag"); + debug ("X = %d\n", x); + showlist (The first, second, and third items.); + report (x>y, "x is %d but y is %d", x, y); +} + +// Check long long types. +#define BIG64 18446744073709551615ull +#define BIG32 4294967295ul +#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) +#if !BIG_OK + your preprocessor is broken; +#endif +#if BIG_OK +#else + your preprocessor is broken; +#endif +static long long int bignum = -9223372036854775807LL; +static unsigned long long int ubignum = BIG64; + +struct incomplete_array +{ + int datasize; + double data[]; +}; + +struct named_init { + int number; + const wchar_t *name; + double average; +}; + +typedef const char *ccp; + +static inline int +test_restrict (ccp restrict text) +{ + // See if C++-style comments work. + // Iterate through items via the restricted pointer. + // Also check for declarations in for loops. + for (unsigned int i = 0; *(text+i) != '\0'; ++i) + continue; + return 0; +} + +// Check varargs and va_copy. +static bool +test_varargs (const char *format, ...) +{ + va_list args; + va_start (args, format); + va_list args_copy; + va_copy (args_copy, args); + + const char *str = ""; + int number = 0; + float fnumber = 0; + + while (*format) + { + switch (*format++) + { + case 's': // string + str = va_arg (args_copy, const char *); + break; + case 'd': // int + number = va_arg (args_copy, int); + break; + case 'f': // float + fnumber = va_arg (args_copy, double); + break; + default: + break; + } + } + va_end (args_copy); + va_end (args); + + return *str && number && fnumber; +}]])# _AC_C_C99_TEST_HEADER + +# _AC_C_C99_TEST_BODY +# ------------------- +# A C body suitable for testing for C99, assuming the corresponding header. +AC_DEFUN([_AC_C_C99_TEST_BODY], +[[ + // Check bool. + _Bool success = false; + + // Check restrict. + if (test_restrict ("String literal") == 0) + success = true; + char *restrict newvar = "Another string"; + + // Check varargs. + success &= test_varargs ("s, d' f .", "string", 65, 34.234); + test_varargs_macros (); + + // Check flexible array members. + struct incomplete_array *ia = + malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); + ia->datasize = 10; + for (int i = 0; i < ia->datasize; ++i) + ia->data[i] = i * 1.234; + + // Check named initializers. + struct named_init ni = { + .number = 34, + .name = L"Test wide string", + .average = 543.34343, + }; + + ni.number = 58; + + int dynamic_array[ni.number]; + dynamic_array[ni.number - 1] = 543; + + // work around unused variable warnings + return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' + || dynamic_array[ni.number - 1] != 543); +]]) + +# _AC_PROG_CC_C99 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +# ---------------------------------------------------------------- +# If the C compiler is not in ISO C99 mode by default, try to add an +# option to output variable CC to make it so. This macro tries +# various options that select ISO C99 on some system or another. It +# considers the compiler to be in ISO C99 mode if it handles _Bool, +# // comments, flexible array members, inline, long long int, mixed +# code and declarations, named initialization of structs, restrict, +# va_copy, varargs macros, variable declarations in for loops and +# variable length arrays. +AC_DEFUN([_AC_PROG_CC_C99], +[_AC_C_STD_TRY([c99], +[_AC_C_C99_TEST_HEADER], +[_AC_C_C99_TEST_BODY], +dnl Try +dnl GCC -std=gnu99 (unused restrictive modes: -std=c99 -std=iso9899:1999) +dnl IBM XL C -qlanglvl=extc1x (V12.1; does not pass C11 test) +dnl IBM XL C -qlanglvl=extc99 +dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdc99) +dnl HP cc -AC99 +dnl Intel ICC -std=c99, -c99 (deprecated) +dnl IRIX -c99 +dnl Solaris -D_STDC_C99= +dnl cc's -xc99 option uses linker magic to define the external +dnl symbol __xpg4 as if by "int __xpg4 = 1;", which enables C99 +dnl behavior for C library functions. This is not wanted here, +dnl because it means that a single module compiled with -xc99 +dnl alters C runtime behavior for the entire program, not for +dnl just the module. Instead, define the (private) symbol +dnl _STDC_C99, which suppresses a bogus failure in . +dnl The resulting compiler passes the test case here, and that's +dnl good enough. For more, please see the thread starting at: +dnl https://lists.gnu.org/r/autoconf/2010-12/msg00059.html +dnl Tru64 -c99 +dnl with extended modes being tried first. +[[-std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc1x -qlanglvl=extc99]], [$1], [$2])[]dnl +])# _AC_PROG_CC_C99 + + +# _AC_PROG_CC_C11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +# ---------------------------------------------------------------- +# If the C compiler is not in ISO C11 mode by default, try to add an +# option to output variable CC to make it so. This macro tries +# various options that select ISO C11 on some system or another. It +# considers the compiler to be in ISO C11 mode if it handles _Alignas, +# _Alignof, _Noreturn, _Static_assert, UTF-8 string literals, +# duplicate typedefs, and anonymous structures and unions. +AC_DEFUN([_AC_PROG_CC_C11], +[_AC_C_STD_TRY([c11], +[_AC_C_C99_TEST_HEADER[ +// Check _Alignas. +char _Alignas (double) aligned_as_double; +char _Alignas (0) no_special_alignment; +extern char aligned_as_int; +char _Alignas (0) _Alignas (int) aligned_as_int; + +// Check _Alignof. +enum +{ + int_alignment = _Alignof (int), + int_array_alignment = _Alignof (int[100]), + char_alignment = _Alignof (char) +}; +_Static_assert (0 < -_Alignof (int), "_Alignof is signed"); + +// Check _Noreturn. +int _Noreturn does_not_return (void) { for (;;) continue; } + +// Check _Static_assert. +struct test_static_assert +{ + int x; + _Static_assert (sizeof (int) <= sizeof (long int), + "_Static_assert does not work in struct"); + long int y; +}; + +// Check UTF-8 literals. +#define u8 syntax error! +char const utf8_literal[] = u8"happens to be ASCII" "another string"; + +// Check duplicate typedefs. +typedef long *long_ptr; +typedef long int *long_ptr; +typedef long_ptr long_ptr; + +// Anonymous structures and unions -- taken from C11 6.7.2.1 Example 1. +struct anonymous +{ + union { + struct { int i; int j; }; + struct { int k; long int l; } w; + }; + int m; +} v1; +]], +[_AC_C_C99_TEST_BODY[ + v1.i = 2; + v1.w.k = 5; + _Static_assert ((offsetof (struct anonymous, i) + == offsetof (struct anonymous, w.k)), + "Anonymous union alignment botch"); +]], +dnl Try +dnl GCC -std=gnu11 (unused restrictive mode: -std=c11) +dnl with extended modes being tried first. +dnl +dnl Do not try -qlanglvl=extc1x, because IBM XL C V12.1 (the latest version as +dnl of September 2012) does not pass the C11 test. For now, try extc1x when +dnl compiling the C99 test instead, since it enables _Static_assert and +dnl _Noreturn, which is a win. If -qlanglvl=extc11 or -qlanglvl=extc1x passes +dnl the C11 test in some future version of IBM XL C, we'll add it here, +dnl preferably extc11. +[[-std=gnu11]], [$1], [$2])[]dnl +])# _AC_PROG_CC_C11 + + +# AC_PROG_CC_C89 +# -------------- +# Do not use AU_ALIAS here and in AC_PROG_CC_C99 and AC_PROG_CC_STDC, +# as that'd be incompatible with how Automake redefines AC_PROG_CC. See +# . +AU_DEFUN([AC_PROG_CC_C89], + [AC_REQUIRE([AC_PROG_CC])], + [$0 is obsolete; use AC_PROG_CC] +) + +# AC_PROG_CC_C99 +# -------------- +AU_DEFUN([AC_PROG_CC_C99], + [AC_REQUIRE([AC_PROG_CC])], + [$0 is obsolete; use AC_PROG_CC] +) + +# AC_PROG_CC_STDC +# --------------- +AU_DEFUN([AC_PROG_CC_STDC], + [AC_REQUIRE([AC_PROG_CC])], + [$0 is obsolete; use AC_PROG_CC] +) + + +# AC_C_PROTOTYPES +# --------------- +# Check if the C compiler supports prototypes, included if it needs +# options. +AC_DEFUN([AC_C_PROTOTYPES], +[AC_REQUIRE([AC_PROG_CC])dnl +if test "$ac_prog_cc_stdc" != no; then + AC_DEFINE(PROTOTYPES, 1, + [Define to 1 if the C compiler supports function prototypes.]) + AC_DEFINE(__PROTOTYPES, 1, + [Define like PROTOTYPES; this can be used by system headers.]) +fi +])# AC_C_PROTOTYPES + + +# _AC_CXX_STD_TRY(STANDARD, TEST-PROLOGUE, TEST-BODY, OPTION-LIST, +# ACTION-IF-AVAILABLE, ACTION-IF-UNAVAILABLE) +# ---------------------------------------------------------------- +# Check whether the C++ compiler accepts features of STANDARD (e.g +# `cxx98', `cxx11') by trying to compile a program of TEST-PROLOGUE +# and TEST-BODY. If this fails, try again with each compiler option +# in the space-separated OPTION-LIST; if one helps, append it to CXX. +# If eventually successful, run ACTION-IF-AVAILABLE, else +# ACTION-IF-UNAVAILABLE. +AC_DEFUN([_AC_CXX_STD_TRY], +[AC_MSG_CHECKING([for $CXX option to enable ]m4_translit(m4_translit($1, [x], [+]), [a-z], [A-Z])[ features]) +AC_LANG_PUSH(C++)dnl +AC_CACHE_VAL(ac_cv_prog_cxx_$1, +[ac_cv_prog_cxx_$1=no +ac_save_CXX=$CXX +AC_LANG_CONFTEST([AC_LANG_PROGRAM([$2], [$3])]) +for ac_arg in '' $4 +do + CXX="$ac_save_CXX $ac_arg" + _AC_COMPILE_IFELSE([], [ac_cv_prog_cxx_$1=$ac_arg]) + test "x$ac_cv_prog_cxx_$1" != "xno" && break +done +rm -f conftest.$ac_ext +CXX=$ac_save_CXX +])# AC_CACHE_VAL +ac_prog_cxx_stdcxx_options= +case "x$ac_cv_prog_cxx_$1" in + x) + AC_MSG_RESULT([none needed]) ;; + xno) + AC_MSG_RESULT([unsupported]) ;; + *) + ac_prog_cxx_stdcxx_options=" $ac_cv_prog_cxx_$1" + CXX=$CXX$ac_prog_cxx_stdcxx_options + AC_MSG_RESULT([$ac_cv_prog_cxx_$1]) ;; +esac +AC_LANG_POP(C++)dnl +AS_IF([test "x$ac_cv_prog_cxx_$1" != xno], [$5], [$6]) +])# _AC_CXX_STD_TRY + +# _AC_CXX_CXX98_TEST_HEADER +# ------------------------- +# A C++ header suitable for testing for CXX98. +AC_DEFUN([_AC_CXX_CXX98_TEST_HEADER], +[[ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace test { + typedef std::vector string_vec; + typedef std::pair map_value; + typedef std::map map_type; + typedef std::set set_type; + + template + class printer { + public: + printer(std::ostringstream& os): os(os) {} + void operator() (T elem) { os << elem << std::endl; } + private: + std::ostringstream& os; + }; +} +]])# _AC_CXX_CXX98_TEST_HEADER + +# _AC_CXX_CXX98_TEST_BODY +# ----------------------- +# A C++ body suitable for testing for CXX98, assuming the corresponding header. +AC_DEFUN([_AC_CXX_CXX98_TEST_BODY], +[[ + +try { + // Basic string. + std::string teststr("ASCII text"); + teststr += " string"; + + // Simple vector. + test::string_vec testvec; + testvec.push_back(teststr); + testvec.push_back("foo"); + testvec.push_back("bar"); + if (testvec.size() != 3) { + throw std::runtime_error("vector size is not 1"); + } + + // Dump vector into stringstream and obtain string. + std::ostringstream os; + for (test::string_vec::const_iterator i = testvec.begin(); + i != testvec.end(); ++i) { + if (i + 1 != testvec.end()) { + os << teststr << '\n'; + } + } + // Check algorithms work. + std::for_each(testvec.begin(), testvec.end(), test::printer(os)); + std::string os_out = os.str(); + + // Test pair and map. + test::map_type testmap; + testmap.insert(std::make_pair(std::string("key"), + std::make_pair(53,false))); + + // Test set. + int values[] = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + test::set_type testset(values, values + sizeof(values)/sizeof(values[0])); + std::list testlist(testset.begin(), testset.end()); + std::copy(testset.begin(), testset.end(), std::back_inserter(testlist)); +} catch (const std::exception& e) { + std::cerr << "Caught exception: " << e.what() << std::endl; + + // Test fstream + std::ofstream of("test.txt"); + of << "Test ASCII text\n" << std::flush; + of << "N= " << std::hex << std::setw(8) << std::left << 534 << std::endl; + of.close(); +} +std::exit(0); +]]) + +# _AC_CXX_CXX11_TEST_HEADER +# ------------------------- +# A C++ header suitable for testing for CXX11. +AC_DEFUN([_AC_CXX_CXX11_TEST_HEADER], +[[ +#include +#include +#include +#include +#include +#include +#include + +namespace cxx11test +{ + typedef std::shared_ptr sptr; + typedef std::weak_ptr wptr; + + typedef std::tuple tp; + typedef std::array int_array; + + constexpr int get_val() { return 20; } + + struct testinit + { + int i; + double d; + }; + + class delegate { + public: + delegate(int n) : n(n) {} + delegate(): delegate(2354) {} + + virtual int getval() { return this->n; }; + protected: + int n; + }; + + class overridden : public delegate { + public: + overridden(int n): delegate(n) {} + virtual int getval() override final { return this->n * 2; } + }; + + class nocopy { + public: + nocopy(int i): i(i) {} + nocopy() = default; + nocopy(const nocopy&) = delete; + nocopy & operator=(const nocopy&) = delete; + private: + int i; + }; +} +]])# _AC_CXX_CXX11_TEST_HEADER + +# _AC_CXX_CXX11_TEST_BODY +# ----------------------- +# A C++ body suitable for testing for CXX11, assuming the corresponding header. +AC_DEFUN([_AC_CXX_CXX11_TEST_BODY], +[[ +{ + // Test auto and decltype + std::deque d; + d.push_front(43); + d.push_front(484); + d.push_front(3); + d.push_front(844); + int total = 0; + for (auto i = d.begin(); i != d.end(); ++i) { total += *i; } + + auto a1 = 6538; + auto a2 = 48573953.4; + auto a3 = "String literal"; + + decltype(a2) a4 = 34895.034; +} +{ + // Test constexpr + short sa[cxx11test::get_val()] = { 0 }; +} +{ + // Test initializer lists + cxx11test::testinit il = { 4323, 435234.23544 }; +} +{ + // Test range-based for and lambda + cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + for (int &x : array) { x += 23; } + std::for_each(array.begin(), array.end(), [](int v1){ std::cout << v1; }); +} +{ + using cxx11test::sptr; + using cxx11test::wptr; + + sptr sp(new std::string("ASCII string")); + wptr wp(sp); + sptr sp2(wp); +} +{ + cxx11test::tp tuple("test", 54, 45.53434); + double d = std::get<2>(tuple); + std::string s; + int i; + std::tie(s,i,d) = tuple; +} +{ + static std::regex filename_regex("^_?([a-z0-9_.]+-)+[a-z0-9]+$"); + std::string testmatch("Test if this string matches"); + bool match = std::regex_search(testmatch, filename_regex); +} +{ + cxx11test::int_array array = {9, 7, 13, 15, 4, 18, 12, 10, 5, 3, 14, 19, 17, 8, 6, 20, 16, 2, 11, 1}; + cxx11test::int_array::size_type size = array.size(); +} +{ + // Test constructor delegation + cxx11test::delegate d1; + cxx11test::delegate d2(); + cxx11test::delegate d3(45); +} +{ + // Test override and final + cxx11test::overridden o1(55464); +} +{ + // Test nullptr + char *c = nullptr; +} +{ + // Test template brackets + std::vector> v1; +} +{ + // Unicode literals + char const *utf8 = u8"UTF-8 string \u2500"; + char16_t const *utf16 = u"UTF-8 string \u2500"; + char32_t const *utf32 = U"UTF-32 string \u2500"; +} +]]) + +# _AC_PROG_CXX_CXX98 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +# ------------------------------------------------------------------- + +# If the C++ compiler is not in ISO C++98 mode by default, try to add +# an option to output variable CXX to make it so. This macro tries +# various options that select ISO C++98 on some system or another. It +# considers the compiler to be in ISO C++98 mode if it handles basic +# features of the std namespace including: string, containers (list, +# map, set, vector), streams (fstreams, iostreams, stringstreams, +# iomanip), pair, exceptions and algorithms. + + +AC_DEFUN([_AC_PROG_CXX_CXX98], +[_AC_CXX_STD_TRY([cxx98], +[_AC_CXX_CXX98_TEST_HEADER], +[_AC_CXX_CXX98_TEST_BODY], +dnl Try +dnl GCC -std=gnu++98 (unused restrictive mode: -std=c++98) +dnl IBM XL C -qlanglvl=extended +dnl HP aC++ -AA +dnl Intel ICC -std=gnu++98 +dnl Solaris N/A (default) +dnl Tru64 N/A (default, but -std gnu could be used) +dnl with extended modes being tried first. +[[-std=gnu++98 -std=c++98 -qlanglvl=extended -AA]], [$1], [$2])[]dnl +])# _AC_PROG_CXX_CXX98 + +# _AC_PROG_CXX_CXX11 ([ACTION-IF-AVAILABLE], [ACTION-IF-UNAVAILABLE]) +# ------------------------------------------------------------------- +# If the C++ compiler is not in ISO CXX11 mode by default, try to add +# an option to output variable CXX to make it so. This macro tries +# various options that select ISO C++11 on some system or another. It +# considers the compiler to be in ISO C++11 mode if it handles all the +# tests from the C++98 checks, plus the following: Language features +# (auto, constexpr, decltype, default/deleted constructors, delegate +# constructors, final, initializer lists, lambda functions, nullptr, +# override, range-based for loops, template brackets without spaces, +# unicode literals) and library features (array, memory (shared_ptr, +# weak_ptr), regex and tuple types). +AC_DEFUN([_AC_PROG_CXX_CXX11], +[_AC_CXX_STD_TRY([cxx11], +[_AC_CXX_CXX11_TEST_HEADER +_AC_CXX_CXX98_TEST_HEADER], +[_AC_CXX_CXX11_TEST_BODY +_AC_CXX_CXX98_TEST_BODY], +dnl Try +dnl GCC -std=gnu++11 (unused restrictive mode: -std=c++11) [and 0x variants] +dnl IBM XL C -qlanglvl=extended0x +dnl (pre-V12.1; unused restrictive mode: -qlanglvl=stdcxx11) +dnl HP aC++ -AA +dnl Intel ICC -std=c++11 -std=c++0x +dnl Solaris N/A (no support) +dnl Tru64 N/A (no support) +dnl with extended modes being tried first. +[[-std=gnu++11 -std=c++11 -std=gnu++0x -std=c++0x -qlanglvl=extended0x -AA]], [$1], [$2])[]dnl +])# _AC_PROG_CXX_CXX11 + + +])# m4_version_prereq diff --git a/gnulib-m4/stdbool.m4 b/gnulib-m4/stdbool.m4 new file mode 100644 index 0000000..3169779 --- /dev/null +++ b/gnulib-m4/stdbool.m4 @@ -0,0 +1,122 @@ +# Check for stdbool.h that conforms to C99. + +dnl Copyright (C) 2002-2006, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +#serial 8 + +# Prepare for substituting if it is not supported. + +AC_DEFUN([AM_STDBOOL_H], +[ + AC_REQUIRE([AC_CHECK_HEADER_STDBOOL]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + dnl On some platforms, does not exist or does not conform to C99. + dnl On Solaris 10 with CC=cc CXX=CC, exists but is not usable + dnl in C++ mode (and no exists). In this case, we use our + dnl replacement, also in C mode (for binary compatibility between C and C++). + if test "$ac_cv_header_stdbool_h" = yes; then + case "$host_os" in + solaris*) + if test -z "$GCC"; then + STDBOOL_H='stdbool.h' + else + STDBOOL_H='' + fi + ;; + *) + STDBOOL_H='' + ;; + esac + else + STDBOOL_H='stdbool.h' + fi + AC_SUBST([STDBOOL_H]) + AM_CONDITIONAL([GL_GENERATE_STDBOOL_H], [test -n "$STDBOOL_H"]) + + if test "$ac_cv_type__Bool" = yes; then + HAVE__BOOL=1 + else + HAVE__BOOL=0 + fi + AC_SUBST([HAVE__BOOL]) +]) + +# AM_STDBOOL_H will be renamed to gl_STDBOOL_H in the future. +AC_DEFUN([gl_STDBOOL_H], [AM_STDBOOL_H]) + +# This version of the macro is needed in autoconf <= 2.68. + +AC_DEFUN([AC_CHECK_HEADER_STDBOOL], + [AC_CACHE_CHECK([for stdbool.h that conforms to C99], + [ac_cv_header_stdbool_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ + #include + + #ifdef __cplusplus + typedef bool Bool; + #else + typedef _Bool Bool; + #ifndef bool + "error: bool is not defined" + #endif + #ifndef false + "error: false is not defined" + #endif + #if false + "error: false is not 0" + #endif + #ifndef true + "error: true is not defined" + #endif + #if true != 1 + "error: true is not 1" + #endif + #endif + + #ifndef __bool_true_false_are_defined + "error: __bool_true_false_are_defined is not defined" + #endif + + struct s { Bool s: 1; Bool t; bool u: 1; bool v; } s; + + char a[true == 1 ? 1 : -1]; + char b[false == 0 ? 1 : -1]; + char c[__bool_true_false_are_defined == 1 ? 1 : -1]; + char d[(bool) 0.5 == true ? 1 : -1]; + /* See body of main program for 'e'. */ + char f[(Bool) 0.0 == false ? 1 : -1]; + char g[true]; + char h[sizeof (Bool)]; + char i[sizeof s.t]; + enum { j = false, k = true, l = false * true, m = true * 256 }; + /* The following fails for + HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */ + Bool n[m]; + char o[sizeof n == m * sizeof n[0] ? 1 : -1]; + char p[-1 - (Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1]; + /* Catch a bug in an HP-UX C compiler. See + https://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html + https://lists.gnu.org/r/bug-coreutils/2005-11/msg00161.html + */ + Bool q = true; + Bool *pq = &q; + bool *qq = &q; + ]], + [[ + bool e = &s; + *pq |= q; *pq |= ! q; + *qq |= q; *qq |= ! q; + /* Refer to every declared value, to avoid compiler optimizations. */ + return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l + + !m + !n + !o + !p + !q + !pq + !qq); + ]])], + [ac_cv_header_stdbool_h=yes], + [ac_cv_header_stdbool_h=no])]) + AC_CHECK_TYPES([_Bool]) +]) diff --git a/gnulib-m4/stddef_h.m4 b/gnulib-m4/stddef_h.m4 new file mode 100644 index 0000000..1303d2e --- /dev/null +++ b/gnulib-m4/stddef_h.m4 @@ -0,0 +1,99 @@ +# stddef_h.m4 serial 11 +dnl Copyright (C) 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl A placeholder for , for platforms that have issues. + +AC_DEFUN_ONCE([gl_STDDEF_H], +[ + AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) + AC_REQUIRE([gt_TYPE_WCHAR_T]) + + dnl Persuade OpenBSD to declare max_align_t. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + STDDEF_H= + + dnl Test whether the type max_align_t exists and whether its alignment + dnl "is as great as is supported by the implementation in all contexts". + AC_CACHE_CHECK([for good max_align_t], + [gl_cv_type_max_align_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + unsigned int s = sizeof (max_align_t); + #if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ + int check1[2 * (__alignof__ (double) <= __alignof__ (max_align_t)) - 1]; + int check2[2 * (__alignof__ (long double) <= __alignof__ (max_align_t)) - 1]; + #endif + typedef struct { char a; max_align_t b; } max_helper; + typedef struct { char a; long b; } long_helper; + typedef struct { char a; double b; } double_helper; + typedef struct { char a; long double b; } long_double_helper; + int check3[2 * (offsetof (long_helper, b) <= offsetof (max_helper, b)) - 1]; + int check4[2 * (offsetof (double_helper, b) <= offsetof (max_helper, b)) - 1]; + int check5[2 * (offsetof (long_double_helper, b) <= offsetof (max_helper, b)) - 1]; + ]])], + [gl_cv_type_max_align_t=yes], + [gl_cv_type_max_align_t=no]) + ]) + if test $gl_cv_type_max_align_t = no; then + HAVE_MAX_ALIGN_T=0 + STDDEF_H=stddef.h + fi + + if test $gt_cv_c_wchar_t = no; then + HAVE_WCHAR_T=0 + STDDEF_H=stddef.h + fi + + AC_CACHE_CHECK([whether NULL can be used in arbitrary expressions], + [gl_cv_decl_null_works], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include + int test[2 * (sizeof NULL == sizeof (void *)) -1]; +]])], + [gl_cv_decl_null_works=yes], + [gl_cv_decl_null_works=no])]) + if test $gl_cv_decl_null_works = no; then + REPLACE_NULL=1 + STDDEF_H=stddef.h + fi + + AC_SUBST([STDDEF_H]) + AM_CONDITIONAL([GL_GENERATE_STDDEF_H], [test -n "$STDDEF_H"]) + if test -n "$STDDEF_H"; then + gl_NEXT_HEADERS([stddef.h]) + fi +]) + +# gl_STDDEF_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_STDDEF_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_STDDEF_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STDDEF_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS], [ + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STDDEF_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_STDDEF_H_DEFAULTS]) +]) + +AC_DEFUN([gl_STDDEF_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + REPLACE_NULL=0; AC_SUBST([REPLACE_NULL]) + HAVE_MAX_ALIGN_T=1; AC_SUBST([HAVE_MAX_ALIGN_T]) + HAVE_WCHAR_T=1; AC_SUBST([HAVE_WCHAR_T]) +]) diff --git a/gnulib-m4/stdint.m4 b/gnulib-m4/stdint.m4 new file mode 100644 index 0000000..2eb1652 --- /dev/null +++ b/gnulib-m4/stdint.m4 @@ -0,0 +1,533 @@ +# stdint.m4 serial 60 +dnl Copyright (C) 2001-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Paul Eggert and Bruno Haible. +dnl Test whether is supported or must be substituted. + +AC_PREREQ([2.61]) + +AC_DEFUN_ONCE([gl_STDINT_H], +[ + AC_PREREQ([2.59])dnl + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + + AC_REQUIRE([gl_LIMITS_H]) + AC_REQUIRE([gt_TYPE_WINT_T]) + + dnl For backward compatibility. Some packages may still be testing these + dnl macros. + AC_DEFINE([HAVE_LONG_LONG_INT], [1], + [Define to 1 if the system has the type 'long long int'.]) + AC_DEFINE([HAVE_UNSIGNED_LONG_LONG_INT], [1], + [Define to 1 if the system has the type 'unsigned long long int'.]) + + dnl Check for , in the same way as gl_WCHAR_H does. + AC_CHECK_HEADERS_ONCE([wchar.h]) + if test $ac_cv_header_wchar_h = yes; then + HAVE_WCHAR_H=1 + else + HAVE_WCHAR_H=0 + fi + AC_SUBST([HAVE_WCHAR_H]) + + dnl Check for . + AC_CHECK_HEADERS_ONCE([inttypes.h]) + if test $ac_cv_header_inttypes_h = yes; then + HAVE_INTTYPES_H=1 + else + HAVE_INTTYPES_H=0 + fi + AC_SUBST([HAVE_INTTYPES_H]) + + dnl Check for . + AC_CHECK_HEADERS_ONCE([sys/types.h]) + if test $ac_cv_header_sys_types_h = yes; then + HAVE_SYS_TYPES_H=1 + else + HAVE_SYS_TYPES_H=0 + fi + AC_SUBST([HAVE_SYS_TYPES_H]) + + gl_CHECK_NEXT_HEADERS([stdint.h]) + if test $ac_cv_header_stdint_h = yes; then + HAVE_STDINT_H=1 + else + HAVE_STDINT_H=0 + fi + AC_SUBST([HAVE_STDINT_H]) + + dnl Now see whether we need a substitute . + if test $ac_cv_header_stdint_h = yes; then + AC_CACHE_CHECK([whether stdint.h conforms to C99], + [gl_cv_header_working_stdint_h], + [gl_cv_header_working_stdint_h=no + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 +#include +/* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in . */ +#if !(defined WCHAR_MIN && defined WCHAR_MAX) +#error "WCHAR_MIN, WCHAR_MAX not defined in " +#endif +] +gl_STDINT_INCLUDES +[ +#ifdef INT8_MAX +int8_t a1 = INT8_MAX; +int8_t a1min = INT8_MIN; +#endif +#ifdef INT16_MAX +int16_t a2 = INT16_MAX; +int16_t a2min = INT16_MIN; +#endif +#ifdef INT32_MAX +int32_t a3 = INT32_MAX; +int32_t a3min = INT32_MIN; +#endif +#ifdef INT64_MAX +int64_t a4 = INT64_MAX; +int64_t a4min = INT64_MIN; +#endif +#ifdef UINT8_MAX +uint8_t b1 = UINT8_MAX; +#else +typedef int b1[(unsigned char) -1 != 255 ? 1 : -1]; +#endif +#ifdef UINT16_MAX +uint16_t b2 = UINT16_MAX; +#endif +#ifdef UINT32_MAX +uint32_t b3 = UINT32_MAX; +#endif +#ifdef UINT64_MAX +uint64_t b4 = UINT64_MAX; +#endif +int_least8_t c1 = INT8_C (0x7f); +int_least8_t c1max = INT_LEAST8_MAX; +int_least8_t c1min = INT_LEAST8_MIN; +int_least16_t c2 = INT16_C (0x7fff); +int_least16_t c2max = INT_LEAST16_MAX; +int_least16_t c2min = INT_LEAST16_MIN; +int_least32_t c3 = INT32_C (0x7fffffff); +int_least32_t c3max = INT_LEAST32_MAX; +int_least32_t c3min = INT_LEAST32_MIN; +int_least64_t c4 = INT64_C (0x7fffffffffffffff); +int_least64_t c4max = INT_LEAST64_MAX; +int_least64_t c4min = INT_LEAST64_MIN; +uint_least8_t d1 = UINT8_C (0xff); +uint_least8_t d1max = UINT_LEAST8_MAX; +uint_least16_t d2 = UINT16_C (0xffff); +uint_least16_t d2max = UINT_LEAST16_MAX; +uint_least32_t d3 = UINT32_C (0xffffffff); +uint_least32_t d3max = UINT_LEAST32_MAX; +uint_least64_t d4 = UINT64_C (0xffffffffffffffff); +uint_least64_t d4max = UINT_LEAST64_MAX; +int_fast8_t e1 = INT_FAST8_MAX; +int_fast8_t e1min = INT_FAST8_MIN; +int_fast16_t e2 = INT_FAST16_MAX; +int_fast16_t e2min = INT_FAST16_MIN; +int_fast32_t e3 = INT_FAST32_MAX; +int_fast32_t e3min = INT_FAST32_MIN; +int_fast64_t e4 = INT_FAST64_MAX; +int_fast64_t e4min = INT_FAST64_MIN; +uint_fast8_t f1 = UINT_FAST8_MAX; +uint_fast16_t f2 = UINT_FAST16_MAX; +uint_fast32_t f3 = UINT_FAST32_MAX; +uint_fast64_t f4 = UINT_FAST64_MAX; +#ifdef INTPTR_MAX +intptr_t g = INTPTR_MAX; +intptr_t gmin = INTPTR_MIN; +#endif +#ifdef UINTPTR_MAX +uintptr_t h = UINTPTR_MAX; +#endif +intmax_t i = INTMAX_MAX; +uintmax_t j = UINTMAX_MAX; + +/* Check that SIZE_MAX has the correct type, if possible. */ +#if 201112 <= __STDC_VERSION__ +int k = _Generic (SIZE_MAX, size_t: 0); +#elif (2 <= __GNUC__ || 4 <= __clang_major__ || defined __IBM__TYPEOF__ \ + || (0x5110 <= __SUNPRO_C && !__STDC__)) +extern size_t k; +extern __typeof__ (SIZE_MAX) k; +#endif + +#include /* for CHAR_BIT */ +#define TYPE_MINIMUM(t) \ + ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t))) +#define TYPE_MAXIMUM(t) \ + ((t) ((t) 0 < (t) -1 \ + ? (t) -1 \ + : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) +struct s { + int check_PTRDIFF: + PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t) + && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t) + ? 1 : -1; + /* Detect bug in FreeBSD 6.0/ia64 and FreeBSD 13.0/arm64. */ + int check_SIG_ATOMIC: + SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t) + && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t) + ? 1 : -1; + int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1; + int check_WCHAR: + WCHAR_MIN == TYPE_MINIMUM (wchar_t) + && WCHAR_MAX == TYPE_MAXIMUM (wchar_t) + ? 1 : -1; + /* Detect bug in mingw. */ + int check_WINT: + WINT_MIN == TYPE_MINIMUM (wint_t) + && WINT_MAX == TYPE_MAXIMUM (wint_t) + ? 1 : -1; + + /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */ + int check_UINT8_C: + (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1; + int check_UINT16_C: + (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1; + + /* Detect bugs in OpenBSD 3.9 stdint.h. */ +#ifdef UINT8_MAX + int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1; +#endif +#ifdef UINT16_MAX + int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1; +#endif +#ifdef UINT32_MAX + int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1; +#endif +#ifdef UINT64_MAX + int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1; +#endif + int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1; + int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1; + int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1; + int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1; + int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1; + int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1; + int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1; + int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1; + int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1; + int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1; + int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; +}; + ]])], + [dnl Determine whether the various *_MIN, *_MAX macros are usable + dnl in preprocessor expression. We could do it by compiling a test + dnl program for each of these macros. It is faster to run a program + dnl that inspects the macro expansion. + dnl This detects a bug on HP-UX 11.23/ia64. + AC_RUN_IFELSE([ + AC_LANG_PROGRAM([[ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#define __STDC_CONSTANT_MACROS 1 +#define __STDC_LIMIT_MACROS 1 +#include +] +gl_STDINT_INCLUDES +[ +#include +#include +#define MVAL(macro) MVAL1(macro) +#define MVAL1(expression) #expression +static const char *macro_values[] = + { +#ifdef INT8_MAX + MVAL (INT8_MAX), +#endif +#ifdef INT16_MAX + MVAL (INT16_MAX), +#endif +#ifdef INT32_MAX + MVAL (INT32_MAX), +#endif +#ifdef INT64_MAX + MVAL (INT64_MAX), +#endif +#ifdef UINT8_MAX + MVAL (UINT8_MAX), +#endif +#ifdef UINT16_MAX + MVAL (UINT16_MAX), +#endif +#ifdef UINT32_MAX + MVAL (UINT32_MAX), +#endif +#ifdef UINT64_MAX + MVAL (UINT64_MAX), +#endif + NULL + }; +]], [[ + const char **mv; + for (mv = macro_values; *mv != NULL; mv++) + { + const char *value = *mv; + /* Test whether it looks like a cast expression. */ + if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0 + || strncmp (value, "((unsigned short)"/*)*/, 17) == 0 + || strncmp (value, "((unsigned char)"/*)*/, 16) == 0 + || strncmp (value, "((int)"/*)*/, 6) == 0 + || strncmp (value, "((signed short)"/*)*/, 15) == 0 + || strncmp (value, "((signed char)"/*)*/, 14) == 0) + return mv - macro_values + 1; + } + return 0; +]])], + [gl_cv_header_working_stdint_h=yes], + [], + [case "$host_os" in + # Guess yes on native Windows. + mingw*) gl_cv_header_working_stdint_h="guessing yes" ;; + # In general, assume it works. + *) gl_cv_header_working_stdint_h="guessing yes" ;; + esac + ]) + ]) + ]) + fi + + HAVE_C99_STDINT_H=0 + HAVE_SYS_BITYPES_H=0 + HAVE_SYS_INTTYPES_H=0 + STDINT_H=stdint.h + case "$gl_cv_header_working_stdint_h" in + *yes) + HAVE_C99_STDINT_H=1 + dnl Now see whether the system works without + dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined. + dnl If not, there would be problems when stdint.h is included from C++. + AC_CACHE_CHECK([whether stdint.h works without ISO C predefines], + [gl_cv_header_stdint_without_STDC_macros], + [gl_cv_header_stdint_without_STDC_macros=no + AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[ +#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */ +#include +] +gl_STDINT_INCLUDES +[ +intmax_t im = INTMAX_MAX; +int32_t i32 = INT32_C (0x7fffffff); + ]])], + [gl_cv_header_stdint_without_STDC_macros=yes]) + ]) + + if test $gl_cv_header_stdint_without_STDC_macros = no; then + AC_DEFINE([__STDC_CONSTANT_MACROS], [1], + [Define to 1 if the system predates C++11.]) + AC_DEFINE([__STDC_LIMIT_MACROS], [1], + [Define to 1 if the system predates C++11.]) + fi + AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.], + [gl_cv_header_stdint_width], + [gl_cv_header_stdint_width=no + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[ + /* Work if build is not clean. */ + #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 + #ifndef __STDC_WANT_IEC_60559_BFP_EXT__ + #define __STDC_WANT_IEC_60559_BFP_EXT__ 1 + #endif + #include + ]gl_STDINT_INCLUDES[ + int iw = UINTMAX_WIDTH; + ]])], + [gl_cv_header_stdint_width=yes])]) + if test "$gl_cv_header_stdint_width" = yes; then + STDINT_H= + fi + ;; + *) + dnl Check for , and for + dnl (used in Linux libc4 >= 4.6.7 and libc5). + AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h]) + if test $ac_cv_header_sys_inttypes_h = yes; then + HAVE_SYS_INTTYPES_H=1 + fi + if test $ac_cv_header_sys_bitypes_h = yes; then + HAVE_SYS_BITYPES_H=1 + fi + gl_STDINT_TYPE_PROPERTIES + ;; + esac + + dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH. + gl_REPLACE_LIMITS_H + + AC_SUBST([HAVE_C99_STDINT_H]) + AC_SUBST([HAVE_SYS_BITYPES_H]) + AC_SUBST([HAVE_SYS_INTTYPES_H]) + AC_SUBST([STDINT_H]) + AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"]) +]) + +dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES) +dnl Determine the size of each of the given types in bits. +AC_DEFUN([gl_STDINT_BITSIZEOF], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + m4_foreach_w([gltype], [$1], + [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), + [Define to the number of bits in type ']gltype['.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}], + [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT], + [$2 +#include ], [result=unknown]) + eval gl_cv_bitsizeof_${gltype}=\$result + ]) + eval result=\$gl_cv_bitsizeof_${gltype} + if test $result = unknown; then + dnl Use a nonempty default, because some compilers, such as IRIX 5 cc, + dnl do a syntax check even on unused #if conditions and give an error + dnl on valid C code like this: + dnl #if 0 + dnl # if > 32 + dnl # endif + dnl #endif + result=0 + fi + GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result]) + eval BITSIZEOF_${GLTYPE}=\$result + done + m4_foreach_w([gltype], [$1], + [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) +]) + +dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES) +dnl Determine the signedness of each of the given types. +dnl Define HAVE_SIGNED_TYPE if type is signed. +AC_DEFUN([gl_CHECK_TYPES_SIGNED], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + m4_foreach_w([gltype], [$1], + [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]), + [Define to 1 if ']gltype[' is a signed integer type.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([$2[ + int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])], + result=yes, result=no) + eval gl_cv_type_${gltype}_signed=\$result + ]) + eval result=\$gl_cv_type_${gltype}_signed + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + if test "$result" = yes; then + AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1]) + eval HAVE_SIGNED_${GLTYPE}=1 + else + eval HAVE_SIGNED_${GLTYPE}=0 + fi + done + m4_foreach_w([gltype], [$1], + [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))]) +]) + +dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES) +dnl Determine the suffix to use for integer constants of the given types. +dnl Define t_SUFFIX for each such type. +AC_DEFUN([gl_INTEGER_TYPE_SUFFIX], +[ + dnl Use a shell loop, to avoid bloating configure, and + dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into + dnl config.h.in, + dnl - extra AC_SUBST calls, so that the right substitutions are made. + m4_foreach_w([gltype], [$1], + [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX], + [Define to l, ll, u, ul, ull, etc., as suitable for + constants of type ']gltype['.])]) + for gltype in $1 ; do + AC_CACHE_CHECK([for $gltype integer literal suffix], + [gl_cv_type_${gltype}_suffix], + [eval gl_cv_type_${gltype}_suffix=no + eval result=\$gl_cv_type_${gltype}_signed + if test "$result" = yes; then + glsufu= + else + glsufu=u + fi + for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do + case $glsuf in + '') gltype1='int';; + l) gltype1='long int';; + ll) gltype1='long long int';; + i64) gltype1='__int64';; + u) gltype1='unsigned int';; + ul) gltype1='unsigned long int';; + ull) gltype1='unsigned long long int';; + ui64)gltype1='unsigned __int64';; + esac + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([$2[ + extern $gltype foo; + extern $gltype1 foo;]])], + [eval gl_cv_type_${gltype}_suffix=\$glsuf]) + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" != no && break + done]) + GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'` + eval result=\$gl_cv_type_${gltype}_suffix + test "$result" = no && result= + eval ${GLTYPE}_SUFFIX=\$result + AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result]) + done + m4_foreach_w([gltype], [$1], + [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])]) +]) + +dnl gl_STDINT_INCLUDES +AC_DEFUN([gl_STDINT_INCLUDES], +[[ + #include + #include + #if HAVE_WCHAR_H + # include + #endif +]]) + +dnl gl_STDINT_TYPE_PROPERTIES +dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t +dnl of interest to stdint.in.h. +AC_DEFUN([gl_STDINT_TYPE_PROPERTIES], +[ + AC_REQUIRE([gl_MULTIARCH]) + if test $APPLE_UNIVERSAL_BUILD = 0; then + gl_STDINT_BITSIZEOF([ptrdiff_t size_t], + [gl_STDINT_INCLUDES]) + fi + gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) + gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) + gl_cv_type_ptrdiff_t_signed=yes + gl_cv_type_size_t_signed=no + if test $APPLE_UNIVERSAL_BUILD = 0; then + gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t], + [gl_STDINT_INCLUDES]) + fi + gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t], + [gl_STDINT_INCLUDES]) + + dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99 + dnl requirement that wint_t is "unchanged by default argument promotions". + dnl In this case gnulib's and override wint_t. + dnl Set the variable BITSIZEOF_WINT_T accordingly. + if test $GNULIBHEADERS_OVERRIDE_WINT_T = 1; then + BITSIZEOF_WINT_T=32 + fi +]) diff --git a/gnulib-m4/stdio_h.m4 b/gnulib-m4/stdio_h.m4 new file mode 100644 index 0000000..e704383 --- /dev/null +++ b/gnulib-m4/stdio_h.m4 @@ -0,0 +1,232 @@ +# stdio_h.m4 serial 56 +dnl Copyright (C) 2007-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_STDIO_H], +[ + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) + AH_VERBATIM([MINGW_ANSI_STDIO], +[/* Use GNU style printf and scanf. */ +#ifndef __USE_MINGW_ANSI_STDIO +# undef __USE_MINGW_ANSI_STDIO +#endif +]) + AC_DEFINE([__USE_MINGW_ANSI_STDIO]) + gl_NEXT_HEADERS([stdio.h]) + + dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and + dnl inttypes.h behave like gnu instead of system; we must give our + dnl printf wrapper the right attribute to match. + AC_CACHE_CHECK([which flavor of printf attribute matches inttypes macros], + [gl_cv_func_printf_attribute_flavor], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ + #define __STDC_FORMAT_MACROS 1 + #include + #include + /* For non-mingw systems, compilation will trivially succeed. + For mingw, compilation will succeed for older mingw (system + printf, "I64d") and fail for newer mingw (gnu printf, "lld"). */ + #if (defined _WIN32 && ! defined __CYGWIN__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) + extern char PRIdMAX_probe[sizeof PRIdMAX == sizeof "I64d" ? 1 : -1]; + #endif + ]])], [gl_cv_func_printf_attribute_flavor=system], + [gl_cv_func_printf_attribute_flavor=gnu])]) + if test "$gl_cv_func_printf_attribute_flavor" = gnu; then + AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1], + [Define to 1 if printf and friends should be labeled with + attribute "__gnu_printf__" instead of "__printf__"]) + fi + + dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c" + dnl "expected source file, required through AC_LIBSOURCES, not found". It is + dnl also an optimization, to avoid performing a configure check whose result + dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING + dnl or GNULIB_NONBLOCKING redundant. + m4_ifdef([gl_NONBLOCKING_IO], [ + gl_NONBLOCKING_IO + if test $gl_cv_have_nonblocking != yes; then + REPLACE_STDIO_READ_FUNCS=1 + AC_LIBOBJ([stdio-read]) + fi + ]) + + dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" + dnl "expected source file, required through AC_LIBSOURCES, not found". It is + dnl also an optimization, to avoid performing a configure check whose result + dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or + dnl GNULIB_SIGPIPE redundant. + m4_ifdef([gl_SIGNAL_SIGPIPE], [ + gl_SIGNAL_SIGPIPE + if test $gl_cv_header_signal_h_SIGPIPE != yes; then + REPLACE_STDIO_WRITE_FUNCS=1 + AC_LIBOBJ([stdio-write]) + fi + ]) + dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c" + dnl "expected source file, required through AC_LIBSOURCES, not found". It is + dnl also an optimization, to avoid performing a configure check whose result + dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING + dnl or GNULIB_NONBLOCKING redundant. + m4_ifdef([gl_NONBLOCKING_IO], [ + gl_NONBLOCKING_IO + if test $gl_cv_have_nonblocking != yes; then + REPLACE_STDIO_WRITE_FUNCS=1 + AC_LIBOBJ([stdio-write]) + fi + ]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by both C89 and C11. + gl_WARN_ON_USE_PREPARE([[#include + ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen + renameat snprintf tmpfile vdprintf vsnprintf]) + + AC_REQUIRE([AC_C_RESTRICT]) + + AC_CHECK_DECLS_ONCE([fcloseall]) + if test $ac_cv_have_decl_fcloseall = no; then + HAVE_DECL_FCLOSEALL=0 + fi +]) + +# gl_STDIO_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_STDIO_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_STDIO_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STDIO_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCLOSE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDOPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFLUSH]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FGETS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FOPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPURGE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FPUTS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FREOPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSEEKO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTELLO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FWRITE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCHAR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDELIM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLINE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OBSTACK_PRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PCLOSE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PERROR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_POPEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTCHAR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PUTS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_REMOVE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RENAMEAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SNPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_NONBLOCKING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STDIO_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TMPFILE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VASPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFSCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSCANF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VDPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VFPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VPRINTF_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSNPRINTF]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_VSPRINTF_POSIX]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FCLOSEALL], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FDOPEN], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_FILENO], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETW], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_PUTW], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TEMPNAM], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STDIO_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_STDIO_H_DEFAULTS]) +]) + +AC_DEFUN([gl_STDIO_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_FCLOSEALL=1; AC_SUBST([HAVE_DECL_FCLOSEALL]) + HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE]) + HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO]) + HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO]) + HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM]) + HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE]) + HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF]) + HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF]) + HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF]) + HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF]) + HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO]) + HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO]) + HAVE_PCLOSE=1; AC_SUBST([HAVE_PCLOSE]) + HAVE_POPEN=1; AC_SUBST([HAVE_POPEN]) + HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT]) + HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF]) + HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF]) + REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF]) + REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE]) + REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN]) + REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH]) + REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN]) + REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF]) + REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE]) + REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN]) + REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK]) + REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO]) + REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL]) + REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO]) + REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM]) + REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE]) + REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF]) + REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR]) + REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN]) + REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF]) + REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE]) + REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME]) + REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT]) + REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF]) + REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF]) + REPLACE_STDIO_READ_FUNCS=0; AC_SUBST([REPLACE_STDIO_READ_FUNCS]) + REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS]) + REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE]) + REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF]) + REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF]) + REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF]) + REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF]) + REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF]) + REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF]) +]) diff --git a/gnulib-m4/stdnoreturn.m4 b/gnulib-m4/stdnoreturn.m4 new file mode 100644 index 0000000..207aa24 --- /dev/null +++ b/gnulib-m4/stdnoreturn.m4 @@ -0,0 +1,54 @@ +# Check for stdnoreturn.h that conforms to C11. + +dnl Copyright 2012-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Prepare for substituting if it is not supported. + +AC_DEFUN([gl_STDNORETURN_H], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_os" in + cygwin*) + dnl Regardless whether a working exists or not, + dnl we need our own , because of the definition + dnl of _Noreturn done by gnulib-common.m4. + STDNORETURN_H='stdnoreturn.h' + ;; + *) + AC_CACHE_CHECK([for working stdnoreturn.h], + [gl_cv_header_working_stdnoreturn_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + #if defined _WIN32 && !defined __CYGWIN__ + # include + #endif + /* Do not check for 'noreturn' after the return type. + C11 allows it, but it's rarely done that way + and circa-2012 bleeding-edge GCC rejects it when given + -Werror=old-style-declaration. */ + noreturn void foo1 (void) { exit (0); } + _Noreturn void foo2 (void) { exit (0); } + int testit (int argc, char **argv) + { + if (argc & 1) + return 0; + (argv[0][0] ? foo1 : foo2) (); + } + ]])], + [gl_cv_header_working_stdnoreturn_h=yes], + [gl_cv_header_working_stdnoreturn_h=no])]) + if test $gl_cv_header_working_stdnoreturn_h = yes; then + STDNORETURN_H='' + else + STDNORETURN_H='stdnoreturn.h' + fi + ;; + esac + AC_SUBST([STDNORETURN_H]) + AM_CONDITIONAL([GL_GENERATE_STDNORETURN_H], [test -n "$STDNORETURN_H"]) +]) diff --git a/gnulib-m4/strerror.m4 b/gnulib-m4/strerror.m4 new file mode 100644 index 0000000..438ba92 --- /dev/null +++ b/gnulib-m4/strerror.m4 @@ -0,0 +1,102 @@ +# strerror.m4 serial 22 +dnl Copyright (C) 2002, 2007-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FUNC_STRERROR], +[ + AC_REQUIRE([gl_STRING_H_DEFAULTS]) + AC_REQUIRE([gl_HEADER_ERRNO_H]) + AC_REQUIRE([gl_FUNC_STRERROR_0]) + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ + AC_REQUIRE([gl_FUNC_STRERROR_R_WORKS]) + ]) + if test "$ERRNO_H:$REPLACE_STRERROR_0" = :0; then + AC_CACHE_CHECK([for working strerror function], + [gl_cv_func_working_strerror], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[if (!*strerror (-2)) return 1;]])], + [gl_cv_func_working_strerror=yes], + [gl_cv_func_working_strerror=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_working_strerror="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_working_strerror="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_working_strerror="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_working_strerror" in + *yes) ;; + *) + dnl The system's strerror() fails to return a string for out-of-range + dnl integers. Replace it. + REPLACE_STRERROR=1 + ;; + esac + m4_ifdef([gl_FUNC_STRERROR_R_WORKS], [ + dnl If the system's strerror_r or __xpg_strerror_r clobbers strerror's + dnl buffer, we must replace strerror. + case "$gl_cv_func_strerror_r_works" in + *no) REPLACE_STRERROR=1 ;; + esac + ]) + else + dnl The system's strerror() cannot know about the new errno values we add + dnl to , or any fix for strerror(0). Replace it. + REPLACE_STRERROR=1 + fi +]) + +dnl Detect if strerror(0) passes (that is, does not set errno, and does not +dnl return a string that matches strerror(-1)). +AC_DEFUN([gl_FUNC_STRERROR_0], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles + REPLACE_STRERROR_0=0 + AC_CACHE_CHECK([whether strerror(0) succeeds], + [gl_cv_func_strerror_0_works], + [AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[#include + #include + ]], + [[int result = 0; + char *str; + errno = 0; + str = strerror (0); + if (!*str) result |= 1; + if (errno) result |= 2; + if (strstr (str, "nknown") || strstr (str, "ndefined")) + result |= 4; + return result;]])], + [gl_cv_func_strerror_0_works=yes], + [gl_cv_func_strerror_0_works=no], + [case "$host_os" in + # Guess yes on glibc systems. + *-gnu* | gnu*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on musl systems. + *-musl*) gl_cv_func_strerror_0_works="guessing yes" ;; + # Guess yes on native Windows. + mingw*) gl_cv_func_strerror_0_works="guessing yes" ;; + # If we don't know, obey --enable-cross-guesses. + *) gl_cv_func_strerror_0_works="$gl_cross_guess_normal" ;; + esac + ]) + ]) + case "$gl_cv_func_strerror_0_works" in + *yes) ;; + *) + REPLACE_STRERROR_0=1 + AC_DEFINE([REPLACE_STRERROR_0], [1], [Define to 1 if strerror(0) + does not return a message implying success.]) + ;; + esac +]) diff --git a/gnulib-m4/string_h.m4 b/gnulib-m4/string_h.m4 new file mode 100644 index 0000000..80d1e58 --- /dev/null +++ b/gnulib-m4/string_h.m4 @@ -0,0 +1,143 @@ +# Configure a GNU-like replacement for . + +# Copyright (C) 2007-2021 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 32 + +# Written by Paul Eggert. + +AC_DEFUN_ONCE([gl_STRING_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_STRING_H_DEFAULTS]) + gl_NEXT_HEADERS([string.h]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use, and which is not + dnl guaranteed by C89. + gl_WARN_ON_USE_PREPARE([[#include + ]], + [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul + strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r + strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) + + AC_REQUIRE([AC_C_RESTRICT]) +]) + +# gl_STRING_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_STRING_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_STRING_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXPLICIT_BZERO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FFSLL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCHRNUL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRDUP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNCAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNDUP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRNLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPBRK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRCASESTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRTOK_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNLEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSRCHR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSNCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPCASECMP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCASESTR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSCSPN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSPBRK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSPN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSSEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MBSTOK_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERROR_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRERRORNAME_NP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGABBREV_NP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SIGDESCR_NP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRSIGNAL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRVERSCMP]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MEMCCPY], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_STRDUP], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_STRING_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_STRING_H_DEFAULTS]) +]) + +AC_DEFUN([gl_STRING_H_DEFAULTS], +[ + HAVE_MBSLEN=0; AC_SUBST([HAVE_MBSLEN]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_EXPLICIT_BZERO=1; AC_SUBST([HAVE_EXPLICIT_BZERO]) + HAVE_FFSL=1; AC_SUBST([HAVE_FFSL]) + HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) + HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) + HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) + HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) + HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) + HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) + HAVE_STPNCPY=1; AC_SUBST([HAVE_STPNCPY]) + HAVE_STRCHRNUL=1; AC_SUBST([HAVE_STRCHRNUL]) + HAVE_DECL_STRDUP=1; AC_SUBST([HAVE_DECL_STRDUP]) + HAVE_DECL_STRNDUP=1; AC_SUBST([HAVE_DECL_STRNDUP]) + HAVE_DECL_STRNLEN=1; AC_SUBST([HAVE_DECL_STRNLEN]) + HAVE_STRPBRK=1; AC_SUBST([HAVE_STRPBRK]) + HAVE_STRSEP=1; AC_SUBST([HAVE_STRSEP]) + HAVE_STRCASESTR=1; AC_SUBST([HAVE_STRCASESTR]) + HAVE_DECL_STRTOK_R=1; AC_SUBST([HAVE_DECL_STRTOK_R]) + HAVE_DECL_STRERROR_R=1; AC_SUBST([HAVE_DECL_STRERROR_R]) + HAVE_STRERRORNAME_NP=1; AC_SUBST([HAVE_STRERRORNAME_NP]) + HAVE_SIGABBREV_NP=1; AC_SUBST([HAVE_SIGABBREV_NP]) + HAVE_SIGDESCR_NP=1; AC_SUBST([HAVE_SIGDESCR_NP]) + HAVE_DECL_STRSIGNAL=1; AC_SUBST([HAVE_DECL_STRSIGNAL]) + HAVE_STRVERSCMP=1; AC_SUBST([HAVE_STRVERSCMP]) + REPLACE_FFSLL=0; AC_SUBST([REPLACE_FFSLL]) + REPLACE_MEMCHR=0; AC_SUBST([REPLACE_MEMCHR]) + REPLACE_MEMMEM=0; AC_SUBST([REPLACE_MEMMEM]) + REPLACE_STPNCPY=0; AC_SUBST([REPLACE_STPNCPY]) + REPLACE_STRCHRNUL=0; AC_SUBST([REPLACE_STRCHRNUL]) + REPLACE_STRDUP=0; AC_SUBST([REPLACE_STRDUP]) + REPLACE_STRNCAT=0; AC_SUBST([REPLACE_STRNCAT]) + REPLACE_STRNDUP=0; AC_SUBST([REPLACE_STRNDUP]) + REPLACE_STRNLEN=0; AC_SUBST([REPLACE_STRNLEN]) + REPLACE_STRSTR=0; AC_SUBST([REPLACE_STRSTR]) + REPLACE_STRCASESTR=0; AC_SUBST([REPLACE_STRCASESTR]) + REPLACE_STRTOK_R=0; AC_SUBST([REPLACE_STRTOK_R]) + REPLACE_STRERROR=0; AC_SUBST([REPLACE_STRERROR]) + REPLACE_STRERROR_R=0; AC_SUBST([REPLACE_STRERROR_R]) + REPLACE_STRERRORNAME_NP=0; AC_SUBST([REPLACE_STRERRORNAME_NP]) + REPLACE_STRSIGNAL=0; AC_SUBST([REPLACE_STRSIGNAL]) + UNDEFINE_STRTOK_R=0; AC_SUBST([UNDEFINE_STRTOK_R]) +]) diff --git a/gnulib-m4/sys_socket_h.m4 b/gnulib-m4/sys_socket_h.m4 new file mode 100644 index 0000000..5676a0d --- /dev/null +++ b/gnulib-m4/sys_socket_h.m4 @@ -0,0 +1,205 @@ +# sys_socket_h.m4 serial 28 +dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Simon Josefsson. + +AC_DEFUN_ONCE([gl_SYS_SOCKET_H], +[ + AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) + AC_REQUIRE([AC_CANONICAL_HOST]) + + dnl On OSF/1, the functions recv(), send(), recvfrom(), sendto() have + dnl old-style declarations (with return type 'int' instead of 'ssize_t') + dnl unless _POSIX_PII_SOCKET is defined. + case "$host_os" in + osf*) + AC_DEFINE([_POSIX_PII_SOCKET], [1], + [Define to 1 in order to get the POSIX compatible declarations + of socket functions.]) + ;; + esac + + AC_CACHE_CHECK([whether is self-contained], + [gl_cv_header_sys_socket_h_selfcontained], + [ + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], [[]])], + [gl_cv_header_sys_socket_h_selfcontained=yes], + [gl_cv_header_sys_socket_h_selfcontained=no]) + ]) + if test $gl_cv_header_sys_socket_h_selfcontained = yes; then + dnl If the shutdown function exists, should define + dnl SHUT_RD, SHUT_WR, SHUT_RDWR. + AC_CHECK_FUNCS([shutdown]) + if test $ac_cv_func_shutdown = yes; then + AC_CACHE_CHECK([whether defines the SHUT_* macros], + [gl_cv_header_sys_socket_h_shut], + [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[int a[] = { SHUT_RD, SHUT_WR, SHUT_RDWR };]])], + [gl_cv_header_sys_socket_h_shut=yes], + [gl_cv_header_sys_socket_h_shut=no]) + ]) + if test $gl_cv_header_sys_socket_h_shut = no; then + SYS_SOCKET_H='sys/socket.h' + fi + fi + fi + # We need to check for ws2tcpip.h now. + gl_PREREQ_SYS_H_SOCKET + AC_CHECK_TYPES([struct sockaddr_storage, sa_family_t],,,[ + /* sys/types.h is not needed according to POSIX, but the + sys/socket.h in i386-unknown-freebsd4.10 and + powerpc-apple-darwin5.5 required it. */ +#include +#ifdef HAVE_SYS_SOCKET_H +#include +#endif +#ifdef HAVE_WS2TCPIP_H +#include +#endif +]) + if test $ac_cv_type_struct_sockaddr_storage = no; then + HAVE_STRUCT_SOCKADDR_STORAGE=0 + fi + if test $ac_cv_type_sa_family_t = no; then + HAVE_SA_FAMILY_T=0 + fi + if test $ac_cv_type_struct_sockaddr_storage != no; then + AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family], + [], + [HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=0], + [#include + #ifdef HAVE_SYS_SOCKET_H + #include + #endif + #ifdef HAVE_WS2TCPIP_H + #include + #endif + ]) + fi + if test $HAVE_STRUCT_SOCKADDR_STORAGE = 0 || test $HAVE_SA_FAMILY_T = 0 \ + || test $HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY = 0; then + SYS_SOCKET_H='sys/socket.h' + fi + gl_PREREQ_SYS_H_WINSOCK2 + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +/* Some systems require prerequisite headers. */ +#include +#include + ]], [socket connect accept bind getpeername getsockname getsockopt + listen recv send recvfrom sendto setsockopt shutdown accept4]) + + AC_REQUIRE([AC_C_RESTRICT]) +]) + +AC_DEFUN([gl_PREREQ_SYS_H_SOCKET], +[ + dnl Check prerequisites of the replacement. + AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) + gl_CHECK_NEXT_HEADERS([sys/socket.h]) + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_SYS_SOCKET_H=1 + else + HAVE_SYS_SOCKET_H=0 + fi + AC_SUBST([HAVE_SYS_SOCKET_H]) + gl_PREREQ_SYS_H_WS2TCPIP +]) + +# Common prerequisites of the replacement and of the +# replacement. +# Sets and substitutes HAVE_WINSOCK2_H. +AC_DEFUN([gl_PREREQ_SYS_H_WINSOCK2], +[ + m4_ifdef([gl_UNISTD_H_DEFAULTS], [AC_REQUIRE([gl_UNISTD_H_DEFAULTS])]) + m4_ifdef([gl_SYS_IOCTL_H_DEFAULTS], [AC_REQUIRE([gl_SYS_IOCTL_H_DEFAULTS])]) + AC_CHECK_HEADERS_ONCE([sys/socket.h]) + if test $ac_cv_header_sys_socket_h != yes; then + dnl We cannot use AC_CHECK_HEADERS_ONCE here, because that would make + dnl the check for those headers unconditional; yet cygwin reports + dnl that the headers are present but cannot be compiled (since on + dnl cygwin, all socket information should come from sys/socket.h). + AC_CHECK_HEADERS([winsock2.h]) + fi + if test "$ac_cv_header_winsock2_h" = yes; then + HAVE_WINSOCK2_H=1 + UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + AC_SUBST([HAVE_WINSOCK2_H]) +]) + +# Common prerequisites of the replacement and of the +# replacement. +# Sets and substitutes HAVE_WS2TCPIP_H. +AC_DEFUN([gl_PREREQ_SYS_H_WS2TCPIP], +[ + AC_REQUIRE([gl_CHECK_SOCKET_HEADERS]) + if test $ac_cv_header_sys_socket_h = yes; then + HAVE_WS2TCPIP_H=0 + else + if test $ac_cv_header_ws2tcpip_h = yes; then + HAVE_WS2TCPIP_H=1 + else + HAVE_WS2TCPIP_H=0 + fi + fi + AC_SUBST([HAVE_WS2TCPIP_H]) +]) + +# gl_SYS_SOCKET_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SYS_SOCKET_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SYS_SOCKET_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_SOCKET_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SOCKET]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CONNECT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_BIND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPEERNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETSOCKOPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LISTEN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SEND]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RECVFROM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SENDTO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETSOCKOPT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SHUTDOWN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCEPT4]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_SOCKET_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_SOCKET_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_SOCKET_H_DEFAULTS], +[ + HAVE_STRUCT_SOCKADDR_STORAGE=1; AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE]) + HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY=1; + AC_SUBST([HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY]) + HAVE_SA_FAMILY_T=1; AC_SUBST([HAVE_SA_FAMILY_T]) + HAVE_ACCEPT4=1; AC_SUBST([HAVE_ACCEPT4]) +]) diff --git a/gnulib-m4/sys_stat_h.m4 b/gnulib-m4/sys_stat_h.m4 new file mode 100644 index 0000000..ac91d42 --- /dev/null +++ b/gnulib-m4/sys_stat_h.m4 @@ -0,0 +1,127 @@ +# sys_stat_h.m4 serial 41 -*- Autoconf -*- +dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Eric Blake. +dnl Provide a GNU-like . + +AC_DEFUN_ONCE([gl_SYS_STAT_H], +[ + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + + dnl Check for broken stat macros. + AC_REQUIRE([AC_HEADER_STAT]) + + gl_CHECK_NEXT_HEADERS([sys/stat.h]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + + dnl Whether to enable precise timestamps in 'struct stat'. + m4_ifdef([gl_WINDOWS_STAT_TIMESPEC], [ + AC_REQUIRE([gl_WINDOWS_STAT_TIMESPEC]) + ], [ + WINDOWS_STAT_TIMESPEC=0 + ]) + AC_SUBST([WINDOWS_STAT_TIMESPEC]) + + dnl Whether to ensure that struct stat.st_size is 64-bit wide. + m4_ifdef([gl_LARGEFILE], [ + AC_REQUIRE([gl_LARGEFILE]) + ], [ + WINDOWS_64_BIT_ST_SIZE=0 + ]) + AC_SUBST([WINDOWS_64_BIT_ST_SIZE]) + + dnl Define types that are supposed to be defined in or + dnl . + AC_CHECK_TYPE([nlink_t], [], + [AC_DEFINE([nlink_t], [int], + [Define to the type of st_nlink in struct stat, or a supertype.])], + [#include + #include ]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include + ]], [fchmodat fstat fstatat futimens getumask lchmod lstat + mkdirat mkfifo mkfifoat mknod mknodat stat utimensat]) + + AC_REQUIRE([AC_C_RESTRICT]) +]) + +# gl_SYS_STAT_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_SYS_STAT_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [ + gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FUTIMENS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUMASK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHMOD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSTAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIRAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFO]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFOAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNOD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNODAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UTIMENSAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OVERRIDES_STRUCT_STAT]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHMOD], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKDIR], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UMASK], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) + HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) + HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) + HAVE_GETUMASK=1; AC_SUBST([HAVE_GETUMASK]) + HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) + HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) + HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) + HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) + HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) + HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) + HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) + HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) + REPLACE_FCHMODAT=0; AC_SUBST([REPLACE_FCHMODAT]) + REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) + REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) + REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) + REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) + REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) + REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) + REPLACE_MKFIFOAT=0; AC_SUBST([REPLACE_MKFIFOAT]) + REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) + REPLACE_MKNODAT=0; AC_SUBST([REPLACE_MKNODAT]) + REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) + REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) +]) diff --git a/gnulib-m4/sys_types_h.m4 b/gnulib-m4/sys_types_h.m4 new file mode 100644 index 0000000..6dd6fee --- /dev/null +++ b/gnulib-m4/sys_types_h.m4 @@ -0,0 +1,70 @@ +# sys_types_h.m4 serial 13 +dnl Copyright (C) 2011-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN_ONCE([gl_SYS_TYPES_H], +[ + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) + + dnl Use sane struct stat types in OpenVMS 8.2 and later. + AC_DEFINE([_USE_STD_STAT], 1, [For standard stat data types on VMS.]) + + gl_NEXT_HEADERS([sys/types.h]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + + dnl Whether to override the 'off_t' type. + AC_REQUIRE([gl_TYPE_OFF_T]) + + dnl Whether to override the 'dev_t' and 'ino_t' types. + m4_ifdef([gl_WINDOWS_STAT_INODES], [ + AC_REQUIRE([gl_WINDOWS_STAT_INODES]) + ], [ + WINDOWS_STAT_INODES=0 + ]) + AC_SUBST([WINDOWS_STAT_INODES]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_SYS_TYPES_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS], [ + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_TYPE_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_SYS_TYPES_H_DEFAULTS]) +]) + +AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], +[ +]) + +# This works around a buggy version in autoconf <= 2.69. +# See +# The 2.70 version isn't quoted properly, so override it too. + +m4_version_prereq([2.70.1], [], [ + +m4_undefine([AC_HEADER_MAJOR]) +AC_DEFUN([AC_HEADER_MAJOR], +[AC_CHECK_HEADERS_ONCE([sys/types.h]) +AC_CHECK_HEADER([sys/mkdev.h], + [AC_DEFINE([MAJOR_IN_MKDEV], [1], + [Define to 1 if `major', `minor', and `makedev' are + declared in .])]) +if test $ac_cv_header_sys_mkdev_h = no; then + AC_CHECK_HEADER([sys/sysmacros.h], + [AC_DEFINE([MAJOR_IN_SYSMACROS], [1], + [Define to 1 if `major', `minor', and `makedev' + are declared in .])]) +fi +])# AC_HEADER_MAJOR + +]) diff --git a/gnulib-m4/threadlib.m4 b/gnulib-m4/threadlib.m4 new file mode 100644 index 0000000..8fc3dfd --- /dev/null +++ b/gnulib-m4/threadlib.m4 @@ -0,0 +1,622 @@ +# threadlib.m4 serial 30 +dnl Copyright (C) 2005-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_PREREQ([2.60]) + +dnl The general structure of the multithreading modules in gnulib is that we +dnl have three set of modules: +dnl +dnl * POSIX API: +dnl pthread, which combines +dnl pthread-h +dnl pthread-thread +dnl pthread-once +dnl pthread-mutex +dnl pthread-rwlock +dnl pthread-cond +dnl pthread-tss +dnl pthread-spin +dnl sched_yield +dnl +dnl * ISO C API: +dnl threads, which combines +dnl threads-h +dnl thrd +dnl mtx +dnl cnd +dnl tss +dnl +dnl * Gnulib API, with an implementation that can be chosen at configure +dnl time through the option --enable-threads=... +dnl thread +dnl lock +dnl cond +dnl tls +dnl yield +dnl +dnl They are independent, except for the fact that +dnl - the implementation of the ISO C API may use the POSIX (or some other +dnl platform dependent) API, +dnl - the implementation of the Gnulib API may use the POSIX or ISO C or +dnl some other platform dependent API, depending on the --enable-threads +dnl option. +dnl +dnl This file contains macros for all of these APIs! + +dnl ============================================================================ +dnl Macros for all thread APIs + +AC_DEFUN([gl_ANYTHREADLIB_EARLY], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + if test -z "$gl_anythreadlib_early_done"; then + case "$host_os" in + osf*) + # On OSF/1, the compiler needs the flag -D_REENTRANT so that it + # groks . cc also understands the flag -pthread, but + # we don't use it because 1. gcc-2.95 doesn't understand -pthread, + # 2. putting a flag into CPPFLAGS that has an effect on the linker + # causes the AC_LINK_IFELSE test below to succeed unexpectedly, + # leading to wrong values of LIBTHREAD and LTLIBTHREAD. + CPPFLAGS="$CPPFLAGS -D_REENTRANT" + ;; + esac + # Some systems optimize for single-threaded programs by default, and + # need special flags to disable these optimizations. For example, the + # definition of 'errno' in . + case "$host_os" in + aix* | freebsd*) CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE" ;; + solaris*) CPPFLAGS="$CPPFLAGS -D_REENTRANT" ;; + esac + gl_anythreadlib_early_done=done + fi +]) + +dnl Checks whether the compiler and linker support weak declarations of symbols. + +AC_DEFUN([gl_WEAK_SYMBOLS], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_CACHE_CHECK([whether imported symbols can be declared weak], + [gl_cv_have_weak], + [gl_cv_have_weak=no + dnl First, test whether the compiler accepts it syntactically. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[extern void xyzzy (); +#pragma weak xyzzy]], + [[xyzzy();]])], + [gl_cv_have_weak=maybe]) + if test $gl_cv_have_weak = maybe; then + dnl Second, test whether it actually works. On Cygwin 1.7.2, with + dnl gcc 4.3, symbols declared weak always evaluate to the address 0. + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#pragma weak fputs +int main () +{ + return (fputs == NULL); +}]])], + [gl_cv_have_weak=yes], + [gl_cv_have_weak=no], + [dnl When cross-compiling, assume that only ELF platforms support + dnl weak symbols. + AC_EGREP_CPP([Extensible Linking Format], + [#ifdef __ELF__ + Extensible Linking Format + #endif + ], + [gl_cv_have_weak="guessing yes"], + [gl_cv_have_weak="guessing no"]) + ]) + fi + dnl But when linking statically, weak symbols don't work. + case " $LDFLAGS " in + *" -static "*) gl_cv_have_weak=no ;; + esac + dnl Test for a bug in FreeBSD 11: A link error occurs when using a weak + dnl symbol and linking against a shared library that has a dependency on + dnl the shared library that defines the symbol. + case "$gl_cv_have_weak" in + *yes) + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + : > conftest1.c + $CC $CPPFLAGS $CFLAGS $LDFLAGS -fPIC -shared -o libempty.so conftest1.c -lpthread >&AS_MESSAGE_LOG_FD 2>&1 + cat < conftest2.c +#include +#pragma weak pthread_mutexattr_gettype +int main () +{ + return (pthread_mutexattr_gettype != NULL); +} +EOF + $CC $CPPFLAGS $CFLAGS $LDFLAGS -o conftest conftest2.c libempty.so >&AS_MESSAGE_LOG_FD 2>&1 \ + || gl_cv_have_weak=no + rm -f conftest1.c libempty.so conftest2.c conftest + ;; + esac + ;; + esac + ]) + case "$gl_cv_have_weak" in + *yes) + AC_DEFINE([HAVE_WEAK_SYMBOLS], [1], + [Define to 1 if the compiler and linker support weak declarations of symbols.]) + ;; + esac +]) + +dnl ============================================================================ +dnl Macros for the POSIX API + +dnl gl_PTHREADLIB +dnl ------------- +dnl Tests for the libraries needs for using the POSIX threads API. +dnl Sets the variable LIBPTHREAD to the linker options for use in a Makefile. +dnl Sets the variable LIBPMULTITHREAD, for programs that really need +dnl multithread functionality. The difference between LIBPTHREAD and +dnl LIBPMULTITHREAD is that on platforms supporting weak symbols, typically +dnl LIBPTHREAD is empty whereas LIBPMULTITHREAD is not. +dnl Sets the variable LIB_SCHED_YIELD to the linker options needed to use the +dnl sched_yield() function. +dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for +dnl multithread-safe programs. +dnl Defines the C macro HAVE_PTHREAD_API if (at least parts of) the POSIX +dnl threads API is available. + +dnl The guts of gl_PTHREADLIB. Needs to be expanded only once. + +AC_DEFUN([gl_PTHREADLIB_BODY], +[ + AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) + if test -z "$gl_pthreadlib_body_done"; then + gl_pthread_api=no + LIBPTHREAD= + LIBPMULTITHREAD= + # On OSF/1, the compiler needs the flag -pthread or -D_REENTRANT so that + # it groks . It's added above, in gl_ANYTHREADLIB_EARLY. + AC_CHECK_HEADER([pthread.h], + [gl_have_pthread_h=yes], [gl_have_pthread_h=no]) + if test "$gl_have_pthread_h" = yes; then + # Other possible tests: + # -lpthreads (FSU threads, PCthreads) + # -lgthreads + # Test whether both pthread_mutex_lock and pthread_mutexattr_init exist + # in libc. IRIX 6.5 has the first one in both libc and libpthread, but + # the second one only in libpthread, and lock.c needs it. + # + # If -pthread works, prefer it to -lpthread, since Ubuntu 14.04 + # needs -pthread for some reason. See: + # https://lists.gnu.org/r/bug-gnulib/2014-09/msg00023.html + save_LIBS=$LIBS + for gl_pthread in '' '-pthread'; do + LIBS="$LIBS $gl_pthread" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + pthread_mutex_t m; + pthread_mutexattr_t ma; + ]], + [[pthread_mutex_lock (&m); + pthread_mutexattr_init (&ma);]])], + [gl_pthread_api=yes + LIBPTHREAD=$gl_pthread + LIBPMULTITHREAD=$gl_pthread]) + LIBS=$save_LIBS + test $gl_pthread_api = yes && break + done + + # Test for libpthread by looking for pthread_kill. (Not pthread_self, + # since it is defined as a macro on OSF/1.) + if test $gl_pthread_api = yes && test -z "$LIBPTHREAD"; then + # The program links fine without libpthread. But it may actually + # need to link with libpthread in order to create multiple threads. + AC_CHECK_LIB([pthread], [pthread_kill], + [LIBPMULTITHREAD=-lpthread + # On Solaris and HP-UX, most pthread functions exist also in libc. + # Therefore pthread_in_use() needs to actually try to create a + # thread: pthread_create from libc will fail, whereas + # pthread_create will actually create a thread. + # On Solaris 10 or newer, this test is no longer needed, because + # libc contains the fully functional pthread functions. + case "$host_os" in + solaris | solaris2.[1-9] | solaris2.[1-9].* | hpux*) + AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], + [Define if the pthread_in_use() detection is hard.]) + esac + ]) + elif test $gl_pthread_api != yes; then + # Some library is needed. Try libpthread and libc_r. + AC_CHECK_LIB([pthread], [pthread_kill], + [gl_pthread_api=yes + LIBPTHREAD=-lpthread + LIBPMULTITHREAD=-lpthread]) + if test $gl_pthread_api != yes; then + # For FreeBSD 4. + AC_CHECK_LIB([c_r], [pthread_kill], + [gl_pthread_api=yes + LIBPTHREAD=-lc_r + LIBPMULTITHREAD=-lc_r]) + fi + fi + fi + AC_MSG_CHECKING([whether POSIX threads API is available]) + AC_MSG_RESULT([$gl_pthread_api]) + AC_SUBST([LIBPTHREAD]) + AC_SUBST([LIBPMULTITHREAD]) + if test $gl_pthread_api = yes; then + AC_DEFINE([HAVE_PTHREAD_API], [1], + [Define if you have the header and the POSIX threads API.]) + fi + + dnl On some systems, sched_yield is in librt, rather than in libpthread. + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include ]], + [[sched_yield ();]])], + [LIB_SCHED_YIELD= + ], + [dnl Solaris 7...10 has sched_yield in librt, not in libpthread or libc. + AC_CHECK_LIB([rt], [sched_yield], [LIB_SCHED_YIELD=-lrt], + [dnl Solaris 2.5.1, 2.6 has sched_yield in libposix4, not librt. + AC_CHECK_LIB([posix4], [sched_yield], [LIB_SCHED_YIELD=-lposix4])]) + ]) + AC_SUBST([LIB_SCHED_YIELD]) + + gl_pthreadlib_body_done=done + fi +]) + +AC_DEFUN([gl_PTHREADLIB], +[ + AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) + gl_PTHREADLIB_BODY +]) + +dnl ============================================================================ +dnl Macros for the ISO C API + +dnl gl_STDTHREADLIB +dnl --------------- +dnl Tests for the libraries needs for using the ISO C threads API. +dnl Sets the variable LIBSTDTHREAD to the linker options for use in a Makefile. +dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for +dnl multithread-safe programs. +dnl Defines the C macro HAVE_THREADS_H if (at least parts of) the ISO C threads +dnl API is available. + +dnl The guts of gl_STDTHREADLIB. Needs to be expanded only once. + +AC_DEFUN([gl_STDTHREADLIB_BODY], +[ + AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) + AC_REQUIRE([AC_CANONICAL_HOST]) + if test -z "$gl_stdthreadlib_body_done"; then + AC_CHECK_HEADERS_ONCE([threads.h]) + + case "$host_os" in + mingw*) + LIBSTDTHREAD= + ;; + *) + gl_PTHREADLIB_BODY + if test $ac_cv_header_threads_h = yes; then + dnl glibc >= 2.29 has thrd_create in libpthread. + dnl FreeBSD >= 10 has thrd_create in libstdthreads; this library depends + dnl on libpthread (for the symbol 'pthread_mutexattr_gettype'). + dnl AIX >= 7.1 and Solaris >= 11.4 have thrd_create in libc. + AC_CHECK_FUNCS([thrd_create]) + if test $ac_cv_func_thrd_create = yes; then + LIBSTDTHREAD= + else + AC_CHECK_LIB([stdthreads], [thrd_create], [ + LIBSTDTHREAD='-lstdthreads -lpthread' + ], [ + dnl Guess that thrd_create is in libpthread. + LIBSTDTHREAD="$LIBPMULTITHREAD" + ]) + fi + else + dnl Libraries needed by thrd.c, mtx.c, cnd.c, tss.c. + LIBSTDTHREAD="$LIBPMULTITHREAD $LIB_SCHED_YIELD" + fi + ;; + esac + AC_SUBST([LIBSTDTHREAD]) + + AC_MSG_CHECKING([whether ISO C threads API is available]) + AC_MSG_RESULT([$ac_cv_header_threads_h]) + gl_stdthreadlib_body_done=done + fi +]) + +AC_DEFUN([gl_STDTHREADLIB], +[ + AC_REQUIRE([gl_ANYTHREADLIB_EARLY]) + gl_STDTHREADLIB_BODY +]) + +dnl ============================================================================ +dnl Macros for the Gnulib API + +dnl gl_THREADLIB +dnl ------------ +dnl Tests for a multithreading library to be used. +dnl If the configure.ac contains a definition of the gl_THREADLIB_DEFAULT_NO +dnl (it must be placed before the invocation of gl_THREADLIB_EARLY!), then the +dnl default is 'no', otherwise it is system dependent. In both cases, the user +dnl can change the choice through the options --enable-threads=choice or +dnl --disable-threads. +dnl Defines at most one of the macros USE_ISOC_THREADS, USE_POSIX_THREADS, +dnl USE_ISOC_AND_POSIX_THREADS, USE_WINDOWS_THREADS. +dnl The choice --enable-threads=isoc+posix is available only on platforms that +dnl have both the ISO C and the POSIX threads APIs. It has the effect of using +dnl the ISO C API for most things and the POSIX API only for creating and +dnl controlling threads (because there is no equivalent to pthread_atfork in +dnl the ISO C API). +dnl Sets the variables LIBTHREAD and LTLIBTHREAD to the linker options for use +dnl in a Makefile (LIBTHREAD for use without libtool, LTLIBTHREAD for use with +dnl libtool). +dnl Sets the variables LIBMULTITHREAD and LTLIBMULTITHREAD similarly, for +dnl programs that really need multithread functionality. The difference +dnl between LIBTHREAD and LIBMULTITHREAD is that on platforms supporting weak +dnl symbols, typically LIBTHREAD is empty whereas LIBMULTITHREAD is not. +dnl Adds to CPPFLAGS the flag -D_REENTRANT or -D_THREAD_SAFE if needed for +dnl multithread-safe programs. +dnl Since support for GNU pth was removed, $LTLIBTHREAD and $LIBTHREAD have the +dnl same value, and similarly $LTLIBMULTITHREAD and $LIBMULTITHREAD have the +dnl same value. Only system libraries are needed. + +AC_DEFUN([gl_THREADLIB_EARLY], +[ + AC_REQUIRE([gl_THREADLIB_EARLY_BODY]) +]) + +dnl The guts of gl_THREADLIB_EARLY. Needs to be expanded only once. + +AC_DEFUN([gl_THREADLIB_EARLY_BODY], +[ + dnl Ordering constraints: This macro modifies CPPFLAGS in a way that + dnl influences the result of the autoconf tests that test for *_unlocked + dnl declarations, on AIX 5 at least. Therefore it must come early. + AC_BEFORE([$0], [gl_FUNC_GLIBC_UNLOCKED_IO])dnl + AC_BEFORE([$0], [gl_ARGP])dnl + + AC_REQUIRE([AC_CANONICAL_HOST]) + dnl _GNU_SOURCE is needed for pthread_rwlock_t on glibc systems. + AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS]) + dnl Check for multithreading. + m4_ifdef([gl_THREADLIB_DEFAULT_NO], + [m4_divert_text([DEFAULTS], [gl_use_threads_default=no])], + [m4_divert_text([DEFAULTS], [gl_use_threads_default=])]) + m4_divert_text([DEFAULTS], [gl_use_winpthreads_default=]) + AC_ARG_ENABLE([threads], +AS_HELP_STRING([--enable-threads={isoc|posix|isoc+posix|windows}], [specify multithreading API])m4_ifdef([gl_THREADLIB_DEFAULT_NO], [], [ +AS_HELP_STRING([--disable-threads], [build without multithread safety])]), + [gl_use_threads=$enableval], + [if test -n "$gl_use_threads_default"; then + gl_use_threads="$gl_use_threads_default" + else +changequote(,)dnl + case "$host_os" in + dnl Disable multithreading by default on OSF/1, because it interferes + dnl with fork()/exec(): When msgexec is linked with -lpthread, its + dnl child process gets an endless segmentation fault inside execvp(). + osf*) gl_use_threads=no ;; + dnl Disable multithreading by default on Cygwin 1.5.x, because it has + dnl bugs that lead to endless loops or crashes. See + dnl . + cygwin*) + case `uname -r` in + 1.[0-5].*) gl_use_threads=no ;; + *) gl_use_threads=yes ;; + esac + ;; + dnl Obey gl_AVOID_WINPTHREAD on mingw. + mingw*) + case "$gl_use_winpthreads_default" in + yes) gl_use_threads=posix ;; + no) gl_use_threads=windows ;; + *) gl_use_threads=yes ;; + esac + ;; + *) gl_use_threads=yes ;; + esac +changequote([,])dnl + fi + ]) + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = isoc \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + # For using or : + gl_ANYTHREADLIB_EARLY + fi +]) + +dnl The guts of gl_THREADLIB. Needs to be expanded only once. + +AC_DEFUN([gl_THREADLIB_BODY], +[ + AC_REQUIRE([gl_THREADLIB_EARLY_BODY]) + gl_threads_api=none + LIBTHREAD= + LTLIBTHREAD= + LIBMULTITHREAD= + LTLIBMULTITHREAD= + if test "$gl_use_threads" != no; then + dnl Check whether the compiler and linker support weak declarations. + gl_WEAK_SYMBOLS + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + dnl If we use weak symbols to implement pthread_in_use / pth_in_use / + dnl thread_in_use, we also need to test whether the ISO C 11 thrd_create + dnl facility is in use. + AC_CHECK_HEADERS_ONCE([threads.h]) + : + fi + if test "$gl_use_threads" = isoc || test "$gl_use_threads" = isoc+posix; then + AC_CHECK_HEADERS_ONCE([threads.h]) + gl_have_isoc_threads="$ac_cv_header_threads_h" + fi + if test "$gl_use_threads" = yes \ + || test "$gl_use_threads" = posix \ + || test "$gl_use_threads" = isoc+posix; then + gl_PTHREADLIB_BODY + LIBTHREAD=$LIBPTHREAD LTLIBTHREAD=$LIBPTHREAD + LIBMULTITHREAD=$LIBPMULTITHREAD LTLIBMULTITHREAD=$LIBPMULTITHREAD + if test $gl_pthread_api = yes; then + if test "$gl_use_threads" = isoc+posix && test "$gl_have_isoc_threads" = yes; then + gl_threads_api='isoc+posix' + AC_DEFINE([USE_ISOC_AND_POSIX_THREADS], [1], + [Define if the combination of the ISO C and POSIX multithreading APIs can be used.]) + LIBTHREAD= LTLIBTHREAD= + else + gl_threads_api=posix + AC_DEFINE([USE_POSIX_THREADS], [1], + [Define if the POSIX multithreading library can be used.]) + if test -n "$LIBMULTITHREAD" || test -n "$LTLIBMULTITHREAD"; then + if case "$gl_cv_have_weak" in *yes) true;; *) false;; esac; then + AC_DEFINE([USE_POSIX_THREADS_WEAK], [1], + [Define if references to the POSIX multithreading library should be made weak.]) + LIBTHREAD= LTLIBTHREAD= + else + case "$host_os" in + freebsd* | dragonfly* | midnightbsd*) + if test "x$LIBTHREAD" != "x$LIBMULTITHREAD"; then + dnl If weak symbols can't tell whether pthread_create(), pthread_key_create() + dnl etc. will succeed, we need a runtime test. + AC_DEFINE([PTHREAD_IN_USE_DETECTION_HARD], [1], + [Define if the pthread_in_use() detection is hard.]) + fi + ;; + esac + fi + fi + fi + fi + fi + if test $gl_threads_api = none; then + if test "$gl_use_threads" = isoc && test "$gl_have_isoc_threads" = yes; then + gl_STDTHREADLIB_BODY + LIBTHREAD=$LIBSTDTHREAD LTLIBTHREAD=$LIBSTDTHREAD + LIBMULTITHREAD=$LIBSTDTHREAD LTLIBMULTITHREAD=$LIBSTDTHREAD + gl_threads_api=isoc + AC_DEFINE([USE_ISOC_THREADS], [1], + [Define if the ISO C multithreading library can be used.]) + fi + fi + if test $gl_threads_api = none; then + case "$gl_use_threads" in + yes | windows | win32) # The 'win32' is for backward compatibility. + if { case "$host_os" in + mingw*) true;; + *) false;; + esac + }; then + gl_threads_api=windows + AC_DEFINE([USE_WINDOWS_THREADS], [1], + [Define if the native Windows multithreading API can be used.]) + fi + ;; + esac + fi + fi + AC_MSG_CHECKING([for multithread API to use]) + AC_MSG_RESULT([$gl_threads_api]) + AC_SUBST([LIBTHREAD]) + AC_SUBST([LTLIBTHREAD]) + AC_SUBST([LIBMULTITHREAD]) + AC_SUBST([LTLIBMULTITHREAD]) +]) + +AC_DEFUN([gl_THREADLIB], +[ + AC_REQUIRE([gl_THREADLIB_EARLY]) + AC_REQUIRE([gl_THREADLIB_BODY]) +]) + + +dnl gl_DISABLE_THREADS +dnl ------------------ +dnl Sets the gl_THREADLIB default so that threads are not used by default. +dnl The user can still override it at installation time, by using the +dnl configure option '--enable-threads'. + +AC_DEFUN([gl_DISABLE_THREADS], [ + m4_divert_text([INIT_PREPARE], [gl_use_threads_default=no]) +]) + + +dnl gl_AVOID_WINPTHREAD +dnl ------------------- +dnl Sets the gl_THREADLIB default so that on mingw, a dependency to the +dnl libwinpthread DLL (mingw-w64 winpthreads library) is avoided. +dnl The user can still override it at installation time, by using the +dnl configure option '--enable-threads'. + +AC_DEFUN([gl_AVOID_WINPTHREAD], [ + m4_divert_text([INIT_PREPARE], [gl_use_winpthreads_default=no]) +]) + + +dnl ============================================================================ + + +dnl Survey of platforms: +dnl +dnl Platform Available Compiler Supports test-lock +dnl flavours option weak result +dnl --------------- --------- --------- -------- --------- +dnl Linux 2.4/glibc posix -lpthread Y OK +dnl +dnl GNU Hurd/glibc posix +dnl +dnl Ubuntu 14.04 posix -pthread Y OK +dnl +dnl FreeBSD 5.3 posix -lc_r Y +dnl posix -lkse ? Y +dnl posix -lpthread ? Y +dnl posix -lthr Y +dnl +dnl FreeBSD 5.2 posix -lc_r Y +dnl posix -lkse Y +dnl posix -lthr Y +dnl +dnl FreeBSD 4.0,4.10 posix -lc_r Y OK +dnl +dnl NetBSD 1.6 -- +dnl +dnl OpenBSD 3.4 posix -lpthread Y OK +dnl +dnl Mac OS X 10.[123] posix -lpthread Y OK +dnl +dnl Solaris 7,8,9 posix -lpthread Y Sol 7,8: 0.0; Sol 9: OK +dnl +dnl HP-UX 11 posix -lpthread N (cc) OK +dnl Y (gcc) +dnl +dnl IRIX 6.5 posix -lpthread Y 0.5 +dnl +dnl AIX 4.3,5.1 posix -lpthread N AIX 4: 0.5; AIX 5: OK +dnl +dnl OSF/1 4.0,5.1 posix -pthread (cc) N OK +dnl -lpthread (gcc) Y +dnl +dnl Cygwin posix -lpthread Y OK +dnl +dnl Mingw windows N OK +dnl +dnl BeOS 5 -- +dnl +dnl The test-lock result shows what happens if in test-lock.c EXPLICIT_YIELD is +dnl turned off: +dnl OK if all three tests terminate OK, +dnl 0.5 if the first test terminates OK but the second one loops endlessly, +dnl 0.0 if the first test already loops endlessly. diff --git a/gnulib-m4/time_h.m4 b/gnulib-m4/time_h.m4 new file mode 100644 index 0000000..b57474b --- /dev/null +++ b/gnulib-m4/time_h.m4 @@ -0,0 +1,175 @@ +# Configure a more-standard replacement for . + +# Copyright (C) 2000-2001, 2003-2007, 2009-2021 Free Software Foundation, Inc. + +# serial 18 + +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Written by Paul Eggert and Jim Meyering. + +AC_DEFUN_ONCE([gl_TIME_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_TIME_H_DEFAULTS]) + + gl_NEXT_HEADERS([time.h]) + AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC]) + + AC_REQUIRE([AC_C_RESTRICT]) + + AC_CACHE_CHECK([for TIME_UTC in ], + [gl_cv_time_h_has_TIME_UTC], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[static int x = TIME_UTC; x++;]])], + [gl_cv_time_h_has_TIME_UTC=yes], + [gl_cv_time_h_has_TIME_UTC=no])]) + if test $gl_cv_time_h_has_TIME_UTC = yes; then + TIME_H_DEFINES_TIME_UTC=1 + else + TIME_H_DEFINES_TIME_UTC=0 + fi + AC_SUBST([TIME_H_DEFINES_TIME_UTC]) +]) + +dnl Check whether 'struct timespec' is declared +dnl in time.h, sys/time.h, pthread.h, or unistd.h. + +AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC], +[ + AC_CHECK_HEADERS_ONCE([sys/time.h]) + AC_CACHE_CHECK([for struct timespec in ], + [gl_cv_sys_struct_timespec_in_time_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [gl_cv_sys_struct_timespec_in_time_h=yes], + [gl_cv_sys_struct_timespec_in_time_h=no])]) + + TIME_H_DEFINES_STRUCT_TIMESPEC=0 + SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0 + PTHREAD_H_DEFINES_STRUCT_TIMESPEC=0 + UNISTD_H_DEFINES_STRUCT_TIMESPEC=0 + if test $gl_cv_sys_struct_timespec_in_time_h = yes; then + TIME_H_DEFINES_STRUCT_TIMESPEC=1 + else + AC_CACHE_CHECK([for struct timespec in ], + [gl_cv_sys_struct_timespec_in_sys_time_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [gl_cv_sys_struct_timespec_in_sys_time_h=yes], + [gl_cv_sys_struct_timespec_in_sys_time_h=no])]) + if test $gl_cv_sys_struct_timespec_in_sys_time_h = yes; then + SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1 + else + AC_CACHE_CHECK([for struct timespec in ], + [gl_cv_sys_struct_timespec_in_pthread_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [gl_cv_sys_struct_timespec_in_pthread_h=yes], + [gl_cv_sys_struct_timespec_in_pthread_h=no])]) + if test $gl_cv_sys_struct_timespec_in_pthread_h = yes; then + PTHREAD_H_DEFINES_STRUCT_TIMESPEC=1 + else + AC_CACHE_CHECK([for struct timespec in ], + [gl_cv_sys_struct_timespec_in_unistd_h], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[static struct timespec x; x.tv_sec = x.tv_nsec;]])], + [gl_cv_sys_struct_timespec_in_unistd_h=yes], + [gl_cv_sys_struct_timespec_in_unistd_h=no])]) + if test $gl_cv_sys_struct_timespec_in_unistd_h = yes; then + UNISTD_H_DEFINES_STRUCT_TIMESPEC=1 + fi + fi + fi + fi + AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC]) + AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC]) + AC_SUBST([PTHREAD_H_DEFINES_STRUCT_TIMESPEC]) + AC_SUBST([UNISTD_H_DEFINES_STRUCT_TIMESPEC]) +]) + +# gl_TIME_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_TIME_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_TIME_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_TIME_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LOCALTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_NANOSLEEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRFTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STRPTIME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMEGM]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIMESPEC_GET]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TIME_RZ]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TZSET]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_TZSET], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_TIME_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_TIME_H_DEFAULTS]) +]) + +AC_DEFUN([gl_TIME_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R]) + HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP]) + HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME]) + HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM]) + HAVE_TIMESPEC_GET=1; AC_SUBST([HAVE_TIMESPEC_GET]) + dnl Even GNU libc does not have timezone_t yet. + HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T]) + dnl If another module says to replace or to not replace, do that. + dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK; + dnl this lets maintainers check for portability. + REPLACE_CTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_CTIME]) + REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R]) + REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME]) + REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP]) + REPLACE_STRFTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRFTIME]) + REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM]) + REPLACE_TZSET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TZSET]) + + dnl Hack so that the time module doesn't depend on the sys_time module. + dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent. + : ${GNULIB_GETTIMEOFDAY=0}; AC_SUBST([GNULIB_GETTIMEOFDAY]) + dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME + dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier + dnl is no longer a big deal. + REPLACE_GMTIME=0; AC_SUBST([REPLACE_GMTIME]) + REPLACE_LOCALTIME=0; AC_SUBST([REPLACE_LOCALTIME]) +]) diff --git a/gnulib-m4/unistd_h.m4 b/gnulib-m4/unistd_h.m4 new file mode 100644 index 0000000..a40a41b --- /dev/null +++ b/gnulib-m4/unistd_h.m4 @@ -0,0 +1,266 @@ +# unistd_h.m4 serial 88 +dnl Copyright (C) 2006-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Simon Josefsson, Bruno Haible. + +AC_DEFUN_ONCE([gl_UNISTD_H], +[ + dnl Ensure to expand the default settings once only, before all statements + dnl that occur in other macros. + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) + + gl_CHECK_NEXT_HEADERS([unistd.h]) + if test $ac_cv_header_unistd_h = yes; then + HAVE_UNISTD_H=1 + else + HAVE_UNISTD_H=0 + fi + AC_SUBST([HAVE_UNISTD_H]) + + dnl Ensure the type pid_t gets defined. + AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Determine WINDOWS_64_BIT_OFF_T. + AC_REQUIRE([gl_TYPE_OFF_T]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[ +#if HAVE_UNISTD_H +# include +#endif +/* Some systems declare various items in the wrong headers. */ +#if !(defined __GLIBC__ && !defined __UCLIBC__) +# include +# include +# include +# if defined _WIN32 && ! defined __CYGWIN__ +# include +# endif +#endif + ]], [access chdir chown copy_file_range dup dup2 dup3 environ euidaccess + execl execle execlp execv execve execvp execvpe + faccessat fchdir + fchownat fdatasync fsync ftruncate getcwd getdomainname getdtablesize + getentropy getgroups gethostname getlogin getlogin_r getpagesize getpass + getusershell setusershell endusershell + group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite + readlink readlinkat rmdir sethostname sleep symlink symlinkat + truncate ttyname_r unlink unlinkat usleep]) + + AC_REQUIRE([AC_C_RESTRICT]) + + AC_CHECK_DECLS_ONCE([execvpe]) + if test $ac_cv_have_decl_execvpe = no; then + HAVE_DECL_EXECVPE=0 + fi +]) + +# gl_UNISTD_MODULE_INDICATOR([modulename]) +# sets the shell variable that indicates the presence of the given module +# to a C preprocessor expression that will evaluate to 1. +# This macro invocation must not occur in macros that are AC_REQUIREd. +AC_DEFUN([gl_UNISTD_MODULE_INDICATOR], +[ + dnl Ensure to expand the default settings once only. + gl_UNISTD_H_REQUIRE_DEFAULTS + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +# Initializes the default values for AC_SUBSTed shell variables. +# This macro must not be AC_REQUIREd. It must only be invoked, and only +# outside of macros or in macros that are not AC_REQUIREd. +AC_DEFUN([gl_UNISTD_H_REQUIRE_DEFAULTS], +[ + m4_defun(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS], [ + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ACCESS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CHOWN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_CLOSE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_COPY_FILE_RANGE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP2]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_DUP3]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ENVIRON]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EUIDACCESS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECLP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECV]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_EXECVPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FACCESSAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHOWNAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FDATASYNC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSYNC]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FTRUNCATE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETCWD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDOMAINNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETDTABLESIZE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETENTROPY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETGROUPS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETHOSTNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETLOGIN_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETOPT_POSIX]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPAGESIZE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETPASS]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUSERSHELL]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GROUP_MEMBER]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_ISATTY]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHOWN]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSEEK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PIPE2]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PREAD]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_PWRITE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READ]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_READLINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RMDIR]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SETHOSTNAME]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SLEEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_SYMLINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TRUNCATE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_TTYNAME_R]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_NONBLOCKING]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNISTD_H_SIGPIPE]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINK]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UNLINKAT]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_USLEEP]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_WRITE]) + dnl Support Microsoft deprecated alias function names by default. + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ACCESS], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHDIR], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CLOSE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_DUP2], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECL], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECLP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECV], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVP], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_EXECVPE], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETCWD], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_GETPID], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_ISATTY], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_LSEEK], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_READ], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_RMDIR], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_SWAB], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UNLINK], [1]) + gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_WRITE], [1]) + ]) + m4_require(GL_MODULE_INDICATOR_PREFIX[_UNISTD_H_MODULE_INDICATOR_DEFAULTS]) + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) +]) + +AC_DEFUN([gl_UNISTD_H_DEFAULTS], +[ + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN]) + HAVE_COPY_FILE_RANGE=1; AC_SUBST([HAVE_COPY_FILE_RANGE]) + HAVE_DUP3=1; AC_SUBST([HAVE_DUP3]) + HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS]) + HAVE_EXECVPE=1; AC_SUBST([HAVE_EXECVPE]) + HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT]) + HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR]) + HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT]) + HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC]) + HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC]) + HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE]) + HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE]) + HAVE_GETENTROPY=1; AC_SUBST([HAVE_GETENTROPY]) + HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS]) + HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME]) + HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN]) + HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE]) + HAVE_GETPASS=1; AC_SUBST([HAVE_GETPASS]) + HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER]) + HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN]) + HAVE_LINK=1; AC_SUBST([HAVE_LINK]) + HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT]) + HAVE_PIPE=1; AC_SUBST([HAVE_PIPE]) + HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2]) + HAVE_PREAD=1; AC_SUBST([HAVE_PREAD]) + HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE]) + HAVE_READLINK=1; AC_SUBST([HAVE_READLINK]) + HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT]) + HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME]) + HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP]) + HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK]) + HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT]) + HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT]) + HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP]) + HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON]) + HAVE_DECL_EXECVPE=1; AC_SUBST([HAVE_DECL_EXECVPE]) + HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR]) + HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC]) + HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME]) + HAVE_DECL_GETLOGIN=1; AC_SUBST([HAVE_DECL_GETLOGIN]) + HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R]) + HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE]) + HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL]) + HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME]) + HAVE_DECL_TRUNCATE=1; AC_SUBST([HAVE_DECL_TRUNCATE]) + HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R]) + HAVE_OS_H=0; AC_SUBST([HAVE_OS_H]) + HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H]) + REPLACE_ACCESS=0; AC_SUBST([REPLACE_ACCESS]) + REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN]) + REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE]) + REPLACE_DUP=0; AC_SUBST([REPLACE_DUP]) + REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2]) + REPLACE_EXECL=0; AC_SUBST([REPLACE_EXECL]) + REPLACE_EXECLE=0; AC_SUBST([REPLACE_EXECLE]) + REPLACE_EXECLP=0; AC_SUBST([REPLACE_EXECLP]) + REPLACE_EXECV=0; AC_SUBST([REPLACE_EXECV]) + REPLACE_EXECVE=0; AC_SUBST([REPLACE_EXECVE]) + REPLACE_EXECVP=0; AC_SUBST([REPLACE_EXECVP]) + REPLACE_EXECVPE=0; AC_SUBST([REPLACE_EXECVPE]) + REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT]) + REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT]) + REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE]) + REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD]) + REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME]) + REPLACE_GETDTABLESIZE=0; AC_SUBST([REPLACE_GETDTABLESIZE]) + REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R]) + REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS]) + REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE]) + REPLACE_GETPASS=0; AC_SUBST([REPLACE_GETPASS]) + REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY]) + REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN]) + REPLACE_LINK=0; AC_SUBST([REPLACE_LINK]) + REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT]) + REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK]) + REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD]) + REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE]) + REPLACE_READ=0; AC_SUBST([REPLACE_READ]) + REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK]) + REPLACE_READLINKAT=0; AC_SUBST([REPLACE_READLINKAT]) + REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR]) + REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP]) + REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK]) + REPLACE_SYMLINKAT=0; AC_SUBST([REPLACE_SYMLINKAT]) + REPLACE_TRUNCATE=0; AC_SUBST([REPLACE_TRUNCATE]) + REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R]) + REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK]) + REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT]) + REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP]) + REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE]) + UNISTD_H_HAVE_SYS_RANDOM_H=0; AC_SUBST([UNISTD_H_HAVE_SYS_RANDOM_H]) + UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H]) + UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0; + AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS]) +]) diff --git a/gnulib-m4/warn-on-use.m4 b/gnulib-m4/warn-on-use.m4 new file mode 100644 index 0000000..04edfe8 --- /dev/null +++ b/gnulib-m4/warn-on-use.m4 @@ -0,0 +1,49 @@ +# warn-on-use.m4 serial 9 +dnl Copyright (C) 2010-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# gl_WARN_ON_USE_PREPARE(INCLUDES, NAMES) +# --------------------------------------- +# If the module 'posixcheck' is in use: +# +# For each whitespace-separated element in the list of NAMES, define +# HAVE_RAW_DECL_name if the function has a declaration among INCLUDES +# even after being undefined as a macro. +# +# See warn-on-use.h for some hints on how to poison function names, as +# well as ideas on poisoning global variables and macros. NAMES may +# include global variables, but remember that only functions work with +# _GL_WARN_ON_USE. Typically, INCLUDES only needs to list a single +# header, but if the replacement header pulls in other headers because +# some systems declare functions in the wrong header, then INCLUDES +# should do likewise. +# +# It is generally safe to assume declarations for functions declared +# in the intersection of C89 and C11 (such as printf) without +# needing gl_WARN_ON_USE_PREPARE. +AC_DEFUN([gl_WARN_ON_USE_PREPARE], +[ + m4_ifdef([gl_POSIXCHECK], + [m4_foreach_w([gl_decl], [$2], + [AH_TEMPLATE([HAVE_RAW_DECL_]AS_TR_CPP(m4_defn([gl_decl])), + [Define to 1 if ]m4_defn([gl_decl])[ is declared even after + undefining macros.])])dnl + for gl_func in m4_flatten([$2]); do + AS_VAR_PUSHDEF([gl_Symbol], [gl_cv_have_raw_decl_$gl_func])dnl + AC_CACHE_CHECK([whether $gl_func is declared without a macro], + [gl_Symbol], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([$1], +[[#undef $gl_func + (void) $gl_func;]])], + [AS_VAR_SET([gl_Symbol], [yes])], [AS_VAR_SET([gl_Symbol], [no])])]) + AS_VAR_IF([gl_Symbol], [yes], + [AC_DEFINE_UNQUOTED(AS_TR_CPP([HAVE_RAW_DECL_$gl_func]), [1]) + dnl shortcut - if the raw declaration exists, then set a cache + dnl variable to allow skipping any later AC_CHECK_DECL efforts + eval ac_cv_have_decl_$gl_func=yes]) + AS_VAR_POPDEF([gl_Symbol])dnl + done + ]) +]) diff --git a/gnulib-m4/wchar_t.m4 b/gnulib-m4/wchar_t.m4 new file mode 100644 index 0000000..34db10e --- /dev/null +++ b/gnulib-m4/wchar_t.m4 @@ -0,0 +1,24 @@ +# wchar_t.m4 serial 4 (gettext-0.18.2) +dnl Copyright (C) 2002-2003, 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. +dnl Test whether has the 'wchar_t' type. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WCHAR_T], +[ + AC_CACHE_CHECK([for wchar_t], [gt_cv_c_wchar_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + wchar_t foo = (wchar_t)'\0';]], + [[]])], + [gt_cv_c_wchar_t=yes], + [gt_cv_c_wchar_t=no])]) + if test $gt_cv_c_wchar_t = yes; then + AC_DEFINE([HAVE_WCHAR_T], [1], [Define if you have the 'wchar_t' type.]) + fi +]) diff --git a/gnulib-m4/wint_t.m4 b/gnulib-m4/wint_t.m4 new file mode 100644 index 0000000..a49c508 --- /dev/null +++ b/gnulib-m4/wint_t.m4 @@ -0,0 +1,57 @@ +# wint_t.m4 serial 11 +dnl Copyright (C) 2003, 2007-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. +dnl Test whether has the 'wint_t' type and whether gnulib's +dnl or would, if present, override 'wint_t'. +dnl Prerequisite: AC_PROG_CC + +AC_DEFUN([gt_TYPE_WINT_T], +[ + AC_CACHE_CHECK([for wint_t], [gt_cv_c_wint_t], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + wint_t foo = (wchar_t)'\0';]], + [[]])], + [gt_cv_c_wint_t=yes], + [gt_cv_c_wint_t=no])]) + if test $gt_cv_c_wint_t = yes; then + AC_DEFINE([HAVE_WINT_T], [1], [Define if you have the 'wint_t' type.]) + + dnl Determine whether gnulib's or would, if present, + dnl override 'wint_t'. + AC_CACHE_CHECK([whether wint_t is large enough], + [gl_cv_type_wint_t_large_enough], + [AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[#include + int verify[sizeof (wint_t) < sizeof (int) ? -1 : 1]; + ]])], + [gl_cv_type_wint_t_large_enough=yes], + [gl_cv_type_wint_t_large_enough=no])]) + if test $gl_cv_type_wint_t_large_enough = no; then + GNULIBHEADERS_OVERRIDE_WINT_T=1 + else + GNULIBHEADERS_OVERRIDE_WINT_T=0 + fi + else + GNULIBHEADERS_OVERRIDE_WINT_T=0 + fi + AC_SUBST([GNULIBHEADERS_OVERRIDE_WINT_T]) +]) + +dnl Prerequisites of the 'wint_t' override. +AC_DEFUN([gl_TYPE_WINT_T_PREREQ], +[ + AC_CHECK_HEADERS_ONCE([crtdefs.h]) + if test $ac_cv_header_crtdefs_h = yes; then + HAVE_CRTDEFS_H=1 + else + HAVE_CRTDEFS_H=0 + fi + AC_SUBST([HAVE_CRTDEFS_H]) +]) diff --git a/gnulib-m4/xsize.m4 b/gnulib-m4/xsize.m4 new file mode 100644 index 0000000..64e8a4f --- /dev/null +++ b/gnulib-m4/xsize.m4 @@ -0,0 +1,12 @@ +# xsize.m4 serial 5 +dnl Copyright (C) 2003-2004, 2008-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_XSIZE], +[ + dnl Prerequisites of lib/xsize.h. + AC_REQUIRE([gl_SIZE_MAX]) + AC_CHECK_HEADERS([stdint.h]) +]) diff --git a/gnulib-m4/zzgnulib.m4 b/gnulib-m4/zzgnulib.m4 new file mode 100644 index 0000000..b953384 --- /dev/null +++ b/gnulib-m4/zzgnulib.m4 @@ -0,0 +1,23 @@ +# zzgnulib.m4 serial 1 +dnl Copyright (C) 2020-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl This file must be named something that sorts after all other +dnl package- or gnulib-provided .m4 files - at least for those packages +dnl that redefine AC_PROG_CC. + +dnl Redefine AC_PROG_CC so that it ends with invocations of gl_COMPILER_CLANG +dnl and gl_COMPILER_PREPARE_CHECK_DECL. +m4_define([AC_PROG_CC], + m4_defn([AC_PROG_CC])[ +gl_COMPILER_CLANG +gl_COMPILER_PREPARE_CHECK_DECL +]) + +# gl_ZZGNULIB +# ----------- +# Witness macro that this file has been included. Needed to force +# Automake to include this file after all other gnulib .m4 files. +AC_DEFUN([gl_ZZGNULIB]) diff --git a/m4/as-underscore.m4 b/m4/as-underscore.m4 new file mode 100644 index 0000000..92dc7f9 --- /dev/null +++ b/m4/as-underscore.m4 @@ -0,0 +1,24 @@ +dnl -*- Autoconf -*- +dnl Copyright (C) 1993-2017 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License as published by the Free Software Foundation; +dnl either version 2 of the License, or (at your option) any later version. +dnl As a special exception to the GNU General Public License, this file +dnl may be distributed as part of a program that contains a configuration +dnl script generated by Autoconf, under the same distribution terms as +dnl the rest of that program. + +dnl From Bruno Haible, Marcus Daniels, Sam Steingold. + +AC_PREREQ([2.57]) + +AC_DEFUN([CL_AS_UNDERSCORE], +[ + AC_REQUIRE([gl_ASM_SYMBOL_PREFIX]) + if test "$USER_LABEL_PREFIX" = '_'; then + AS_UNDERSCORE=true + else + AS_UNDERSCORE=false + fi + AC_SUBST([AS_UNDERSCORE]) +]) diff --git a/m4/cc-gcc.m4 b/m4/cc-gcc.m4 new file mode 100644 index 0000000..1e12d8e --- /dev/null +++ b/m4/cc-gcc.m4 @@ -0,0 +1,36 @@ +dnl -*- Autoconf -*- +dnl Copyright (C) 1993-2017 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License as published by the Free Software Foundation; +dnl either version 2 of the License, or (at your option) any later version. +dnl As a special exception to the GNU General Public License, this file +dnl may be distributed as part of a program that contains a configuration +dnl script generated by Autoconf, under the same distribution terms as +dnl the rest of that program. + +dnl From Bruno Haible, Marcus Daniels. + +AC_PREREQ([2.13]) + +AC_DEFUN([CL_CC_GCC], +[ + AC_REQUIRE([AC_PROG_CPP]) + AC_CACHE_CHECK([whether using GNU C], [cl_cv_prog_cc_gcc], + [AC_EGREP_CPP([yes], + [#ifdef __GNUC__ + yes + #endif + ], + [cl_cv_prog_cc_gcc=yes], + [cl_cv_prog_cc_gcc=no]) + ]) + if test $cl_cv_prog_cc_gcc = yes; then + CC_GCC=true + GCC_X_NONE='-x none' + else + CC_GCC=false + GCC_X_NONE='' + fi + AC_SUBST([CC_GCC]) + AC_SUBST([GCC_X_NONE]) +]) diff --git a/m4/codeexec.m4 b/m4/codeexec.m4 new file mode 100644 index 0000000..4bf8a73 --- /dev/null +++ b/m4/codeexec.m4 @@ -0,0 +1,606 @@ +dnl -*- Autoconf -*- +dnl Copyright (C) 1993-2020 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License as published by the Free Software Foundation; +dnl either version 2 of the License, or (at your option) any later version. +dnl As a special exception to the GNU General Public License, this file +dnl may be distributed as part of a program that contains a configuration +dnl script generated by Autoconf, under the same distribution terms as +dnl the rest of that program. + +dnl From Bruno Haible, Marcus Daniels, Sam Steingold. + +AC_PREREQ([2.63]) + +AC_DEFUN([FFCALL_CODEEXEC], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_HOST_CPU_C_ABI]) + AC_REQUIRE([gl_FUNC_MMAP_ANON]) + + AC_CACHE_CHECK([whether code in malloc()ed memory is executable], + [ffcall_cv_codeexec], + [dnl The test below does not work on platforms with the following ABIs: + dnl - hppa, because function pointers are actually pointers into(!) + dnl a two-pointer struct. + dnl - hppa64, because function pointers are actually pointers to a + dnl four-pointer struct. + dnl - powerpc on AIX, powerpc64, because function pointers are actually + dnl pointers to a three-pointer struct. + dnl - ia64, because function pointers are actually pointers to a + dnl two-pointer struct. + case "$HOST_CPU_C_ABI--$host_os" in + hppa--* | hppa64--* | powerpc--aix* | powerpc64--* | ia64--*) + dnl On these platforms, it's irrelevant whether malloc'ed memory is + dnl executable, because the trampolines are built without executable + dnl code. + ffcall_cv_codeexec="irrelevant" + ;; + arm64--freebsd*) + dnl On this platform, malloc()ed memory is not executable, and the + dnl test program loops endlessly. + ffcall_cv_codeexec=no + ;; + *) + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + GL_NOCRASH + [#include + /* declare malloc() */ + #include + int fun () { return 31415926; } + int main () + { nocrash_init(); + {long size = (char*)&main - (char*)&fun; + char* funcopy = (char*) malloc(size); + int i; + for (i = 0; i < size; i++) { funcopy[i] = ((char*)&fun)[i]; } + return !((*(int(*)())funcopy)() == 31415926); + }} + ]]) + ], + [ffcall_cv_codeexec=yes], + [ffcall_cv_codeexec=no], + [dnl When cross-compiling, assume the known behaviour. + dnl If we don't know, assume the worst. + case "$host_os" in + cygwin*) + case "$HOST_CPU_C_ABI" in + i386) + ffcall_cv_codeexec="guessing yes" ;; + x86_64) + ffcall_cv_codeexec="guessing no" ;; + *) + ffcall_cv_codeexec="guessing no" ;; + esac + ;; + darwin*) + case "$HOST_CPU_C_ABI" in + i386 | powerpc) + ffcall_cv_codeexec="guessing yes" ;; + x86_64) + ffcall_cv_codeexec="guessing no" ;; + *) + ffcall_cv_codeexec="guessing no" ;; + esac + ;; + irix*) + ffcall_cv_codeexec="guessing no" ;; + linux*) + case "$HOST_CPU_C_ABI" in + alpha | ia64) + ffcall_cv_codeexec="guessing yes" ;; + arm | armhf | arm64 | i386 | mips* | s390 | s390x | sparc | sparc64 | x86_64*) + ffcall_cv_codeexec="guessing no" ;; + *) + ffcall_cv_codeexec="guessing no" ;; + esac + ;; + solaris*) + case "$HOST_CPU_C_ABI" in + i386 | sparc | sparc64) + ffcall_cv_codeexec="guessing yes" ;; + x86_64) + ffcall_cv_codeexec="guessing no" ;; + *) + ffcall_cv_codeexec="guessing no" ;; + esac + ;; + *) + ffcall_cv_codeexec="guessing no" ;; + esac + ]) + ;; + esac + ]) + case "$ffcall_cv_codeexec" in + *yes | irrelevant) + AC_DEFINE([CODE_EXECUTABLE], [], [whether code in malloc()ed memory is executable]) + ;; + *no) ;; + esac + + AC_CHECK_HEADER([sys/mman.h], [], [no_mmap=1]) + if test -z "$no_mmap"; then + AC_CHECK_FUNC([mmap], [], [no_mmap=1]) + if test -z "$no_mmap"; then + mmap_prog_1=' + #include + #ifdef HAVE_UNISTD_H + #include + #endif + #include + #include + #include + int main () + { + ' + mmap_prog_2=' + if (mmap(NULL,0x100000,PROT_READ|PROT_WRITE,flags,fd,0) == (void*)-1) + exit(1); + exit(0); + } + ' + AC_CACHE_CHECK([for working mmap with MAP_ANONYMOUS], + [ffcall_cv_func_mmap_anonymous], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + GL_NOCRASH + [$mmap_prog_1 + int flags = MAP_ANONYMOUS | MAP_PRIVATE; + int fd = -1; + nocrash_init(); + $mmap_prog_2 + ]]) + ], + [have_mmap_anon=1 + ffcall_cv_func_mmap_anonymous=yes], + [ffcall_cv_func_mmap_anonymous=no], + [dnl When cross-compiling, assume the known behaviour. + dnl If we don't know, don't assume anything. + case "$host_os" in + aix* | cygwin* | darwin* | hpux* | linux* | solaris*) + ffcall_cv_func_mmap_anonymous="guessing yes" ;; + *) + ffcall_cv_func_mmap_anonymous="guessing no" ;; + esac + ]) + ]) + case "$ffcall_cv_func_mmap_anonymous" in + *yes) + AC_DEFINE([HAVE_MMAP_ANONYMOUS], [1], + [ defines MAP_ANONYMOUS and mmaping with MAP_ANONYMOUS works]) + ;; + *) + dnl This is needed for IRIX. + AC_CACHE_CHECK([for working mmap of /dev/zero], + [ffcall_cv_func_mmap_devzero], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + GL_NOCRASH + [$mmap_prog_1 + #ifndef MAP_FILE + #define MAP_FILE 0 + #endif + int flags = MAP_FILE | MAP_PRIVATE; + int fd = open("/dev/zero",O_RDONLY,0666); + if (fd<0) + exit(1); + nocrash_init(); + $mmap_prog_2 + ]]) + ], + [have_mmap_devzero=1 + ffcall_cv_func_mmap_devzero=yes], + [ffcall_cv_func_mmap_devzero=no], + [dnl When cross-compiling, assume the known behaviour. + dnl If we don't know, don't assume anything. + case "$host_os" in + aix* | cygwin* | hpux* | irix* | linux* | solaris*) + ffcall_cv_func_mmap_devzero="guessing yes" ;; + *) + ffcall_cv_func_mmap_devzero="guessing no" ;; + esac + ]) + ]) + case "$ffcall_cv_func_mmap_devzero" in + *yes) + AC_DEFINE([HAVE_MMAP_DEVZERO], [1], + [mmaping of the special device /dev/zero works]) + ;; + esac + ;; + esac + fi + fi + + AC_CHECK_FUNCS([mprotect]) + if test $ac_cv_func_mprotect = yes; then + AC_CACHE_CHECK([for working mprotect], [cl_cv_func_mprotect_works], + [if test $cross_compiling = no; then + mprotect_prog=' + #include + /* Declare malloc(). */ + #include + /* Declare getpagesize(). */ + #ifdef HAVE_UNISTD_H + #include + #endif + #ifdef __hpux + extern + #ifdef __cplusplus + "C" + #endif + int getpagesize (void); + #endif + /* Declare mprotect(). */ + #include + char foo; + int main () + { + unsigned long pagesize = getpagesize(); + #define page_align(address) (char*)((unsigned long)(address) & -pagesize) + ' + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + [$mprotect_prog + if ((pagesize-1) & pagesize) exit(1); + exit(0); + } + ]]) + ], + [], + [no_mprotect=1], + [dnl When cross-compiling, don't assume anything. + no_mprotect=1 + ]) + mprotect_prog="$mprotect_prog"' + char* area = (char*) malloc(6*pagesize); + char* fault_address = area + pagesize*7/2; + ' + if test -z "$no_mprotect"; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + GL_NOCRASH + [$mprotect_prog + nocrash_init(); + if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) + exit(0); + foo = *fault_address; /* this should cause an exception or signal */ + exit(0); + } + ]]) + ], + [no_mprotect=1], + [], + [dnl When cross-compiling, don't assume anything. + : + ]) + fi + if test -z "$no_mprotect"; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + GL_NOCRASH + [$mprotect_prog + nocrash_init(); + if (mprotect(page_align(fault_address),pagesize,PROT_NONE) < 0) + exit(0); + *fault_address = 'z'; /* this should cause an exception or signal */ + exit(0); + } + ]]) + ], + [no_mprotect=1], + [], + [dnl When cross-compiling, don't assume anything. + : + ]) + fi + if test -z "$no_mprotect"; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + GL_NOCRASH + [$mprotect_prog + nocrash_init(); + if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) + exit(0); + *fault_address = 'z'; /* this should cause an exception or signal */ + exit(0); + } + ]]) + ], + [no_mprotect=1], + [], + [dnl When cross-compiling, don't assume anything. + : + ]) + fi + if test -z "$no_mprotect"; then + AC_RUN_IFELSE( + [AC_LANG_SOURCE([ + GL_NOCRASH + [$mprotect_prog + nocrash_init(); + if (mprotect(page_align(fault_address),pagesize,PROT_READ) < 0) + exit(1); + if (mprotect(page_align(fault_address),pagesize,PROT_READ|PROT_WRITE) < 0) + exit(1); + *fault_address = 'z'; /* this should not cause an exception or signal */ + exit(0); + } + ]]) + ], + [], + [no_mprotect=1], + [dnl When cross-compiling, don't assume anything. + : + ]) + fi + if test -z "$no_mprotect"; then + cl_cv_func_mprotect_works=yes + else + cl_cv_func_mprotect_works=no + fi + else + dnl When cross-compiling, assume the known behaviour. + dnl If we don't know, don't assume anything. + case "$host_os" in + aix* | cygwin* | darwin* | hpux* | irix* | linux* | solaris*) + cl_cv_func_mprotect_works="guessing yes" ;; + mingw*) + cl_cv_func_mprotect_works="guessing no" ;; + *) + cl_cv_func_mprotect_works="guessing no" ;; + esac + fi + ]) + case "$cl_cv_func_mprotect_works" in + *yes) + AC_DEFINE([HAVE_WORKING_MPROTECT], [1], + [have a working mprotect() function]) + ;; + esac + fi + + dnl Test how to use the mprotect function to make memory executable. + dnl Test against the mprotect limitations found in PaX enabled Linux kernels + dnl and HardenedBSD. + case "$ffcall_cv_codeexec" in + *yes | irrelevant) ;; + *) + case "$ac_cv_func_mprotect--$cl_cv_func_mprotect_works" in + yes--*yes) + AC_CACHE_CHECK([whether mprotect can make malloc()ed memory executable], + [ffcall_cv_malloc_mprotect_can_exec], + [dnl On RHEL 6 / CentOS 6 with SELinux enabled, the result of + dnl this test depends on SELinux flags that can be changed at + dnl runtime: By default, the result is 'no'. However, when the flag + dnl allow_execheap is turned on, the result is 'yes'. But the flag + dnl can be turned off again at any moment. + if test "$cross_compiling" != yes -a -d /etc/selinux; then + ffcall_cv_malloc_mprotect_can_exec='determined by SELinux at runtime' + else + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include + #include + /* Declare getpagesize(). */ + #ifdef HAVE_UNISTD_H + #include + #endif + #ifdef __hpux + extern + #ifdef __cplusplus + "C" + #endif + int getpagesize (void); + #endif + #include + /* Declare mprotect(). */ + #include + int + main () + { + unsigned int pagesize = getpagesize (); + char *p = (char *) malloc (50); + int ret; + if (p == (char*) -1) + /* malloc is not working as expected. */ + return 1; + p[5] = 0x77; + ret = mprotect (p - ((unsigned int) p & (pagesize - 1)), pagesize, PROT_READ | PROT_WRITE | PROT_EXEC); + if (ret < 0 + && (errno == EACCES || errno == ENOMEM || errno == ENOTSUP)) + /* mprotect is forbidden to make malloc()ed pages executable that were writable earlier. */ + return 2; + return 0; + } + ]]) + ], + [ffcall_cv_malloc_mprotect_can_exec=yes], + [ffcall_cv_malloc_mprotect_can_exec=no], + [dnl When cross-compiling, assume SELinux on Linux. + dnl If we don't know, assume the worst. + case "$host_os" in + linux*) + ffcall_cv_malloc_mprotect_can_exec='determined by SELinux at runtime' ;; + aix* | cygwin* | darwin* | irix* | solaris*) + ffcall_cv_malloc_mprotect_can_exec="guessing yes" ;; + *) + ffcall_cv_malloc_mprotect_can_exec="guessing no" ;; + esac + ]) + fi + ]) + case "$ffcall_cv_malloc_mprotect_can_exec" in + *yes) MPROTECT_AFTER_MALLOC_CAN_EXEC=1 ;; + *no) MPROTECT_AFTER_MALLOC_CAN_EXEC=0 ;; + *runtime*) MPROTECT_AFTER_MALLOC_CAN_EXEC='-1' ;; + esac + AC_DEFINE_UNQUOTED([HAVE_MPROTECT_AFTER_MALLOC_CAN_EXEC], [$MPROTECT_AFTER_MALLOC_CAN_EXEC], + [have an mprotect() function that can make malloc()ed memory pages executable]) + case "$ffcall_cv_malloc_mprotect_can_exec" in + *yes) ;; + *) + AC_CACHE_CHECK([whether mprotect can make mmap()ed memory executable], + [ffcall_cv_mmap_mprotect_can_exec], + [dnl On RHEL 6 / CentOS 6 with SELinux enabled, the result of + dnl this test depends on SELinux flags that can be changed at + dnl runtime: By default, the result is 'yes'. However, when the flags + dnl allow_execmem and allow_execstack are turned off, the result is + dnl 'no'. + if test "$cross_compiling" != yes -a -d /etc/selinux; then + ffcall_cv_mmap_mprotect_can_exec='determined by SELinux at runtime' + else + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include + #include + /* Declare getpagesize(). */ + #ifdef HAVE_UNISTD_H + #include + #endif + #ifdef __hpux + extern + #ifdef __cplusplus + "C" + #endif + int getpagesize (void); + #endif + #include + /* Declare mmap(), mprotect(). */ + #include + #ifndef MAP_FILE + #define MAP_FILE 0 + #endif + #ifndef MAP_VARIABLE + #define MAP_VARIABLE 0 + #endif + int + main () + { + unsigned int pagesize = getpagesize (); + char *p; + int ret; + #if HAVE_MMAP_ANONYMOUS + p = (char *) mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_VARIABLE, -1, 0); + #elif HAVE_MMAP_DEVZERO + int zero_fd = open("/dev/zero", O_RDONLY, 0666); + if (zero_fd < 0) + return 1; + p = (char *) mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_FILE | MAP_VARIABLE, zero_fd, 0); + #else + ?? + #endif + if (p == (char*) -1) + /* mmap is not working as expected. */ + return 1; + p[5] = 0x77; + ret = mprotect (p, pagesize, PROT_READ | PROT_WRITE | PROT_EXEC); + if (ret < 0 + && (errno == EACCES || errno == ENOMEM || errno == ENOTSUP)) + /* mprotect is forbidden to make mmap()ed pages executable that were writable earlier. */ + return 2; + return 0; + } + ]]) + ], + [ffcall_cv_mmap_mprotect_can_exec=yes], + [ffcall_cv_mmap_mprotect_can_exec=no], + [dnl When cross-compiling, assume SELinux on Linux. + dnl If we don't know, assume the worst. + case "$host_os" in + linux*) ffcall_cv_mmap_mprotect_can_exec='determined by SELinux at runtime' ;; + *) ffcall_cv_mmap_mprotect_can_exec="guessing no" ;; + esac + ]) + fi + ]) + case "$ffcall_cv_mmap_mprotect_can_exec" in + *yes) MPROTECT_AFTER_MMAP_CAN_EXEC=1 ;; + *no) MPROTECT_AFTER_MMAP_CAN_EXEC=0 ;; + *runtime*) MPROTECT_AFTER_MMAP_CAN_EXEC='-1' ;; + esac + AC_DEFINE_UNQUOTED([HAVE_MPROTECT_AFTER_MMAP_CAN_EXEC], [$MPROTECT_AFTER_MMAP_CAN_EXEC], + [have an mprotect() function that can make mmap()ed memory pages executable]) + case "$ffcall_cv_mmap_mprotect_can_exec" in + *yes) ;; + *) + AC_CACHE_CHECK([whether a shared mmap can make memory pages executable], + [ffcall_cv_mmap_shared_can_exec], + [filename="/tmp/trampdata$$.data" + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ + #include + #include + /* Declare getpagesize(). */ + #ifdef HAVE_UNISTD_H + #include + #endif + #ifdef __hpux + extern + #ifdef __cplusplus + "C" + #endif + int getpagesize (void); + #endif + /* Declare mmap(). */ + #include + #ifndef MAP_FILE + #define MAP_FILE 0 + #endif + #ifndef MAP_VARIABLE + #define MAP_VARIABLE 0 + #endif + int + main () + { + unsigned int pagesize = getpagesize (); + int fd; + char *pw; + char *px; + fd = open ("$filename", O_CREAT | O_RDWR | O_TRUNC, 0700); + if (fd < 0) + return 1; + if (ftruncate (fd, pagesize) < 0) + return 2; + pw = (char *) mmap (NULL, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FILE | MAP_VARIABLE, fd, 0); + if (pw == (char*) -1) + return 3; + pw[5] = 0xc3; + px = (char *) mmap (NULL, pagesize, PROT_READ | PROT_EXEC, MAP_SHARED | MAP_FILE | MAP_VARIABLE, fd, 0); + if (px == (char*) -1) + return 4; + if ((char)px[5] != (char)0xc3) + return 5; + /* On i386 and x86_64 this is a 'ret' instruction that we can invoke. */ + #if (defined __i386 || defined __i386__ || defined _I386 || defined _M_IX86 || defined _X86_) || (defined __x86_64__ || defined __amd64__) + ((void (*) (void)) (px + 5)) (); + #endif + return 0; + } + ]]) + ], + [ffcall_cv_mmap_shared_can_exec=yes], + [ffcall_cv_mmap_shared_can_exec=no], + [dnl When cross-compiling, assume yes, since this is the result + dnl on all the platforms where we have tested it. + ffcall_cv_mmap_shared_can_exec="guessing yes" + ]) + rm -f "$filename" + ]) + case "$ffcall_cv_mmap_shared_can_exec" in + *yes) + AC_DEFINE([HAVE_MMAP_SHARED_CAN_EXEC], [1], + [have an mmap() function that, with MAP_SHARED, can make memory pages executable]) + ;; + esac + ;; + esac + ;; + esac + ;; + esac + ;; + esac +]) diff --git a/m4/endianness.m4 b/m4/endianness.m4 new file mode 100644 index 0000000..51f1a3d --- /dev/null +++ b/m4/endianness.m4 @@ -0,0 +1,70 @@ +# endianness.m4 serial 1 +dnl Copyright (C) 2017 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl For specific bi-endian CPUs, sets the ENDIANNESS variable to either +dnl 'eb' (means big endian) or 'el' (means little endian). +dnl +dnl This variable can be used to select a particular assembly language +dnl source file that will interoperate with C code on the given host. +AC_DEFUN([FFCALL_ENDIANNESS], +[ + AC_REQUIRE([AC_CANONICAL_HOST]) + case "$host_cpu" in + arm* ) + AC_CACHE_CHECK([endianness], [ffcall_cv_endianness], + [AC_EGREP_CPP([yes], + [#if defined __ARMEL__ + yes + #endif], + [ffcall_cv_endianness=little], + [ffcall_cv_endianness=big])]) + ;; + mips* ) + AC_CACHE_CHECK([endianness], [ffcall_cv_endianness], + [# Compilers on IRIX define only _MIPSEB as indicator. + # Compilers on Linux define _MIPSEB, __MIPSEB__, __MIPSEB or - in + # the opposite case - _MIPSEL, __MIPSEL__, __MIPSEL. + AC_EGREP_CPP([yes], + [#if defined _MIPSEB + yes + #endif], + [ffcall_cv_endianness=big], + [AC_EGREP_CPP([yes], + [#if defined _MIPSEL + yes + #endif], + [ffcall_cv_endianness=little], + [ffcall_cv_endianness=unknown])]) + ]) + ;; + powerpc*) + AC_CACHE_CHECK([endianness], [ffcall_cv_endianness], + [# Compilers on AIX and Linux define _BIG_ENDIAN, __BIG_ENDIAN__ or + # - in the opposite case - _LITTLE_ENDIAN, __LITTLE_ENDIAN__. + AC_EGREP_CPP([yes], + [#if defined _BIG_ENDIAN + yes + #endif], + [ffcall_cv_endianness=big], + [AC_EGREP_CPP([yes], + [#if defined _LITTLE_ENDIAN + yes + #endif], + [ffcall_cv_endianness=little], + [ffcall_cv_endianness=unknown])]) + ]) + ;; + *) ffcall_cv_endianness=known ;; + esac + case "$ffcall_cv_endianness" in + big) ENDIANNESS='eb' ;; + little) ENDIANNESS='el' ;; + *) ENDIANNESS='' ;; + esac + AC_SUBST([ENDIANNESS]) +]) diff --git a/m4/libtool.m4 b/m4/libtool.m4 new file mode 100644 index 0000000..3471fca --- /dev/null +++ b/m4/libtool.m4 @@ -0,0 +1,8369 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 2014 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. + +# GNU Libtool 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 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program or library that is built +# using GNU Libtool, you may include this file under the same +# distribution terms that you use for the rest of that program. +# +# GNU Libtool 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, see . +]) + +# serial 58 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS=$ltmain + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_PREPARE_CC_BASENAME +# ----------------------- +m4_defun([_LT_PREPARE_CC_BASENAME], [ +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +func_cc_basename () +{ + for cc_temp in @S|@*""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac + done + func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +} +])# _LT_PREPARE_CC_BASENAME + + +# _LT_CC_BASENAME(CC) +# ------------------- +# It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, +# but that macro is also expanded into generated libtool script, which +# arranges for $SED and $ECHO to be set by different means. +m4_defun([_LT_CC_BASENAME], +[m4_require([_LT_PREPARE_CC_BASENAME])dnl +AC_REQUIRE([_LT_DECL_SED])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl +func_cc_basename $1 +cc_basename=$func_cc_basename_result +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl +dnl +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl +m4_require([_LT_CMD_TRUNCATE])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options that allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a '.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld=$lt_cv_prog_gnu_ld + +old_CC=$CC +old_CFLAGS=$CFLAGS + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from 'configure', and 'config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# 'config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain=$ac_aux_dir/ltmain.sh +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the 'libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to 'config.status' so that its +# declaration there will have the same value as in 'configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags='_LT_TAGS'dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into 'config.status', and then the shell code to quote escape them in +# for loops in 'config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# '#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test 0 = "$lt_write_fail" && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +'$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -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 + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2011 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test 0 != $[#] +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try '$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try '$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test yes = "$silent" && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options that allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}"; then + setopt NO_GLOB_SUBST + fi + + cfgfile=${ofile}T + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL +# Generated automatically by $as_me ($PACKAGE) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. + +# Provide generalized library-building support services. +# Written by Gordon Matzigkeit, 1996 + +_LT_COPYING +_LT_LIBTOOL_TAGS + +# Configured defaults for sys_lib_dlsearch_path munging. +: \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + cat <<'_LT_EOF' >> "$cfgfile" + +# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE + +_LT_PREPARE_MUNGE_PATH_LIST +_LT_PREPARE_CC_BASENAME + +# ### END FUNCTIONS SHARED WITH CONFIGURE + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test set != "${COLLECT_NAMES+set}"; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Go], [_LT_LANG(GO)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +m4_ifndef([AC_PROG_GO], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_GO. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ +m4_defun([AC_PROG_GO], +[AC_LANG_PUSH(Go)dnl +AC_ARG_VAR([GOC], [Go compiler command])dnl +AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl +_AC_ARG_VAR_LDFLAGS()dnl +AC_CHECK_TOOL(GOC, gccgo) +if test -z "$GOC"; then + if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) + fi +fi +if test -z "$GOC"; then + AC_CHECK_PROG(GOC, gccgo, gccgo, false) +fi +])#m4_defun +])#m4_ifndef + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([AC_PROG_GO], + [LT_LANG(GO)], + [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "$LT_MULTI_MODULE"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + # If there is a non-empty error log, and "single_module" + # appears in it, assume the flag caused a linker warning + if test -s conftest.err && $GREP single_module conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + # Otherwise, if the output was created with a 0 exit code from + # the compiler, it worked. + elif test -f libconftest.dylib && test 0 = "$_lt_result"; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS=$save_LDFLAGS + ]) + + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -s conftest.err && $GREP force_load conftest.err; then + cat conftest.err >&AS_MESSAGE_LOG_FD + elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[[012]][[,.]]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test yes = "$lt_cv_apple_cc_single_mod"; then + _lt_dar_single_mod='$single_module' + fi + if test yes = "$lt_cv_ld_exported_symbols_list"; then + _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' + fi + if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES([TAG]) +# --------------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test yes = "$lt_cv_ld_force_load"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], + [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined + case $cc_basename in + ifort*|nagfor*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test yes = "$_lt_dar_can_shared"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" + m4_if([$1], [CXX], +[ if test yes != "$lt_cv_apple_cc_single_mod"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test set = "${lt_cv_aix_libpath+set}"; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script that will find a shell with a builtin +# printf (that we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case $ECHO in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], + [Search for dependent libraries within DIR (or the compiler's sysroot + if not specified).])], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case $with_sysroot in #( + yes) + if test yes = "$GCC"; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([$with_sysroot]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and where our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test no = "$enable_libtool_lock" || enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out what ABI is being produced by ac_compile, and set mode + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE=32 + ;; + *ELF-64*) + HPUX_IA64_MODE=64 + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test yes = "$lt_cv_prog_gnu_ld"; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +mips64*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + emul=elf + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + emul="${emul}32" + ;; + *64-bit*) + emul="${emul}64" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *MSB*) + emul="${emul}btsmip" + ;; + *LSB*) + emul="${emul}ltsmip" + ;; + esac + case `/usr/bin/file conftest.$ac_objext` in + *N32*) + emul="${emul}n32" + ;; + esac + LD="${LD-ld} -m $emul" + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. Note that the listed cases only cover the + # situations where additional linker options are needed (such as when + # doing 32-bit compilation for a host where ld defaults to 64-bit, or + # vice versa); the common cases where no linker options are needed do + # not appear in the list. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac + ;; + powerpc64le-*linux*) + LD="${LD-ld} -m elf32lppclinux" + ;; + powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + powerpcle-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test yes != "$lt_cv_cc_needs_belf"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS=$SAVE_CFLAGS + fi + ;; +*-*solaris*) + # Find out what ABI is being produced by ac_compile, and set linker + # options accordingly. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) + case $host in + i?86-*-solaris*|x86_64-*-solaris*) + LD="${LD-ld} -m elf_x86_64" + ;; + sparc*-*-solaris*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + # GNU ld 2.21 introduced _sol2 emulations. Use them if available. + if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then + LD=${LD-ld}_sol2 + fi + ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks=$enable_libtool_lock +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test 0 -eq "$ac_status"; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test 0 -ne "$ac_status"; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test no = "$lt_cv_ar_at_file"; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + bitrig* | openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test yes = "[$]$2"; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS=$save_LDFLAGS +]) + +if test yes = "[$]$2"; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring=ABCD + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + bitrig* | darwin* | dragonfly* | freebsd* | midnightbsd* | netbsd* | openbsd*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + os2*) + # The test takes a long time on OS/2. + lt_cv_sys_max_cmd_len=8192 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test X`env echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test 17 != "$i" # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n "$lt_cv_sys_max_cmd_len"; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes = "$cross_compiling"; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisibility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test yes != "$enable_dlopen"; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen=load_add_on + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen=LoadLibrary + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ + lt_cv_dlopen=dyld + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + tpf*) + # Don't try to run any link tests for TPF. We know it's impossible + # because TPF is a cross-compiler, and we know how we open DSOs. + lt_cv_dlopen=dlopen + lt_cv_dlopen_libs= + lt_cv_dlopen_self=no + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen=shl_load], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen=dlopen], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test no = "$lt_cv_dlopen"; then + enable_dlopen=no + else + enable_dlopen=yes + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS=$CPPFLAGS + test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS=$LDFLAGS + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS=$LIBS + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test yes = "$lt_cv_dlopen_self"; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS=$save_CPPFLAGS + LDFLAGS=$save_LDFLAGS + LIBS=$save_LIBS + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links=nottested +if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test no = "$hard_links"; then + AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", + [Define to the sub-directory where libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then + + # We can hardcode non-existent directories. + if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && + test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || + test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then + # Fast installation is not supported + enable_fast_install=no +elif test yes = "$shlibpath_overrides_runpath" || + test no = "$enable_shared"; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP"; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_PREPARE_MUNGE_PATH_LIST +# --------------------------- +# Make sure func_munge_path_list() is defined correctly. +m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], +[[# func_munge_path_list VARIABLE PATH +# ----------------------------------- +# VARIABLE is name of variable containing _space_ separated list of +# directories to be munged by the contents of PATH, which is string +# having a format: +# "DIR[:DIR]:" +# string "DIR[ DIR]" will be prepended to VARIABLE +# ":DIR[:DIR]" +# string "DIR[ DIR]" will be appended to VARIABLE +# "DIRP[:DIRP]::[DIRA:]DIRA" +# string "DIRP[ DIRP]" will be prepended to VARIABLE and string +# "DIRA[ DIRA]" will be appended to VARIABLE +# "DIR[:DIR]" +# VARIABLE will be replaced by "DIR[ DIR]" +func_munge_path_list () +{ + case x@S|@2 in + x) + ;; + *:) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" + ;; + x:*) + eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + *::*) + eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" + eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" + ;; + *) + eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" + ;; + esac +} +]])# _LT_PREPARE_PATH_LIST + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test yes = "$GCC"; then + case $host_os in + darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; + *) lt_awk_arg='/^libraries:/' ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; + *) lt_sed_strip_eq='s|=/|/|g' ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary... + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + # ...but if some path component already ends with the multilib dir we assume + # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). + case "$lt_multi_os_dir; $lt_search_path_spec " in + "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) + lt_multi_os_dir= + ;; + esac + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" + elif test -n "$lt_multi_os_dir"; then + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS = " "; FS = "/|\n";} { + lt_foo = ""; + lt_count = 0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo = "/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=.so +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +AC_ARG_VAR([LT_SYS_LIBRARY_PATH], +[User-defined run-time library search path.]) + +case $host_os in +aix3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='$libname$release$shared_ext$major' + ;; + +aix[[4-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test ia64 = "$host_cpu"; then + # AIX 5 supports IA64 + library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line '#! .'. This would cause the generated library to + # depend on '.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # Using Import Files as archive members, it is possible to support + # filename-based versioning of shared library archives on AIX. While + # this would work for both with and without runtime linking, it will + # prevent static linking of such archives. So we do filename-based + # shared library versioning with .so extension only, which is used + # when both runtime linking and shared linking is enabled. + # Unfortunately, runtime linking may impact performance, so we do + # not want this to be the default eventually. Also, we use the + # versioned .so libs for executables only if there is the -brtl + # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. + # To allow for filename-based versioning support, we need to create + # libNAME.so.V as an archive file, containing: + # *) an Import File, referring to the versioned filename of the + # archive as well as the shared archive member, telling the + # bitwidth (32 or 64) of that shared object, and providing the + # list of exported symbols of that shared object, eventually + # decorated with the 'weak' keyword + # *) the shared object with the F_LOADONLY flag set, to really avoid + # it being seen by the linker. + # At run time we better use the real file rather than another symlink, + # but for link time we create the symlink libNAME.so -> libNAME.so.V + + case $with_aix_soname,$aix_use_runtimelinking in + # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + aix,yes) # traditional libtool + dynamic_linker='AIX unversionable lib.so' + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + aix,no) # traditional AIX only + dynamic_linker='AIX lib.a[(]lib.so.V[)]' + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + ;; + svr4,*) # full svr4 only + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,yes) # both, prefer svr4 + dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" + library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' + # unpreferred sharedlib libNAME.a needs extra handling + postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' + postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' + # We do not specify a path in Import Files, so LIBPATH fires. + shlibpath_overrides_runpath=yes + ;; + *,no) # both, prefer aix + dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" + library_names_spec='$libname$release.a $libname.a' + soname_spec='$libname$release$shared_ext$major' + # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling + postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' + postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' + ;; + esac + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='$libname$shared_ext' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' + library_names_spec='$libname.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec=$LIB + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' + soname_spec='$libname$release$major$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd* | dragonfly* | midnightbsd*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[23]].*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2.*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +haiku*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=no + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + if test 32 = "$HPUX_IA64_MODE"; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + sys_lib_dlsearch_path_spec=/usr/lib/hpux32 + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + sys_lib_dlsearch_path_spec=/usr/lib/hpux64 + fi + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test yes = "$lt_cv_prog_gnu_ld"; then + version_type=linux # correct to gnu/linux during the next big refactor + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" + sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +linux*android*) + version_type=none # Android doesn't support versioned libraries. + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext' + soname_spec='$libname$release$shared_ext' + finish_cmds= + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + dynamic_linker='Android linker' + # Don't embed -rpath directories since the linker doesn't support them. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Ideally, we could use ldconfig to report *all* directores which are + # searched for libraries, however this is still not possible. Aside from not + # being certain /sbin/ldconfig is available, command + # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, + # even though it is searched at run-time. Try to do the best guess by + # appending ld.so.conf contents (and includes) to the search path. + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd* | bitrig*) + version_type=sunos + sys_lib_dlsearch_path_spec=/usr/lib + need_lib_prefix=no + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + need_version=no + else + need_version=yes + fi + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +os2*) + libname_spec='$name' + version_type=windows + shrext_cmds=.dll + need_version=no + need_lib_prefix=no + # OS/2 can only load a DLL with a base name of 8 characters or less. + soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; + v=$($ECHO $release$versuffix | tr -d .-); + n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); + $ECHO $n$v`$shared_ext' + library_names_spec='${libname}_dll.$libext' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=BEGINLIBPATH + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + postinstall_cmds='base_file=`basename \$file`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='$libname$release$shared_ext$major' + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test yes = "$with_gnu_ld"; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec; then + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' + soname_spec='$libname$shared_ext.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=sco + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test yes = "$with_gnu_ld"; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux # correct to gnu/linux during the next big refactor + need_lib_prefix=no + need_version=no + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux # correct to gnu/linux during the next big refactor + library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' + soname_spec='$libname$release$shared_ext$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test no = "$dynamic_linker" && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test yes = "$GCC"; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then + sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec +fi + +if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then + sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec +fi + +# remember unaugmented sys_lib_dlsearch_path content for libtool script decls... +configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec + +# ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code +func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" + +# to be used as default LT_SYS_LIBRARY_PATH value in generated libtool +configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], + [Detected run-time system search path for libraries]) +_LT_DECL([], [configure_time_lt_sys_library_path], [2], + [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program that can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD=$MAGIC_CMD + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$1"; then + lt_cv_path_MAGIC_CMD=$ac_dir/"$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD=$lt_cv_path_MAGIC_CMD + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS=$lt_save_ifs + MAGIC_CMD=$lt_save_MAGIC_CMD + ;; +esac]) +MAGIC_CMD=$lt_cv_path_MAGIC_CMD +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program that can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test no = "$withval" || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test yes = "$GCC"; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return, which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD=$ac_prog + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test yes = "$with_gnu_ld"; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD=$ac_dir/$ac_prog + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i +cat conftest.i conftest.i >conftest2.i +: ${lt_DD:=$DD} +AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], +[if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: +fi]) +rm -f conftest.i conftest2.i conftest.out]) +])# _LT_PATH_DD + + +# _LT_CMD_TRUNCATE +# ---------------- +# find command to truncate a binary pipe +m4_defun([_LT_CMD_TRUNCATE], +[m4_require([_LT_PATH_DD]) +AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], +[printf 0123456789abcdef0123456789abcdef >conftest.i +cat conftest.i conftest.i >conftest2.i +lt_cv_truncate_bin= +if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then + cmp -s conftest.i conftest.out \ + && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" +fi +rm -f conftest.i conftest2.i conftest.out +test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) +_LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], + [Command to truncate a binary pipe]) +])# _LT_CMD_TRUNCATE + + +# _LT_CHECK_MAGIC_METHOD +# ---------------------- +# how to check for library dependencies +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_MAGIC_METHOD], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +AC_CACHE_CHECK([how to recognize dependent libraries], +lt_cv_deplibs_check_method, +[lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# 'unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# that responds to the $file_magic_cmd with a given extended regex. +# If you have 'file' or equivalent on your system and you're not sure +# whether 'pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[[4-9]]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[[45]]*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + if ( file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly* | midnightbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be glibc/ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd* | bitrig*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +os2*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM=$NM +else + lt_nm_to_check=${ac_tool_prefix}nm + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS=$lt_save_ifs + test -z "$ac_dir" && ac_dir=. + tmp_nm=$ac_dir/$lt_tmp_nm + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the 'sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty + case $build_os in + mingw*) lt_bad_file=conftest.nm/nofile ;; + *) lt_bad_file=/dev/null ;; + esac + case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in + *$lt_bad_file* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break 2 + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break 2 + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS=$lt_save_ifs + done + : ${lt_cv_path_NM=no} +fi]) +if test no != "$lt_cv_path_NM"; then + NM=$lt_cv_path_NM +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols -headers" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test : != "$DUMPBIN"; then + NM=$DUMPBIN + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh; + # decide which one to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd=$ECHO + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test yes != "$lt_cv_path_mainfest_tool"; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# _LT_DLL_DEF_P([FILE]) +# --------------------- +# True iff FILE is a Windows DLL '.def' file. +# Keep in sync with func_dll_def_p in the libtool script +AC_DEFUN([_LT_DLL_DEF_P], +[dnl + test DEF = "`$SED -n dnl + -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace + -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments + -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl + -e q dnl Only consider the first "real" line + $1`" dnl +])# _LT_DLL_DEF_P + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM=-lm) + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test yes = "$GCC"; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test ia64 = "$host_cpu"; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BCDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Gets list of data symbols to import. + lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" + # Adjust the below global symbol transforms to fixup imported variables. + lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" + lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" + lt_c_name_lib_hook="\ + -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ + -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" +else + # Disable hooks by default. + lt_cv_sys_global_symbol_to_import= + lt_cdecl_hook= + lt_c_name_hook= + lt_c_name_lib_hook= +fi + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n"\ +$lt_cdecl_hook\ +" -e 's/^T .* \(.*\)$/extern int \1();/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ +$lt_c_name_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" + +# Transform an extracted symbol line into symbol name with lib prefix and +# symbol address. +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ +$lt_c_name_lib_hook\ +" -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ +" -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ +" -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function, + # D for any global variable and I for any imported variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ +" /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ +" /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ +" {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ +" s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE +/* DATA imports from DLLs on WIN32 can't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined __osf__ +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS=conftstm.$ac_objext + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test yes = "$pipe_works"; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], + [Transform the output of nm into a list of symbols to manually relocate]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([nm_interface], [lt_cv_nm_interface], [1], + [The name lister interface]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64, which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test yes = "$GCC"; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the '-m68020' flag to GCC prevents building anything better, + # like '-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" + fi + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test ia64 = "$host_cpu"; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + case $cc_basename in + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + case $host_os in + os2*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' + ;; + esac + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + # old Intel for x86_64, which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ F* | *Sun*Fortran*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + *Intel*\ [[CF]]*Compiler*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + *Portland\ Group*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms that do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ' (' and ')$', so one must not match beginning or + # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', + # as well as any symbol that contains 'd'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test yes != "$GCC"; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd* | bitrig*) + with_gnu_ld=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test yes = "$with_gnu_ld"; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test yes = "$lt_use_gnu_ld_interface"; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='$wl' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test ia64 != "$host_cpu"; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test linux-dietlibc = "$host_os"; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test no = "$tmp_diet" + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + nagfor*) # NAGFOR 5.3 + tmp_sharedflag='-Wl,-shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + tcc*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' + ;; + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to GNU nm, but means don't demangle to AIX nm. + # Without the "-l" option, or with the "-B" option, AIX nm treats + # weak defined symbols like other global defined symbols, whereas + # GNU nm marks them as "W". + # While the 'weak' keyword is ignored in the Export File, we need + # it in the Import File for the 'aix-soname' feature, so we have + # to replace the "-B" option with "-P" for AIX nm. + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then + aix_use_runtimelinking=yes + break + fi + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # traditional, no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GCC"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag="$shared_flag "'$wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2.*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly* | midnightbsd*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + + hpux10*) + if test yes,no = "$GCC,$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test yes,no = "$GCC,$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS=$LDFLAGS + LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS=$save_LDFLAGS]) + if test yes = "$lt_cv_irix_exported_symbol"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + linux*) + case $cc_basename in + tcc*) + # Fabrice Bellard et al's Tiny C Compiler + _LT_TAGVAR(ld_shlibs, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + osf3*) + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test yes = "$GCC"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test yes = "$GCC"; then + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='$wl' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. GCC discards it without '$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test yes = "$GCC"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test sequent = "$host_vendor"; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + if test yes = "$GCC"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test sni = "$host_vendor"; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test yes,yes = "$GCC,$enable_shared"; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting $shlibpath_var if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC=$CC +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report what library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC=$lt_save_CC +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test no != "$CXX" && + ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || + (test g++ != "$CXX"))); then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_caught_CXX_error"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test yes = "$GXX"; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test yes = "$GXX"; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test yes = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='$wl' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test ia64 = "$host_cpu"; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag= + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # have runtime linking enabled, and use it for executables. + # For shared libraries, we enable/disable runtime linking + # depending on the kind of the shared library created - + # when "with_aix_soname,aix_use_runtimelinking" is: + # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables + # "aix,yes" lib.so shared, rtl:yes, for executables + # lib.a static archive + # "both,no" lib.so.V(shr.o) shared, rtl:yes + # lib.a(lib.so.V) shared, rtl:no, for executables + # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a(lib.so.V) shared, rtl:no + # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables + # lib.a static archive + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then + # With aix-soname=svr4, we create the lib.so.V shared archives only, + # so we don't have lib.a shared libs to link our executables. + # We have to force runtime linking in this case. + aix_use_runtimelinking=yes + LDFLAGS="$LDFLAGS -Wl,-brtl" + fi + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='$wl-f,' + case $with_aix_soname,$aix_use_runtimelinking in + aix,*) ;; # no import file + svr4,* | *,yes) # use import file + # The Import File defines what to hardcode. + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + ;; + esac + + if test yes = "$GXX"; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`$CC -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test yes = "$aix_use_runtimelinking"; then + shared_flag=$shared_flag' $wl-G' + fi + # Need to ensure runtime linking is disabled for the traditional + # shared library, or the linker may eventually find shared libraries + # /with/ Import File - we do not want to mix them. + shared_flag_aix='-shared' + shared_flag_svr4='-shared $wl-G' + else + # not using gcc + if test ia64 = "$host_cpu"; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test yes = "$aix_use_runtimelinking"; then + shared_flag='$wl-G' + else + shared_flag='$wl-bM:SRE' + fi + shared_flag_aix='$wl-bM:SRE' + shared_flag_svr4='$wl-G' + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + # The "-G" linker flag allows undefined symbols. + _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag + else + if test ia64 = "$host_cpu"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' + if test yes = "$with_gnu_ld"; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' + # -brtl affects multiple linker settings, -berok does not and is overridden later + compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' + if test svr4 != "$with_aix_soname"; then + # This is similar to how AIX traditionally builds its shared + # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' + fi + if test aix != "$with_aix_soname"; then + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' + else + # used by -dlpreopen to get the symbols + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' + fi + _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=.dll + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp "$export_symbols" "$output_objdir/$soname.def"; + echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; + else + $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile=$lt_outputfile.exe + lt_tool_outputfile=$lt_tool_outputfile.exe + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file, use it as + # is; otherwise, prepend EXPORTS... + _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + shrext_cmds=.dll + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ + $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ + $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ + $ECHO EXPORTS >> $output_objdir/$libname.def~ + prefix_cmds="$SED"~ + if test EXPORTS = "`$SED 1q $export_symbols`"; then + prefix_cmds="$prefix_cmds -e 1d"; + fi~ + prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ + cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ + $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ + emximp -o $lib $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd2.*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly* | midnightbsd*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test yes = "$GXX"; then + if test no = "$with_gnu_ld"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' + if test yes = "$supports_anon_versioning"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd* | bitrig*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands '-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test yes,no = "$GXX,$with_gnu_ld"; then + _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require '-G' NOT '-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We CANNOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no + + _LT_TAGVAR(GCC, $1)=$GXX + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test yes != "$_lt_caught_CXX_error" + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case @S|@2 in + .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; + *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF +package foo +func foo() { +} +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case $prev$p in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test x-L = "$p" || + test x-R = "$p"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test no = "$pre_test_object_deps_done"; then + case $prev in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)=$prev$p + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test no = "$pre_test_object_deps_done"; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)=$p + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)=$p + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test no = "$F77"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_F77"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$G77 + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_F77" + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test no = "$FC"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test yes != "$_lt_disable_FC"; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test no = "$can_build_shared" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test yes = "$enable_shared" && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test ia64 != "$host_cpu"; then + case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in + yes,aix,yes) ;; # shared object as lib.so file only + yes,svr4,*) ;; # shared object as lib.so archive member only + yes,*) enable_static=no ;; # shared object in lib.a archive as well + esac + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test yes = "$enable_shared" || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu + _LT_TAGVAR(LD, $1)=$LD + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test yes != "$_lt_disable_FC" + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_GO_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Go compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_GO_CONFIG], +[AC_REQUIRE([LT_PROG_GO])dnl +AC_LANG_SAVE + +# Source file extension for Go test sources. +ac_ext=go + +# Object file extension for compiled Go test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="package main; func main() { }" + +# Code to be used in simple link tests +lt_simple_link_test_code='package main; func main() { }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GOC-"gccgo"} +CFLAGS=$GOFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)=$LD +_LT_CC_BASENAME([$compiler]) + +# Go did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GO_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to 'libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code=$lt_simple_compile_test_code + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_GO +# ---------- +AC_DEFUN([LT_PROG_GO], +[AC_CHECK_TOOL(GOC, gccgo,) +]) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f "$lt_ac_sed" && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test 10 -lt "$lt_ac_count" && break + lt_ac_count=`expr $lt_ac_count + 1` + if test "$lt_ac_count" -gt "$lt_ac_max"; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine what file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/m4/ln.m4 b/m4/ln.m4 new file mode 100644 index 0000000..b2ccbea --- /dev/null +++ b/m4/ln.m4 @@ -0,0 +1,51 @@ +dnl -*- Autoconf -*- +dnl Copyright (C) 1993-2017 Free Software Foundation, Inc. +dnl This file is free software, distributed under the terms of the GNU +dnl General Public License as published by the Free Software Foundation; +dnl either version 2 of the License, or (at your option) any later version. +dnl As a special exception to the GNU General Public License, this file +dnl may be distributed as part of a program that contains a configuration +dnl script generated by Autoconf, under the same distribution terms as +dnl the rest of that program. + +dnl From Bruno Haible, Marcus Daniels, Sam Steingold. + +AC_PREREQ([2.13]) + +AC_DEFUN([CL_PROG_LN], +[ + AC_CACHE_CHECK([how to make hard links], [cl_cv_prog_LN], + [rm -f conftestdata conftestfile + echo data > conftestfile + if ln conftestfile conftestdata 2>/dev/null; then + cl_cv_prog_LN=ln + else + cl_cv_prog_LN="cp -p" + fi + rm -f conftestdata conftestfile + ]) + LN="$cl_cv_prog_LN" + AC_SUBST([LN]) +]) + +AC_DEFUN([CL_PROG_LN_S], +[ + AC_REQUIRE([CL_PROG_LN]) + dnl Make a symlink if possible; otherwise try a hard link. On filesystems + dnl which support neither symlink nor hard link, use a plain copy. + AC_CACHE_CHECK([whether ln -s works], [cl_cv_prog_LN_S_works], + [rm -f conftestdata + if ln -s X conftestdata 2>/dev/null; then + cl_cv_prog_LN_S_works=yes + else + cl_cv_prog_LN_S_works=no + fi + rm -f conftestdata + ]) + if test $cl_cv_prog_LN_S_works = yes; then + LN_S="ln -s" + else + LN_S="$cl_cv_prog_LN" + fi + AC_SUBST([LN_S]) +]) diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4 new file mode 100644 index 0000000..94b0829 --- /dev/null +++ b/m4/ltoptions.m4 @@ -0,0 +1,437 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 8 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option '$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl 'shared' nor 'disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], + [_LT_WITH_AIX_SONAME([aix])]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the 'shared' and +# 'disable-shared' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the 'static' and +# 'disable-static' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the 'fast-install' +# and 'disable-fast-install' LT_INIT options. +# DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for pkg in $enableval; do + IFS=$lt_save_ifs + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the 'disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_AIX_SONAME([DEFAULT]) +# ---------------------------------- +# implement the --with-aix-soname flag, and support the `aix-soname=aix' +# and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT +# is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. +m4_define([_LT_WITH_AIX_SONAME], +[m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl +shared_archive_member_spec= +case $host,$enable_shared in +power*-*-aix[[5-9]]*,yes) + AC_MSG_CHECKING([which variant of shared library versioning to provide]) + AC_ARG_WITH([aix-soname], + [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], + [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], + [case $withval in + aix|svr4|both) + ;; + *) + AC_MSG_ERROR([Unknown argument to --with-aix-soname]) + ;; + esac + lt_cv_with_aix_soname=$with_aix_soname], + [AC_CACHE_VAL([lt_cv_with_aix_soname], + [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) + with_aix_soname=$lt_cv_with_aix_soname]) + AC_MSG_RESULT([$with_aix_soname]) + if test aix != "$with_aix_soname"; then + # For the AIX way of multilib, we name the shared archive member + # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', + # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. + # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, + # the AIX toolchain works better with OBJECT_MODE set (default 32). + if test 64 = "${OBJECT_MODE-32}"; then + shared_archive_member_spec=shr_64 + else + shared_archive_member_spec=shr + fi + fi + ;; +*) + with_aix_soname=aix + ;; +esac + +_LT_DECL([], [shared_archive_member_spec], [0], + [Shared archive member basename, for filename based shared library versioning on AIX])dnl +])# _LT_WITH_AIX_SONAME + +LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) +LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the 'pic-only' and 'no-pic' +# LT_INIT options. +# MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [lt_p=${PACKAGE-default} + case $withval in + yes|no) pic_mode=$withval ;; + *) + pic_mode=default + # Look at the argument we got. We use all the common list separators. + lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, + for lt_pkg in $withval; do + IFS=$lt_save_ifs + if test "X$lt_pkg" = "X$lt_p"; then + pic_mode=yes + fi + done + IFS=$lt_save_ifs + ;; + esac], + [pic_mode=m4_default([$1], [default])]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the 'pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4 new file mode 100644 index 0000000..48bc934 --- /dev/null +++ b/m4/ltsugar.m4 @@ -0,0 +1,124 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software +# Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59, which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/m4/ltversion.m4 b/m4/ltversion.m4 new file mode 100644 index 0000000..fa04b52 --- /dev/null +++ b/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 4179 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4.6]) +m4_define([LT_PACKAGE_REVISION], [2.4.6]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4.6' +macro_revision='2.4.6' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4 new file mode 100644 index 0000000..c6b26f8 --- /dev/null +++ b/m4/lt~obsolete.m4 @@ -0,0 +1,99 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software +# Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/m4/mmap-anon.m4 b/m4/mmap-anon.m4 new file mode 100644 index 0000000..e47aa2d --- /dev/null +++ b/m4/mmap-anon.m4 @@ -0,0 +1,55 @@ +# mmap-anon.m4 serial 12 +dnl Copyright (C) 2005, 2007, 2009-2021 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +# Detect how mmap can be used to create anonymous (not file-backed) memory +# mappings. +# - On Linux, AIX, OSF/1, Solaris, Cygwin, Interix, Haiku, both MAP_ANONYMOUS +# and MAP_ANON exist and have the same value. +# - On HP-UX, only MAP_ANONYMOUS exists. +# - On Mac OS X, FreeBSD, NetBSD, OpenBSD, Minix, only MAP_ANON exists. +# - On IRIX, neither exists, and a file descriptor opened to /dev/zero must be +# used. + +AC_DEFUN_ONCE([gl_FUNC_MMAP_ANON], +[ + dnl Persuade glibc to define MAP_ANONYMOUS. + AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + + # Check for mmap(). Don't use AC_FUNC_MMAP, because it checks too much: it + # fails on HP-UX 11, because MAP_FIXED mappings do not work. But this is + # irrelevant for anonymous mappings. + AC_CHECK_FUNC([mmap], [gl_have_mmap=yes], [gl_have_mmap=no]) + + # Try to allow MAP_ANONYMOUS. + gl_have_mmap_anonymous=no + if test $gl_have_mmap = yes; then + AC_MSG_CHECKING([for MAP_ANONYMOUS]) + AC_EGREP_CPP([I cannot identify this map], [ +#include +#ifdef MAP_ANONYMOUS + I cannot identify this map +#endif +], + [gl_have_mmap_anonymous=yes]) + if test $gl_have_mmap_anonymous != yes; then + AC_EGREP_CPP([I cannot identify this map], [ +#include +#ifdef MAP_ANON + I cannot identify this map +#endif +], + [AC_DEFINE([MAP_ANONYMOUS], [MAP_ANON], + [Define to a substitute value for mmap()'s MAP_ANONYMOUS flag.]) + gl_have_mmap_anonymous=yes]) + fi + AC_MSG_RESULT([$gl_have_mmap_anonymous]) + if test $gl_have_mmap_anonymous = yes; then + AC_DEFINE([HAVE_MAP_ANONYMOUS], [1], + [Define to 1 if mmap()'s MAP_ANONYMOUS flag is available after including + config.h and .]) + fi + fi +]) diff --git a/testcases.c b/testcases.c new file mode 100644 index 0000000..9dbef32 --- /dev/null +++ b/testcases.c @@ -0,0 +1,807 @@ +/* + * Copyright 1993 Bill Triggs + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +/* This file defines test functions of selected signatures, that exercise + dark corners of the various ABIs. */ + +#include + +FILE* out; + +#define uchar unsigned char +#define ushort unsigned short +#define uint unsigned int +#define ulong unsigned long + +typedef struct { char x; } Char; +typedef struct { short x; } Short; +typedef struct { int x; } Int; +typedef struct { long x; } Long; +typedef struct { float x; } Float; +typedef struct { double x; } Double; +typedef struct { char c; float f; } A; +typedef struct { double d; int i[3]; } B; +typedef struct { long l1; long l2; } J; +typedef struct { long l1; long l2; long l3; long l4; } K; +typedef struct { long l1; long l2; long l3; long l4; long l5; long l6; } L; +typedef struct { char x1; } Size1; +typedef struct { char x1; char x2; } Size2; +typedef struct { char x1; char x2; char x3; } Size3; +typedef struct { char x1; char x2; char x3; char x4; } Size4; +typedef struct { + char x1; char x2; char x3; char x4; char x5; char x6; char x7; +} Size7; +typedef struct { + char x1; char x2; char x3; char x4; char x5; char x6; char x7; char x8; +} Size8; +typedef struct { + char x1; char x2; char x3; char x4; char x5; char x6; char x7; char x8; + char x9; char x10; char x11; char x12; +} Size12; +typedef struct { + char x1; char x2; char x3; char x4; char x5; char x6; char x7; char x8; + char x9; char x10; char x11; char x12; char x13; char x14; char x15; +} Size15; +typedef struct { + char x1; char x2; char x3; char x4; char x5; char x6; char x7; char x8; + char x9; char x10; char x11; char x12; char x13; char x14; char x15; char x16; +} Size16; +typedef struct { char c[3]; } T; +typedef struct { char c[33],c1; } X; + +char c1='a', c2=127, c3=(char)128, c4=(char)255, c5=-1; +short s1=32767, s2=(short)32768, s3=3, s4=4, s5=5, s6=6, s7=7, s8=8, s9=9; +int i1=1, i2=2, i3=3, i4=4, i5=5, i6=6, i7=7, i8=8, i9=9, i10=11, i11=12, + i12=13, i13=14, i14=15, i15=16, i16=17, i17=18, i18=19, i19=20, i20=21, + i21=22, i22=23, i23=24, i24=25, i25=26, i26=27, i27=28, i28=29, i29=30, + i30=31, i31=32, i32=33; +long l1=1, l2=2, l3=3, l4=4, l5=5, l6=6, l7=7, l8=8, l9=9; +long long ll1 = 3875056143130689530LL; +float f1=0.1, f2=0.2, f3=0.3, f4=0.4, f5=0.5, f6=0.6, f7=0.7, f8=0.8, f9=0.9, + f10=1.1, f11=1.2, f12=1.3, f13=1.4, f14=1.5, f15=1.6, f16=1.7, f17=1.8, + f18=1.9, f19=2.1, f20=2.2, f21=2.3, f22=2.4, f23=2.5, f24=2.6; +double d1=0.1, d2=0.2, d3=0.3, d4=0.4, d5=0.5, d6=0.6, d7=0.7, d8=0.8, d9=0.9, + d10=1.1, d11=1.2, d12=1.3, d13=1.4, d14=1.5, d15=1.6, d16=1.7, d17=1.8; + +uchar uc1='a', uc2=127, uc3=128, uc4=255, uc5=(uchar)-1; +ushort us1=1, us2=2, us3=3, us4=4, us5=5, us6=6, us7=7, us8=8, us9=9; +uint ui1=1, ui2=2, ui3=3, ui4=4, ui5=5, ui6=6, ui7=7, ui8=8, ui9=9; +ulong ul1=1, ul2=2, ul3=3, ul4=4, ul5=5, ul6=6, ul7=7, ul8=8, ul9=9; + +char *str1="hello",str2[]="goodbye",*str3="still here?"; +Char C1={'A'}, C2={'B'}, C3={'C'}, C4={'\377'}, C5={(char)(-1)}; +Short S1={1}, S2={2}, S3={3}, S4={4}, S5={5}, S6={6}, S7={7}, S8={8}, S9={9}; +Int I1={1}, I2={2}, I3={3}, I4={4}, I5={5}, I6={6}, I7={7}, I8={8}, I9={9}; +Float F1={0.1}, F2={0.2}, F3={0.3}, F4={0.4}, F5={0.5}, F6={0.6}, F7={0.7}, F8={0.8}, F9={0.9}; +Double D1={0.1}, D2={0.2}, D3={0.3}, D4={0.4}, D5={0.5}, D6={0.6}, D7={0.7}, D8={0.8}, D9={0.9}; + +A A1={'a',0.1},A2={'b',0.2},A3={'\377',0.3}; +B B1={0.1,{1,2,3}},B2={0.2,{5,4,3}}; +J J1={47,11},J2={73,55}; +K K1={19,69,12,28}; +L L1={561,1105,1729,2465,2821,6601}; /* A002997 */ +Size1 Size1_1={'a'}; +Size2 Size2_1={'a','b'}; +Size3 Size3_1={'a','b','c'}; +Size4 Size4_1={'a','b','c','d'}; +Size7 Size7_1={'a','b','c','d','e','f','g'}; +Size8 Size8_1={'a','b','c','d','e','f','g','h'}; +Size12 Size12_1={'a','b','c','d','e','f','g','h','i','j','k','l'}; +Size15 Size15_1={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o'}; +Size16 Size16_1={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p'}; +T T1={'t','h','e'},T2={'f','o','x'}; +X X1={"abcdefghijklmnopqrstuvwxyzABCDEF",'G'}, X2={"123",'9'}, X3={"return-return-return",'R'}; + +/* void tests */ +void v_v (void) +{ + fprintf(out,"void f(void):\n"); + fflush(out); +} + +/* int tests */ +int i_v (void) +{ + int r=99; + fprintf(out,"int f(void):"); + fflush(out); + return r; +} +int i_i (int a) +{ + int r=a+1; + fprintf(out,"int f(int):(%d)",a); + fflush(out); + return r; +} +int i_i2 (int a, int b) +{ + int r=a+b; + fprintf(out,"int f(2*int):(%d,%d)",a,b); + fflush(out); + return r; +} +int i_i4 (int a, int b, int c, int d) +{ + int r=a+b+c+d; + fprintf(out,"int f(4*int):(%d,%d,%d,%d)",a,b,c,d); + fflush(out); + return r; +} +int i_i8 (int a, int b, int c, int d, int e, int f, int g, int h) +{ + int r=a+b+c+d+e+f+g+h; + fprintf(out,"int f(8*int):(%d,%d,%d,%d,%d,%d,%d,%d)",a,b,c,d,e,f,g,h); + fflush(out); + return r; +} +int i_i16 (int a, int b, int c, int d, int e, int f, int g, int h, + int i, int j, int k, int l, int m, int n, int o, int p) +{ + int r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p; + fprintf(out,"int f(16*int):(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)", + a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); + fflush(out); + return r; +} +int i_i32 (int a, int b, int c, int d, int e, int f, int g, int h, + int i, int j, int k, int l, int m, int n, int o, int p, + int aa, int ab, int ac, int ad, int ae, int af, int ag, int ah, + int ai, int aj, int ak, int al, int am, int an, int ao, int ap) +{ + int r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+aa+ab+ac+ad+ae+af+ag+ah+ai+aj+ak+al+am+an+ao+ap; + fprintf(out,"int f(32*int):(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)", + a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap); + fflush(out); + return r; +} + +/* float tests */ +float f_f (float a) +{ + float r=a+1.0; + fprintf(out,"float f(float):(%g)",a); + fflush(out); + return r; +} +float f_f2 (float a, float b) +{ + float r=a+b; + fprintf(out,"float f(2*float):(%g,%g)",a,b); + fflush(out); + return r; +} +float f_f4 (float a, float b, float c, float d) +{ + float r=a+b+c+d; + fprintf(out,"float f(4*float):(%g,%g,%g,%g)",a,b,c,d); + fflush(out); + return r; +} +float f_f8 (float a, float b, float c, float d, float e, float f, + float g, float h) +{ + float r=a+b+c+d+e+f+g+h; + fprintf(out,"float f(8*float):(%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h); + fflush(out); + return r; +} +float f_f16 (float a, float b, float c, float d, float e, float f, float g, float h, + float i, float j, float k, float l, float m, float n, float o, float p) +{ + float r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p; + fprintf(out,"float f(16*float):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); + fflush(out); + return r; +} +float f_f24 (float a, float b, float c, float d, float e, float f, float g, float h, + float i, float j, float k, float l, float m, float n, float o, float p, + float q, float s, float t, float u, float v, float w, float x, float y) +{ + float r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+v+w+x+y; + fprintf(out,"float f(24*float):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,v,w,x,y); + fflush(out); + return r; +} + +/* double tests */ +double d_d (double a) +{ + double r=a+1.0; + fprintf(out,"double f(double):(%g)",a); + fflush(out); + return r; +} +double d_d2 (double a, double b) +{ + double r=a+b; + fprintf(out,"double f(2*double):(%g,%g)",a,b); + fflush(out); + return r; +} +double d_d4 (double a, double b, double c, double d) +{ + double r=a+b+c+d; + fprintf(out,"double f(4*double):(%g,%g,%g,%g)",a,b,c,d); + fflush(out); + return r; +} +double d_d8 (double a, double b, double c, double d, double e, double f, + double g, double h) +{ + double r=a+b+c+d+e+f+g+h; + fprintf(out,"double f(8*double):(%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h); + fflush(out); + return r; +} +double d_d16 (double a, double b, double c, double d, double e, double f, + double g, double h, double i, double j, double k, double l, + double m, double n, double o, double p) +{ + double r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p; + fprintf(out,"double f(16*double):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); + fflush(out); + return r; +} + +/* pointer tests */ +void* vp_vpdpcpsp (void* a, double* b, char* c, Int* d) +{ + void* ret = (char*)b + 1; + fprintf(out,"void* f(void*,double*,char*,Int*):(0x%p,0x%p,0x%p,0x%p)",a,b,c,d); + fflush(out); + return ret; +} + +/* mixed number tests */ +uchar uc_ucsil (uchar a, ushort b, uint c, ulong d) +{ + uchar r = (uchar)-1; + fprintf(out,"uchar f(uchar,ushort,uint,ulong):(%u,%u,%u,%lu)",a,b,c,d); + fflush(out); + return r; +} +double d_iidd (int a, int b, double c, double d) +{ + double r = a+b+c+d; + fprintf(out,"double f(int,int,double,double):(%d,%d,%g,%g)",a,b,c,d); + fflush(out); + return r; +} +double d_iiidi (int a, int b, int c, double d, int e) +{ + double r = a+b+c+d+e; + fprintf(out,"double f(int,int,int,double,int):(%d,%d,%d,%g,%d)",a,b,c,d,e); + fflush(out); + return r; +} +double d_idid (int a, double b, int c, double d) +{ + double r = a+b+c+d; + fprintf(out,"double f(int,double,int,double):(%d,%g,%d,%g)",a,b,c,d); + fflush(out); + return r; +} +double d_fdi (float a, double b, int c) +{ + double r = a+b+c; + fprintf(out,"double f(float,double,int):(%g,%g,%d)",a,b,c); + fflush(out); + return r; +} +ushort us_cdcd (char a, double b, char c, double d) +{ + ushort r = (ushort)(int)(a + b + c + d); + fprintf(out,"ushort f(char,double,char,double):('%c',%g,'%c',%g)",a,b,c,d); + fflush(out); + return r; +} + +long long ll_iiilli (int a, int b, int c, long long d, int e) +{ + long long r = (long long)(int)a+(long long)(int)b+(long long)(int)c+d+(long long)(int)e; + fprintf(out,"long long f(int,int,int,long long,int):(%d,%d,%d,0x%lx%08lx,%d)",a,b,c,(long)(d>>32),(long)(d&0xffffffff),e); + fflush(out); + return r; +} +long long ll_flli (float a, long long b, int c) +{ + long long r = (long long)(int)a + b + (long long)c; + fprintf(out,"long long f(float,long long,int):(%g,0x%lx%08lx,0x%lx)",a,(long)(b>>32),(long)(b&0xffffffff),(long)c); + fflush(out); + return r; +} + +float f_fi (float a, int z) +{ + float r = a+z; + fprintf(out,"float f(float,int):(%g,%d)",a,z); + fflush(out); + return r; +} +float f_f2i (float a, float b, int z) +{ + float r = a+b+z; + fprintf(out,"float f(2*float,int):(%g,%g,%d)",a,b,z); + fflush(out); + return r; +} +float f_f3i (float a, float b, float c, int z) +{ + float r = a+b+c+z; + fprintf(out,"float f(3*float,int):(%g,%g,%g,%d)",a,b,c,z); + fflush(out); + return r; +} +float f_f4i (float a, float b, float c, float d, int z) +{ + float r = a+b+c+d+z; + fprintf(out,"float f(4*float,int):(%g,%g,%g,%g,%d)",a,b,c,d,z); + fflush(out); + return r; +} +float f_f7i (float a, float b, float c, float d, float e, float f, float g, + int z) +{ + float r = a+b+c+d+e+f+g+z; + fprintf(out,"float f(7*float,int):(%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,z); + fflush(out); + return r; +} +float f_f8i (float a, float b, float c, float d, float e, float f, float g, + float h, int z) +{ + float r = a+b+c+d+e+f+g+h+z; + fprintf(out,"float f(8*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,z); + fflush(out); + return r; +} +float f_f12i (float a, float b, float c, float d, float e, float f, float g, + float h, float i, float j, float k, float l, int z) +{ + float r = a+b+c+d+e+f+g+h+i+j+k+l+z; + fprintf(out,"float f(12*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,z); + fflush(out); + return r; +} +float f_f13i (float a, float b, float c, float d, float e, float f, float g, + float h, float i, float j, float k, float l, float m, int z) +{ + float r = a+b+c+d+e+f+g+h+i+j+k+l+m+z; + fprintf(out,"float f(13*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,m,z); + fflush(out); + return r; +} + +double d_di (double a, int z) +{ + double r = a+z; + fprintf(out,"double f(double,int):(%g,%d)",a,z); + fflush(out); + return r; +} +double d_d2i (double a, double b, int z) +{ + double r = a+b+z; + fprintf(out,"double f(2*double,int):(%g,%g,%d)",a,b,z); + fflush(out); + return r; +} +double d_d3i (double a, double b, double c, int z) +{ + double r = a+b+c+z; + fprintf(out,"double f(3*double,int):(%g,%g,%g,%d)",a,b,c,z); + fflush(out); + return r; +} +double d_d4i (double a, double b, double c, double d, int z) +{ + double r = a+b+c+d+z; + fprintf(out,"double f(4*double,int):(%g,%g,%g,%g,%d)",a,b,c,d,z); + fflush(out); + return r; +} +double d_d7i (double a, double b, double c, double d, double e, double f, + double g, int z) +{ + double r = a+b+c+d+e+f+g+z; + fprintf(out,"double f(7*double,int):(%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,z); + fflush(out); + return r; +} +double d_d8i (double a, double b, double c, double d, double e, double f, + double g, double h, int z) +{ + double r = a+b+c+d+e+f+g+h+z; + fprintf(out,"double f(8*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,z); + fflush(out); + return r; +} +double d_d12i (double a, double b, double c, double d, double e, double f, + double g, double h, double i, double j, double k, double l, + int z) +{ + double r = a+b+c+d+e+f+g+h+i+j+k+l+z; + fprintf(out,"double f(12*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,z); + fflush(out); + return r; +} +double d_d13i (double a, double b, double c, double d, double e, double f, + double g, double h, double i, double j, double k, double l, + double m, int z) +{ + double r = a+b+c+d+e+f+g+h+i+j+k+l+m+z; + fprintf(out,"double f(13*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,m,z); + fflush(out); + return r; +} + +/* small structure return tests */ +Size1 S1_v (void) +{ + fprintf(out,"Size1 f(void):"); + fflush(out); + return Size1_1; +} +Size2 S2_v (void) +{ + fprintf(out,"Size2 f(void):"); + fflush(out); + return Size2_1; +} +Size3 S3_v (void) +{ + fprintf(out,"Size3 f(void):"); + fflush(out); + return Size3_1; +} +Size4 S4_v (void) +{ + fprintf(out,"Size4 f(void):"); + fflush(out); + return Size4_1; +} +Size7 S7_v (void) +{ + fprintf(out,"Size7 f(void):"); + fflush(out); + return Size7_1; +} +Size8 S8_v (void) +{ + fprintf(out,"Size8 f(void):"); + fflush(out); + return Size8_1; +} +Size12 S12_v (void) +{ + fprintf(out,"Size12 f(void):"); + fflush(out); + return Size12_1; +} +Size15 S15_v (void) +{ + fprintf(out,"Size15 f(void):"); + fflush(out); + return Size15_1; +} +Size16 S16_v (void) +{ + fprintf(out,"Size16 f(void):"); + fflush(out); + return Size16_1; +} + +/* structure tests */ +Int I_III (Int a, Int b, Int c) +{ + Int r; + r.x = a.x + b.x + c.x; + fprintf(out,"Int f(Int,Int,Int):({%d},{%d},{%d})",a.x,b.x,c.x); + fflush(out); + return r; +} +Char C_CdC (Char a, double b, Char c) +{ + Char r; + r.x = (a.x + c.x)/2; + fprintf(out,"Char f(Char,double,Char):({'%c'},%g,{'%c'})",a.x,b,c.x); + fflush(out); + return r; +} +Float F_Ffd (Float a, float b, double c) +{ + Float r; + r.x = a.x + b + c; + fprintf(out,"Float f(Float,float,double):({%g},%g,%g)",a.x,b,c); + fflush(out); + return r; +} +Double D_fDd (float a, Double b, double c) +{ + Double r; + r.x = a + b.x + c; + fprintf(out,"Double f(float,Double,double):(%g,{%g},%g)",a,b.x,c); + fflush(out); + return r; +} +Double D_Dfd (Double a, float b, double c) +{ + Double r; + r.x = a.x + b + c; + fprintf(out,"Double f(Double,float,double):({%g},%g,%g)",a.x,b,c); + fflush(out); + return r; +} +J J_JiJ (J a, int b, J c) +{ + J r; + r.l1 = a.l1+c.l1; r.l2 = a.l2+b+c.l2; + fprintf(out,"J f(J,int,J):({%ld,%ld},%d,{%ld,%ld})",a.l1,a.l2,b,c.l1,c.l2); + fflush(out); + return r; +} +T T_TcT (T a, char b, T c) +{ + T r; + r.c[0]='b'; r.c[1]=c.c[1]; r.c[2]=c.c[2]; + fprintf(out,"T f(T,char,T):({\"%c%c%c\"},'%c',{\"%c%c%c\"})",a.c[0],a.c[1],a.c[2],b,c.c[0],c.c[1],c.c[2]); + fflush(out); + return r; +} +X X_BcdB (B a, char b, double c, B d) +{ + static X xr={"return val",'R'}; + X r; + r = xr; + r.c1 = b; + fprintf(out,"X f(B,char,double,B):({%g,{%d,%d,%d}},'%c',%g,{%g,{%d,%d,%d}})", + a.d,a.i[0],a.i[1],a.i[2],b,c,d.d,d.i[0],d.i[1],d.i[2]); + fflush(out); + return r; +} + +/* Test for cases where some argument (especially structure, 'long long', or + 'double') may be passed partially in general-purpose argument registers + and partially on the stack. Different ABIs pass between 4 and 8 arguments + (or none) in general-purpose argument registers. */ + +long l_l0J (J b, long c) +{ + long r = b.l1 + b.l2 + c; + fprintf(out,"long f(J,long):(%ld,%ld,%ld)",b.l1,b.l2,c); + fflush(out); + return r; +} +long l_l1J (long a1, J b, long c) +{ + long r = a1 + b.l1 + b.l2 + c; + fprintf(out,"long f(long,J,long):(%ld,%ld,%ld,%ld)",a1,b.l1,b.l2,c); + fflush(out); + return r; +} +long l_l2J (long a1, long a2, J b, long c) +{ + long r = a1 + a2 + b.l1 + b.l2 + c; + fprintf(out,"long f(2*long,J,long):(%ld,%ld,%ld,%ld,%ld)",a1,a2,b.l1,b.l2,c); + fflush(out); + return r; +} +long l_l3J (long a1, long a2, long a3, J b, long c) +{ + long r = a1 + a2 + a3 + b.l1 + b.l2 + c; + fprintf(out,"long f(3*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,b.l1,b.l2,c); + fflush(out); + return r; +} +long l_l4J (long a1, long a2, long a3, long a4, J b, long c) +{ + long r = a1 + a2 + a3 + a4 + b.l1 + b.l2 + c; + fprintf(out,"long f(4*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,b.l1,b.l2,c); + fflush(out); + return r; +} +long l_l5J (long a1, long a2, long a3, long a4, long a5, J b, long c) +{ + long r = a1 + a2 + a3 + a4 + a5 + b.l1 + b.l2 + c; + fprintf(out,"long f(5*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,b.l1,b.l2,c); + fflush(out); + return r; +} +long l_l6J (long a1, long a2, long a3, long a4, long a5, long a6, J b, long c) +{ + long r = a1 + a2 + a3 + a4 + a5 + a6 + b.l1 + b.l2 + c; + fprintf(out,"long f(6*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,a6,b.l1,b.l2,c); + fflush(out); + return r; +} +long l_l7J (long a1, long a2, long a3, long a4, long a5, long a6, long a7, J b, long c) +{ + long r = a1 + a2 + a3 + a4 + a5 + a6 + a7 + b.l1 + b.l2 + c; + fprintf(out,"long f(7*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,a6,a7,b.l1,b.l2,c); + fflush(out); + return r; +} +long l_l0K (K b, long c) +{ + long r = b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(K,long):(%ld,%ld,%ld,%ld,%ld)",b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + return r; +} +long l_l1K (long a1, K b, long c) +{ + long r = a1 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld)",a1,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + return r; +} +long l_l2K (long a1, long a2, K b, long c) +{ + long r = a1 + a2 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(2*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + return r; +} +long l_l3K (long a1, long a2, long a3, K b, long c) +{ + long r = a1 + a2 + a3 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(3*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + return r; +} +long l_l4K (long a1, long a2, long a3, long a4, K b, long c) +{ + long r = a1 + a2 + a3 + a4 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(4*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + return r; +} +long l_l5K (long a1, long a2, long a3, long a4, long a5, K b, long c) +{ + long r = a1 + a2 + a3 + a4 + a5 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(5*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + return r; +} +long l_l6K (long a1, long a2, long a3, long a4, long a5, long a6, K b, long c) +{ + long r = a1 + a2 + a3 + a4 + a5 + a6 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(6*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,a6,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + return r; +} +/* These tests is crafted on the knowledge that for all known ABIs: + * 17 > number of floating-point argument registers, + * 3 < number of general-purpose argument registers < 3 + 6. */ +float f_f17l3L (float a, float b, float c, float d, float e, float f, float g, + float h, float i, float j, float k, float l, float m, float n, + float o, float p, float q, + long s, long t, long u, L z) +{ + float r = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+z.l1+z.l2+z.l3+z.l4+z.l5+z.l6; + fprintf(out,"float f(17*float,3*int,L):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,z.l1,z.l2,z.l3,z.l4,z.l5,z.l6); + fflush(out); + return r; +} +double d_d17l3L (double a, double b, double c, double d, double e, double f, + double g, double h, double i, double j, double k, double l, + double m, double n, double o, double p, double q, + long s, long t, long u, L z) +{ + double r = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+z.l1+z.l2+z.l3+z.l4+z.l5+z.l6; + fprintf(out,"double f(17*double,3*int,L):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,z.l1,z.l2,z.l3,z.l4,z.l5,z.l6); + fflush(out); + return r; +} + +long long ll_l2ll (long a1, long a2, long long b, long c) +{ + long long r = (long long) (a1 + a2) + b + c; + fprintf(out,"long long f(2*long,long long,long):(%ld,%ld,0x%lx%08lx,%ld)",a1,a2,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + return r; +} +long long ll_l3ll (long a1, long a2, long a3, long long b, long c) +{ + long long r = (long long) (a1 + a2 + a3) + b + c; + fprintf(out,"long long f(3*long,long long,long):(%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + return r; +} +long long ll_l4ll (long a1, long a2, long a3, long a4, long long b, long c) +{ + long long r = (long long) (a1 + a2 + a3 + a4) + b + c; + fprintf(out,"long long f(4*long,long long,long):(%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + return r; +} +long long ll_l5ll (long a1, long a2, long a3, long a4, long a5, long long b, long c) +{ + long long r = (long long) (a1 + a2 + a3 + a4 + a5) + b + c; + fprintf(out,"long long f(5*long,long long,long):(%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + return r; +} +long long ll_l6ll (long a1, long a2, long a3, long a4, long a5, long a6, long long b, long c) +{ + long long r = (long long) (a1 + a2 + a3 + a4 + a5 + a6) + b + c; + fprintf(out,"long long f(6*long,long long,long):(%ld,%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,a6,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + return r; +} +long long ll_l7ll (long a1, long a2, long a3, long a4, long a5, long a6, long a7, long long b, long c) +{ + long long r = (long long) (a1 + a2 + a3 + a4 + a5 + a6 + a7) + b + c; + fprintf(out,"long long f(7*long,long long,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,a6,a7,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + return r; +} + +double d_l2d (long a1, long a2, double b, long c) +{ + double r = (double) (a1 + a2) + b + c; + fprintf(out,"double f(2*long,double,long):(%ld,%ld,%g,%ld)",a1,a2,b,c); + fflush(out); + return r; +} +double d_l3d (long a1, long a2, long a3, double b, long c) +{ + double r = (double) (a1 + a2 + a3) + b + c; + fprintf(out,"double f(3*long,double,long):(%ld,%ld,%ld,%g,%ld)",a1,a2,a3,b,c); + fflush(out); + return r; +} +double d_l4d (long a1, long a2, long a3, long a4, double b, long c) +{ + double r = (double) (a1 + a2 + a3 + a4) + b + c; + fprintf(out,"double f(4*long,double,long):(%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,b,c); + fflush(out); + return r; +} +double d_l5d (long a1, long a2, long a3, long a4, long a5, double b, long c) +{ + double r = (double) (a1 + a2 + a3 + a4 + a5) + b + c; + fprintf(out,"double f(5*long,double,long):(%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,b,c); + fflush(out); + return r; +} +double d_l6d (long a1, long a2, long a3, long a4, long a5, long a6, double b, long c) +{ + double r = (double) (a1 + a2 + a3 + a4 + a5 + a6) + b + c; + fprintf(out,"double f(6*long,double,long):(%ld,%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,a6,b,c); + fflush(out); + return r; +} +double d_l7d (long a1, long a2, long a3, long a4, long a5, long a6, long a7, double b, long c) +{ + double r = (double) (a1 + a2 + a3 + a4 + a5 + a6 + a7) + b + c; + fprintf(out,"double f(7*long,double,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,a6,a7,b,c); + fflush(out); + return r; +} + +/* This function is used to verify that structs larger than 2 words are really + passed by value, not accidentally by reference. */ +void v_clobber_K (K k) +{ + k.l1 += 1; + k.l2 += 10; + k.l3 += 100; + k.l4 += 1000; +} diff --git a/trampoline/COPYING b/trampoline/COPYING new file mode 100644 index 0000000..a3d1815 --- /dev/null +++ b/trampoline/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 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 + + Appendix: 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. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +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. + + , 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/trampoline/Makefile.devel b/trampoline/Makefile.devel new file mode 100644 index 0000000..ec9e0ae --- /dev/null +++ b/trampoline/Makefile.devel @@ -0,0 +1,217 @@ +# This is the developer's -*-Makefile-*-, not the user's makefile. +# Do not use it unless you know exactly what you do! + +THISFILE = Makefile.devel +RM = rm -f + +# ============ Rules that require cross-compilation tools ============ + +GCC = gcc +GCCFLAGS = -O2 -fomit-frame-pointer -fPIC +CPP = $(GCC) -E +CROSS_TOOL = cross + +precompiled : \ + cache-sparc-macro.S cache-sparc64-macro.S \ + cache-alpha-macro.S \ + cache-hppa-macro.S cache-hppa64-macro.S \ + cache-powerpc-linux-macro.S cache-powerpc-macos.s \ + cache-powerpc64-elfv2-macro.S + + +cache-sparc-linux.s : cache-sparc.c $(THISFILE) + $(CROSS_TOOL) sparc-linux gcc -V 3.1 $(GCCFLAGS) -D__sparc__ -S cache-sparc.c -o cache-sparc-linux.s + +cache-sparc-macro.S : cache-sparc-linux.s ../common/asm-sparc.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-sparc.h"' ; ../common/asm-sparc.sh < cache-sparc-linux.s ; cat ../common/noexecstack.h) > cache-sparc-macro.S + +cache-sparc64-linux.s : cache-sparc.c $(THISFILE) + $(CROSS_TOOL) sparc64-linux gcc -V 4.0.2 $(GCCFLAGS) -D__sparc64__ -S cache-sparc.c -o cache-sparc64-linux.s + +cache-sparc64-macro.S : cache-sparc64-linux.s ../common/asm-sparc.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-sparc.h"' ; ../common/asm-sparc.sh < cache-sparc64-linux.s ; cat ../common/noexecstack.h) > cache-sparc64-macro.S + + +cache-alpha-linux.s : cache-alpha.c $(THISFILE) + $(CROSS_TOOL) alpha-linux gcc -V 4.0.2 $(GCCFLAGS) -D__alpha__ -S cache-alpha.c -o cache-alpha-linux.s + +cache-alpha-macro.S : cache-alpha-linux.s ../common/asm-alpha.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-alpha.sh < cache-alpha-linux.s ; cat ../common/noexecstack.h) > cache-alpha-macro.S + + +cache-hppa-linux.s : cache-hppa.c $(THISFILE) + $(CROSS_TOOL) hppa-linux gcc -V 3.1 $(GCCFLAGS) -D__hppa__ -S cache-hppa.c -o cache-hppa-linux.s + +cache-hppa-macro.S : cache-hppa-linux.s ../common/asm-hppa.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-hppa.h"' ; ../common/asm-hppa.sh < cache-hppa-linux.s ; cat ../common/noexecstack.h) > cache-hppa-macro.S + + +cache-hppa64-linux.s : cache-hppa.c $(THISFILE) + $(CROSS_TOOL) hppa64-linux gcc -V 3.1 $(GCCFLAGS) -D__hppa64__ -S cache-hppa.c -o cache-hppa64-linux.s + +cache-hppa64-macro.S : cache-hppa64-linux.s ../common/asm-hppa64.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-hppa64.h"' ; ../common/asm-hppa64.sh < cache-hppa64-linux.s ; cat ../common/noexecstack.h) > cache-hppa64-macro.S + + +cache-powerpc-linux.s : cache-powerpc.c $(THISFILE) + $(CROSS_TOOL) powerpc-linux gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc $(GCCFLAGS) -D__powerpc__ -S cache-powerpc.c -o cache-powerpc-linux.s + +cache-powerpc-linux-macro.S : cache-powerpc-linux.s ../common/asm-powerpc.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-powerpc.sh < cache-powerpc-linux.s ; cat ../common/noexecstack.h) > cache-powerpc-linux-macro.S + +cache-powerpc-macos.s : cache-powerpc.c $(THISFILE) + $(CROSS_TOOL) powerpc-darwin gcc -V 3.3.6 $(GCCFLAGS) -D__powerpc__ -S cache-powerpc.c -o cache-powerpc-macos.s + + +cache-powerpc64-elfv2-linux.s : cache-powerpc64.c $(THISFILE) + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv2 -mcpu=power4 -mlittle-endian $(GCCFLAGS) -D__powerpc64__ -S cache-powerpc64.c -o cache-powerpc64-elfv2-linux-le.s + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv2 -mcpu=power4 -mbig-endian $(GCCFLAGS) -D__powerpc64__ -S cache-powerpc64.c -o cache-powerpc64-elfv2-linux-be.s + cmp cache-powerpc64-elfv2-linux-le.s cache-powerpc64-elfv2-linux-be.s > /dev/null + mv cache-powerpc64-elfv2-linux-le.s cache-powerpc64-elfv2-linux.s + $(RM) cache-powerpc64-elfv2-linux-be.s + +cache-powerpc64-elfv2-macro.S : cache-powerpc64-elfv2-linux.s ../common/asm-powerpc.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-powerpc.sh < cache-powerpc64-elfv2-linux.s ; cat ../common/noexecstack.h) > cache-powerpc64-elfv2-macro.S + + +# --------------- Older rules --------------- + +OLDGCCFLAGS = -O2 -fomit-frame-pointer +ASPREFIX = /usr1/gnu/lib + +proto-precompiled : proto-i386.s proto-m68k.s proto-mips.s proto-mipsn32.s proto-mips64.s proto-sparc.s proto-sparc64.s proto-alpha.s proto-hppa.s proto-hppa64.s proto-arm.s proto-arm64.s proto-powerpc-aix.s proto-powerpc-sysv4.s proto-powerpc-macos.s proto-powerpc64-aix.s proto-powerpc64-elfv2.s proto-ia64.s proto-x86_64.s proto-x86_64-x32.s proto-s390.s proto-s390x.s proto-riscv32.s proto-riscv64.s + +proto-i386.s : proto.c + $(GCC) -V 2.7.2 -b i486-linuxaout $(OLDGCCFLAGS) -D__i386__ -S proto.c -o $@ + +proto-m68k.s : proto.c + $(GCC) -V egcs-2.91.57 -b m68k-sun $(OLDGCCFLAGS) -D__m68k__ -S proto.c -o $@ + +proto-mips.s : proto.c + $(GCC) -V 2.95.2 -b mips-sgi $(OLDGCCFLAGS) -D__mips__ -S proto.c -o $@ -mabicalls + +proto-mipsn32.s : proto.c + $(GCC) -V 2.95.2 -b mips-sgi-irix6 $(OLDGCCFLAGS) -D__mipsn32__ -S proto.c -o $@ -mabicalls + +proto-mips64.s : proto64.c + $(GCC) -V 2.95.2 -b mips-sgi -mips3 -mlong64 $(OLDGCCFLAGS) -D__mips64__ -S proto64.c -o $@ -mabicalls + +proto-sparc.s : proto.c + $(GCC) -V 2.95.2 -b sparc-sun $(OLDGCCFLAGS) -D__sparc__ -S proto.c -o $@ + +proto-sparc64.s : proto64.c + sparc64-linux-gcc -V 2.95.2 -b sparc64-linux $(OLDGCCFLAGS) -D__sparc64__ -S proto64.c -o $@ + +proto-alpha.s : proto64.c + $(GCC) -V 2.7.2 -b alpha-dec-osf $(OLDGCCFLAGS) -D__alpha__ -S proto64.c -o $@ + +proto-hppa.s : proto.c + $(GCC) -V 2.6.3 -b hppa1.0-hpux $(OLDGCCFLAGS) -D__hppa__ -S proto.c -o $@ + +proto-hppa64.s : proto64.c + $(CROSS_TOOL) hppa64-linux gcc -V 3.1 $(OLDGCCFLAGS) -D__hppa64__ -S proto64.c -o $@ + +proto-arm.s : proto.c + $(GCC) -V 2.6.3 -b arm-acorn-riscix $(OLDGCCFLAGS) -D__arm__ -S proto.c -o $@ + +proto-arm64.s : proto64.c + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 $(OLDGCCFLAGS) -D__arm64__ -S proto64.c -o $@ + +proto-powerpc-aix.s : proto.c + $(GCC) -V 2.95.2 -b rs6000 -mno-power -mno-power2 -mno-powerpc -mnew-mnemonics $(OLDGCCFLAGS) -D__powerpc__ -S proto.c -o $@ + +proto-powerpc-sysv4.s : proto.c + $(GCC) -V 2.95.2 -b ppc-linux -mno-power -mno-power2 -mno-powerpc $(OLDGCCFLAGS) -D__powerpc__ -S proto.c -o $@ + +proto-powerpc-macos.s : proto.c + $(GCC) -V 3.3.2 -b powerpc-darwin $(OLDGCCFLAGS) -D__powerpc__ -S proto.c -o $@ + +proto-powerpc64-aix.s : proto64.c + $(CROSS_TOOL) powerpc64-linux gcc $(OLDGCCFLAGS) -D__powerpc64__ -S proto64.c -o $@ + +proto-powerpc64-elfv2.s : proto64.c + $(CROSS_TOOL) powerpc64le-linux gcc -mabi=elfv2 $(OLDGCCFLAGS) -D__powerpc64__ -S proto64.c -o $@ + +proto-ia64.s : proto64.c + $(GCC) -V 2.9-ia64-000216 -b ia64-hp-linux $(OLDGCCFLAGS) -D__ia64__ -S proto64.c -o $@ + +proto-x86_64.s : proto64.c + $(GCC) -V 3.2.2 -b x86_64-suse-linux $(OLDGCCFLAGS) -D__x86_64__ -S proto64.c -o $@ + +proto-x86_64-x32.s : proto.c + $(CROSS_TOOL) x86_64-linux gcc-5.4.0 -mx32 $(OLDGCCFLAGS) -fno-asynchronous-unwind-tables -D__x86_64__ -D__x86_64_x32__ -S proto.c -o $@ + +proto-s390.s : proto.c + $(CROSS_TOOL) s390-linux gcc -V 3.1 $(OLDGCCFLAGS) -D__s390__ -S proto.c -o $@ + +proto-s390x.s : proto64.c + $(CROSS_TOOL) s390x-linux gcc-5.4.0 $(OLDGCCFLAGS) -D__s390x__ -S proto64.c -o $@ + +proto-riscv32.s : proto.c + $(CROSS_TOOL) riscv32-linux gcc-7.3.0 $(OLDGCCFLAGS) -D__riscv32__ -S proto.c -o $@ + +proto-riscv64.s : proto64.c + $(CROSS_TOOL) riscv64-linux gcc-7.3.0 $(OLDGCCFLAGS) -D__riscv64__ -S proto64.c -o $@ + +tramp-i386.o : tramp-i386.s + $(ASPREFIX)/i486-linux/bin/as tramp-i386.s -o $@ + +tramp-m68k.o : tramp-m68k.s + $(ASPREFIX)/m68k-sun/bin/as tramp-m68k.s -o $@ + +tramp-mips.o : tramp-mips.s + $(ASPREFIX)/mips-sgi/bin/as tramp-mips.s -o $@ + +tramp-mips64.o : tramp-mips64.s + $(ASPREFIX)/mips-sgi/bin/as -mips3 -membedded-pic tramp-mips64.s -o $@ + +tramp-sparc.o : tramp-sparc.s + $(ASPREFIX)/sparc-sun/bin/as tramp-sparc.s -o $@ + +tramp-sparc64.o : tramp-sparc64.s + $(ASPREFIX)/sparc64-linux/bin/as tramp-sparc64.s -o $@ + +tramp-alpha.o : tramp-alpha.s + $(ASPREFIX)/alpha-dec-osf/bin/as tramp-alpha.s -o $@ + +tramp-hppa.o : tramp-hppa.s + $(ASPREFIX)/hppa1.0-hpux/bin/as tramp-hppa.s -o $@ + +tramp-hppa64.o : tramp-hppa64.s + $(CROSS_TOOL) hppa64-linux as tramp-hppa64.s -o $@ + +tramp-arm.o : tramp-arm.s + $(ASPREFIX)/arm-acorn-riscix/bin/as tramp-arm.s -o $@ + +tramp-arm64.o : tramp-arm64.s + $(CROSS_TOOL) aarch64-linux as tramp-arm64.s -o $@ + +tramp-powerpc-old.o : tramp-powerpc-old.s + $(ASPREFIX)/rs6000/bin/as tramp-powerpc-old.s -o $@ + +tramp-powerpc-sysv4.o : tramp-powerpc-sysv4.s + $(ASPREFIX)/ppc-linux/bin/as tramp-powerpc-sysv4.s -o $@ + +tramp-powerpc64-elfv2.o : tramp-powerpc64-elfv2.s + $(CROSS_TOOL) powerpc64le-linux as tramp-powerpc64-elfv2.s -o $@ + +tramp-ia64.o : tramp-ia64.s + /nue/usr/ia64-hp-linux/bin/as tramp-ia64.s -o $@ + +tramp-x86_64.o : tramp-x86_64.s + $(ASPREFIX)/x86_64-suse-linux/bin/as tramp-x86_64.s -o $@ + +tramp-x86_64-x32.o : tramp-x86_64-x32.s + $(CROSS_TOOL) x86_64-linux as tramp-x86_64-x32.s -o $@ + +tramp-s390.o : tramp-s390.s + $(CROSS_TOOL) s390-linux as tramp-s390.s -o $@ + +tramp-s390x.o : tramp-s390x.s + $(CROSS_TOOL) s390x-linux as tramp-s390x.s -o $@ + +tramp-riscv32.o : tramp-riscv32.s + $(CROSS_TOOL) riscv32-linux as tramp-riscv32.s -o $@ + +tramp-riscv64.o : tramp-riscv64.s + $(CROSS_TOOL) riscv64-linux as tramp-riscv64.s -o $@ diff --git a/trampoline/Makefile.in b/trampoline/Makefile.in new file mode 100644 index 0000000..eb7e526 --- /dev/null +++ b/trampoline/Makefile.in @@ -0,0 +1,272 @@ +# Makefile for trampoline + +#### Start of system configuration section. #### + +HOST = @host@ +CPU = @HOST_CPU_C_ABI@ +OS = @host_os@ + +# Directories used by "make": +srcdir = @srcdir@ + +# Directories used by "make install": +prefix = @prefix@ +local_prefix = /usr/local +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +mandir = @mandir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +htmldir = $(datadir)/html + +# Programs used by "make": +# C compiler +CC = @CC@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +# C++ compiler +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +# Both C and C++ compiler +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I. -I$(srcdir) -I.. +INCLUDES_WITH_GNULIB = $(INCLUDES) -I../gnulib-lib -I$(srcdir)/../gnulib-lib +ASPFLAGS = `if test @AS_UNDERSCORE@ = true; then echo '-DASM_UNDERSCORE'; fi` +LDFLAGS = @LDFLAGS@ +LIBTOOL = @LIBTOOL@ +LIBTOOL_COMPILE = $(LIBTOOL) --mode=compile +LIBTOOL_LINK = $(LIBTOOL) --mode=link +LIBTOOL_INSTALL = $(LIBTOOL) --mode=install +LIBTOOL_UNINSTALL = $(LIBTOOL) --mode=uninstall +AR = @AR@ +AR_FLAGS = rc +RANLIB = @RANLIB@ +RM = rm -f +@SET_MAKE@ + +# Programs used by "make install": +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +# Libtool options for linking with the thread library. +LTLIBTHREAD = @LTLIBTHREAD@ + +#### End of system configuration section. #### + +SHELL = /bin/sh + +# Needed by $(LIBTOOL). +top_builddir = .. + +OBJECTS = trampoline.lo @CPU_OBJECTS@ + +# Limit the set of exported symbols, on those platforms where libtool supports it. +# Currently this excludes the symbols from gnulib modules. +LIBTRAMPOLINE_EXPORTED_SYMBOLS_REGEX = 'trampoline' + +# Before making a release, change this according to the libtool documentation, +# section "Library interface versions". +LIBTRAMPOLINE_VERSION_INFO = 1:3:0 + +all : $(OBJECTS) libtrampoline.la $(srcdir)/trampoline.3 $(srcdir)/trampoline.html + +trampoline.lo : $(srcdir)/trampoline.c $(srcdir)/trampoline.h + $(LIBTOOL_COMPILE) $(CC) $(INCLUDES_WITH_GNULIB) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/trampoline.c + +tramp-hppa.lo : tramp-hppa.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c tramp-hppa.s + +tramp-hppa.s : $(srcdir)/tramp-hppa-macro.S $(srcdir)/../common/noexecstack.h + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/tramp-hppa-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > tramp-hppa.s + +tramp-hppa64.lo : tramp-hppa64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c tramp-hppa64.s + +tramp-hppa64.s : $(srcdir)/tramp-hppa64-macro.S $(srcdir)/../common/noexecstack.h + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/tramp-hppa64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > tramp-hppa64.s + +tramp-powerpc.lo : tramp-powerpc.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c tramp-powerpc.s + +tramp-powerpc.s : $(srcdir)/tramp-powerpc-aix.S + $(CPP) $(srcdir)/tramp-powerpc-aix.S > tramp-powerpc.s + +tramp-powerpc64.lo : tramp-powerpc64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c tramp-powerpc64.s + +tramp-powerpc64.s : $(srcdir)/tramp-powerpc64-aix.S $(srcdir)/../common/noexecstack.h + $(CPP) -I$(srcdir)/../common $(srcdir)/tramp-powerpc64-aix.S > tramp-powerpc64.s + +tramp-ia64.lo : tramp-ia64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c tramp-ia64.s + +tramp-ia64.s : $(srcdir)/tramp-ia64-macro.S $(srcdir)/../common/noexecstack.h + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/tramp-ia64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > tramp-ia64.s + +cache-sparc.lo : cache-sparc.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-sparc.s + +cache-sparc.s : $(srcdir)/cache-sparc-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common - < $(srcdir)/cache-sparc-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//.*$$,,' -e 's,\$$,#,g' -e 's,# ,#,g' > cache-sparc.s + +cache-sparc64.lo : cache-sparc64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-sparc64.s + +cache-sparc64.s : $(srcdir)/cache-sparc64-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common - < $(srcdir)/cache-sparc64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//.*$$,,' -e 's,\$$,#,g' -e 's,# ,#,g' > cache-sparc64.s + +cache-alpha.lo : cache-alpha.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-alpha.s + +cache-alpha.s : $(srcdir)/cache-alpha-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/cache-alpha-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > cache-alpha.s + +cache-hppa.lo : cache-hppa.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-hppa.s + +cache-hppa.s : $(srcdir)/cache-hppa-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/cache-hppa-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > cache-hppa.s + +cache-hppa64.lo : cache-hppa64.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-hppa64.s + +cache-hppa64.s : $(srcdir)/cache-hppa64-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/cache-hppa64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > cache-hppa64.s + +cache-powerpc.lo : cache-powerpc.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-powerpc.s + +cache-powerpc.s : $(srcdir)/cache-powerpc-linux-macro.S $(srcdir)/cache-powerpc-macos.s + case "$(OS)" in \ + macos* | darwin*) syntax=macos;; \ + *) syntax=linux;; \ + esac; \ + case $${syntax} in \ + macos) \ + grep -v '\.machine' $(srcdir)/cache-powerpc-$${syntax}.s > cache-powerpc.s || exit 1 ;; \ + linux) \ + $(CPP) $(ASPFLAGS) $(srcdir)/cache-powerpc-$${syntax}-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > cache-powerpc.s || exit 1 ;; \ + *) \ + cp $(srcdir)/cache-powerpc-$${syntax}.s cache-powerpc.s || exit 1 ;; \ + esac + +cache-powerpc64-elfv2.lo : cache-powerpc64-elfv2.s + $(LIBTOOL_COMPILE) $(CC) @GCC_X_NONE@ -c cache-powerpc64-elfv2.s + +cache-powerpc64-elfv2.s : $(srcdir)/cache-powerpc64-elfv2-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/cache-powerpc64-elfv2-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > cache-powerpc64-elfv2.s + +libtrampoline.la : $(OBJECTS) ../gnulib-lib/libgnu.la + $(LIBTOOL_LINK) $(CC) -o libtrampoline.la -rpath $(libdir) -no-undefined -export-symbols-regex $(LIBTRAMPOLINE_EXPORTED_SYMBOLS_REGEX) -version-info $(LIBTRAMPOLINE_VERSION_INFO) $(OBJECTS) ../gnulib-lib/libgnu.la $(LDFLAGS) $(LTLIBTHREAD) + +install : all force + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(exec_prefix) + mkdir -p $(DESTDIR)$(libdir) + $(LIBTOOL_INSTALL) $(INSTALL_DATA) libtrampoline.la $(DESTDIR)$(libdir)/libtrampoline.la + mkdir -p $(DESTDIR)$(includedir) + $(INSTALL_DATA) $(srcdir)/trampoline.h $(DESTDIR)$(includedir)/trampoline.h + mkdir -p $(DESTDIR)$(mandir) + mkdir -p $(DESTDIR)$(mandir)/man3 + $(INSTALL_DATA) $(srcdir)/trampoline.3 $(DESTDIR)$(mandir)/man3/trampoline.3 + mkdir -p $(DESTDIR)$(datadir) + mkdir -p $(DESTDIR)$(htmldir) + $(INSTALL_DATA) $(srcdir)/trampoline.html $(DESTDIR)$(htmldir)/trampoline.html + +installdirs : force + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(exec_prefix) + mkdir -p $(DESTDIR)$(libdir) + mkdir -p $(DESTDIR)$(includedir) + mkdir -p $(DESTDIR)$(mandir) + mkdir -p $(DESTDIR)$(mandir)/man3 + mkdir -p $(DESTDIR)$(datadir) + mkdir -p $(DESTDIR)$(htmldir) + +uninstall : force + $(LIBTOOL_UNINSTALL) $(RM) $(DESTDIR)$(libdir)/libtrampoline.la + $(RM) $(DESTDIR)$(includedir)/trampoline.h + $(RM) $(DESTDIR)$(mandir)/man3/trampoline.3 + $(RM) $(DESTDIR)$(htmldir)/trampoline.html + +test1.@OBJEXT@ : $(srcdir)/test1.c $(srcdir)/trampoline.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/test1.c + +test1 : test1.@OBJEXT@ libtrampoline.la + $(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ test1.@OBJEXT@ libtrampoline.la $(LDFLAGS) -o test1 + +test2.@OBJEXT@ : $(srcdir)/test2.c $(srcdir)/trampoline.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/test2.c + +test2 : test2.@OBJEXT@ libtrampoline.la + $(LIBTOOL_LINK) $(CC) $(CFLAGS) @GCC_X_NONE@ test2.@OBJEXT@ libtrampoline.la $(LDFLAGS) -o test2 + +test2-c++.@OBJEXT@ : $(srcdir)/test2-c++.cc $(srcdir)/test2.c $(srcdir)/trampoline.h + $(CXX) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) -c $(srcdir)/test2-c++.cc + +test2-c++ : test2-c++.@OBJEXT@ libtrampoline.la + $(LIBTOOL_LINK) $(CXX) $(CXXFLAGS) @GCC_X_NONE@ test2-c++.@OBJEXT@ libtrampoline.la $(LDFLAGS) -o test2-c++ + +check1 : all test1 + ./test1 + +check : all test1 test2 + ./test1 + ./test2 +@IF_CXX@ ./test2-c++ + touch tests.passed.$(HOST) +@IF_CXX@check : test2-c++ + +extracheck : check + +mostlyclean : clean + +clean : force + $(RM) $(OBJECTS) `echo $(OBJECTS) | sed -e 's/\.lo/.@OBJEXT@/g'` tramp-hppa.s tramp-hppa64.s tramp-powerpc.s tramp-powerpc64.s tramp-ia64.s cache-sparc.s cache-sparc64.s cache-alpha.s cache-hppa.s cache-hppa64.s cache-powerpc.s cache-powerpc64-elfv2.s libtrampoline.* core + $(RM) -r .libs _libs + $(RM) test1.@OBJEXT@ test1 test2.@OBJEXT@ test2 test2-c++.@OBJEXT@ test2-c++ + +distclean : clean + $(RM) Makefile tests.passed.* + +maintainer-clean : distclean + + +# List of source files (committed in version control or generated by Makefile.devel). +SOURCE_FILES = \ + COPYING \ + PLATFORMS PORTING README trampoline.3 trampoline.html \ + Makefile.devel \ + Makefile.maint \ + Makefile.in \ + trampoline.h \ + trampoline.c \ + tramp-hppa-macro.S \ + tramp-hppa64-macro.S \ + tramp-powerpc-aix.S \ + tramp-powerpc64-aix.S \ + tramp-ia64-macro.S \ + cache.c \ + cache-alpha.c cache-alpha-linux.s cache-alpha-macro.S \ + cache-hppa.c cache-hppa-linux.s cache-hppa-macro.S cache-hppa64-linux.s cache-hppa64-macro.S \ + cache-powerpc.c cache-powerpc-linux.s cache-powerpc-linux-macro.S cache-powerpc-macos.s \ + cache-powerpc64.c cache-powerpc64-elfv2-linux.s cache-powerpc64-elfv2-macro.S \ + cache-sparc.c cache-sparc-linux.s cache-sparc-macro.S cache-sparc64-linux.s cache-sparc64-macro.S \ + test1.c \ + test2.c test2-c++.cc +# List of distributed files generated by Makefile.maint. +GENERATED_FILES = \ + trampoline.man +# List of distributed files. +DISTFILES = $(SOURCE_FILES) $(GENERATED_FILES) + +distdir : $(DISTFILES) + for file in $(DISTFILES); do \ + if test -f $$file; then dir='.'; else dir='$(srcdir)'; fi; \ + cp -p "$$dir/$$file" '$(distdir)'/$$file || exit 1; \ + done + + +force : diff --git a/trampoline/Makefile.maint b/trampoline/Makefile.maint new file mode 100644 index 0000000..7356d20 --- /dev/null +++ b/trampoline/Makefile.maint @@ -0,0 +1,18 @@ +# maintainer -*-Makefile-*- + +RM = rm -f + +# ==================== Easily regeneratable files ==================== + +ROFF_MAN = groff -Tutf8 -mandoc + +all : trampoline.man + +trampoline.man : trampoline.3 + $(ROFF_MAN) trampoline.3 > trampoline.man + +totally-clean : force + $(RM) trampoline.man + + +force : diff --git a/trampoline/PLATFORMS b/trampoline/PLATFORMS new file mode 100644 index 0000000..ef73e74 --- /dev/null +++ b/trampoline/PLATFORMS @@ -0,0 +1,40 @@ +Supported CPUs: (Put the GNU config.guess values here.) + i386 i486-unknown-linux, i686-unknown-gnu0.9, i386-unknown-sysv4.0, + i386-pc-solaris2.6, i386-pc-solaris2.10, + i486-unknown-sco3.2v4.2, i386-pc-cygwin32, i386-w64-mingw32, + i586-unknown-freebsd11.0, i386-unknown-dragonfly3.8, + i386-unknown-netbsdelf7.0, i386-unknown-openbsd6.0, + i586-pc-haiku, i386-pc-minix + m68k m68k-next-bsd, m68k-next-nextstep3, m68k-sun-sunos4.0, + m68k-unknown-linux + mips mips-sgi-irix4.0.5, mips-sgi-irix5.2, mips-sgi-irix5.3, + mips-sgi-irix6.2, mips-sgi-irix6.4, mips-sgi-irix6.5, + mips-unknown-linux, mips64-unknown-linux + sparc sparc-sun-sunos4.1.1, sparc-sun-solaris2.3, + sparc-sun-solaris2.4, sparc-sun-solaris2.10, + sparc64-sun-solaris2.10, sparc-unknown-linux, + sparc64-unknown-linux, + sparc-unknown-netbsdelf7.1, sparc64-unknown-netbsd8.0 + alpha alpha-dec-osf3.0, alpha-dec-osf4.0, alphaev67-unknown-linux + hppa hppa1.0-hp-hpux8.00, hppa1.1-hp-hpux9.05, hppa1.1-hp-hpux10.01, + hppa2.0-hp-hpux10.20, hppa2.0w-hp-hpux11.31, hppa-unknown-linux + hppa64 hppa64-hp-hpux11.31 + arm armv5tejl-unknown-linux, armv6l-unknown-linux, + armv7l-unknown-linux + arm64 aarch64-unknown-linux, aarch64-apple-darwin20.4.0 + powerpc powerpc-ibm-aix4.1.4.0, powerpc-ibm-aix7.1.3.0, + powerpc-unknown-linux, powerpc-apple-darwin6.8, + powerpc-apple-darwin9.8.0 + powerpc64 powerpc-ibm-aix7.1.3.0 (gcc -maix64, xlc -q64; AR="ar -X 64"), + powerpc64-unknown-linux (gcc -m64), + powerpc64le-unknown-linux (gcc) + ia64 ia64-unknown-linux + x86_64 x86_64-suse-linux, x86_64-unknown-linux (gcc -mx32), + x86_64-pc-solaris2.10, x86_64-pc-cygwin, x86_64-w64-mingw32, + x86_64-unknown-freebsd11.0, x86_64-unknown-netbsd7.0, + x86_64-unknown-openbsd6.0 + s390 s390x-ibm-linux + s390x s390x-ibm-linux + riscv32 riscv32-unknown-linux + riscv64 riscv64-unknown-linux + diff --git a/trampoline/PORTING b/trampoline/PORTING new file mode 100644 index 0000000..46b6042 --- /dev/null +++ b/trampoline/PORTING @@ -0,0 +1,95 @@ +The list of CPUs and platforms TRAMPOLINE has been ported to can be found +at the top of file trampoline.c. + +To port TRAMPOLINE to a new platform, three issues may have to be resolved: +A. a new CPU - how to build the trampoline? +B. a new OS - how to make code in malloc'ed memory executable? +C. a new CPU or OS - how to flush the instruction cache? + + +A. a new CPU - how to build the trampoline? + + The trampoline is a short sequence of machine instructions which puts + the constant into , then jumps to

. The only + registers that are allowed to be modified are call-used registers. No + stack manipulations are allowed since the trampoline has to pass its + arguments along to the function at
. + + 1. To find out which instructions are available for "move"/"store" and + "jump", compile proto.c for your CPU: + + make -f Makefile.devel proto-${CPU}.s + or + gcc -O2 -fomit-frame-pointer -S proto.c -o proto-${CPU}.s + + 2. Write down the instructions for the trampoline in a file tramp-${CPU}.s, + using constants for , ,
. Assemble it: + + gcc -c tramp-${CPU}.s + + Verify that the jump actually goes to
. (Beware: Some CPUs have + program-counter relative jumps.) + + gdb tramp-${CPU}.o + disassemble tramp + + 3. Take a hex dump of tramp-${CPU}.o + + hexdump -e '"%06.6_ax " 16/1 " %02X" "\n"' < tramp-${CPU}.o + or + od -tx1 -Ax < tramp-${CPU}.o + or + od -x +x < tramp-${CPU}.o + + Look out for the magic numbers you used for , and +
. + + 4. Write the code which builds up a trampoline in memory, in trampoline.c. + + 5. Try it: + + make + make check1 + + 6. Write the is_tramp() macro and the tramp_xxx() accessor macros + in trampoline.c. + + 7. Try it: + + make + make check + + +B. a new OS - how to make code in malloc'ed memory executable? + + ‘configure’ will find out whether code stored in malloc'ed memory is + executable, or whether virtual memory protections have to be set in order + to allow this. (The test is pretty simple: it copies a small function + to malloc'ed memory and tries to executed it. The test could also fail + because the compiler produced non-position-independent code or because + of alignment issues.) + + To set virtual memory protections on a page of memory, your system should + provide the mprotect() and getpagesize() functions. If it does not, find + a substitute. + + +C. a new CPU or OS - how to flush the instruction cache? + + CPUs which have separate data and instruction caches need to flush + (part of) the instruction cache when alloc_trampoline() is called. + (There may have been an old trampoline at the same location, and the + instruction cache is not updated when the new trampoline is built. + The effect can be that when the new trampoline is called, the old one + will still be executed.) + + To flush the instruction cache, some CPUs have special instruction which + can be put into gcc "asm" statements. On some CPUs these instructions are + privileged, you therefore need to call some system or library function. + On other CPUs, the only way to flush the instruction cache is to execute + a long sequence of "nop" or "jump" instructions. This is hairy. + + +When you are done with porting to a new platform, or even if TRAMPOLINE +passes the "make check" out of the box without modifications, please report +your results to the author of TRAMPOLINE, for inclusion in the next release. diff --git a/trampoline/README b/trampoline/README new file mode 100644 index 0000000..01595c7 --- /dev/null +++ b/trampoline/README @@ -0,0 +1,70 @@ +trampoline - closures as first-class C functions. + +This library implements closures as first-class C functions. A closure +consists of a regular C function and a piece of data which gets passed to +the C function when the closure is called. + +Typical uses of closures are nested functions in programming languages, +and call-back functions passed to other libraries. + + +Installation instructions: + + Configure the parent directory. Then: + cd trampoline + make + make check + make install + + +Files in this package: + + Documentation: + + README this text + COPYING free software license + PLATFORMS list of supported platforms + trampoline.3 manual page in Unix man format + trampoline.html manual page in HTML format + + Source: + + trampoline.h include file + trampoline.c implementation of the library functions + tramp-hppa.s the trampoline for hppa, in assembly language + tramp-powerpc.S the trampoline for powerpc, in assembly language + cache.c how to flush the instruction cache, now unused + test1.c test program + test2.c test program + + Building: + + Makefile.in Makefile master + + Porting: + + PORTING porting instructions + Makefile.devel developer's Makefile + proto.c sample source containing assignment and jumping + proto-*.s its translation to assembly language + tramp-*.s the trampoline, in assembly language + tramp-*.o the trampoline, in binary form + + +Copyright notice: + +Copyright 1995-2017 Bruno Haible + +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, see . + diff --git a/trampoline/cache-alpha-linux.s b/trampoline/cache-alpha-linux.s new file mode 100644 index 0000000..6754a16 --- /dev/null +++ b/trampoline/cache-alpha-linux.s @@ -0,0 +1,20 @@ + .set noreorder + .set volatile + .set noat + .set nomacro + .text + .align 2 + .align 4 + .globl __TR_clear_cache + .ent __TR_clear_cache +$__TR_clear_cache..ng: +__TR_clear_cache: + .frame $30,0,$26,0 + .prologue 0 + .set macro + call_pal 0x86 + .set nomacro + ret $31,($26),1 + .end __TR_clear_cache + .ident "GCC: (GNU) 4.0.2" + .section .note.GNU-stack,"",@progbits diff --git a/trampoline/cache-alpha-macro.S b/trampoline/cache-alpha-macro.S new file mode 100644 index 0000000..e350f4c --- /dev/null +++ b/trampoline/cache-alpha-macro.S @@ -0,0 +1,21 @@ + .set noreorder + .set volatile + .set noat + .set nomacro + .text + .align 2 + .align 4 + .globl __TR_clear_cache + .ent __TR_clear_cache +$__TR_clear_cache..ng: +__TR_clear_cache: + .frame $30,0,$26,0 + .prologue 0 + .set macro + call_pal 0x86 + .set nomacro + ret $31,($26),1 + .end __TR_clear_cache +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/trampoline/cache-alpha.c b/trampoline/cache-alpha.c new file mode 100644 index 0000000..ad20947 --- /dev/null +++ b/trampoline/cache-alpha.c @@ -0,0 +1,24 @@ +/* Instruction cache flushing for alpha */ + +/* + * Copyright 1997 Bruno Haible + * + * 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, see . + */ + +void __TR_clear_cache (void) +{ + /* Taken from gforth-0.3.0. */ + asm volatile ("call_pal 0x86"); /* imb (instruction-memory barrier) */ +} diff --git a/trampoline/cache-hppa-linux.s b/trampoline/cache-hppa-linux.s new file mode 100644 index 0000000..b9c9a6d --- /dev/null +++ b/trampoline/cache-hppa-linux.s @@ -0,0 +1,33 @@ + .LEVEL 1.1 + .text + .align 4 +.globl __TR_clear_cache + .type __TR_clear_cache,@function +__TR_clear_cache: + .PROC + .CALLINFO FRAME=0,NO_CALLS + .ENTRY +#APP + fdc 0(0,%r26) + fdc 0(0,%r25) + sync + mfsp %sr0,%r20 + ldsid (0,%r26),%r26 + mtsp %r26,%sr0 + fic 0(%sr0,%r26) + fic 0(%sr0,%r25) + sync + mtsp %r20,%sr0 + nop + nop + nop + nop + nop + nop +#NO_APP + bv,n %r0(%r2) + .EXIT + .PROCEND +.Lfe1: + .size __TR_clear_cache,.Lfe1-__TR_clear_cache + .ident "GCC: (GNU) 3.1" diff --git a/trampoline/cache-hppa-macro.S b/trampoline/cache-hppa-macro.S new file mode 100644 index 0000000..7c39646 --- /dev/null +++ b/trampoline/cache-hppa-macro.S @@ -0,0 +1,36 @@ +#include "asm-hppa.h" + .LEVEL 1.1 + IMPORT_MILLICODE($$dyncall) + TEXT1() + TEXT2() + .align 4 +GLOBL(__TR_clear_cache) + DECLARE_FUNCTION(__TR_clear_cache) +DEF(__TR_clear_cache) + .PROC + .CALLINFO FRAME=0,NO_CALLS + .ENTRY + fdc 0(0,%r26) + fdc 0(0,%r25) + sync + mfsp %sr0,%r20 + ldsid (0,%r26),%r26 + mtsp %r26,%sr0 + fic 0(%sr0,%r26) + fic 0(%sr0,%r25) + sync + mtsp %r20,%sr0 + nop + nop + nop + nop + nop + nop + bv,n %r0(%r2) + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(__TR_clear_cache) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/trampoline/cache-hppa.c b/trampoline/cache-hppa.c new file mode 100644 index 0000000..2174716 --- /dev/null +++ b/trampoline/cache-hppa.c @@ -0,0 +1,65 @@ +/* Instruction cache flushing for hppa */ + +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +#ifdef __hppa64__ +/* Tell GCC not to clobber the registers that are call-saved in the HP C + calling convention. */ +register long arg0 __asm__("r26"); +register long arg1 __asm__("r25"); +register long arg2 __asm__("r24"); +register long arg3 __asm__("r23"); +register long arg4 __asm__("r22"); +register long arg5 __asm__("r21"); +register long arg6 __asm__("r20"); +register long arg7 __asm__("r19"); +#endif + +/* + * This assumes that the range [first_addr..last_addr] lies in at most two + * cache lines. + */ +void __TR_clear_cache (char* first_addr, char* last_addr) +{ + register int tmp1; + register int tmp2; + /* Flush the relevant data cache lines. (Yes, this is needed. I tried it.) */ + asm volatile ("fdc 0(0,%0)" + "\n\t" "fdc 0(0,%1)" + "\n\t" "sync" + : + : "r" (first_addr), "r" (last_addr) + ); + /* Flush the relevant instruction cache lines. */ + asm volatile ("mfsp %%sr0,%1" + "\n\t" "ldsid (0,%4),%0" + "\n\t" "mtsp %0,%%sr0" + "\n\t" "fic 0(%%sr0,%2)" + "\n\t" "fic 0(%%sr0,%3)" + "\n\t" "sync" + "\n\t" "mtsp %1,%%sr0" + "\n\t" "nop" + "\n\t" "nop" + "\n\t" "nop" + "\n\t" "nop" + "\n\t" "nop" + "\n\t" "nop" + : "=r" (tmp1), "=r" (tmp2) + : "r" (first_addr), "r" (last_addr), "r" (first_addr) + ); +} diff --git a/trampoline/cache-hppa64-linux.s b/trampoline/cache-hppa64-linux.s new file mode 100644 index 0000000..928f35f --- /dev/null +++ b/trampoline/cache-hppa64-linux.s @@ -0,0 +1,35 @@ + .LEVEL 2.0w + .text + .align 8 +.globl __TR_clear_cache + .type __TR_clear_cache,@function +__TR_clear_cache: + .PROC + .CALLINFO FRAME=128,NO_CALLS + .ENTRY + ldo 128(%r30),%r30 +#APP + fdc 0(0,%r26) + fdc 0(0,%r25) + sync + mfsp %sr0,%r31 + ldsid (0,%r26),%r28 + mtsp %r28,%sr0 + fic 0(%sr0,%r26) + fic 0(%sr0,%r25) + sync + mtsp %r31,%sr0 + nop + nop + nop + nop + nop + nop +#NO_APP + bve (%r2) + ldo -128(%r30),%r30 + .EXIT + .PROCEND +.Lfe1: + .size __TR_clear_cache,.Lfe1-__TR_clear_cache + .ident "GCC: (GNU) 3.1" diff --git a/trampoline/cache-hppa64-macro.S b/trampoline/cache-hppa64-macro.S new file mode 100644 index 0000000..e5344ae --- /dev/null +++ b/trampoline/cache-hppa64-macro.S @@ -0,0 +1,37 @@ +#include "asm-hppa64.h" + .LEVEL 2.0w + TEXT1() + TEXT2() + .align 8 +GLOBL(__TR_clear_cache) + DECLARE_FUNCTION(__TR_clear_cache) +DEF(__TR_clear_cache) + .PROC + .CALLINFO FRAME=128,NO_CALLS + .ENTRY + ldo 128(%r30),%r30 + fdc 0(0,%r26) + fdc 0(0,%r25) + sync + mfsp %sr0,%r31 + ldsid (0,%r26),%r28 + mtsp %r28,%sr0 + fic 0(%sr0,%r26) + fic 0(%sr0,%r25) + sync + mtsp %r31,%sr0 + nop + nop + nop + nop + nop + nop + bve (%r2) + ldo -128(%r30),%r30 + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(__TR_clear_cache) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/trampoline/cache-powerpc-linux-macro.S b/trampoline/cache-powerpc-linux-macro.S new file mode 100644 index 0000000..6dc7e1a --- /dev/null +++ b/trampoline/cache-powerpc-linux-macro.S @@ -0,0 +1,37 @@ + .file "cache-powerpc.c" + .section ".text" + .align 2 + .globl __TR_clear_cache + .type __TR_clear_cache, @function +__TR_clear_cache: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-32(1) + icbi 0,3; dcbf 0,3 + addi 0,3,4 + icbi 0,0; dcbf 0,0 + addi 9,3,8 + icbi 0,9; dcbf 0,9 + addi 0,3,12 + icbi 0,0; dcbf 0,0 + addi 9,3,16 + icbi 0,9; dcbf 0,9 + addi 0,3,20 + icbi 0,0; dcbf 0,0 + addi 9,3,24 + icbi 0,9; dcbf 0,9 + addi 0,3,28 + icbi 0,0; dcbf 0,0 + addi 3,3,32 + icbi 0,3; dcbf 0,3 + sync; isync + addi 1,1,32 + blr + .size __TR_clear_cache, .-__TR_clear_cache +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/trampoline/cache-powerpc-linux.s b/trampoline/cache-powerpc-linux.s new file mode 100644 index 0000000..0fb871e --- /dev/null +++ b/trampoline/cache-powerpc-linux.s @@ -0,0 +1,54 @@ + .file "cache-powerpc.c" + .section ".text" + .align 2 + .globl __TR_clear_cache + .type __TR_clear_cache, @function +__TR_clear_cache: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-32(1) +#APP + icbi 0,3; dcbf 0,3 +#NO_APP + addi 0,3,4 +#APP + icbi 0,0; dcbf 0,0 +#NO_APP + addi 9,3,8 +#APP + icbi 0,9; dcbf 0,9 +#NO_APP + addi 0,3,12 +#APP + icbi 0,0; dcbf 0,0 +#NO_APP + addi 9,3,16 +#APP + icbi 0,9; dcbf 0,9 +#NO_APP + addi 0,3,20 +#APP + icbi 0,0; dcbf 0,0 +#NO_APP + addi 9,3,24 +#APP + icbi 0,9; dcbf 0,9 +#NO_APP + addi 0,3,28 +#APP + icbi 0,0; dcbf 0,0 +#NO_APP + addi 3,3,32 +#APP + icbi 0,3; dcbf 0,3 + sync; isync +#NO_APP + addi 1,1,32 + blr + .size __TR_clear_cache, .-__TR_clear_cache + .section .note.GNU-stack,"",@progbits + .ident "GCC: (GNU) 3.3.6" diff --git a/trampoline/cache-powerpc-macos.s b/trampoline/cache-powerpc-macos.s new file mode 100644 index 0000000..ba869fb --- /dev/null +++ b/trampoline/cache-powerpc-macos.s @@ -0,0 +1,23 @@ +.text + .align 2 + .globl ___TR_clear_cache +___TR_clear_cache: + icbi 0,r3; dcbf 0,r3 + addi r0,r3,4 + icbi 0,r0; dcbf 0,r0 + addi r9,r3,8 + icbi 0,r9; dcbf 0,r9 + addi r0,r3,12 + icbi 0,r0; dcbf 0,r0 + addi r9,r3,16 + icbi 0,r9; dcbf 0,r9 + addi r0,r3,20 + icbi 0,r0; dcbf 0,r0 + addi r9,r3,24 + icbi 0,r9; dcbf 0,r9 + addi r0,r3,28 + icbi 0,r0; dcbf 0,r0 + addi r3,r3,32 + icbi 0,r3; dcbf 0,r3 + sync; isync + blr diff --git a/trampoline/cache-powerpc.c b/trampoline/cache-powerpc.c new file mode 100644 index 0000000..b204d22 --- /dev/null +++ b/trampoline/cache-powerpc.c @@ -0,0 +1,35 @@ +/* Instruction cache flushing for powerpc, not on AIX */ + +/* + * Copyright 1997-2017 Bruno Haible + * + * 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, see . + */ + +void __TR_clear_cache (char* first_addr) +{ + /* Taken from egcs-1.1.2/gcc/config/rs6000/tramp.asm. */ + /* The number of asm statements here depends on the value of TRAMP_LENGTH + for __powerpcsysv4__. */ + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+4)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+8)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+12)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+16)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+20)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+24)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+28)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+32)); + asm volatile ("sync; isync"); +} diff --git a/trampoline/cache-powerpc64-elfv2-linux.s b/trampoline/cache-powerpc64-elfv2-linux.s new file mode 100644 index 0000000..2cc82f5 --- /dev/null +++ b/trampoline/cache-powerpc64-elfv2-linux.s @@ -0,0 +1,54 @@ + .file "cache-powerpc64.c" + .machine power4 + .abiversion 2 + .section ".toc","aw" + .section ".text" + .align 2 + .p2align 4,,15 + .globl __TR_clear_cache + .type __TR_clear_cache, @function +__TR_clear_cache: +#APP + # 25 "cache-powerpc64.c" 1 + icbi 0,3; dcbf 0,3 + # 0 "" 2 +#NO_APP + addi 9,3,4 +#APP + # 26 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 +#NO_APP + addi 9,3,8 +#APP + # 27 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 +#NO_APP + addi 9,3,12 +#APP + # 28 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 +#NO_APP + addi 9,3,16 +#APP + # 29 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 +#NO_APP + addi 3,3,20 +#APP + # 30 "cache-powerpc64.c" 1 + icbi 0,3; dcbf 0,3 + # 0 "" 2 + # 31 "cache-powerpc64.c" 1 + sync; isync + # 0 "" 2 +#NO_APP + blr + .long 0 + .byte 0,0,0,0,0,0,0,0 + .size __TR_clear_cache,.-__TR_clear_cache + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/trampoline/cache-powerpc64-elfv2-macro.S b/trampoline/cache-powerpc64-elfv2-macro.S new file mode 100644 index 0000000..98cb970 --- /dev/null +++ b/trampoline/cache-powerpc64-elfv2-macro.S @@ -0,0 +1,43 @@ + .file "cache-powerpc64.c" + .machine power4 + .abiversion 2 + .section ".toc","aw" + .section ".text" + .align 2 + .p2align 4,,15 + .globl __TR_clear_cache + .type __TR_clear_cache, @function +__TR_clear_cache: + # 25 "cache-powerpc64.c" 1 + icbi 0,3; dcbf 0,3 + # 0 "" 2 + addi 9,3,4 + # 26 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 + addi 9,3,8 + # 27 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 + addi 9,3,12 + # 28 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 + addi 9,3,16 + # 29 "cache-powerpc64.c" 1 + icbi 0,9; dcbf 0,9 + # 0 "" 2 + addi 3,3,20 + # 30 "cache-powerpc64.c" 1 + icbi 0,3; dcbf 0,3 + # 0 "" 2 + # 31 "cache-powerpc64.c" 1 + sync; isync + # 0 "" 2 + blr + .long 0 + .byte 0,0,0,0,0,0,0,0 + .size __TR_clear_cache,.-__TR_clear_cache +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/trampoline/cache-powerpc64.c b/trampoline/cache-powerpc64.c new file mode 100644 index 0000000..8baba8c --- /dev/null +++ b/trampoline/cache-powerpc64.c @@ -0,0 +1,32 @@ +/* Instruction cache flushing for powerpc64, not the AIX ABI */ + +/* + * Copyright 1997-2017 Bruno Haible + * + * 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, see . + */ + +void __TR_clear_cache (char* first_addr) +{ + /* Taken from egcs-1.1.2/gcc/config/rs6000/tramp.asm. */ + /* The number of asm statements here depends on the value of TRAMP_LENGTH-3*8 + for __powerpc64_elfv2__. */ + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+4)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+8)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+12)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+16)); + asm volatile ("icbi 0,%0; dcbf 0,%0" : : "r" (first_addr+20)); + asm volatile ("sync; isync"); +} diff --git a/trampoline/cache-sparc-linux.s b/trampoline/cache-sparc-linux.s new file mode 100644 index 0000000..a59943c --- /dev/null +++ b/trampoline/cache-sparc-linux.s @@ -0,0 +1,15 @@ + .file "cache-sparc.c" + .section ".text" + .align 4 + .global __TR_clear_cache_4 + .type __TR_clear_cache_4,#function + .proc 020 +__TR_clear_cache_4: + !#PROLOGUE# 0 + iflush %o0+0;iflush %o0+8;iflush %o0+16;iflush %o0+24 + nop + retl + nop +.LLfe1: + .size __TR_clear_cache_4,.LLfe1-__TR_clear_cache_4 + .ident "GCC: (GNU) 3.1" diff --git a/trampoline/cache-sparc-macro.S b/trampoline/cache-sparc-macro.S new file mode 100644 index 0000000..d9ec5bc --- /dev/null +++ b/trampoline/cache-sparc-macro.S @@ -0,0 +1,17 @@ +#include "asm-sparc.h" + .section ".text" + .align 4 + .global C(__TR_clear_cache_4) + DECLARE_FUNCTION(__TR_clear_cache_4) + .proc 020 +FUNBEGIN(__TR_clear_cache_4) + !$PROLOGUE$ 0 + iflush %o0+0;iflush %o0+8;iflush %o0+16;iflush %o0+24 + nop + retl + nop +L(Lfe1): + FUNEND(__TR_clear_cache_4) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/trampoline/cache-sparc.c b/trampoline/cache-sparc.c new file mode 100644 index 0000000..83981e2 --- /dev/null +++ b/trampoline/cache-sparc.c @@ -0,0 +1,31 @@ +/* Instruction cache flushing for sparc */ + +/* + * Copyright 1996-1999 Bruno Haible + * + * 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, see . + */ + +/* + * This assumes that the range [first_addr..last_addr] lies in at most four + * cache lines. + */ +void __TR_clear_cache_4 (char* first_addr, char* last_addr) +{ + asm volatile ("iflush %0+0;" /* the +0 is needed by gas, says gforth-0.3.0 */ + "iflush %0+8;" + "iflush %0+16;" + "iflush %0+24" + : : "r" (first_addr)); +} diff --git a/trampoline/cache-sparc64-linux.s b/trampoline/cache-sparc64-linux.s new file mode 100644 index 0000000..2951612 --- /dev/null +++ b/trampoline/cache-sparc64-linux.s @@ -0,0 +1,13 @@ + .file "cache-sparc.c" + .section ".text" + .align 4 + .global __TR_clear_cache_4 + .type __TR_clear_cache_4, #function + .proc 020 +__TR_clear_cache_4: + iflush %o0+0;iflush %o0+8;iflush %o0+16;iflush %o0+24 + jmp %o7+8 + nop + .size __TR_clear_cache_4, .-__TR_clear_cache_4 + .ident "GCC: (GNU) 4.0.2" + .section ".note.GNU-stack" diff --git a/trampoline/cache-sparc64-macro.S b/trampoline/cache-sparc64-macro.S new file mode 100644 index 0000000..5e5da94 --- /dev/null +++ b/trampoline/cache-sparc64-macro.S @@ -0,0 +1,14 @@ +#include "asm-sparc.h" + .section ".text" + .align 4 + .global C(__TR_clear_cache_4) + DECLARE_FUNCTION(__TR_clear_cache_4) + .proc 020 +FUNBEGIN(__TR_clear_cache_4) + iflush %o0+0;iflush %o0+8;iflush %o0+16;iflush %o0+24 + jmp %o7+8 + nop + FUNEND(__TR_clear_cache_4) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/trampoline/cache.c b/trampoline/cache.c new file mode 100644 index 0000000..7d34af9 --- /dev/null +++ b/trampoline/cache.c @@ -0,0 +1,143 @@ +/* This file is derived from gcc-2.6.3/libgcc2.c, section L_clear_cache */ + +/* Copyright (C) 1989-2017 Free Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 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, see . */ + + +/* Clear part of an instruction cache. */ + +/* Our emphasis here is _not_ to clear as few cache lines as possible + * or with as few machine instructions as possible, but to do it _right_. + */ + + + +/* This code is apparently untested!! */ + +/* This is from Andreas Stolcke . */ +#if defined(__mips__) || defined(__mips64__) +#include +#define CLEAR_INSN_CACHE(BEG, END) \ + cacheflush (BEG, END - BEG, BCACHE) +#endif + +void +__TR_clear_cache (beg, end) + char *beg, *end; +{ +#ifdef CLEAR_INSN_CACHE + CLEAR_INSN_CACHE (beg, end); +#else +#ifdef INSN_CACHE_SIZE /* This is actually dead code!! */ +#define INSN_CACHE_PLANE_SIZE (INSN_CACHE_SIZE / INSN_CACHE_DEPTH) + static char array[INSN_CACHE_SIZE + INSN_CACHE_PLANE_SIZE + INSN_CACHE_LINE_WIDTH]; + static int initialized = 0; + int offset; + void *start_addr; + void *end_addr; + typedef (*function_ptr) (); + +#if (INSN_CACHE_SIZE / INSN_CACHE_LINE_WIDTH) < 16 + /* It's cheaper to clear the whole cache. + Put in a series of jump instructions so that calling the beginning + of the cache will clear the whole thing. */ + + if (! initialized) + { + int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1) + & -INSN_CACHE_LINE_WIDTH); + int end_ptr = ptr + INSN_CACHE_SIZE; + + while (ptr < end_ptr) + { + *(INSTRUCTION_TYPE *)ptr + = JUMP_AHEAD_INSTRUCTION + INSN_CACHE_LINE_WIDTH; + ptr += INSN_CACHE_LINE_WIDTH; + } + *(INSTRUCTION_TYPE *)(ptr - INSN_CACHE_LINE_WIDTH) = RETURN_INSTRUCTION; + + initialized = 1; + } + + /* Call the beginning of the sequence. */ + (((function_ptr) (((int) array + INSN_CACHE_LINE_WIDTH - 1) + & -INSN_CACHE_LINE_WIDTH)) + ()); + +#else /* Cache is large. */ + + if (! initialized) + { + int ptr = (((int) array + INSN_CACHE_LINE_WIDTH - 1) + & -INSN_CACHE_LINE_WIDTH); + + while (ptr < (int) array + sizeof array) + { + *(INSTRUCTION_TYPE *)ptr = RETURN_INSTRUCTION; + ptr += INSN_CACHE_LINE_WIDTH; + } + + initialized = 1; + } + + /* Find the location in array that occupies the same cache line as BEG. */ + + offset = ((int) beg & -INSN_CACHE_LINE_WIDTH) & (INSN_CACHE_PLANE_SIZE - 1); + start_addr = (((int) (array + INSN_CACHE_PLANE_SIZE - 1) + & -INSN_CACHE_PLANE_SIZE) + + offset); + + /* Compute the cache alignment of the place to stop clearing. */ +#if 0 /* This is not needed for gcc's purposes. */ + /* If the block to clear is bigger than a cache plane, + we clear the entire cache, and OFFSET is already correct. */ + if (end < beg + INSN_CACHE_PLANE_SIZE) +#endif + offset = (((int) (end + INSN_CACHE_LINE_WIDTH - 1) + & -INSN_CACHE_LINE_WIDTH) + & (INSN_CACHE_PLANE_SIZE - 1)); + +#if INSN_CACHE_DEPTH > 1 + end_addr = (start_addr & -INSN_CACHE_PLANE_SIZE) + offset; + if (end_addr <= start_addr) + end_addr += INSN_CACHE_PLANE_SIZE; + + for (plane = 0; plane < INSN_CACHE_DEPTH; plane++) + { + int addr = start_addr + plane * INSN_CACHE_PLANE_SIZE; + int stop = end_addr + plane * INSN_CACHE_PLANE_SIZE; + + while (addr != stop) + { + /* Call the return instruction at ADDR. */ + ((function_ptr) addr) (); + + addr += INSN_CACHE_LINE_WIDTH; + } + } +#else /* just one plane */ + do + { + /* Call the return instruction at START_ADDR. */ + ((function_ptr) start_addr) (); + + start_addr += INSN_CACHE_LINE_WIDTH; + } + while ((start_addr % INSN_CACHE_SIZE) != offset); +#endif /* just one plane */ +#endif /* Cache is large */ +#endif /* Cache exists */ +#endif /* CLEAR_INSN_CACHE */ +} diff --git a/trampoline/test1.c b/trampoline/test1.c new file mode 100644 index 0000000..d447ac3 --- /dev/null +++ b/trampoline/test1.c @@ -0,0 +1,45 @@ +/* Trampoline test */ + +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +#include +#include + +#include "trampoline.h" + +#define MAGIC1 0x9db9af42 +#define MAGIC2 0x614a13c9 + +static int magic = MAGIC1; + +void* function_data; + +int f (int x) +{ return *(int*)function_data + x; } + +int main () +{ + trampoline_function_t cf = alloc_trampoline((trampoline_function_t)&f, &function_data, &magic); + /* calling cf shall set function_data = &magic and then call f(x), + * thus returning magic + x. + */ + if (((*cf)(MAGIC2) == MAGIC1+MAGIC2) && (function_data == &magic)) + { free_trampoline(cf); printf("Works, test1 passed.\n"); exit(0); } + else + { printf("Doesn't work!\n"); exit(1); } +} diff --git a/trampoline/test2-c++.cc b/trampoline/test2-c++.cc new file mode 100644 index 0000000..6c7dfff --- /dev/null +++ b/trampoline/test2-c++.cc @@ -0,0 +1,18 @@ +/* + * Copyright 2017 Bruno Haible + * + * 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, see . + */ + +#include "test2.c" diff --git a/trampoline/test2.c b/trampoline/test2.c new file mode 100644 index 0000000..2ee55da --- /dev/null +++ b/trampoline/test2.c @@ -0,0 +1,51 @@ +/* Trampoline accessor test */ + +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +#include +#include + +#include "trampoline.h" + +int f (int x) +{ return x; } + +void* variable; + +static int data; + +int main () +{ + trampoline_function_t cf = alloc_trampoline((trampoline_function_t)&f, &variable, &data); + if (is_trampoline((void*)&f)) + { printf("is_trampoline(&f) returns true!\n"); exit(1); } +#if !defined(__cplusplus) + if (is_trampoline((void*)&main)) + { printf("is_trampoline(&main) returns true!\n"); exit(1); } +#endif + if (!is_trampoline((void*)cf)) + { printf("is_trampoline() returns false!\n"); exit(1); } + if (trampoline_address(cf) != (trampoline_function_t)&f) + { printf("trampoline_address() doesn't work!\n"); exit(1); } + if (trampoline_variable(cf) != &variable) + { printf("trampoline_variable() doesn't work!\n"); exit(1); } + if (trampoline_data(cf) != &data) + { printf("trampoline_data() doesn't work!\n"); exit(1); } + printf("test2 passed.\n"); + exit(0); +} diff --git a/trampoline/tramp-hppa-macro.S b/trampoline/tramp-hppa-macro.S new file mode 100644 index 0000000..4cc60ad --- /dev/null +++ b/trampoline/tramp-hppa-macro.S @@ -0,0 +1,53 @@ +; Trampoline for hppa CPU + +; Copyright 1997-2017 Bruno Haible +; +; 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, see . + +; Available registers: %r1, %r19, %r20, %r21, %r22, %r29, %r31. + + .code + .IMPORT $global$,DATA + .IMPORT $$dyncall,MILLICODE + .code + + .align 4 + .EXPORT tramp,ENTRY,PRIV_LEV=3,ARGW0=GR,ARGW1=GR + .label tramp + .PROC + .CALLINFO FRAME=0,NO_CALLS + .ENTRY +; The closure pointer is already in register %r19. +; Move into register %r20. + ldw 0(0,%r19),%r20 +; Move into register %r22 + ldw 4(0,%r19),%r22 +; Move
into register %r21. + ldw 8(0,%r19),%r21 +; Store into . + stw %r22,0(0,%r20) +; Jump to %r21. + bb,>=,n %r21,30,tramp_2 + depi 0,31,2,%r21 + ldw 4(0,%r21),%r19 + ldw 0(0,%r21),%r21 + .label tramp_2 + ldsid (0,%r21),%r1 + mtsp %r1,%sr0 + be,n 0(%sr0,%r21) + nop + .EXIT + .PROCEND + +#include "noexecstack.h" diff --git a/trampoline/tramp-hppa64-macro.S b/trampoline/tramp-hppa64-macro.S new file mode 100644 index 0000000..2f7b8af --- /dev/null +++ b/trampoline/tramp-hppa64-macro.S @@ -0,0 +1,50 @@ +; Trampoline for hppa64 CPU + +; Copyright 2017 Bruno Haible +; +; 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, see . + +; Available registers: %r1, %r27, %r31. +; %r27 has a fixed meaning at function calls: pic_base (a.k.a. gp or dp). +; %r31 has a fixed meaning as millicode return pointer (mrp). + +#include "asm-hppa64.h" + + .LEVEL 2.0w + TEXT1() + TEXT2() + .align 8 + GLOBL(tramp) + DECLARE_FUNCTION(tramp) +DEF(tramp) + .PROC + .CALLINFO FRAME=0,NO_CALLS + .ENTRY +; The closure pointer is already in register %r27. +; Move into . + ldd 0(%r27),%r31 ; get + ldd 8(%r27),%r1 ; get + std %r1,0(%r31) ; store in +; Jump to . + ldd 16(%r27),%r27 ; get + ldd 16(%r27),%r1 + ldd 24(%r27),%r27 + bve (%r1) ; jump to + nop + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(tramp) + +#include "noexecstack.h" diff --git a/trampoline/tramp-ia64-macro.S b/trampoline/tramp-ia64-macro.S new file mode 100644 index 0000000..1b694b8 --- /dev/null +++ b/trampoline/tramp-ia64-macro.S @@ -0,0 +1,46 @@ +/* Trampoline for ia64 CPU */ + +/* + * Copyright 2001-2017 Bruno Haible + * + * 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, see . + */ + +/* Available registers: r14 ... r31, r9 ... r11, r2 ... r3. */ + + .text + .align 16 + .global tramp# + .proc tramp# +tramp: + /* The closure pointer is already in register r1. */ + ld8 r14 = [r1] /* Move
into register r14. */ + adds r15 = 8, r1 + adds r16 = 16, r1 + ;; + /* Jump to r14. */ + ld8 r18 = [r14] + ld8 r15 = [r15] /* Move into register r15. */ + adds r17 = 8, r14 + ;; + ld8 r16 = [r16] /* Move into register r16. */ + ld8 r1 = [r17] + mov b6 = r18 + ;; + st8 [r15] = r16 /* Store into . */ + br b6 + ;; + .endp tramp# + +#include "noexecstack.h" diff --git a/trampoline/tramp-powerpc-aix.S b/trampoline/tramp-powerpc-aix.S new file mode 100644 index 0000000..a36634b --- /dev/null +++ b/trampoline/tramp-powerpc-aix.S @@ -0,0 +1,51 @@ +/* Trampoline for powerpc CPU with AIX calling convention */ + +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +/* Available registers: r0, r11, r12. */ +/* However, r0 is special in that it cannot be used as a base register. */ + + .globl tramp + .globl .tramp +.csect tramp[DS] +tramp: + .long .tramp, 0, 0 +.csect .text[PR] +.tramp: +/* Move into */ + lwz 11,0(2) /* get */ + lwz 12,4(2) /* get */ + stw 12,0(11) +/* Get */ + lwz 12,8(2) +/* + * gcc-2.6.3 source says: + * A function pointer is a pointer to a data area whose first word contains + * the actual address of the function, whose second word contains a pointer + * to its TOC, and whose third word contains a value to place in the static + * chain register (r11). + */ + lwz 11,8(12) /* pass static chain in r11 */ + lwz 2,4(12) /* pass TOC in r2 */ + lwz 0,0(12) /* actual code address */ + mtctr 0 + bctr + +_section_.text: +.csect .data[RW] + .long _section_.text diff --git a/trampoline/tramp-powerpc64-aix.S b/trampoline/tramp-powerpc64-aix.S new file mode 100644 index 0000000..7fd0f66 --- /dev/null +++ b/trampoline/tramp-powerpc64-aix.S @@ -0,0 +1,57 @@ +/* Trampoline for powerpc64 CPU with AIX calling convention */ + +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +/* Available registers: r0, r11, r12. */ +/* However, r0 is special in that it cannot be used as a base register. */ + + .machine "ppc64" + +#ifdef _AIX + .rename H.4.NO_SYMBOL{PR},"" + .lglobl H.4.NO_SYMBOL{PR} + + .globl .tramp + .csect H.4.NO_SYMBOL{PR},7 +#else + .globl tramp + .globl .tramp +tramp: + .quad .tramp +#endif +.tramp: +/* Move into */ + ld 11,0(2) /* get */ + ld 12,8(2) /* get */ + std 12,0(11) +/* Get */ + ld 12,16(2) +/* + * gcc-2.6.3 source says: + * A function pointer is a pointer to a data area whose first word contains + * the actual address of the function, whose second word contains a pointer + * to its TOC, and whose third word contains a value to place in the static + * chain register (r11). + */ + ld 11,16(12) /* pass static chain in r11 */ + ld 2,8(12) /* pass TOC in r2 */ + ld 0,0(12) /* actual code address */ + mtctr 0 + bctr + +#include "noexecstack.h" diff --git a/trampoline/trampoline.3 b/trampoline/trampoline.3 new file mode 100644 index 0000000..09d33ac --- /dev/null +++ b/trampoline/trampoline.3 @@ -0,0 +1,124 @@ +.\" Copyright (C) 1995-2017 Bruno Haible +.\" +.\" This manual is free documentation. It is dually licensed under the +.\" GNU FDL and the GNU GPL. This means that you can redistribute this +.\" manual under either of these two licenses, at your choice. +.\" +.\" This manual is covered by the GNU FDL. Permission is granted to copy, +.\" distribute and/or modify this document under the terms of the +.\" GNU Free Documentation License (FDL), either version 1.2 of the +.\" License, or (at your option) any later version published by the +.\" Free Software Foundation (FSF); with no Invariant Sections, with no +.\" Front-Cover Text, and with no Back-Cover Texts. +.\" A copy of the license is at . +.\" +.\" This manual is covered by the GNU GPL. You can redistribute it and/or +.\" modify it under the terms of the GNU General Public License (GPL), either +.\" version 2 of the License, or (at your option) any later version published +.\" by the Free Software Foundation (FSF). +.\" A copy of the license is at . +.\" +.TH TRAMPOLINE 3 "1 January 2017" +.SH NAME +trampoline \- closures as first-class C functions +.SH SYNOPSIS +.B #include +.LP +.B function = alloc_trampoline(address, variable, data); +.LP +.B free_trampoline(function); +.LP +.nf +.B is_trampoline(function) +.B trampoline_address(function) +.B trampoline_variable(function) +.B trampoline_data(function) +.fi +.SH DESCRIPTION +.LP +These functions implement +.I closures +as first-class C functions. +A closure consists of a regular C function and a piece of data +which gets passed to the C function when the closure is called. + +Closures as +.I first-class C functions +means that they fit into a function +pointer and can be called exactly like any other C function. +.IB function " = alloc_trampoline(" address ", " variable ", " data ")" +allocates a closure. When +.I function +gets called, it stores +.I data +in the variable +.I variable +and calls the C function at +.IR address . +The function at +.I address +is responsible for fetching +.I data +out of +.I variable +immediately, before execution of any other function call. + +This is much like +.BR gcc "'s" +local functions, except that the GNU C local functions have dynamic extent +(i.e. are deallocated when the creating function returns), while +.I trampoline +provides functions with indefinite extent: +.I function +is only deallocated when +.BI free_trampoline( function ) +is called. + +.BI "is_trampoline(" function ")" +checks whether the C function +.I function +was produced by a call to +.IR alloc_trampoline . +If this returns true, the arguments given to +.I alloc_trampoline +can be retrieved: +.RS 4 +.LP +.BI "trampoline_address(" function ")" +returns +.IR address , +.LP +.BI "trampoline_variable(" function ")" +returns +.IR variable , +.LP +.BI "trampoline_data(" function ")" +returns +.IR data . +.RE + +.SH SEE ALSO +.BR gcc (1), +.BR stdarg (3), +.BR callback (3) + +.SH BUGS +Passing the data through a global variable is not reentrant. Don't call +trampoline functions from within signal handlers. This is fixed in the +.BR callback (3) +package. + +.SH PORTING +The way +.B gcc +builds local functions is described in the gcc source, file +.RI gcc-2.6.3/config/ cpu / cpu .h. + +.SH AUTHOR + +Bruno Haible + +.SH ACKNOWLEDGEMENTS + +Many ideas were cribbed from the gcc source. + diff --git a/trampoline/trampoline.c b/trampoline/trampoline.c new file mode 100644 index 0000000..9b79e0d --- /dev/null +++ b/trampoline/trampoline.c @@ -0,0 +1,1726 @@ +/* Trampoline construction */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + + +#include "config.h" +#include "trampoline.h" + +#if defined(__hppa__) && !defined(__hppa64__) +#if 0 +#define __hppaold__ /* Old trampoline, real machine code. */ +#else +#define __hppanew__ /* New trampoline, just a closure. */ +#endif +#endif +#if defined(__hppa64__) +#if 0 +#define __hppa64old__ /* Old trampoline, real machine code. */ +#else +#define __hppa64new__ /* New trampoline, just a closure. */ +#endif +#endif +#if defined(__powerpc__) && !defined(__powerpc64__) +#if !defined(_AIX) +#define __powerpcsysv4__ /* SysV.4 ABI, real machine code. */ +#else +#define __powerpcaix__ /* AIX ABI, just a closure. */ +#endif +#endif +#if defined(__powerpc64__) && !defined(__powerpc64_elfv2__) +#define __powerpc64aix__ /* AIX ABI, just a closure. */ +#endif +#if defined(__hppanew__) || defined(__hppa64new__) +/* + * A function pointer is a biased pointer to a data area whose first word + * (hppa) or third word (hppa64) contains the actual address of the function. + */ +extern void tramp (); /* trampoline prototype */ +/* We don't need to take any special measures to make the code executable + * since the actual instructions are in the text segment. + */ +#ifndef CODE_EXECUTABLE +#define CODE_EXECUTABLE +#endif +#endif +#if defined(__powerpcaix__) || defined(__powerpc64aix__) || defined(__ia64__) +/* + * A function pointer is a pointer to a data area whose first word contains + * the actual address of the function. + */ +extern void (*tramp) (); /* trampoline prototype */ +/* We don't need to take any special measures to make the code executable + * since the actual instructions are in the text segment. + */ +#ifndef CODE_EXECUTABLE +#define CODE_EXECUTABLE +#endif +#endif + +#ifndef CODE_EXECUTABLE /* Linux, Hurd, macOS, *BSD, IRIX, Solaris, Cygwin, native Windows */ + /* How do we make the trampoline's code executable? */ + #if HAVE_WORKING_MPROTECT /* Linux, Hurd, macOS, *BSD, IRIX, Solaris, Cygwin */ + #if HAVE_MPROTECT_AFTER_MALLOC_CAN_EXEC > 0 /* Hurd, macOS, *BSD except HardenedBSD, IRIX, Solaris, Cygwin */ + /* mprotect() [or equivalent] the malloc'ed area. */ + #define EXECUTABLE_VIA_MALLOC_THEN_MPROTECT + #elif HAVE_MPROTECT_AFTER_MMAP_CAN_EXEC > 0 + /* mprotect() [or equivalent] the mmap'ed area. */ + #define EXECUTABLE_VIA_MMAP_THEN_MPROTECT + #elif HAVE_MMAP_SHARED_CAN_EXEC /* Linux, HardenedBSD */ + #define EXECUTABLE_VIA_MMAP_FILE_SHARED + #else + #error "Don't know how to make memory pages executable." + #endif + #else /* native Windows, very old Linux */ + #if HAVE_MMAP_ANONYMOUS /* very old Linux */ + /* Use an mmap'ed page. */ + #define EXECUTABLE_VIA_MMAP + #else + #if defined(_WIN32) && ! defined(__CYGWIN__) /* native Windows */ + #define EXECUTABLE_VIA_VIRTUALALLOC + #else + ?? + #endif + #endif + #endif +#endif + +#include /* declares fprintf() */ + +#include +#include /* declares abort(), malloc(), free() */ +#ifdef HAVE_UNISTD_H +#include /* declares getpagesize() */ +#endif + +/* Define intptr_t, uintptr_t. */ +#include + +/* Declare getpagesize(). */ +/* On HP-UX, getpagesize exists, but it is not declared in even if + the compiler options -D_HPUX_SOURCE -D_XOPEN_SOURCE=600 are used. */ +#ifdef __hpux +extern +#ifdef __cplusplus + "C" +#endif + int getpagesize (void); +#endif + +/* Declare mprotect(). */ +#if defined(EXECUTABLE_VIA_MALLOC_THEN_MPROTECT) || defined(EXECUTABLE_VIA_MMAP_THEN_MPROTECT) +#include +#include +#endif + +/* Declare mmap(). */ +#if defined(EXECUTABLE_VIA_MMAP) || defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) +#include +#include +#endif + +/* Declare open(). */ +#if defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) +#include +#include +#include +#endif + +/* Declare VirtualAlloc(), GetSystemInfo. */ +#ifdef EXECUTABLE_VIA_VIRTUALALLOC +#define WIN32_LEAN_AND_MEAN +#define WIN32_EXTRA_LEAN +#include +#endif + +/* Some old mmap() implementations require the flag MAP_VARIABLE whenever you + pass an addr == NULL. */ +#ifndef MAP_VARIABLE +#define MAP_VARIABLE 0 +#endif + +/* Support for instruction cache flush. */ +#if defined _WIN32 && !defined __CYGWIN__ +# define WIN32_LEAN_AND_MEAN +# define WIN32_EXTRA_LEAN +# include +#elif defined __APPLE__ && defined __MACH__ +# include +#elif defined _AIX +# include +#elif defined __sgi +# include +#else +#ifdef __i386__ +#if defined(_WIN32) && ! defined(__CYGWIN__) /* native Windows */ +#define WIN32_LEAN_AND_MEAN +#define WIN32_EXTRA_LEAN +#include +#endif +#endif +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__riscv32__) || defined(__riscv64__) +#ifdef HAVE_SYS_CACHECTL_H /* IRIX, Linux */ +#include +#else +#ifdef __OpenBSD__ +#include +#endif +#endif +#endif +/* Inline assembly function for instruction cache flush. */ +#if defined(__sparc__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppaold__) || defined(__hppa64old__) || defined(__powerpcsysv4__) || defined(__powerpc64_elfv2__) +#if defined(__sparc__) || defined(__sparc64__) +extern void __TR_clear_cache_4(); +#else +extern void __TR_clear_cache(); +#endif +#endif +#endif + +/* Support for multithread-safe coding. */ +#include "glthread/lock.h" + +#if defined(__APPLE__) && defined(__MACH__) /* only needed on macOS */ +#define KEEP_TEMP_FILE_VISIBLE +/* Support for temporary files that are cleaned up automatically. */ +#include "clean-temp-simple.h" +#endif + +#if !defined(CODE_EXECUTABLE) && defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) +/* Opens a file descriptor and attempts to make it non-inheritable. */ +static int open_noinherit (const char *filename, int flags, int mode) +{ +# if O_CLOEXEC + return open (filename, flags | O_CLOEXEC, mode); +# else + int fd = open (filename, flags, mode); +# ifdef F_SETFD + if (fd >= 0) + { + int flags = fcntl (fd, F_GETFD, 0); + if (flags >= 0) + fcntl (fd, F_SETFD, flags | FD_CLOEXEC); + } +# endif + return fd; +# endif +} +#endif + +/* Length and alignment of trampoline */ +#ifdef __i386__ +#define TRAMP_LENGTH 15 +#define TRAMP_ALIGN 16 /* 4 for a i386, 16 for a i486 */ +#endif +#ifdef __m68k__ +#define TRAMP_LENGTH 18 +#define TRAMP_ALIGN 16 +#endif +#if defined(__mipsold__) && !defined(__mipsn32__) +#define TRAMP_LENGTH 32 +#define TRAMP_ALIGN 4 +#endif +#if (defined(__mips__) || defined(__mipsn32__)) && !defined(__mips64__) +#define TRAMP_LENGTH 36 +#define TRAMP_ALIGN 4 +#endif +#ifdef __mips64old__ +#define TRAMP_LENGTH 84 +#define TRAMP_ALIGN 4 +#endif +#ifdef __mips64__ +#define TRAMP_LENGTH 48 +#define TRAMP_ALIGN 8 +#endif +#if defined(__sparc__) && !defined(__sparc64__) +#define TRAMP_LENGTH 28 +#define TRAMP_ALIGN 16 +#endif +#ifdef __sparc64__ +#define TRAMP_LENGTH 48 +#define TRAMP_ALIGN 16 +#endif +#ifdef __alpha__ +#define TRAMP_LENGTH 48 +#define TRAMP_ALIGN 8 +#endif +#ifdef __hppaold__ +#define TRAMP_LENGTH 56 +#define TRAMP_ALIGN 16 +#endif +#ifdef __hppanew__ +#define TRAMP_LENGTH 20 +#define TRAMP_ALIGN 16 +#define TRAMP_BIAS 2 +#endif +#ifdef __hppa64old__ +#define TRAMP_LENGTH 96 +#define TRAMP_ALIGN 8 +#define TRAMP_BIAS 64 +#endif +#ifdef __hppa64new__ +#define TRAMP_LENGTH 56 +#define TRAMP_ALIGN 8 +#endif +#if defined(__arm__) || defined(__armhf__) +#define TRAMP_LENGTH 36 +#define TRAMP_ALIGN 4 +#endif +#ifdef __arm64__ +#define TRAMP_LENGTH 48 +#define TRAMP_ALIGN 8 +#endif +#ifdef __powerpcsysv4__ +#define TRAMP_LENGTH 36 +#define TRAMP_ALIGN 4 +#endif +#ifdef __powerpcaix__ +#define TRAMP_LENGTH 24 +#define TRAMP_ALIGN 4 +#endif +#ifdef __powerpc64_elfv2__ +#define TRAMP_LENGTH 48 +#define TRAMP_ALIGN 8 +#endif +#ifdef __powerpc64aix__ +#define TRAMP_LENGTH 48 +#define TRAMP_ALIGN 8 +#endif +#ifdef __ia64__ +#define TRAMP_LENGTH 40 +#define TRAMP_ALIGN 16 +#endif +#ifdef __x86_64__ +#ifdef __x86_64_x32__ +#define TRAMP_LENGTH 18 +#define TRAMP_ALIGN 4 +#else +#define TRAMP_LENGTH 32 +#define TRAMP_ALIGN 16 +#endif +#endif +#if defined(__s390__) && !defined(__s390x__) +#define TRAMP_LENGTH 40 +#define TRAMP_ALIGN 4 +#endif +#if defined(__s390x__) +#define TRAMP_LENGTH 64 +#define TRAMP_ALIGN 8 +#endif +#if defined(__riscv32__) +#define TRAMP_LENGTH 36 +#define TRAMP_ALIGN 4 +#endif +#if defined(__riscv64__) +#define TRAMP_LENGTH 48 +#define TRAMP_ALIGN 8 +#endif + +#ifndef TRAMP_BIAS +#define TRAMP_BIAS 0 +#endif + +#if !defined(CODE_EXECUTABLE) +static long pagesize = 0; +#endif + +#if !defined(CODE_EXECUTABLE) && defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) + +/* Variables needed for obtaining memory pages via mmap(). */ +static int file_fd; +static long file_length; + +/* Initialization of these variables. */ +static void for_mmap_init (void) +{ + { + char filename[100]; + sprintf(filename, "%s/trampdata-%d-%ld", "/tmp", getpid (), random ()); +#if defined(KEEP_TEMP_FILE_VISIBLE) + if (register_temporary_file(filename) < 0) + { fprintf(stderr,"trampoline: Out of virtual memory!\n"); abort(); } +#endif + file_fd = open_noinherit (filename, O_CREAT | O_RDWR | O_TRUNC, 0700); + if (file_fd < 0) + { +#if defined(KEEP_TEMP_FILE_VISIBLE) + unregister_temporary_file(filename); +#endif + fprintf(stderr,"trampoline: Cannot open %s!\n",filename); + abort(); + } +#if !defined(KEEP_TEMP_FILE_VISIBLE) + /* Remove the file from the file system as soon as possible, to make + sure there is no leftover after this process terminates or crashes. + On macOS 11.2, this does not work: It would make the mmap call below, + with arguments PROT_READ|PROT_EXEC and MAP_SHARED, fail. */ + unlink(filename); +#endif + } + file_length = 0; +} + +/* Once-only initializer for these variables. */ +gl_once_define(static, for_mmap_once) + +#endif + +#if !defined(CODE_EXECUTABLE) && !defined(EXECUTABLE_VIA_MALLOC_THEN_MPROTECT) +/* AIX doesn't support mprotect() in malloc'ed memory. Must get pages of + * memory with execute permission via mmap(). Then keep a free list of + * free trampolines. + */ +static char* freelist = NULL; +/* Lock that protects the freelist from simultaneous access from multiple + threads. */ +gl_lock_define_initialized(static, freelist_lock) +#endif + +trampoline_function_t alloc_trampoline (trampoline_function_t address, void** variable, void* data) +{ + char* function; + char* function_x; + +#if !defined(CODE_EXECUTABLE) + /* First, get the page size once and for all. */ + if (!pagesize) + { +#if defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) + /* Use a once-only initializer here, since simultaneous execution of + for_mmap_init() in multiple threads must be avoided. */ + gl_once (for_mmap_once, for_mmap_init); +#endif + /* Simultaneous execution of this initialization in multiple threads + is OK. */ +#if defined(EXECUTABLE_VIA_VIRTUALALLOC) + /* GetSystemInfo + + */ + SYSTEM_INFO info; + GetSystemInfo(&info); + pagesize = info.dwPageSize; +#else + pagesize = getpagesize(); +#endif + } +#endif + + /* 1. Allocate room */ + +#if !defined(CODE_EXECUTABLE) && !defined(EXECUTABLE_VIA_MALLOC_THEN_MPROTECT) + gl_lock_lock(freelist_lock); + if (freelist == NULL) + { /* Get a new page. */ + char* page; + char* page_end; +#ifdef EXECUTABLE_VIA_VIRTUALALLOC + /* VirtualAlloc + + */ + page = VirtualAlloc(NULL,pagesize,MEM_COMMIT,PAGE_EXECUTE_READWRITE); + if (page == NULL) + { fprintf(stderr,"trampoline: Out of virtual memory!\n"); abort(); } + page_end = page + pagesize; +#else +#ifdef EXECUTABLE_VIA_MMAP_FILE_SHARED + char* page_x; + /* Extend the file by one page. */ + long new_file_length = file_length + pagesize; + if (ftruncate(file_fd,new_file_length) < 0) + { fprintf(stderr,"trampoline: Cannot extend backing file!\n"); abort(); } + /* Create separate mappings for writing and for executing. */ + page = (char*)mmap(NULL,pagesize,PROT_READ|PROT_WRITE,MAP_SHARED,file_fd,file_length); + page_x = (char*)mmap(NULL,pagesize,PROT_READ|PROT_EXEC,MAP_SHARED,file_fd,file_length); + if (page == (char*)(-1) || page_x == (char*)(-1)) + { fprintf(stderr,"trampoline: Out of virtual memory!\n"); abort(); } + file_length = new_file_length; + page_end = page + pagesize; + /* Link the two pages together. */ + ((intptr_t*)page)[0] = page_x - page; + page = (char*)(((uintptr_t)page + sizeof(intptr_t) + TRAMP_ALIGN-1) & -TRAMP_ALIGN); +#else +#ifdef EXECUTABLE_VIA_MMAP_THEN_MPROTECT + /* Use mmap with the MAP_ANONYMOUS or MAP_ANON flag. */ + page = mmap(NULL, pagesize, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_VARIABLE, -1, 0); +#endif +#ifdef EXECUTABLE_VIA_MMAP + /* Use mmap with the MAP_ANONYMOUS or MAP_ANON flag. */ + page = mmap(NULL, pagesize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS | MAP_VARIABLE, -1, 0); +#endif + if (page == (char*)(-1)) + { fprintf(stderr,"trampoline: Out of virtual memory!\n"); abort(); } + page_end = page + pagesize; +#endif +#endif + /* Fill it with free trampolines. */ + { char** last = &freelist; + while (page+TRAMP_LENGTH <= page_end) + { *last = page; last = (char**)page; + page = (char*)(((uintptr_t)page + TRAMP_LENGTH + TRAMP_ALIGN-1) & -TRAMP_ALIGN); + } + *last = NULL; + } } + function = freelist; freelist = *(char**)freelist; + gl_lock_unlock(freelist_lock); +#else + { char* room = (char*) malloc(sizeof(void*) + TRAMP_LENGTH + TRAMP_ALIGN-1); + if (!room) + { fprintf(stderr,"trampoline: Out of virtual memory!\n"); abort(); } + function = (char*)(((uintptr_t)room + sizeof(void*) + TRAMP_ALIGN-1) & -TRAMP_ALIGN); + ((char**)function)[-1] = room; /* backpointer for free_trampoline() */ + } +#endif + +#if !defined(CODE_EXECUTABLE) && defined(EXECUTABLE_VIA_MMAP_FILE_SHARED) + /* Find the executable address corresponding to the writable address. */ + { uintptr_t page = (uintptr_t) function & -(intptr_t)pagesize; + function_x = function + ((intptr_t*)page)[0]; + } +#else + function_x = function; +#endif + + /* 2. Fill out the trampoline */ +#ifdef __i386__ + /* function: + * movl $, C7 05 + * jmp
E9
- + * here: + */ + *(short *) (function + 0) = 0x05C7; + *(long *) (function + 2) = (long) variable; + *(long *) (function + 6) = (long) data; + *(char *) (function +10) = 0xE9; + *(long *) (function +11) = (long) address - (long) (function_x + 15); +#define is_tramp(function) \ + *(unsigned short *) (function + 0) == 0x05C7 && \ + *(unsigned char *) (function +10) == 0xE9 +#define tramp_address(function) \ + *(long *) (function +11) + (long) (function + 15) +#define tramp_variable(function) \ + *(long *) (function + 2) +#define tramp_data(function) \ + *(long *) (function + 6) +#endif +#ifdef __m68k__ + /* function: + * movel #, 23 FC + * jmp
4E F9
+ * nop 4E 71 + */ + *(short *) (function + 0) = 0x23FC; + *(long *) (function + 2) = (long) data; + *(long *) (function + 6) = (long) variable; + *(short *) (function +10) = 0x4EF9; + *(long *) (function +12) = (long) address; + *(short *) (function +16) = 0x4E71; +#define is_tramp(function) \ + *(unsigned short *) (function + 0) == 0x23FC && \ + *(unsigned short *) (function +10) == 0x4EF9 && \ + *(unsigned short *) (function +16) == 0x4E71 +#define tramp_address(function) \ + *(long *) (function +12) +#define tramp_variable(function) \ + *(long *) (function + 6) +#define tramp_data(function) \ + *(long *) (function + 2) +#endif +#if defined(__mipsold__) && !defined(__mipsn32__) + /* function: + * li $2,&0xffff0000 3C 02 hi16() + * ori $2,$2,&0xffff 34 42 lo16() + * sw $2, 3C 01 hi16() + * AC 22 lo16() + * li $25,
&0xffff0000 3C 19 hi16(
) + * ori $25,$25,
&0xffff 37 39 lo16(
) + * jal $0,$25 03 20 00 09 was: j $25 03 20 00 08 + * nop 00 00 00 00 + */ + /* What about big endian / little endian ?? */ + *(short *) (function + 0) = 0x3C02; + *(short *) (function + 2) = (unsigned long) data >> 16; + *(short *) (function + 4) = 0x3442; + *(short *) (function + 6) = (unsigned long) data & 0xffff; + *(short *) (function + 8) = 0x3C01; + *(short *) (function +10) = (unsigned long) variable >> 16; + *(short *) (function +12) = 0xAC22; + *(short *) (function +14) = (unsigned long) variable & 0xffff; + *(short *) (function +16) = 0x3C19; + *(short *) (function +18) = (unsigned long) address >> 16; + *(short *) (function +20) = 0x3739; + *(short *) (function +22) = (unsigned long) address & 0xffff; + *(long *) (function +24) = 0x03200009; + *(long *) (function +28) = 0x00000000; +#define is_tramp(function) \ + *(unsigned short *) (function + 0) == 0x3C02 && \ + *(unsigned short *) (function + 4) == 0x3442 && \ + *(unsigned short *) (function + 8) == 0x3C01 && \ + *(unsigned short *) (function +12) == 0xAC22 && \ + *(unsigned short *) (function +16) == 0x3C19 && \ + *(unsigned short *) (function +20) == 0x3739 && \ + *(unsigned long *) (function +24) == 0x03200009 && \ + *(unsigned long *) (function +28) == 0x00000000 +#define hilo(hiword,loword) \ + (((unsigned long) (hiword) << 16) | (unsigned long) (loword)) +#define tramp_address(function) \ + hilo(*(unsigned short *) (function +18), *(unsigned short *) (function +22)) +#define tramp_variable(function) \ + hilo(*(unsigned short *) (function +10), *(unsigned short *) (function +14)) +#define tramp_data(function) \ + hilo(*(unsigned short *) (function + 2), *(unsigned short *) (function + 6)) +#endif +#if (defined(__mips__) || defined(__mipsn32__)) && !defined(__mips64__) + /* function: + * lw $2,24($25) 8F 22 00 18 + * lw $3,28($25) 8F 23 00 1C + * sw $3,0($2) AC 43 00 00 + * lw $25,32($25) 8F 39 00 20 + * jal $0,$25 03 20 00 09 was: j $25 03 20 00 08 + * nop 00 00 00 00 + * .word + * .word + * .word
+ */ + *(unsigned int *) (function + 0) = 0x8F220018; + *(unsigned int *) (function + 4) = 0x8F23001C; + *(unsigned int *) (function + 8) = 0xAC430000; + *(unsigned int *) (function +12) = 0x8F390020; + *(unsigned int *) (function +16) = 0x03200009; + *(unsigned int *) (function +20) = 0x00000000; + *(unsigned int *) (function +24) = (unsigned int) variable; + *(unsigned int *) (function +28) = (unsigned int) data; + *(unsigned int *) (function +32) = (unsigned int) address; +#define TRAMP_CODE_LENGTH 24 +#define is_tramp(function) \ + *(int *) (function + 0) == 0x8F220018 && \ + *(int *) (function + 4) == 0x8F23001C && \ + *(int *) (function + 8) == 0xAC430000 && \ + *(int *) (function +12) == 0x8F390020 && \ + *(int *) (function +16) == 0x03200009 && \ + *(int *) (function +20) == 0x00000000 +#define tramp_address(function) \ + *(unsigned int *) (function +32) +#define tramp_variable(function) \ + *(unsigned int *) (function +24) +#define tramp_data(function) \ + *(unsigned int *) (function +28) +#endif +#ifdef __mips64old__ + /* function: + * dli $2, 3C 02 hi16(hi32()) + * 34 42 lo16(hi32()) + * 00 02 14 38 + * 34 42 hi16(lo32()) + * 00 02 14 38 + * 34 42 lo16(lo32()) + * dli $3, 3C 03 hi16(hi32()) + * 34 63 lo16(hi32()) + * 00 03 1C 38 + * 34 63 hi16(lo32()) + * 00 03 1C 38 + * 34 63 lo16(lo32()) + * sd $3,0($2) FC 43 00 00 + * dli $25,
3C 19 hi16(hi32(
)) + * 37 39 lo16(hi32(
)) + * 00 19 CC 38 + * 37 39 hi16(lo32(
)) + * 00 19 CC 38 + * 37 39 lo16(lo32(
)) + * jal $0,$25 03 20 00 09 was: j $25 03 20 00 08 + * nop 00 00 00 00 + */ + /* What about big endian / little endian ?? */ + *(short *) (function + 0) = 0x3C02; + *(short *) (function + 2) = (unsigned long) variable >> 48; + *(short *) (function + 4) = 0x3442; + *(short *) (function + 6) = ((unsigned long) variable >> 32) & 0xffff; + *(int *) (function + 8) = 0x00021438; + *(short *) (function +12) = 0x3442; + *(short *) (function +14) = ((unsigned long) variable >> 16) & 0xffff; + *(int *) (function +16) = 0x00021438; + *(short *) (function +20) = 0x3442; + *(short *) (function +22) = (unsigned long) variable & 0xffff; + *(short *) (function +24) = 0x3C03; + *(short *) (function +26) = (unsigned long) data >> 48; + *(short *) (function +28) = 0x3463; + *(short *) (function +30) = ((unsigned long) data >> 32) & 0xffff; + *(int *) (function +32) = 0x00031C38; + *(short *) (function +36) = 0x3463; + *(short *) (function +38) = ((unsigned long) data >> 16) & 0xffff; + *(int *) (function +40) = 0x00031C38; + *(short *) (function +44) = 0x3463; + *(short *) (function +46) = (unsigned long) data & 0xffff; + *(int *) (function +48) = 0xFC430000; + *(short *) (function +52) = 0x3C19; + *(short *) (function +54) = (unsigned long) address >> 48; + *(short *) (function +56) = 0x3739; + *(short *) (function +58) = ((unsigned long) address >> 32) & 0xffff; + *(int *) (function +60) = 0x0019CC38; + *(short *) (function +64) = 0x3739; + *(short *) (function +66) = ((unsigned long) address >> 16) & 0xffff; + *(int *) (function +68) = 0x0019CC38; + *(short *) (function +72) = 0x3739; + *(short *) (function +74) = (unsigned long) address & 0xffff; + *(int *) (function +76) = 0x03200009; + *(int *) (function +80) = 0x00000000; +#define is_tramp(function) \ + *(unsigned short *) (function + 0) == 0x3C02 && \ + *(unsigned short *) (function + 4) == 0x3442 && \ + *(unsigned int *) (function + 8) == 0x00021438 && \ + *(unsigned short *) (function +12) == 0x3442 && \ + *(unsigned int *) (function +16) == 0x00021438 && \ + *(unsigned short *) (function +20) == 0x3442 && \ + *(unsigned short *) (function +24) == 0x3C03 && \ + *(unsigned short *) (function +28) == 0x3463 && \ + *(unsigned int *) (function +32) == 0x00031C38 && \ + *(unsigned short *) (function +36) == 0x3463 && \ + *(unsigned int *) (function +40) == 0x00031C38 && \ + *(unsigned short *) (function +44) == 0x3463 && \ + *(unsigned int *) (function +48) == 0xFC430000 && \ + *(unsigned short *) (function +52) == 0x3C19 && \ + *(unsigned short *) (function +56) == 0x3739 && \ + *(unsigned int *) (function +60) == 0x0019CC38 && \ + *(unsigned short *) (function +64) == 0x3739 && \ + *(unsigned int *) (function +68) == 0x0019CC38 && \ + *(unsigned short *) (function +72) == 0x3739 && \ + *(unsigned int *) (function +76) == 0x03200009 && \ + *(unsigned int *) (function +80) == 0x00000000 +#define hilo(word3,word2,word1,word0) \ + (((unsigned long) (word3) << 48) | ((unsigned long) (word2) << 32) | \ + ((unsigned long) (word1) << 16) | (unsigned long) (word0)) +#define tramp_address(function) \ + hilo(*(unsigned short *) (function +54), \ + *(unsigned short *) (function +58), \ + *(unsigned short *) (function +66), \ + *(unsigned short *) (function +74)) +#define tramp_variable(function) \ + hilo(*(unsigned short *) (function + 2), \ + *(unsigned short *) (function + 6), \ + *(unsigned short *) (function +14), \ + *(unsigned short *) (function +22)) +#define tramp_data(function) \ + hilo(*(unsigned short *) (function +26), \ + *(unsigned short *) (function +30), \ + *(unsigned short *) (function +38), \ + *(unsigned short *) (function +46)) +#endif +#ifdef __mips64__ + /* function: + * ld $2,24($25) DF 22 00 18 + * ld $3,32($25) DF 23 00 20 + * sd $3,0($2) FC 43 00 00 + * ld $25,40($25) DF 39 00 28 + * jal $0,$25 03 20 00 09 was: j $25 03 20 00 08 + * nop 00 00 00 00 + * .dword + * .dword + * .dword
+ */ + *(unsigned int *) (function + 0) = 0xDF220018; + *(unsigned int *) (function + 4) = 0xDF230020; + *(unsigned int *) (function + 8) = 0xFC430000; + *(unsigned int *) (function +12) = 0xDF390028; + *(unsigned int *) (function +16) = 0x03200009; + *(unsigned int *) (function +20) = 0x00000000; + *(unsigned long *) (function +24) = (unsigned long) variable; + *(unsigned long *) (function +32) = (unsigned long) data; + *(unsigned long *) (function +40) = (unsigned long) address; +#define TRAMP_CODE_LENGTH 24 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0xDF220018 && \ + *(unsigned int *) (function + 4) == 0xDF230020 && \ + *(unsigned int *) (function + 8) == 0xFC430000 && \ + *(unsigned int *) (function +12) == 0xDF390028 && \ + *(unsigned int *) (function +16) == 0x03200009 && \ + *(unsigned int *) (function +20) == 0x00000000 +#define tramp_address(function) \ + *(unsigned long *) (function +40) +#define tramp_variable(function) \ + *(unsigned long *) (function +24) +#define tramp_data(function) \ + *(unsigned long *) (function +32) +#endif +#if defined(__sparc__) && !defined(__sparc64__) + /* function: + * sethi %hi(),%g1 03000000 | ( >> 10) + * sethi %hi(),%g2 05000000 | ( >> 10) + * or %g2,%lo(),%g2 8410A000 | ( & 0x3ff) + * st %g2,[%g1+%lo()] C4206000 | ( & 0x3ff) + * sethi %hi(
),%g1 03000000 | (
>> 10) + * jmp %g1+%lo(
) 81C06000 | (
& 0x3ff) + * nop 01000000 + */ +#define hi(word) ((unsigned long) (word) >> 10) +#define lo(word) ((unsigned long) (word) & 0x3ff) + *(long *) (function + 0) = 0x03000000 | hi(variable); + *(long *) (function + 4) = 0x05000000 | hi(data); + *(long *) (function + 8) = 0x8410A000 | lo(data); + *(long *) (function +12) = 0xC4206000 | lo(variable); + *(long *) (function +16) = 0x03000000 | hi(address); + *(long *) (function +20) = 0x81C06000 | lo(address); + *(long *) (function +24) = 0x01000000; +#define is_tramp(function) \ + (*(long *) (function + 0) & 0xffc00000) == 0x03000000 && \ + (*(long *) (function + 4) & 0xffc00000) == 0x05000000 && \ + (*(long *) (function + 8) & 0xfffffc00) == 0x8410A000 && \ + (*(long *) (function +12) & 0xfffffc00) == 0xC4206000 && \ + (*(long *) (function +16) & 0xffc00000) == 0x03000000 && \ + (*(long *) (function +20) & 0xfffffc00) == 0x81C06000 && \ + *(long *) (function +24) == 0x01000000 +#define hilo(hiword,loword) (((hiword) << 10) | ((loword) & 0x3ff)) +#define tramp_address(function) \ + hilo(*(long *) (function +16), *(long *) (function +20)) +#define tramp_variable(function) \ + hilo(*(long *) (function + 0), *(long *) (function +12)) +#define tramp_data(function) \ + hilo(*(long *) (function + 4), *(long *) (function + 8)) +#endif +#ifdef __sparc64__ + /* function: + * rd %pc,%g1 83414000 + * ldx [%g1+24],%g2 C4586018 + * ldx [%g1+32],%g3 C6586020 + * ldx [%g1+40],%g1 C2586028 + * jmp %g1 81C04000 + * stx %g3,[%g2] C6708000 + * .long high32() >> 32 + * .long low32() & 0xffffffff + * .long high32() >> 32 + * .long low32() & 0xffffffff + * .long high32(
)
>> 32 + * .long low32(
)
& 0xffffffff + */ + *(int *) (function + 0) = 0x83414000; + *(int *) (function + 4) = 0xC4586018; + *(int *) (function + 8) = 0xC6586020; + *(int *) (function +12) = 0xC2586028; + *(int *) (function +16) = 0x81C04000; + *(int *) (function +20) = 0xC6708000; + *(long *) (function +24) = (long) variable; + *(long *) (function +32) = (long) data; + *(long *) (function +40) = (long) address; +#define TRAMP_CODE_LENGTH 24 +#define is_tramp(function) \ + *(int *) (function + 0) == 0x83414000 && \ + *(int *) (function + 4) == 0xC4586018 && \ + *(int *) (function + 8) == 0xC6586020 && \ + *(int *) (function +12) == 0xC2586028 && \ + *(int *) (function +16) == 0x81C04000 && \ + *(int *) (function +20) == 0xC6708000 +#define tramp_address(function) \ + *(long *) (function +40) +#define tramp_variable(function) \ + *(long *) (function +24) +#define tramp_data(function) \ + *(long *) (function +32) +#endif +#ifdef __alpha__ + /* function: + * br $1,function..ng 00 00 20 C0 + * function..ng: + * ldq $2,20($1) 14 00 41 A4 + * ldq $3,28($1) 1C 00 61 A4 + * ldq $27,36($1) 24 00 61 A7 + * stq $2,0($3) 00 00 43 B4 + * jmp $31,($27),0 00 00 FB 6B + * .quad + * .quad + * .quad
+ */ + { static int code [6] = + { 0xC0200000, 0xA4410014, 0xA461001C, 0xA7610024, 0xB4430000, 0x6BFB0000 }; + int i; + for (i=0; i<6; i++) { ((int *) function)[i] = code[i]; } + ((long *) function)[3] = (long) data; + ((long *) function)[4] = (long) variable; + ((long *) function)[5] = (long) address; + } +#define TRAMP_CODE_LENGTH 24 +#define is_tramp(function) \ + ((int *) function)[0] == 0xC0200000 && \ + ((int *) function)[1] == 0xA4410014 && \ + ((int *) function)[2] == 0xA461001C && \ + ((int *) function)[3] == 0xA7610024 && \ + ((int *) function)[4] == 0xB4430000 && \ + ((int *) function)[5] == 0x6BFB0000 +#define tramp_address(function) \ + ((long *) function)[5] +#define tramp_variable(function) \ + ((long *) function)[4] +#define tramp_data(function) \ + ((long *) function)[3] +#endif +#ifdef __hppaold__ + /* function: + * ldil L',%r20 22800000 | hi() + * ldil L',%r19 22600000 | hi() + * ldo R'(%r20),%r20 36940000 | lo() + * stw %r20,R'(%r19) 6A740000 | lo() + * ldil L'
,%r21 22A00000 | hi(
) + * ldo R'
(%r21),%r21 36B50000 | lo(
) + * bb,>=,n %r21,30,function2 C7D5C012 + * depi 0,31,2,%r21 D6A01C1E + * ldw 4(0,%r21),%r19 4AB30008 + * ldw 0(0,%r21),%r21 4AB50000 + * function2: + * ldsid (0,%r21),%r1 02A010A1 + * mtsp %r1,%sr0 00011820 + * be,n 0(%sr0,%r21) E2A00002 + * nop 08000240 + */ + /* When decoding a 21-bit argument in an instruction, the hppa performs + * the following bit manipulation: + * assemble21: x[20]...x[0] + * --> x[0] x[11]...x[1] x[15]..x[14] x[20]...x[16] x[13]..x[12] + * When encoding a 21-bit argument into an instruction, we need the + * to perform the reverse permutation: + * permute21: y[20]...y[0] + * --> y[6]...y[2] y[8]..y[7] y[1]..y[0] y[19]...y[9] y[20] + */ +#define assemble21(x) \ + ((((x) & 0x1) << 20) | (((x) & 0xFFE) << 8) | \ + (((x) & 0xC000) >> 7) | (((x) & 0x1F0000) >> 14) | (((x) & 0x3000) >> 12)) +#define permute21(y) \ + ((((y) & 0x7C) << 14) | (((y) & 0x180) << 7) | (((y) & 0x3) << 12) | \ + (((y) & 0xFFE00) >> 8) | (((y) & 0x100000) >> 20)) +#define hi(word) permute21((unsigned long) (word) >> 11) +#define lo(word) (((unsigned long) (word) & 0x7FF) << 1) + *(long *) (function + 0) = 0x22800000 | hi(data); + *(long *) (function + 4) = 0x22600000 | hi(variable); + *(long *) (function + 8) = 0x36940000 | lo(data); + *(long *) (function +12) = 0x6A740000 | lo(variable); + *(long *) (function +16) = 0x22A00000 | hi(address); + *(long *) (function +20) = 0x36B50000 | lo(address); + *(long *) (function +24) = 0xC7D5C012; + *(long *) (function +28) = 0xD6A01C1E; + *(long *) (function +32) = 0x4AB30008; + *(long *) (function +36) = 0x4AB50000; + *(long *) (function +40) = 0x02A010A1; + *(long *) (function +44) = 0x00011820; + *(long *) (function +48) = 0xE2A00002; + *(long *) (function +52) = 0x08000240; +#define is_tramp(function) \ + ((long) function & 3) == 0 && \ + (*(long *) (function + 0) & 0xffe00000) == 0x22800000 && \ + (*(long *) (function + 4) & 0xffe00000) == 0x22600000 && \ + (*(long *) (function + 8) & 0xfffff000) == 0x36940000 && \ + (*(long *) (function +12) & 0xfffff000) == 0x6A740000 && \ + (*(long *) (function +16) & 0xffe00000) == 0x22A00000 && \ + (*(long *) (function +20) & 0xfffff000) == 0x36B50000 && \ + *(long *) (function +24) == 0xC7D5C012 && \ + *(long *) (function +28) == 0xD6A01C1E && \ + *(long *) (function +32) == 0x4AB30008 && \ + *(long *) (function +36) == 0x4AB50000 && \ + *(long *) (function +40) == 0x02A010A1 && \ + *(long *) (function +44) == 0x00011820 && \ + *(long *) (function +48) == 0xE2A00002 && \ + *(long *) (function +52) == 0x08000240 +#define hilo(hiword,loword) \ + ((assemble21((unsigned long) (hiword)) << 11) | \ + (((unsigned long) (loword) & 0xFFE) >> 1) \ + ) +#define tramp_address(function) \ + hilo(*(long *) (function +16), *(long *) (function +20)) +#define tramp_variable(function) \ + hilo(*(long *) (function + 4), *(long *) (function +12)) +#define tramp_data(function) \ + hilo(*(long *) (function + 0), *(long *) (function + 8)) +#endif +#ifdef __hppanew__ + /* function: + * .long tramp + * .long closure + * closure: + * .long + * .long + * .long
+ */ + { /* work around a bug in gcc 3.* */ + void* tramp_address = &tramp; + *(long *) (function + 0) = ((long *) ((char*)tramp_address-2))[0]; + *(long *) (function + 4) = (long) (function + 8); + *(long *) (function + 8) = (long) variable; + *(long *) (function +12) = (long) data; + *(long *) (function +16) = (long) address; + } +#define TRAMP_CODE_LENGTH 0 +#define is_tramp(function) \ + ((long *) function)[0] == ((long *) ((char*)tramp_address-2))[0] +#define tramp_address(function) \ + ((long *) function)[4] +#define tramp_variable(function) \ + ((long *) function)[2] +#define tramp_data(function) \ + ((long *) function)[3] +#endif +#ifdef __hppa64old__ + /* function: + * mfia %r27 000014BB + * ldd 40(%r27),%r31 537F0050 + * ldd 48(%r27),%r1 53610060 + * std %r1,0(%r31) 0FE112C0 + * ldd 56(%r27),%r27 537B0070 + * ldd 16(%r27),%r1 53610020 + * ldd 24(%r27),%r27 537B0030 + * bve (%r1) E820D000 + * nop 08000240 + * .align 8 + * .dword + * .dword + * .dword
+ * function_pointer: + * .dword 0 + * .dword 0 + * .dword function + * .dword 0 + */ + *(int *) (function + 0) = 0x000014BB; + *(int *) (function + 4) = 0x537F0050; + *(int *) (function + 8) = 0x53610060; + *(int *) (function +12) = 0x0FE112C0; + *(int *) (function +16) = 0x537B0070; + *(int *) (function +20) = 0x53610020; + *(int *) (function +24) = 0x537B0030; + *(int *) (function +28) = 0xE820D000; + *(int *) (function +32) = 0x08000240; + *(long *) (function +40) = (long)variable; + *(long *) (function +48) = (long)data; + *(long *) (function +56) = (long)address; + *(long *) (function +64) = (long)0; + *(long *) (function +72) = (long)0; + *(long *) (function +80) = (long)function; + *(long *) (function +88) = (long)0; +#define TRAMP_CODE_LENGTH 36 +#define is_tramp(function) \ + *(int *) (function + 0) == 0x000014BB && \ + *(int *) (function + 4) == 0x537F0050 && \ + *(int *) (function + 8) == 0x53610060 && \ + *(int *) (function +12) == 0x0FE112C0 && \ + *(int *) (function +16) == 0x537B0070 && \ + *(int *) (function +20) == 0x53610020 && \ + *(int *) (function +24) == 0x537B0030 && \ + *(int *) (function +28) == 0xE820D000 && \ + *(int *) (function +32) == 0x08000240 +#define tramp_address(function) \ + (*(unsigned long *) (function +56)) +#define tramp_variable(function) \ + (*(unsigned long *) (function +40)) +#define tramp_data(function) \ + (*(unsigned long *) (function +48)) +#endif +#ifdef __hppa64new__ + /* function: + * .dword 0 + * .dword 0 + * .dword tramp + * .dword closure + * closure: + * .dword + * .dword + * .dword
+ */ + *(long *) (function + 0) = 0; + *(long *) (function + 8) = 0; + *(long *) (function +16) = ((long *) (void*) &tramp)[2]; + *(long *) (function +24) = (long) (function + 32); + *(long *) (function +32) = (long) variable; + *(long *) (function +40) = (long) data; + *(long *) (function +48) = (long) address; +#define TRAMP_CODE_LENGTH 0 +#define is_tramp(function) \ + ((long *) function)[2] == ((long *) (void*) &tramp)[2] && \ + ((long *) function)[3] == (long) (function + 32) +#define tramp_address(function) \ + ((long *) function)[6] +#define tramp_variable(function) \ + ((long *) function)[4] +#define tramp_data(function) \ + ((long *) function)[5] +#endif +#if defined(__arm__) || defined(__armhf__) + /* function: + * stmfd sp!,{r0} E92D0001 + * ldr r0,[pc,#16] E59F000C + * ldr ip,[pc,#16] E59FC00C + * str r0,[ip] E58C0000 + * ldmfd sp!,{r0} E8BD0001 + * ldr pc,[pc,#4] E59FF004 + * _data: + * .word + * _variable: + * .word + * _address: + * .word
+ */ + { + ((long *) function)[0] = 0xE92D0001; + ((long *) function)[1] = 0xE59F000C; + ((long *) function)[2] = 0xE59FC00C; + ((long *) function)[3] = 0xE58C0000; + ((long *) function)[4] = 0xE8BD0001; + ((long *) function)[5] = 0xE59FF004; + ((long *) function)[6] = (long)data; + ((long *) function)[7] = (long)variable; + ((long *) function)[8] = (long)address; + } +#define TRAMP_CODE_LENGTH 24 +#define is_tramp(function) \ + ((long *) function)[0] == 0xE92D0001 && \ + ((long *) function)[1] == 0xE59F000C && \ + ((long *) function)[2] == 0xE59FC00C && \ + ((long *) function)[3] == 0xE58C0000 && \ + ((long *) function)[4] == 0xE8BD0001 && \ + ((long *) function)[5] == 0xE59FF004 +#define tramp_address(function) \ + ((long *) function)[8] +#define tramp_variable(function) \ + ((long *) function)[7] +#define tramp_data(function) \ + ((long *) function)[6] +#endif +#ifdef __arm64__ + /* function: + * ldr x9,.+24 580000C9 + * ldr x10,.+28 580000EA + * ldr x11,.+32 5800010B + * str x9,[x10] F9000149 + * br x11 D61F0160 + * nop D503201F + * .xword + * .xword + * .xword
+ */ + *(int *) (function + 0) = 0x580000C9; + *(int *) (function + 4) = 0x580000EA; + *(int *) (function + 8) = 0x5800010B; + *(int *) (function +12) = 0xF9000149; + *(int *) (function +16) = 0xD61F0160; + *(int *) (function +20) = 0xD503201F; + *(long *) (function +24) = (unsigned long) data; + *(long *) (function +32) = (unsigned long) variable; + *(long *) (function +40) = (unsigned long) address; +#define TRAMP_CODE_LENGTH 24 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0x580000C9 && \ + *(unsigned int *) (function + 4) == 0x580000EA && \ + *(unsigned int *) (function + 8) == 0x5800010B && \ + *(unsigned int *) (function +12) == 0xF9000149 && \ + *(unsigned int *) (function +16) == 0xD61F0160 && \ + *(unsigned int *) (function +20) == 0xD503201F +#define tramp_address(function) \ + (*(unsigned long *) (function +40)) +#define tramp_variable(function) \ + (*(unsigned long *) (function +32)) +#define tramp_data(function) \ + (*(unsigned long *) (function +24)) +#endif +#ifdef __powerpcsysv4__ + /* function: + * {liu|lis} 11,hi16() 3D 60 hi16() + * {oril|ori} 11,11,lo16() 61 6B lo16() + * {liu|lis} 12,hi16() 3D 80 hi16() + * {oril|ori} 12,12,lo16() 61 8C lo16() + * {st|stw} 12,0(11) 91 8B 00 00 + * {liu|lis} 0,hi16(
) 3C 00 hi16(
) + * {oril|ori} 0,0,lo16(
) 60 00 lo16(
) + * mtctr 0 7C 09 03 A6 + * bctr 4E 80 04 20 + */ + *(short *) (function + 0) = 0x3D60; + *(short *) (function + 2) = (unsigned long) variable >> 16; + *(short *) (function + 4) = 0x616B; + *(short *) (function + 6) = (unsigned long) variable & 0xffff; + *(short *) (function + 8) = 0x3D80; + *(short *) (function +10) = (unsigned long) data >> 16; + *(short *) (function +12) = 0x618C; + *(short *) (function +14) = (unsigned long) data & 0xffff; + *(long *) (function +16) = 0x918B0000; + *(short *) (function +20) = 0x3C00; + *(short *) (function +22) = (unsigned long) address >> 16; + *(short *) (function +24) = 0x6000; + *(short *) (function +26) = (unsigned long) address & 0xffff; + *(long *) (function +28) = 0x7C0903A6; + *(long *) (function +32) = 0x4E800420; +#define is_tramp(function) \ + *(unsigned short *) (function + 0) == 0x3D60 && \ + *(unsigned short *) (function + 4) == 0x616B && \ + *(unsigned short *) (function + 8) == 0x3D80 && \ + *(unsigned short *) (function +12) == 0x618C && \ + *(unsigned long *) (function +16) == 0x918B0000 && \ + *(unsigned short *) (function +20) == 0x3C00 && \ + *(unsigned short *) (function +24) == 0x6000 && \ + *(unsigned long *) (function +28) == 0x7C0903A6 && \ + *(unsigned long *) (function +32) == 0x4E800420 +#define hilo(hiword,loword) \ + (((unsigned long) (hiword) << 16) | (unsigned long) (loword)) +#define tramp_address(function) \ + hilo(*(unsigned short *) (function +22), *(unsigned short *) (function +26)) +#define tramp_variable(function) \ + hilo(*(unsigned short *) (function + 2), *(unsigned short *) (function + 6)) +#define tramp_data(function) \ + hilo(*(unsigned short *) (function +10), *(unsigned short *) (function +14)) +#endif +#ifdef __powerpcaix__ + /* function: + * .long .tramp + * .long .mytoc + * .long 0 + * .mytoc: + * .long + * .long + * .long
+ */ + *(long *) (function + 0) = ((long *) &tramp)[0]; + *(long *) (function + 4) = (long) (function + 12); + *(long *) (function + 8) = 0; + *(long *) (function +12) = (long) variable; + *(long *) (function +16) = (long) data; + *(long *) (function +20) = (long) address; +#define TRAMP_CODE_LENGTH 0 +#define is_tramp(function) \ + ((long *) function)[0] == ((long *) &tramp)[0] +#define tramp_address(function) \ + ((long *) function)[5] +#define tramp_variable(function) \ + ((long *) function)[3] +#define tramp_data(function) \ + ((long *) function)[4] +#endif +#ifdef __powerpc64_elfv2__ + /* function: + * ld 11,24(12) 18 00 6C E9 + * ld 0,32(12) 20 00 0C E8 + * std 0,0(11) 00 00 0B F8 + * ld 12,40(12) 28 00 8C E9 + * mtctr 12 A6 03 89 7D + * bctr 20 04 80 4E + * .quad + * .quad + * .quad
+ */ + *(int *) (function + 0) = 0xE96C0018; + *(int *) (function + 4) = 0xE80C0020; + *(int *) (function + 8) = 0xF80B0000; + *(int *) (function +12) = 0xE98C0028; + *(int *) (function +16) = 0x7D8903A6; + *(int *) (function +20) = 0x4E800420; + *(long *) (function +24) = (unsigned long) variable; + *(long *) (function +32) = (unsigned long) data; + *(long *) (function +40) = (unsigned long) address; +#define TRAMP_CODE_LENGTH 24 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0xE96C0018 && \ + *(unsigned int *) (function + 4) == 0xE80C0020 && \ + *(unsigned int *) (function + 8) == 0xF80B0000 && \ + *(unsigned int *) (function +12) == 0xE98C0028 && \ + *(unsigned int *) (function +16) == 0x7D8903A6 && \ + *(unsigned int *) (function +20) == 0x4E800420 +#define tramp_address(function) \ + (*(unsigned long *) (function +40)) +#define tramp_variable(function) \ + (*(unsigned long *) (function +24)) +#define tramp_data(function) \ + (*(unsigned long *) (function +32)) +#endif +#ifdef __powerpc64aix__ + /* function: + * .quad .tramp + * .quad .mytoc + * .quad 0 + * .mytoc: + * .quad + * .quad + * .quad
+ */ + *(long *) (function + 0) = ((long *) &tramp)[0]; + *(long *) (function + 8) = (long) (function + 24); + *(long *) (function +16) = 0; + *(long *) (function +24) = (long) variable; + *(long *) (function +32) = (long) data; + *(long *) (function +40) = (long) address; +#define TRAMP_CODE_LENGTH 0 +#define is_tramp(function) \ + ((long *) function)[0] == ((long *) &tramp)[0] +#define tramp_address(function) \ + ((long *) function)[5] +#define tramp_variable(function) \ + ((long *) function)[3] +#define tramp_data(function) \ + ((long *) function)[4] +#endif +#ifdef __ia64__ + /* function: + * data8 tramp + * data8 closure + * closure: + * data8
+ * data8 + * data8 + */ + *(long *) (function + 0) = (long) &tramp; + *(long *) (function + 8) = (long) (function + 16); + *(long *) (function +16) = (long) address; + *(long *) (function +24) = (long) variable; + *(long *) (function +32) = (long) data; +#define TRAMP_CODE_LENGTH 0 +#define is_tramp(function) \ + ((long *) function)[0] == (long) &tramp +#define tramp_address(function) \ + ((long *) function)[2] +#define tramp_variable(function) \ + ((long *) function)[3] +#define tramp_data(function) \ + ((long *) function)[4] +#endif +#ifdef __x86_64__ +#ifdef __x86_64_x32__ + /* function: + * movl $, C7 04 25 + * movl $
,%eax B8
+ * jmp *%rax FF E0 + */ + *(int *) (function + 0) = ((unsigned long) variable << 24) | 0x2504C7; + *(int *) (function + 4) = ((unsigned long) data << 24) | ((unsigned long) variable >> 8); + *(int *) (function + 8) = 0xB8000000 | ((unsigned long) data >> 8); + *(int *) (function +12) = (unsigned long) address; + *(short *) (function +16) = 0xE0FF; +#define is_tramp(function) \ + (*(unsigned long *) (function + 0) & 0x00FFFFFF) == 0x2504C7 && \ + (*(unsigned long *) (function + 8) & 0xFF000000) == 0xB8000000 && \ + *(unsigned short *) (function +16) == 0xE0FF +#define tramp_address(function) \ + (*(unsigned int *) (function +12)) +#define tramp_variable(function) \ + ((*(unsigned long *) (function + 0) >> 24) | \ + (*(unsigned long *) (function + 4) << 8)) +#define tramp_data(function) \ + ((*(unsigned long *) (function + 4) >> 24) | \ + (*(unsigned long *) (function + 8) << 8)) +#else + /* function: + * movabsq $,%rax 48 B8 + * movabsq %rax, 48 A3 + * movabsq $
,%rax 48 B8
+ * jmp *%rax FF E0 + */ + *(short *) (function + 0) = 0xB848; + *(short *) (function + 2) = (unsigned long long) data & 0xffff; + *(int *) (function + 4) = ((unsigned long long) data >> 16) & 0xffffffff; + *(short *) (function + 8) = ((unsigned long long) data >> 48) & 0xffff; + *(short *) (function +10) = 0xA348; + *(int *) (function +12) = (unsigned long long) variable & 0xffffffff; + *(int *) (function +16) = ((unsigned long long) variable >> 32) & 0xffffffff; + *(short *) (function +20) = 0xB848; + *(short *) (function +22) = (unsigned long long) address & 0xffff; + *(int *) (function +24) = ((unsigned long long) address >> 16) & 0xffffffff; + *(short *) (function +28) = ((unsigned long long) address >> 48) & 0xffff; + *(short *) (function +30) = 0xE0FF; +#define is_tramp(function) \ + *(unsigned short *) (function + 0) == 0xB848 && \ + *(unsigned short *) (function +10) == 0xA348 && \ + *(unsigned short *) (function +20) == 0xB848 && \ + *(unsigned short *) (function +30) == 0xE0FF +#define hilo(hiword,loword) \ + (((unsigned long long) (hiword) << 32) | (unsigned long long) (loword)) +#define himidlo(hishort,midword,loshort) \ + (((unsigned long long) (hishort) << 48) | (unsigned long long) (midword) << 16 \ + | (unsigned long long) (loshort)) +#define tramp_address(function) \ + himidlo(*(unsigned short *) (function +28), \ + *(unsigned int *) (function +24), \ + *(unsigned short *) (function +22)) +#define tramp_variable(function) \ + hilo(*(unsigned int *) (function +16), *(unsigned int *) (function +12)) +#define tramp_data(function) \ + himidlo(*(unsigned short *) (function + 8), \ + *(unsigned int *) (function + 4), \ + *(unsigned short *) (function + 2)) +#endif +#endif +#if defined(__s390__) && !defined(__s390x__) + /* function: + * bras %r1,.L1 A7150002 + * .L1: + * l %r0,data-.L1(%r1) 58001018 + * l %r1,variable-.L1(%r1) 5810101C + * st %r0,0(%r1) 50001000 + * bras %r1,.L2 A7150002 + * .L2: + * l %r1,function-.L2(%r1) 58101010 + * br %r1 07F1 + * nop 0707 + * data: .long + * variable: .long + * address: .long
+ */ + *(int *) (function + 0) = 0xA7150002; + *(int *) (function + 4) = 0x58001018; + *(int *) (function + 8) = 0x5810101C; + *(int *) (function +12) = 0x50001000; + *(int *) (function +16) = 0xA7150002; + *(int *) (function +20) = 0x58101010; + *(int *) (function +24) = 0x07F10707; + *(int *) (function +28) = (unsigned int) data; + *(int *) (function +32) = (unsigned int) variable; + *(int *) (function +36) = (unsigned int) address; +#define TRAMP_CODE_LENGTH 28 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0xA7150002 && \ + *(unsigned int *) (function + 4) == 0x58001018 && \ + *(unsigned int *) (function + 8) == 0x5810101C && \ + *(unsigned int *) (function +12) == 0x50001000 && \ + *(unsigned int *) (function +16) == 0xA7150002 && \ + *(unsigned int *) (function +20) == 0x58101010 && \ + *(unsigned int *) (function +24) == 0x07F10707 +#define tramp_address(function) \ + *(unsigned int *) (function +36) +#define tramp_variable(function) \ + *(unsigned int *) (function +32) +#define tramp_data(function) \ + *(unsigned int *) (function +28) +#endif +#ifdef __s390x__ + /* function: + * larl %r1,.L1 C01000000003 + * .L1: + * lg %r0,data-.L1(%r1) E30010220004 + * lg %r1,variable-.L1(%r1) E310102A0004 + * stg %r0,0(%r1) E30010000024 + * larl %r1,.L2 C01000000003 + * .L2: + * lg %r1,function-.L2(%r1) E310101A0004 + * br %r1 07F1 + * nop 0707 + * data: .quad + * variable: .quad + * address: .quad
+ */ + *(int *) (function + 0) = 0xC0100000; + *(int *) (function + 4) = 0x0003E300; + *(int *) (function + 8) = 0x10220004; + *(int *) (function +12) = 0xE310102A; + *(int *) (function +16) = 0x0004E300; + *(int *) (function +20) = 0x10000024; + *(int *) (function +24) = 0xC0100000; + *(int *) (function +28) = 0x0003E310; + *(int *) (function +32) = 0x101A0004; + *(int *) (function +36) = 0x07F10707; + *(long *) (function +40) = (unsigned long) data; + *(long *) (function +48) = (unsigned long) variable; + *(long *) (function +56) = (unsigned long) address; +#define TRAMP_CODE_LENGTH 40 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0xC0100000 && \ + *(unsigned int *) (function + 4) == 0x0003E300 && \ + *(unsigned int *) (function + 8) == 0x10220004 && \ + *(unsigned int *) (function +12) == 0xE310102A && \ + *(unsigned int *) (function +16) == 0x0004E300 && \ + *(unsigned int *) (function +20) == 0x10000024 && \ + *(unsigned int *) (function +24) == 0xC0100000 && \ + *(unsigned int *) (function +28) == 0x0003E310 && \ + *(unsigned int *) (function +32) == 0x101A0004 && \ + *(unsigned int *) (function +36) == 0x07F10707 +#define tramp_address(function) \ + (*(unsigned long *) (function +56)) +#define tramp_variable(function) \ + (*(unsigned long *) (function +48)) +#define tramp_data(function) \ + (*(unsigned long *) (function +40)) +#endif +#ifdef __riscv32__ + /* function: + * auipc t3,0 00000E17 + * lw t0,24(t3) 018E2283 + * lw t1,28(t3) 01CE2303 + * lw t2,32(t3) 020E2383 + * sw t0,(t1) 00532023 + * jr t2 00038067 + * data: .word + * variable: .word + * address: .word
+ */ + *(int *) (function + 0) = 0x00000E17; + *(int *) (function + 4) = 0x018E2283; + *(int *) (function + 8) = 0x01CE2303; + *(int *) (function +12) = 0x020E2383; + *(int *) (function +16) = 0x00532023; + *(int *) (function +20) = 0x00038067; + *(int *) (function +24) = (unsigned int) data; + *(int *) (function +28) = (unsigned int) variable; + *(int *) (function +32) = (unsigned int) address; +#define TRAMP_CODE_LENGTH 24 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0x00000E17 && \ + *(unsigned int *) (function + 4) == 0x018E2283 && \ + *(unsigned int *) (function + 8) == 0x01CE2303 && \ + *(unsigned int *) (function +12) == 0x020E2383 && \ + *(unsigned int *) (function +16) == 0x00532023 && \ + *(unsigned int *) (function +20) == 0x00038067 +#define tramp_address(function) \ + (*(unsigned int *) (function +32)) +#define tramp_variable(function) \ + (*(unsigned int *) (function +28)) +#define tramp_data(function) \ + (*(unsigned int *) (function +24)) +#endif +#ifdef __riscv64__ + /* function: + * auipc t3,0 00000E17 + * ld t0,24(t3) 018E3283 + * ld t1,32(t3) 020E3303 + * ld t2,40(t3) 028E3383 + * sd t0,(t1) 00533023 + * jr t2 00038067 + * data: .quad + * variable: .quad + * address: .quad
+ */ + *(int *) (function + 0) = 0x00000E17; + *(int *) (function + 4) = 0x018E3283; + *(int *) (function + 8) = 0x020E3303; + *(int *) (function +12) = 0x028E3383; + *(int *) (function +16) = 0x00533023; + *(int *) (function +20) = 0x00038067; + *(long *) (function +24) = (unsigned long) data; + *(long *) (function +32) = (unsigned long) variable; + *(long *) (function +40) = (unsigned long) address; +#define TRAMP_CODE_LENGTH 24 +#define is_tramp(function) \ + *(unsigned int *) (function + 0) == 0x00000E17 && \ + *(unsigned int *) (function + 4) == 0x018E3283 && \ + *(unsigned int *) (function + 8) == 0x020E3303 && \ + *(unsigned int *) (function +12) == 0x028E3383 && \ + *(unsigned int *) (function +16) == 0x00533023 && \ + *(unsigned int *) (function +20) == 0x00038067 +#define tramp_address(function) \ + (*(unsigned long *) (function +40)) +#define tramp_variable(function) \ + (*(unsigned long *) (function +32)) +#define tramp_data(function) \ + (*(unsigned long *) (function +24)) +#endif + + /* 3. Set memory protection to "executable" */ + +#if !defined(CODE_EXECUTABLE) +#if defined(EXECUTABLE_VIA_MALLOC_THEN_MPROTECT) || defined(EXECUTABLE_VIA_MMAP_THEN_MPROTECT) + /* Call mprotect on the pages that contain the range. */ + { uintptr_t start_addr = (uintptr_t) function; + uintptr_t end_addr = (uintptr_t) (function + TRAMP_LENGTH); + start_addr = start_addr & -pagesize; + end_addr = (end_addr + pagesize-1) & -pagesize; + {uintptr_t len = end_addr - start_addr; + if (mprotect((void*)start_addr, len, PROT_READ|PROT_WRITE|PROT_EXEC) < 0) + { fprintf(stderr,"trampoline: cannot make memory executable\n"); abort(); } + }} +#endif +#endif + + /* 4. Flush instruction cache */ + /* We need this because some CPUs have separate data cache and instruction + * cache. The freshly built trampoline is visible to the data cache, but not + * maybe not to the instruction cache. This is hairy. + */ + /* TRAMP_CODE_LENGTH = length of the machine instructions. */ +#ifndef TRAMP_CODE_LENGTH +#define TRAMP_CODE_LENGTH TRAMP_LENGTH +#endif +#if !(defined(__hppanew__) || defined(__hppa64new__) || defined(__powerpcaix__) || defined(__powerpc64aix__) || defined(__ia64__)) + /* Only needed if we really set up machine instructions. */ + /* Use the operating system provided function, when available. */ +#if defined _WIN32 && !defined __CYGWIN__ + /* Native Windows. + FlushInstructionCache + */ + HANDLE process = GetCurrentProcess (); + while (!FlushInstructionCache (process, function_x, TRAMP_CODE_LENGTH)) + ; +#elif defined __APPLE__ && defined __MACH__ + /* macOS */ + sys_icache_invalidate (function_x, TRAMP_CODE_LENGTH); +#elif defined _AIX + /* AIX. */ + _sync_cache_range (function_x, TRAMP_CODE_LENGTH); +#elif defined __sgi + /* IRIX. */ + cacheflush (function_x, TRAMP_CODE_LENGTH, ICACHE); +#elif defined __sun + /* Solaris. */ + extern void sync_instruction_memory (char *, size_t); + sync_instruction_memory (function_x, TRAMP_CODE_LENGTH); +#else + /* No operating system provided function. Dispatch according to the CPU. */ +#ifdef __i386__ +#if defined(_WIN32) + while (!FlushInstructionCache(GetCurrentProcess(),function_x,TRAMP_CODE_LENGTH)) + continue; +#endif +#endif +#ifdef __m68k__ +#if defined(__NetBSD__) && defined(__GNUC__) + { register uintptr_t _beg __asm__ ("%a1") = (uintptr_t) function_x; + register uintptr_t _len __asm__ ("%d1") = TRAMP_CODE_LENGTH; + __asm__ __volatile__ ( + "move%.l %#0x80000004,%/d0\n\t" /* CC_EXTPURGE | C_IPURGE */ + "trap #12" /* kernel call ‘cachectl’ */ + : + : "a" (_beg), "d" (_len) + : "%a0", "%a1", "%d0", "%d1" /* call-used registers */ + ); + } +#endif +#if defined(__linux__) && defined(__GNUC__) + { register uintptr_t _beg __asm__ ("%d1") = (uintptr_t) function_x; + register uintptr_t _len __asm__ ("%d4") = TRAMP_CODE_LENGTH + 32; + __asm__ __volatile__ ( + "move%.l %#123,%/d0\n\t" + "move%.l %#1,%/d2\n\t" + "move%.l %#3,%/d3\n\t" + "trap %#0" + : + : "d" (_beg), "d" (_len) + : "%d0", "%d2", "%d3" + ); + } +#endif +#if defined(AUX) && defined(__GNUC__) + /* sysm68k(105, addr, scope, cache, len) */ + __asm__ __volatile__ ( + "move%.l %1,%/sp@-\n\t" + "move%.l %#3,%/sp@-\n\t" + "move%.l %#1,%/sp@-\n\t" + "move%.l %0,%/sp@-\n\t" + "move%.l %#105,%/sp@-\n\t" + "move%.l %#0,%/sp@-\n\t" + "move%.l %#38,%/sp@-\n\t" + "trap %#0\n\t" + "add%.l %#24,%/sp" + : + : "r" (function_x), "g" ((int)TRAMP_CODE_LENGTH) + : "%d0" + ); +#endif +#endif +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) + cacheflush(function_x,TRAMP_CODE_LENGTH,ICACHE); + /* gforth-0.3.0 uses BCACHE instead of ICACHE. Why?? */ +#endif +#if defined(__sparc__) || defined(__sparc64__) + /* This assumes that the trampoline fits in at most four cache lines. */ + __TR_clear_cache_4(function_x,function_x+TRAMP_CODE_LENGTH-1); +#endif +#ifdef __alpha__ + __TR_clear_cache(); +#endif +#if defined(__hppa__) || defined(__hppa64__) + /* This assumes that the trampoline fits in at most two cache lines. */ + __TR_clear_cache(function_x,function_x+TRAMP_CODE_LENGTH-1); +#endif +#if defined(__arm__) || defined(__armhf__) || defined(__arm64__) + /* On ARM, cache flushing can only be done through a system call. + GCC implements it for Linux with EABI, through an "swi 0" with code + 0xf0002. For other systems, it may be an "swi 0x9f0002", + an "swi 0xf00000", or similar. */ + /* On ARM64, cache flushing is done through special instructions, + and the length of the cache lines must be determined at runtime. + See gcc/libgcc/config/aarch64/sync-cache.c. */ +#if defined(__GNUC__) + /* Use the GCC built-in. */ + __clear_cache((void*)function_x,(void*)(function_x+TRAMP_CODE_LENGTH)); +#else + #error "Don't know how to implement clear_cache on this platform." +#endif +#endif +#if defined(__powerpc__) || defined(__powerpc64__) + __TR_clear_cache(function_x); +#endif +#if defined(__riscv32__) || defined(__riscv64__) +#if defined(__linux__) + /* Use the libc function. */ + __riscv_flush_icache((void*)function_x,(void*)(function_x+TRAMP_CODE_LENGTH),0); +#elif defined(__GNUC__) + __asm__ __volatile__ ("fence.i"); +#endif +#endif +#endif +#endif + + /* 5. Return. */ + return (trampoline_function_t) (function_x + TRAMP_BIAS); +} + +void free_trampoline (trampoline_function_t function) +{ +#if TRAMP_BIAS + function = (trampoline_function_t)((char*)function - TRAMP_BIAS); +#endif +#if !defined(CODE_EXECUTABLE) && !defined(EXECUTABLE_VIA_MALLOC_THEN_MPROTECT) +#ifdef EXECUTABLE_VIA_MMAP_FILE_SHARED + /* Find the writable address corresponding to the executable address. */ + { uintptr_t page_x = (uintptr_t) function & -(intptr_t)pagesize; + function -= ((intptr_t*)page_x)[0]; + } +#endif + gl_lock_lock(freelist_lock); + *(char**)function = freelist; freelist = (char*)function; + gl_lock_unlock(freelist_lock); + /* It is probably not worth calling munmap() for entirely freed pages. */ +#else + free(((char**)function)[-1]); +#endif +} + +int is_trampoline (void* function) +{ +#ifdef is_tramp +#ifdef __hppanew__ + void* tramp_address = &tramp; + if (!(((uintptr_t)function & 3) == (TRAMP_BIAS & 3))) return 0; +#endif + return ((is_tramp(((char*)function - TRAMP_BIAS))) ? 1 : 0); +#else + abort(); +#endif +} + +trampoline_function_t trampoline_address (trampoline_function_t function) +{ +#ifdef tramp_address + return (trampoline_function_t)(tramp_address(((char*)function - TRAMP_BIAS))); +#else + abort(); +#endif +} + +void** trampoline_variable (trampoline_function_t function) +{ +#ifdef tramp_variable + return (void**)(tramp_variable(((char*)function - TRAMP_BIAS))); +#else + abort(); +#endif +} + +void* trampoline_data (trampoline_function_t function) +{ +#ifdef tramp_data + return (void*)(tramp_data(((char*)function - TRAMP_BIAS))); +#else + abort(); +#endif +} diff --git a/trampoline/trampoline.h b/trampoline/trampoline.h new file mode 100644 index 0000000..3e93ae3 --- /dev/null +++ b/trampoline/trampoline.h @@ -0,0 +1,85 @@ +/* + * Copyright 1995-2017 Bruno Haible + * + * 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, see . + */ + +#ifndef _TRAMPOLINE_H +#define _TRAMPOLINE_H + +#include "ffcall-version.h" + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* This type denotes an opaque function pointer. + You need to cast it to an actual function pointer type (with correct return + type) before you can actually invoke it. */ +#ifdef __cplusplus +typedef int (*trampoline_function_t) (...); +#else +typedef int (*trampoline_function_t) (); +#endif + + +/* Allocates a trampoline. + It returns a function pointer that takes the same parameters and returns the + same type as ADDRESS. + When invoked, it first stores DATA at the location pointed to by VARIABLE, + then invokes ADDRESS with the same arguments. It returns the value returned + by ADDRESS. + The trampoline has indefinite extent. It can be accessed until a call to + free_trampoline(). + */ +extern trampoline_function_t alloc_trampoline (trampoline_function_t /* ADDRESS */, void** /* VARIABLE */, void* /* DATA */); + +/* Frees the memory used by a trampoline. + FUNCTION must be the result of an alloc_trampoline() invocation. + After this call, FUNCTION must not be used any more - neither invoked, + not used as an argument to other functions. + */ +extern void free_trampoline (trampoline_function_t /* FUNCTION */); + + +/* Tests whether a given pointer is a function pointer returned by + alloc_trampoline(). Returns 1 for yes, 0 for no. + If yes, it can be cast to trampoline_function_t. + */ +extern int is_trampoline (void* /* FUNCTION */); + +/* Returns the ADDRESS argument passed to the alloc_trampoline() invocation. + FUNCTION must be the result of an alloc_trampoline() invocation. + */ +extern trampoline_function_t trampoline_address (trampoline_function_t /* FUNCTION */); + +/* Returns the VARIABLE argument passed to the alloc_trampoline() invocation. + FUNCTION must be the result of an alloc_trampoline() invocation. + */ +extern void** trampoline_variable (trampoline_function_t /* FUNCTION */); + +/* Returns the DATA argument passed to the alloc_trampoline() invocation. + FUNCTION must be the result of an alloc_trampoline() invocation. + */ +extern void* trampoline_data (trampoline_function_t /* FUNCTION */); + + +#ifdef __cplusplus +} +#endif + + +#endif /* _TRAMPOLINE_H */ diff --git a/trampoline/trampoline.html b/trampoline/trampoline.html new file mode 100644 index 0000000..ab4be00 --- /dev/null +++ b/trampoline/trampoline.html @@ -0,0 +1,144 @@ + + + + TRAMPOLINE manual page + + +

TRAMPOLINE manual page

+ + +

+ +


+ + +

Name

+
+ +trampoline - closures as first-class C functions + + +

Synopsis

+
+ +
+#include <trampoline.h>
+function = alloc_trampoline(address, variable, data);
+free_trampoline(function);
+is_trampoline(function)
+trampoline_address(function)
+trampoline_variable(function)
+trampoline_data(function)
+
+ + +

Description

+
+ +These functions implement closures as first-class +C functions. A closure consists of a regular C function and a +piece of data which gets passed to the C function when the +closure is called. +

+Closures as first-class C functions means that they fit +into a function pointer and can be called exactly like any +other C function. +function = alloc_trampoline(address, variable, data) +allocates a closure. +When function gets called, it stores +data in the variable variable + and calls the C function at address. +The function at address is responsible for +fetching data out of variable + immediately, before execution of any other function call. +

+This is much like gcc's local functions, except that the +GNU C local functions have dynamic extent (i.e. are +deallocated when the creating function returns), while trampoline + provides functions with indefinite extent: function +is only deallocated when free_trampoline(function) is +called. +

+is_trampoline(function) +checks whether the C function function +was produced by a call to alloc_trampoline. +If this returns true, the arguments given to alloc_trampoline +can be retrieved: +

    +
  • trampoline_address(function) returns address, +
  • trampoline_variable(function) returns variable, +
  • trampoline_data(function) returns data. +
+ + +

See also

+
+gcc(1), stdarg(3), callback(3) + + +

Bugs

+
+ +Passing the data through a global variable is not reentrant. Don't +call trampoline functions from within signal +handlers. This is fixed in the callback(3) package. + + +

Porting

+
+ +The way gcc builds local functions is described in the gcc +source, file gcc-2.6.3/config/cpu/cpu.h. + + +

Author

+
+ +Bruno Haible <bruno@clisp.org> + + +

Acknowledgements

+
+ +Many ideas were cribbed from the gcc source. +

+ +


+ +
TRAMPOLINE manual page
+Bruno Haible <bruno@clisp.org> +
+

+Last modified: 1 January 2017. + + + diff --git a/trampoline/trampoline.man b/trampoline/trampoline.man new file mode 100644 index 0000000..2262814 --- /dev/null +++ b/trampoline/trampoline.man @@ -0,0 +1,75 @@ +TRAMPOLINE(3) Library Functions Manual TRAMPOLINE(3) + + + +NAME + trampoline - closures as first-class C functions + +SYNOPSIS + #include  + + function = alloc_trampoline(address, variable, data); + + free_trampoline(function); + + is_trampoline(function) + trampoline_address(function) + trampoline_variable(function) + trampoline_data(function) + +DESCRIPTION + These functions implement closures as first-class C functions. A clo‐ + sure consists of a regular C function and a piece of data which gets + passed to the C function when the closure is called. + + Closures as first-class C functions means that they fit into a function + pointer and can be called exactly like any other C function. function + = alloc_trampoline(address, variable, data) allocates a closure. When + function gets called, it stores data in the variable variable and calls + the C function at address. The function at address is responsible for + fetching data out of variable immediately, before execution of any + other function call. + + This is much like gcc's local functions, except that the GNU C local + functions have dynamic extent (i.e. are deallocated when the creating + function returns), while trampoline provides functions with indefinite + extent: function is only deallocated when free_trampoline(function) is + called. + + is_trampoline(function) checks whether the C function function was pro‐ + duced by a call to alloc_trampoline. If this returns true, the argu‐ + ments given to alloc_trampoline can be retrieved: + + trampoline_address(function) returns address, + + trampoline_variable(function) returns variable, + + trampoline_data(function) returns data. + + +SEE ALSO + gcc(1), stdarg(3), callback(3) + + +BUGS + Passing the data through a global variable is not reentrant. Don't call + trampoline functions from within signal handlers. This is fixed in the + callback(3) package. + + +PORTING + The way gcc builds local functions is described in the gcc source, file + gcc-2.6.3/config/cpu/cpu.h. + + +AUTHOR + Bruno Haible + + +ACKNOWLEDGEMENTS + Many ideas were cribbed from the gcc source. + + + + + 1 January 2017 TRAMPOLINE(3) diff --git a/vacall/COPYING b/vacall/COPYING new file mode 100644 index 0000000..a3d1815 --- /dev/null +++ b/vacall/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + 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 + + Appendix: 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. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +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. + + , 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/vacall/Makefile.devel b/vacall/Makefile.devel new file mode 100644 index 0000000..1c78798 --- /dev/null +++ b/vacall/Makefile.devel @@ -0,0 +1,317 @@ +# This is the developer's -*-Makefile-*-, not the user's makefile. +# Do not use it unless you know exactly what you do! + +THISFILE = Makefile.devel +LN = ln -s +RM = rm -f + +# ============ Rules that require cross-compilation tools ============ + +GCC = gcc +GCCFLAGS = -I.. -I../dummy -O2 -fno-omit-frame-pointer +SED = sed +CROSS_TOOL = cross + +precompiled : \ + vacall-i386-macro.S \ + vacall-m68k.mit.S vacall-m68k.motorola.S \ + vacall-mipseb-macro.S vacall-mipsel-macro.S vacall-mipsn32eb-macro.S vacall-mipsn32el-macro.S vacall-mips64eb-macro.S vacall-mips64el-macro.S \ + vacall-sparc-macro.S vacall-sparc64-macro.S \ + vacall-alpha-macro.S \ + vacall-hppa-macro.S vacall-hppa64-macro.S \ + vacall-arm-macro.S vacall-armhf-macro.S \ + vacall-arm64-macro.S vacall-arm64-macos-macro.S \ + vacall-powerpc-aix.s vacall-powerpc-linux-macro.S vacall-powerpc-sysv4-macro.S vacall-powerpc-macos.s vacall-powerpc64-aix.s vacall-powerpc64-linux.S vacall-powerpc64-elfv2-linux.S \ + vacall-ia64-macro.S \ + vacall-x86_64-macro.S vacall-x86_64-x32-linux.s vacall-x86_64-windows-macro.S \ + vacall-s390-macro.S vacall-s390x-macro.S \ + vacall-riscv32-ilp32d-macro.S vacall-riscv64-lp64d-macro.S + + +vacall-i386-linux.s : vacall-i386.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) i386-linux gcc -V 3.1 $(GCCFLAGS) -D__i386__ -S vacall-i386.c -o vacall-i386-linux.s + +vacall-i386-linux-pic.s : vacall-i386.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) i386-linux gcc -V 3.1 $(GCCFLAGS) -fPIC -D__i386__ -S vacall-i386.c -o vacall-i386-linux-pic.s + +vacall-i386-macro.S : vacall-i386-linux.s vacall-i386-linux-pic.s ../common/asm-i386.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-i386.h"' ; echo '#ifdef __PIC__' ; sed -e '/\.align.*,0x90$$/d' < vacall-i386-linux-pic.s | sed -e 's/vacall_function/C(vacall_function)/g' | ../common/asm-i386.sh ; echo '#else' ; sed -e '/\.align.*,0x90$$/d' < vacall-i386-linux.s | sed -e 's/vacall_function/C(vacall_function)/g' | ../common/asm-i386.sh ; echo '#endif' ; cat ../common/noexecstack.h) > vacall-i386-macro.S + + +vacall-m68k-linux.s : vacall-m68k.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) m68k-linux gcc -V 3.1 $(GCCFLAGS) -D__m68k__ -S vacall-m68k.c -o vacall-m68k-linux.s + +vacall-m68k-sun.s : vacall-m68k.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) m68k-sun gcc -V 3.1 $(GCCFLAGS) -D__m68k__ -S vacall-m68k.c -o vacall-m68k-sun.s + +vacall-m68k.mit.S : vacall-m68k-sun.s ../common/asm-m68k.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-m68k.h"' ; ../common/asm-m68k.sh mit < vacall-m68k-sun.s ; cat ../common/noexecstack.h) > vacall-m68k.mit.S + +vacall-m68k.motorola.S : vacall-m68k-linux.s ../common/asm-m68k.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-m68k.h"' ; ../common/asm-m68k.sh motorola < vacall-m68k-linux.s | sed -e 's/vacall_function/C(vacall_function)/g' ; cat ../common/noexecstack.h) > vacall-m68k.motorola.S + + +vacall-mipseb-linux.s : vacall-mips.c vacall-internal.h vacall.h $(THISFILE) +# For references to global symbols: -mno-explicit-relocs ensures a syntax that the IRIX assembler understands. + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=32 -mfpxx -march=mips2 -meb -mno-explicit-relocs $(GCCFLAGS) -D__mips__ -S vacall-mips.c -o vacall-mipseb-linux.s + +vacall-mipseb-macro.S : vacall-mipseb-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < vacall-mipseb-linux.s) > vacall-mipseb-macro.S + +vacall-mipsel-linux.s : vacall-mips.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=32 -mfpxx -march=mips2 -mel -mno-explicit-relocs $(GCCFLAGS) -D__mips__ -S vacall-mips.c -o vacall-mipsel-linux.s + +vacall-mipsel-macro.S : vacall-mipsel-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < vacall-mipsel-linux.s) > vacall-mipsel-macro.S + +vacall-mipsn32eb-linux.s : vacall-mipsn32.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=n32 -meb $(GCCFLAGS) -D__mipsn32__ -S vacall-mipsn32.c -o vacall-mipsn32eb-linux.s + +vacall-mipsn32eb-macro.S : vacall-mipsn32eb-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < vacall-mipsn32eb-linux.s) > vacall-mipsn32eb-macro.S + +vacall-mipsn32el-linux.s : vacall-mipsn32.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=n32 -mel $(GCCFLAGS) -D__mipsn32__ -S vacall-mipsn32.c -o vacall-mipsn32el-linux.s + +vacall-mipsn32el-macro.S : vacall-mipsn32el-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < vacall-mipsn32el-linux.s) > vacall-mipsn32el-macro.S + +vacall-mips64eb-linux.s : vacall-mips64.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=64 -meb $(GCCFLAGS) -D__mips64__ -S vacall-mips64.c -o vacall-mips64eb-linux.s + +vacall-mips64eb-macro.S : vacall-mips64eb-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < vacall-mips64eb-linux.s) > vacall-mips64eb-macro.S + +vacall-mips64el-linux.s : vacall-mips64.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) mips64-linux gcc-5.4.0 -mabi=64 -mel $(GCCFLAGS) -D__mips64__ -S vacall-mips64.c -o vacall-mips64el-linux.s + +vacall-mips64el-macro.S : vacall-mips64el-linux.s ../common/asm-mips.sh $(THISFILE) + (echo '#include "asm-mips.h"' ; ../common/asm-mips.sh < vacall-mips64el-linux.s) > vacall-mips64el-macro.S + + +vacall-sparc-linux.s : vacall-sparc.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) sparc-linux gcc -V 3.1 $(GCCFLAGS) -D__sparc__ -S vacall-sparc.c -o vacall-sparc-linux.s + +vacall-sparc-linux-pic.s : vacall-sparc.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) sparc-linux gcc -V 3.1 $(GCCFLAGS) -fPIC -D__sparc__ -S vacall-sparc.c -o vacall-sparc-linux-pic.s + +vacall-sparc-macro.S : vacall-sparc-linux.s vacall-sparc-linux-pic.s ../common/asm-sparc.sh ../common/noexecstack.h $(THISFILE) +# For references to global symbols, we need to distinguish the PIC and non-PIC case. +# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81653 + (echo '#include "asm-sparc.h"' ; echo '#ifdef __PIC__' ; ../common/asm-sparc.sh < vacall-sparc-linux-pic.s | sed -e 's/vacall_function/C(vacall_function)/g' ; echo '#else' ; ../common/asm-sparc.sh < vacall-sparc-linux.s | sed -e 's/vacall_function/C(vacall_function)/g' ; echo '#endif' ; cat ../common/noexecstack.h) > vacall-sparc-macro.S + +vacall-sparc64-linux.s : vacall-sparc64.c vacall-internal.h vacall.h $(THISFILE) +# For references to global symbols in non-PIC mode: +# - -mcmodel=medlow uses 2 instructions, but the code does not work on Solaris (error "ld: fatal: relocation error: R_SPARC_HI22"). +# - -mcmodel=medmid uses 3 instructions, but the code still makes some assumptions about the address space. +# - -mcmodel=medany uses 4 instructions. + $(CROSS_TOOL) sparc64-linux gcc -V 4.0.2 -mcmodel=medany $(GCCFLAGS) -D__sparc64__ -S vacall-sparc64.c -o vacall-sparc64-linux.s + +vacall-sparc64-linux-pic.s : vacall-sparc64.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) sparc64-linux gcc -V 4.0.2 $(GCCFLAGS) -fPIC -D__sparc64__ -S vacall-sparc64.c -o vacall-sparc64-linux-pic.s + +vacall-sparc64-macro.S : vacall-sparc64-linux.s vacall-sparc64-linux-pic.s ../common/asm-sparc.sh ../common/noexecstack.h $(THISFILE) +# For references to global symbols, we need to distinguish the PIC and non-PIC case. +# See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81653 + (echo '#include "asm-sparc.h"' ; echo '#ifdef __PIC__' ; ../common/asm-sparc.sh < vacall-sparc64-linux-pic.s | sed -e 's/vacall_function/C(vacall_function)/g' ; echo '#else' ; ../common/asm-sparc.sh < vacall-sparc64-linux.s | sed -e 's/vacall_function/C(vacall_function)/g' ; echo '#endif' ; cat ../common/noexecstack.h) > vacall-sparc64-macro.S + + +vacall-alpha-linux.s : vacall-alpha.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) alpha-linux gcc -V 4.0.2 $(GCCFLAGS) -D__alpha__ -S vacall-alpha.c -o vacall-alpha-linux.s + +vacall-alpha-macro.S : vacall-alpha-linux.s ../common/asm-alpha.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-alpha.sh < vacall-alpha-linux.s ; cat ../common/noexecstack.h) > vacall-alpha-macro.S + + +vacall-hppa-linux.s : vacall-hppa.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) hppa-linux gcc -V 3.1 $(GCCFLAGS) -D__hppa__ -S vacall-hppa.c -o vacall-hppa-linux.s + +vacall-hppa-macro.S : vacall-hppa-linux.s ../common/asm-hppa.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-hppa.h"' ; ../common/asm-hppa.sh < vacall-hppa-linux.s ; echo 'IMPORT_DATA(vacall_function)' ; cat ../common/noexecstack.h) > vacall-hppa-macro.S + +vacall-hppa64-linux.s : vacall-hppa64.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) hppa64-linux gcc -V 3.1 $(GCCFLAGS) -D__hppa64__ -S vacall-hppa64.c -o vacall-hppa64-linux.s + +vacall-hppa64-macro.S : vacall-hppa64-linux.s ../common/asm-hppa64.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-hppa64.h"' ; ../common/asm-hppa64.sh < vacall-hppa64-linux.s ; echo 'IMPORT_DATA(vacall_function)' ; cat ../common/noexecstack.h) > vacall-hppa64-macro.S + + +vacall-arm-linux.s : vacall-arm.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) arm-linux gcc -V 3.1 -mlittle-endian $(GCCFLAGS) -D__arm__ -S vacall-arm.c -o vacall-armel.s + $(CROSS_TOOL) arm-linux gcc -V 3.1 -mbig-endian $(GCCFLAGS) -D__arm__ -S vacall-arm.c -o vacall-armeb.s + cmp vacall-armel.s vacall-armeb.s > /dev/null + cp vacall-armel.s vacall-arm-linux.s + $(RM) vacall-armel.s vacall-armeb.s + +vacall-arm-linux-pic.s : vacall-arm.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) arm-linux gcc -V 3.1 -mlittle-endian $(GCCFLAGS) -fPIC -D__arm__ -S vacall-arm.c -o vacall-armel-pic.s + $(CROSS_TOOL) arm-linux gcc -V 3.1 -mbig-endian $(GCCFLAGS) -fPIC -D__arm__ -S vacall-arm.c -o vacall-armeb-pic.s + cmp vacall-armel-pic.s vacall-armeb-pic.s > /dev/null + cp vacall-armel-pic.s vacall-arm-linux-pic.s + $(RM) vacall-armel-pic.s vacall-armeb-pic.s + +vacall-arm-macro.S : vacall-arm-linux.s vacall-arm-linux-pic.s ../common/asm-arm.sh ../common/noexecstack-arm.h $(THISFILE) + (echo '#include "asm-arm.h"' ; echo '#ifdef __PIC__' ; ../common/asm-arm.sh < vacall-arm-linux-pic.s | sed -e 's/vacall_function/C(vacall_function)/g' ; echo '#else' ; ../common/asm-arm.sh < vacall-arm-linux.s | sed -e 's/vacall_function/C(vacall_function)/g' ; echo '#endif' ; cat ../common/noexecstack-arm.h) > vacall-arm-macro.S + +vacall-armhf-linux.s : vacall-armhf.c vacall-internal.h vacall.h $(THISFILE) +# The option -mabi=aapcs ensures an 8-bytes-aligned stack pointer. + $(CROSS_TOOL) armv7l-linux-gnueabihf gcc-6.5.0 -march=armv6 -mabi=aapcs -mfloat-abi=hard -mlittle-endian $(GCCFLAGS) -D__armhf__ -S vacall-armhf.c -o vacall-armhfel.s + $(CROSS_TOOL) armv7l-linux-gnueabihf gcc-6.5.0 -march=armv6 -mabi=aapcs -mfloat-abi=hard -mbig-endian $(GCCFLAGS) -D__armhf__ -S vacall-armhf.c -o vacall-armhfeb.s + cmp vacall-armhfel.s vacall-armhfeb.s > /dev/null + cp vacall-armhfel.s vacall-armhf-linux.s + $(RM) vacall-armhfel.s vacall-armhfeb.s + +vacall-armhf-linux-pic.s : vacall-armhf.c vacall-internal.h vacall.h $(THISFILE) +# The option -mabi=aapcs ensures an 8-bytes-aligned stack pointer. + $(CROSS_TOOL) armv7l-linux-gnueabihf gcc-6.5.0 -march=armv6 -mabi=aapcs -mfloat-abi=hard -mlittle-endian $(GCCFLAGS) -fPIC -D__armhf__ -S vacall-armhf.c -o vacall-armhfel-pic.s + $(CROSS_TOOL) armv7l-linux-gnueabihf gcc-6.5.0 -march=armv6 -mabi=aapcs -mfloat-abi=hard -mbig-endian $(GCCFLAGS) -fPIC -D__armhf__ -S vacall-armhf.c -o vacall-armhfeb-pic.s + cmp vacall-armhfel-pic.s vacall-armhfeb-pic.s > /dev/null + cp vacall-armhfel-pic.s vacall-armhf-linux-pic.s + $(RM) vacall-armhfel-pic.s vacall-armhfeb-pic.s + +vacall-armhf-macro.S : vacall-armhf-linux.s vacall-armhf-linux-pic.s ../common/asm-arm.sh ../common/noexecstack-arm.h $(THISFILE) + (echo '#include "asm-arm.h"' ; echo '#ifdef __PIC__' ; ../common/asm-arm.sh < vacall-armhf-linux-pic.s | sed -e 's/vacall_function/C(vacall_function)/g' ; echo '#else' ; ../common/asm-arm.sh < vacall-armhf-linux.s | sed -e 's/vacall_function/C(vacall_function)/g' ; echo '#endif' ; cat ../common/noexecstack-arm.h) > vacall-armhf-macro.S + + +vacall-arm64-macro.S : vacall-arm64.c vacall-internal.h vacall.h ../common/asm-arm64.sh ../common/noexecstack-arm.h $(THISFILE) + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 -mlittle-endian $(GCCFLAGS) -D__arm64__ -S vacall-arm64.c -o vacall-arm64el.s + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 -mbig-endian $(GCCFLAGS) -D__arm64__ -S vacall-arm64.c -o vacall-arm64eb.s + cmp vacall-arm64el.s vacall-arm64eb.s > /dev/null + (echo '#include "asm-arm64.h"' ; ../common/asm-arm64.sh < vacall-arm64el.s ; cat ../common/noexecstack-arm.h) > vacall-arm64-macro.S + $(RM) vacall-arm64el.s vacall-arm64eb.s + + +vacall-arm64-macos-macro.S : vacall-arm64.c vacall-internal.h vacall.h ../common/asm-arm64.sh ../common/noexecstack-arm.h $(THISFILE) + $(CROSS_TOOL) aarch64-linux gcc-5.4.0 -mlittle-endian $(GCCFLAGS) -D__arm64__ -D__APPLE__ -D__MACH__ -S vacall-arm64.c -o vacall-arm64-macos.s + (echo '#include "asm-arm64.h"' ; ../common/asm-arm64.sh < vacall-arm64-macos.s ; cat ../common/noexecstack-arm.h) > vacall-arm64-macos-macro.S + $(RM) vacall-arm64-macos.s + + +vacall-powerpc-aix.s : vacall-powerpc.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) rs6000-aix gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc -mnew-mnemonics $(GCCFLAGS) -D__powerpc__ -S vacall-powerpc.c -o vacall-powerpc-aix.s + echo ' .extern vacall_function[RW]' >> vacall-powerpc-aix.s + +vacall-powerpc-linux.s : vacall-powerpc.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) powerpc-linux gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc $(GCCFLAGS) -D__powerpc__ -S vacall-powerpc.c -o vacall-powerpc-linux.s + +vacall-powerpc-linux-macro.S : vacall-powerpc-linux.s ../common/asm-powerpc.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-powerpc.sh < vacall-powerpc-linux.s ; cat ../common/noexecstack.h) > vacall-powerpc-linux-macro.S + +vacall-powerpc-sysv4-macro.S : vacall-powerpc.c vacall-internal.h vacall.h ../common/asm-powerpc.sh ../common/noexecstack.h $(THISFILE) + $(CROSS_TOOL) powerpc-linux gcc -V 3.3.6 -mno-power -mno-power2 -mno-powerpc $(GCCFLAGS) -D__powerpc__ -S vacall-powerpc.c -o vacall-powerpc-sysv4.s + (../common/asm-powerpc.sh < vacall-powerpc-sysv4.s ; cat ../common/noexecstack.h) > vacall-powerpc-sysv4-macro.S + $(RM) vacall-powerpc-sysv4.s + +vacall-powerpc-macos.s : vacall-powerpc.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) powerpc-darwin gcc -V 3.3.6 $(GCCFLAGS) -D__powerpc__ -S vacall-powerpc.c -o vacall-powerpc-macos.s + +vacall-powerpc64-aix.s : vacall-powerpc64.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) rs6000-aix6.1 gcc-5.4.0 -maix64 $(GCCFLAGS) -D__powerpc64__ -S vacall-powerpc64.c -o vacall-powerpc64-aix.s + echo ' .extern vacall_function[UA]' >> vacall-powerpc64-aix.s + +vacall-powerpc64-linux.S : vacall-powerpc64.c vacall-internal.h vacall.h ../common/asm-powerpc.sh ../common/noexecstack.h $(THISFILE) + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv1 -mcpu=power4 -mlittle-endian $(GCCFLAGS) -D__powerpc64__ -S vacall-powerpc64.c -o vacall-powerpc64-linux-le.s + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv1 -mcpu=power4 -mbig-endian $(GCCFLAGS) -D__powerpc64__ -S vacall-powerpc64.c -o vacall-powerpc64-linux-be.s + cmp vacall-powerpc64-linux-le.s vacall-powerpc64-linux-be.s > /dev/null + (../common/asm-powerpc.sh < vacall-powerpc64-linux-be.s ; cat ../common/noexecstack.h) > vacall-powerpc64-linux.S + $(RM) vacall-powerpc64-linux-le.s vacall-powerpc64-linux-be.s + +vacall-powerpc64-elfv2-linux.S : vacall-powerpc64.c vacall-internal.h vacall.h ../common/asm-powerpc.sh ../common/noexecstack.h $(THISFILE) + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv2 -mcpu=power4 -mlittle-endian $(GCCFLAGS) -D__powerpc64__ -D__powerpc64_elfv2__ -S vacall-powerpc64.c -o vacall-powerpc64-elfv2-linux-le.s + $(CROSS_TOOL) powerpc64le-linux gcc-5.4.0 -mabi=elfv2 -mcpu=power4 -mbig-endian $(GCCFLAGS) -D__powerpc64__ -D__powerpc64_elfv2__ -S vacall-powerpc64.c -o vacall-powerpc64-elfv2-linux-be.s +# vacall-powerpc64-elfv2-linux-be.s contains endianness specific optimizations. + (../common/asm-powerpc.sh < vacall-powerpc64-elfv2-linux-le.s ; cat ../common/noexecstack.h) > vacall-powerpc64-elfv2-linux.S + $(RM) vacall-powerpc64-elfv2-linux-le.s vacall-powerpc64-elfv2-linux-be.s + + +vacall-ia64-linux.s : vacall-ia64.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) ia64-linux gcc -V 4.0.1 $(GCCFLAGS) -D__ia64__ -S vacall-ia64.c -o vacall-ia64-linux.s + +vacall-ia64-macro.S : vacall-ia64-linux.s ../common/noexecstack.h $(THISFILE) + cat vacall-ia64-linux.s ../common/noexecstack.h > vacall-ia64-macro.S + + +vacall-x86_64-linux.s : vacall-x86_64.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) x86_64-linux gcc-4.0.2 $(GCCFLAGS) -D__x86_64__ -S vacall-x86_64.c -o vacall-x86_64-linux.s + +vacall-x86_64-linux-pic.s : vacall-x86_64.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) x86_64-linux gcc-4.0.2 $(GCCFLAGS) -fPIC -D__x86_64__ -S vacall-x86_64.c -o vacall-x86_64-linux-pic.s + +vacall-x86_64-macro.S : vacall-x86_64-linux.s vacall-x86_64-linux-pic.s ../common/asm-x86_64.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-x86_64.h"' ; echo '#if defined __OpenBSD__' ; ../common/asm-x86_64.sh < vacall-x86_64-linux-pic.s ; echo '#else' ; ../common/asm-x86_64.sh < vacall-x86_64-linux.s ; echo '#endif' ; cat ../common/noexecstack.h) > vacall-x86_64-macro.S + +vacall-x86_64-x32-linux.s : vacall-x86_64.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) x86_64-linux gcc-5.4.0 -mx32 $(GCCFLAGS) -D__x86_64__ -D__x86_64_x32__ -S vacall-x86_64.c -o vacall-x86_64-x32-linux.s + +vacall-x86_64-windows.s : vacall-x86_64-windows.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) x86_64-linux gcc-5.4.0 -mabi=ms $(GCCFLAGS) -fno-reorder-blocks-and-partition -D__x86_64__ -D_WIN32 -S vacall-x86_64-windows.c -o vacall-x86_64-windows.s + +vacall-x86_64-windows-macro.S : vacall-x86_64-windows.s ../common/asm-x86_64.sh ../common/noexecstack.h $(THISFILE) + (echo '#include "asm-x86_64.h"' ; ../common/asm-x86_64.sh < vacall-x86_64-windows.s ; cat ../common/noexecstack.h) > vacall-x86_64-windows-macro.S + + +vacall-s390-linux.s : vacall-s390.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) s390-linux gcc -V 3.1 $(GCCFLAGS) -D__s390__ -S vacall-s390.c -o vacall-s390-linux.s + +vacall-s390-macro.S : vacall-s390-linux.s ../common/asm-s390.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-s390.sh < vacall-s390-linux.s ; cat ../common/noexecstack.h) > vacall-s390-macro.S + + +vacall-s390x-linux.s : vacall-s390x.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) s390x-linux gcc-5.4.0 $(GCCFLAGS) -D__s390x__ -S vacall-s390x.c -o vacall-s390x-linux.s + +vacall-s390x-macro.S : vacall-s390x-linux.s ../common/asm-s390.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-s390.sh < vacall-s390x-linux.s ; cat ../common/noexecstack.h) > vacall-s390x-macro.S + + +vacall-riscv32-ilp32d-linux.s : vacall-riscv32.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) riscv32-linux gcc-7.3.0 $(GCCFLAGS) -D__riscv32__ -S vacall-riscv32.c -o vacall-riscv32-ilp32d-linux.s + +vacall-riscv32-ilp32d-macro.S : vacall-riscv32-ilp32d-linux.s ../common/asm-riscv.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-riscv.sh < vacall-riscv32-ilp32d-linux.s ; cat ../common/noexecstack.h) > vacall-riscv32-ilp32d-macro.S + + +vacall-riscv64-lp64d-linux.s : vacall-riscv64.c vacall-internal.h vacall.h $(THISFILE) + $(CROSS_TOOL) riscv64-linux gcc-7.3.0 $(GCCFLAGS) -D__riscv64__ -S vacall-riscv64.c -o vacall-riscv64-lp64d-linux.s + +vacall-riscv64-lp64d-macro.S : vacall-riscv64-lp64d-linux.s ../common/asm-riscv.sh ../common/noexecstack.h $(THISFILE) + (../common/asm-riscv.sh < vacall-riscv64-lp64d-linux.s ; cat ../common/noexecstack.h) > vacall-riscv64-lp64d-macro.S + + +# --------------- Rules for debugging test failures --------------- + +tests : tests-i386.s tests-m68k.s tests-mips.s tests-sparc.s tests-alpha.s tests-hppa.s tests-arm.s tests-powerpc.s tests-powerpc64.s tests-ia64.s tests-x86_64.s + true + +tests-i386.s : tests.c vacall.h + $(GCC) -V 2.7.2 -b i486-linuxaout $(GCCFLAGS) -I/usr/include -D__i386__ -S tests.c -o tests-i386.s + +tests-m68k.s : tests.c vacall.h + $(GCC) -V 2.95.2 -b m68k-sun $(GCCFLAGS) -I/usr/include -D__m68k__ -S tests.c -o tests-m68k.s + +tests-mips.s : tests.c vacall.h + $(GCC) -V 2.95.2 -b mips-sgi $(GCCFLAGS) -I/usr/include -D__mips__ -S tests.c -o tests-mips.s + +tests-sparc.s : tests.c vacall.h + $(GCC) -V 2.95.2 -b sparc-sun $(GCCFLAGS) -I/usr/include -D__sparc__ -S tests.c -o tests-sparc.s + +tests-alpha.s : tests.c vacall.h + $(GCC) -V 2.7.2 -b alpha-dec-osf $(GCCFLAGS) -I/usr/include -D__alpha__ -S tests.c -o tests-alpha.s + +tests-hppa.s : tests.c vacall.h + $(GCC) -V 2.6.3 -b hppa1.0-hpux $(GCCFLAGS) -I/usr/include -D__hppa__ -S tests.c -o tests-hppa.s + +tests-arm.s : tests.c vacall.h + $(GCC) -V 2.6.3 -b arm-acorn-riscix $(GCCFLAGS) -I/usr/include -D__arm__ -S tests.c -o tests-arm.s + +tests-powerpc.s : tests.c vacall.h + $(GCC) -V 2.95.2 -b rs6000 $(GCCFLAGS) -I/usr/include -D__powerpc__ -S tests.c -o tests-powerpc.s + +tests-powerpc64.s : tests.c vacall.h + /cross/powerpc64-linux-tools/bin/powerpc64-linux-gcc $(GCCFLAGS) -I/usr/include -D__powerpc64__ -S tests.c -o tests-powerpc64.s + +tests-ia64.s : tests.c vacall.h + $(GCC) -V 2.9-ia64-000216 -b ia64-hp-linux $(GCCFLAGS) -I/usr/include -D__ia64__ -S tests.c -o tests-ia64.s + +tests-x86_64.s : tests.c vacall.h + $(GCC) -V 3.2.2 -b x86_64-suse-linux $(GCCFLAGS) -I/usr/include -D__x86_64__ -S tests.c -o tests-x86_64.s diff --git a/vacall/Makefile.in b/vacall/Makefile.in new file mode 100644 index 0000000..ec31846 --- /dev/null +++ b/vacall/Makefile.in @@ -0,0 +1,384 @@ +# Makefile for vacall + +#### Start of system configuration section. #### + +HOST = @host@ +CPU = @HOST_CPU_C_ABI@ +OS = @host_os@ + +# Directories used by "make": +srcdir = @srcdir@ + +# Directories used by "make install": +prefix = @prefix@ +local_prefix = /usr/local +exec_prefix = @exec_prefix@ +libdir = @libdir@ +includedir = @includedir@ +mandir = @mandir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +htmldir = $(datadir)/html + +# Programs used by "make": +# C compiler +CC = @CC@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +# C++ compiler +CXX = @CXX@ +CXXFLAGS = @CXXFLAGS@ +# Both C and C++ compiler +CPPFLAGS = @CPPFLAGS@ +INCLUDES = -I. -I$(srcdir) -I.. -I$(srcdir)/.. +INCLUDES_WITH_GNULIB = $(INCLUDES) -I../gnulib-lib -I$(srcdir)/../gnulib-lib +ASPFLAGS = `if test @AS_UNDERSCORE@ = true; then echo '-DASM_UNDERSCORE'; fi` +LDFLAGS = @LDFLAGS@ +AR = @AR@ +AR_FLAGS = rc +RANLIB = @RANLIB@ +MV = mv +LN = @LN@ +RM = rm -f +@SET_MAKE@ + +# Programs used by "make install": +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +#### End of system configuration section. #### + +SHELL = /bin/sh + +OBJECTS = vacall.@OBJEXT@ vacall-libapi.@OBJEXT@ vacall-structcpy.@OBJEXT@ + +all : $(OBJECTS) libvacall.a $(srcdir)/vacall.3 $(srcdir)/vacall.html + +vacall.@OBJEXT@ : vacall-$(CPU).@OBJEXT@ + $(RM) vacall.@OBJEXT@ + $(LN) vacall-$(CPU).@OBJEXT@ vacall.@OBJEXT@ + +@IFNOT_MSVC@vacall-i386.@OBJEXT@ : vacall-i386.s +@IFNOT_MSVC@ $(CC) @GCC_X_NONE@ -c vacall-i386.s + +@IFNOT_MSVC@vacall-i386.s : $(srcdir)/vacall-i386-macro.S +@IFNOT_MSVC@ $(CPP) $(ASPFLAGS) -I$(srcdir)/../common - < $(srcdir)/vacall-i386-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,@ ,@,g' -e 's,//.*$$,,' -e 's/##//g' > vacall-i386.s + +@IF_MSVC@vacall-i386.@OBJEXT@ : $(srcdir)/vacall-i386-msvc.c +@IF_MSVC@ $(CC) $(INCLUDES) -I$(srcdir)/../common $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/vacall-i386-msvc.c -o vacall-i386.@OBJEXT@ + +vacall-sparc.@OBJEXT@ : vacall-sparc.s + $(CC) @WORKAROUND_BUG_81653@ @GCC_X_NONE@ -c vacall-sparc.s + +vacall-sparc.s : $(srcdir)/vacall-sparc-macro.S + $(CPP) @WORKAROUND_BUG_81653@ $(ASPFLAGS) -I$(srcdir)/../common - < $(srcdir)/vacall-sparc-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//.*$$,,' -e 's,\$$,#,g' -e 's,# ,#,g' > vacall-sparc.s + +vacall-sparc64.@OBJEXT@ : vacall-sparc64.s + $(CC) @GCC_X_NONE@ -c vacall-sparc64.s + +vacall-sparc64.s : $(srcdir)/vacall-sparc64-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common - < $(srcdir)/vacall-sparc64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,//.*$$,,' -e 's,\$$,#,g' -e 's,# ,#,g' > vacall-sparc64.s + +vacall-m68k.@OBJEXT@ : vacall-m68k.s + $(CC) @GCC_X_NONE@ -c vacall-m68k.s + +vacall-m68k.s : $(srcdir)/vacall-m68k.mit.S $(srcdir)/vacall-m68k.motorola.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/vacall-m68k.motorola.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' | if test @AS_UNDERSCORE@ = true; then sed -e 's/\$$//g'; else sed -e 's/\$$/%/g'; fi > vacall-m68k.s + +vacall-mips.@OBJEXT@ : vacall-mips.s + $(CC) @GCC_X_NONE@ -c vacall-mips.s + +vacall-mips.s : $(srcdir)/vacall-mips@ENDIANNESS@-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/vacall-mips@ENDIANNESS@-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-mips.s + +vacall-mipsn32.@OBJEXT@ : vacall-mipsn32.s + $(CC) @GCC_X_NONE@ -c vacall-mipsn32.s + +vacall-mipsn32.s : $(srcdir)/vacall-mipsn32@ENDIANNESS@-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/vacall-mipsn32@ENDIANNESS@-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-mipsn32.s + +vacall-mips64.@OBJEXT@ : vacall-mips64.s + $(CC) @GCC_X_NONE@ -c vacall-mips64.s + +vacall-mips64.s : $(srcdir)/vacall-mips64@ENDIANNESS@-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/vacall-mips64@ENDIANNESS@-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-mips64.s + +vacall-alpha.@OBJEXT@ : vacall-alpha.s + $(CC) @GCC_X_NONE@ -c vacall-alpha.s + +vacall-alpha.s : $(srcdir)/vacall-alpha-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-alpha-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-alpha.s + +vacall-hppa.@OBJEXT@ : vacall-hppa.s + $(CC) @GCC_X_NONE@ -c vacall-hppa.s + +vacall-hppa.s : $(srcdir)/vacall-hppa-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/vacall-hppa-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > vacall-hppa.s + +vacall-hppa64.@OBJEXT@ : vacall-hppa64.s + $(CC) @GCC_X_NONE@ -c vacall-hppa64.s + +vacall-hppa64.s : $(srcdir)/vacall-hppa64-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/vacall-hppa64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e "s,!,',g" > vacall-hppa64.s + +vacall-arm.@OBJEXT@ : vacall-arm.s + $(CC) @GCC_X_NONE@ -c vacall-arm.s + +vacall-arm.s : $(srcdir)/vacall-arm-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/vacall-arm-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > vacall-arm.s + +vacall-armhf.@OBJEXT@ : vacall-armhf.s + $(CC) @GCC_X_NONE@ -c vacall-armhf.s + +vacall-armhf.s : $(srcdir)/vacall-armhf-macro.S + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/vacall-armhf-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > vacall-armhf.s + +vacall-arm64.@OBJEXT@ : vacall-arm64.s + $(CC) @GCC_X_NONE@ -c vacall-arm64.s + +vacall-arm64.s : $(srcdir)/vacall-arm64-macro.S $(srcdir)/vacall-arm64-macos-macro.S + case "$(OS)" in \ + macos* | darwin*) input=vacall-arm64-macos-macro.S ;; \ + *) input=vacall-arm64-macro.S ;; \ + esac; \ + $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/$${input} | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//,@,g' -e 's,\$$,#,g' > vacall-arm64.s + +vacall-powerpc.@OBJEXT@ : vacall-powerpc.s + $(CC) @GCC_X_NONE@ -c vacall-powerpc.s + +vacall-powerpc.s : $(srcdir)/vacall-powerpc-aix.s $(srcdir)/vacall-powerpc-linux-macro.S $(srcdir)/vacall-powerpc-macos.s $(srcdir)/vacall-powerpc-sysv4-macro.S + case "$(OS)" in \ + aix*) syntax=aix;; \ + linux* | netbsd* | openbsd*) syntax=linux;; \ + macos* | darwin*) syntax=macos;; \ + *) syntax=sysv4;; \ + esac; \ + case $${syntax} in \ + macos) \ + grep -v '\.machine' $(srcdir)/vacall-powerpc-$${syntax}.s > vacall-powerpc.s || exit 1 ;; \ + linux | sysv4) \ + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-powerpc-$${syntax}-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-powerpc.s || exit 1 ;; \ + *) \ + cp $(srcdir)/vacall-powerpc-$${syntax}.s vacall-powerpc.s || exit 1 ;; \ + esac + +vacall-powerpc64.@OBJEXT@ : vacall-powerpc64.s + $(CC) @GCC_X_NONE@ -c vacall-powerpc64.s + +vacall-powerpc64.s : $(srcdir)/vacall-powerpc64-aix.s $(srcdir)/vacall-powerpc64-linux.S + case "$(OS)" in \ + aix*) syntax=aix;; \ + *) syntax=linux;; \ + esac; \ + case $${syntax} in \ + linux) \ + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-powerpc64-$${syntax}.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-powerpc64.s || exit 1 ;; \ + *) \ + cp $(srcdir)/vacall-powerpc64-$${syntax}.s vacall-powerpc64.s || exit 1 ;; \ + esac + +vacall-powerpc64-elfv2.@OBJEXT@ : vacall-powerpc64-elfv2.s + $(CC) @GCC_X_NONE@ -c vacall-powerpc64-elfv2.s + +vacall-powerpc64-elfv2.s : $(srcdir)/vacall-powerpc64-elfv2-linux.S + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-powerpc64-elfv2-linux.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-powerpc64-elfv2.s + +vacall-ia64.@OBJEXT@ : vacall-ia64.s + $(CC) @GCC_X_NONE@ -c vacall-ia64.s + +vacall-ia64.s : $(srcdir)/vacall-ia64-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-ia64-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-ia64.s + +@IFNOT_MSVC@vacall-x86_64.@OBJEXT@ : vacall-x86_64.s +@IFNOT_MSVC@ $(CC) @GCC_X_NONE@ -c vacall-x86_64.s + +@IFNOT_MSVC@vacall-x86_64.s : $(srcdir)/vacall-x86_64-macro.S $(srcdir)/vacall-x86_64-windows-macro.S +@IFNOT_MSVC@ case "$(OS)" in \ +@IFNOT_MSVC@ cygwin* | mingw*) variant='-windows';; \ +@IFNOT_MSVC@ *) variant='';; \ +@IFNOT_MSVC@ esac; \ +@IFNOT_MSVC@ $(CPP) $(ASPFLAGS) -I$(srcdir)/../common - < $(srcdir)/vacall-x86_64$${variant}-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,\. ,.,g' -e 's,@ ,@,g' -e 's,//.*$$,,' -e 's/##//g' > vacall-x86_64.s + +@IF_MSVC@vacall-x86_64.@OBJEXT@ : vacall-x86_64.asm +@IF_MSVC@ ml64 -c -nologo vacall-x86_64.asm + +@IF_MSVC@vacall-x86_64.asm : $(srcdir)/vacall-x86_64-windows-macro.S +@IF_MSVC@ { echo 'EXTERNDEF vacall_function:QWORD'; $(CPP) $(ASPFLAGS) -I$(srcdir)/../common $(srcdir)/vacall-x86_64-windows-macro.S | grep -v '^#'; echo 'END'; } > vacall-x86_64.asm + +vacall-x86_64-x32.@OBJEXT@ : vacall-x86_64-x32.s + $(CC) @GCC_X_NONE@ -c vacall-x86_64-x32.s + +vacall-x86_64-x32.s : $(srcdir)/vacall-x86_64-x32-linux.s + cp $(srcdir)/vacall-x86_64-x32-linux.s vacall-x86_64-x32.s + +vacall-s390.@OBJEXT@ : vacall-s390.s + $(CC) @GCC_X_NONE@ -c vacall-s390.s + +vacall-s390.s : $(srcdir)/vacall-s390-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-s390-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-s390.s + +vacall-s390x.@OBJEXT@ : vacall-s390x.s + $(CC) @GCC_X_NONE@ -c vacall-s390x.s + +vacall-s390x.s : $(srcdir)/vacall-s390x-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-s390x-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-s390x.s + +vacall-riscv32-ilp32d.@OBJEXT@ : vacall-riscv32-ilp32d.s + $(CC) @GCC_X_NONE@ -c vacall-riscv32-ilp32d.s + +vacall-riscv32-ilp32d.s : $(srcdir)/vacall-riscv32-ilp32d-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-riscv32-ilp32d-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-riscv32-ilp32d.s + +vacall-riscv64-lp64d.@OBJEXT@ : vacall-riscv64-lp64d.s + $(CC) @GCC_X_NONE@ -c vacall-riscv64-lp64d.s + +vacall-riscv64-lp64d.s : $(srcdir)/vacall-riscv64-lp64d-macro.S + $(CPP) $(ASPFLAGS) $(srcdir)/vacall-riscv64-lp64d-macro.S | grep -v '^ *#line' | grep -v '^#' | sed -e 's,% ,%,g' -e 's,//.*$$,,' > vacall-riscv64-lp64d.s + +vacall-libapi.@OBJEXT@ : $(srcdir)/vacall-libapi.c $(srcdir)/vacall-internal.h $(srcdir)/vacall.h ../config.h + $(CC) $(INCLUDES_WITH_GNULIB) $(CPPFLAGS) $(CFLAGS) @DISABLE_TYPE_BASED_ALIASING@ -c $(srcdir)/vacall-libapi.c + +vacall-structcpy.@OBJEXT@ : $(srcdir)/vacall-structcpy.c $(srcdir)/../common/structcpy.c + $(CC) -I$(srcdir)/../common $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/vacall-structcpy.c + +libvacall.a : $(OBJECTS) + $(RM) libvacall.a + $(AR) $(AR_FLAGS) libvacall.a $(OBJECTS) + $(RANLIB) libvacall.a + +install : all force + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(exec_prefix) + mkdir -p $(DESTDIR)$(libdir) + $(INSTALL_DATA) libvacall.a $(DESTDIR)$(libdir)/libvacall.a + mkdir -p $(DESTDIR)$(includedir) + $(INSTALL_DATA) $(srcdir)/vacall.h $(DESTDIR)$(includedir)/vacall.h + mkdir -p $(DESTDIR)$(mandir) + mkdir -p $(DESTDIR)$(mandir)/man3 + $(INSTALL_DATA) $(srcdir)/vacall.3 $(DESTDIR)$(mandir)/man3/vacall.3 + mkdir -p $(DESTDIR)$(datadir) + mkdir -p $(DESTDIR)$(htmldir) + $(INSTALL_DATA) $(srcdir)/vacall.html $(DESTDIR)$(htmldir)/vacall.html + +installdirs : force + mkdir -p $(DESTDIR)$(prefix) + mkdir -p $(DESTDIR)$(exec_prefix) + mkdir -p $(DESTDIR)$(libdir) + mkdir -p $(DESTDIR)$(includedir) + mkdir -p $(DESTDIR)$(mandir) + mkdir -p $(DESTDIR)$(mandir)/man3 + mkdir -p $(DESTDIR)$(datadir) + mkdir -p $(DESTDIR)$(htmldir) + +uninstall : force + $(RM) $(DESTDIR)$(libdir)/libvacall.a + $(RM) $(DESTDIR)$(includedir)/vacall.h + $(RM) $(DESTDIR)$(mandir)/man3/vacall.3 + $(RM) $(DESTDIR)$(htmldir)/vacall.html + +minitests.@OBJEXT@ : $(srcdir)/minitests.c $(srcdir)/tests.c $(srcdir)/vacall.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/minitests.c + +minitests.s : $(srcdir)/minitests.c $(srcdir)/tests.c $(srcdir)/vacall.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -S $(srcdir)/minitests.c + +minitests : minitests.@OBJEXT@ libvacall.a + $(CC) $(CFLAGS) @GCC_X_NONE@ minitests.@OBJEXT@ libvacall.a $(LDFLAGS) -o minitests + +minitests-c++.@OBJEXT@ : $(srcdir)/minitests-c++.cc $(srcdir)/minitests.c $(srcdir)/tests.c $(srcdir)/vacall.h + $(CXX) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS) -c $(srcdir)/minitests-c++.cc + +minitests-c++ : minitests-c++.@OBJEXT@ libvacall.a + $(CXX) $(CXXFLAGS) @GCC_X_NONE@ minitests-c++.@OBJEXT@ libvacall.a $(LDFLAGS) -o minitests-c++ + +check : all minitests + ./minitests > minitests.out + LC_ALL=C uniq -u < minitests.out > minitests.output.$(HOST) + test '!' -s minitests.output.$(HOST) +@IF_CXX@ ./minitests-c++ > minitests-c++.out +@IF_CXX@ LC_ALL=C uniq -u < minitests-c++.out > minitests-c++.output.$(HOST) +@IF_CXX@ test '!' -s minitests-c++.output.$(HOST) +@IF_CXX@check : minitests-c++ + +tests.@OBJEXT@ : $(srcdir)/tests.c $(srcdir)/vacall.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $(srcdir)/tests.c + +tests.s : $(srcdir)/tests.c $(srcdir)/vacall.h + $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -S $(srcdir)/tests.c + +tests : tests.@OBJEXT@ libvacall.a + $(CC) $(CFLAGS) @GCC_X_NONE@ tests.@OBJEXT@ libvacall.a $(LDFLAGS) -o tests + +extracheck : all tests + ./tests > tests.out + LC_ALL=C uniq -u < tests.out > tests.output.$(HOST) + test '!' -s tests.output.$(HOST) + +mostlyclean : clean + +clean : force + $(RM) *.@OBJEXT@ *.a core + $(RM) vacall-i386.s vacall-sparc.s vacall-sparc64.s vacall-m68k.s vacall-mips.s vacall-mipsn32.s vacall-mips64.s vacall-alpha.s vacall-hppa.s vacall-hppa64.s vacall-arm.s vacall-armhf.s vacall-arm64.s vacall-powerpc.s vacall-powerpc64.s vacall-powerpc64-elfv2.s vacall-ia64.s vacall-x86_64.s vacall-x86_64.asm vacall-x86_64-x32.s vacall-s390.s vacall-s390x.s vacall-riscv32-ilp32d.s vacall-riscv64-lp64d.s + $(RM) minitests.@OBJEXT@ minitests.s minitests minitests.out + $(RM) minitests-c++.@OBJEXT@ minitests-c++ minitests-c++.out + $(RM) tests.@OBJEXT@ tests.s tests tests.out + +distclean : clean + $(RM) Makefile minitests.output.* minitests-c++.output.* tests.output.* + +maintainer-clean : distclean + + +# List of source files (committed in version control or generated by Makefile.devel). +SOURCE_FILES = \ + COPYING \ + PLATFORMS README vacall.3 vacall.html \ + Makefile.devel \ + Makefile.maint \ + Makefile.in \ + vacall.h vacall-internal.h \ + vacall-alpha.c vacall-alpha-linux.s vacall-alpha-macro.S \ + vacall-arm.c vacall-arm-linux.s vacall-arm-linux-pic.s vacall-arm-macro.S \ + vacall-armhf.c vacall-armhf-linux.s vacall-armhf-linux-pic.s vacall-armhf-macro.S \ + vacall-arm64.c vacall-arm64-macro.S vacall-arm64-macos-macro.S \ + vacall-hppa.c vacall-hppa-linux.s vacall-hppa-macro.S \ + vacall-hppa64.c vacall-hppa64-linux.s vacall-hppa64-macro.S \ + vacall-i386.c vacall-i386-linux.s vacall-i386-linux-pic.s vacall-i386-macro.S \ + vacall-ia64.c vacall-ia64-linux.s vacall-ia64-macro.S \ + vacall-m68k.c vacall-m68k-linux.s vacall-m68k-sun.s vacall-m68k.mit.S vacall-m68k.motorola.S \ + vacall-mips.c vacall-mipseb-linux.s vacall-mipsel-linux.s vacall-mipseb-macro.S vacall-mipsel-macro.S \ + vacall-mipsn32.c vacall-mipsn32eb-linux.s vacall-mipsn32el-linux.s vacall-mipsn32eb-macro.S vacall-mipsn32el-macro.S \ + vacall-mips64.c vacall-mips64eb-linux.s vacall-mips64el-linux.s vacall-mips64eb-macro.S vacall-mips64el-macro.S \ + vacall-powerpc.c \ + vacall-powerpc-aix.s \ + vacall-powerpc-linux.s vacall-powerpc-linux-macro.S vacall-powerpc-macos.s vacall-powerpc-sysv4-macro.S \ + vacall-powerpc64.c vacall-powerpc64-aix.s vacall-powerpc64-linux.S vacall-powerpc64-elfv2-linux.S \ + vacall-riscv32.c vacall-riscv32-ilp32d-linux.s vacall-riscv32-ilp32d-macro.S \ + vacall-riscv64.c vacall-riscv64-lp64d-linux.s vacall-riscv64-lp64d-macro.S \ + vacall-s390.c vacall-s390-linux.s vacall-s390-macro.S \ + vacall-s390x.c vacall-s390x-linux.s vacall-s390x-macro.S \ + vacall-sparc.c vacall-sparc-linux.s vacall-sparc-linux-pic.s vacall-sparc-macro.S \ + vacall-sparc64.c vacall-sparc64-linux.s vacall-sparc64-linux-pic.s vacall-sparc64-macro.S \ + vacall-x86_64.c vacall-x86_64-linux.s vacall-x86_64-macro.S vacall-x86_64-x32-linux.s \ + vacall-x86_64-windows.c vacall-x86_64-windows.s vacall-x86_64-windows-macro.S \ + vacall-libapi.c \ + vacall-structcpy.c \ + minitests.c minitests-c++.cc \ + tests.c +# List of distributed files generated by Makefile.maint. +GENERATED_FILES = \ + vacall.man \ + vacall-i386-msvc.c +# List of distributed files. +DISTFILES = $(SOURCE_FILES) $(GENERATED_FILES) + +distdir : $(DISTFILES) + for file in $(DISTFILES); do \ + if test -f $$file; then dir='.'; else dir='$(srcdir)'; fi; \ + cp -p "$$dir/$$file" '$(distdir)'/$$file || exit 1; \ + done + + +force : + diff --git a/vacall/Makefile.maint b/vacall/Makefile.maint new file mode 100644 index 0000000..51789a9 --- /dev/null +++ b/vacall/Makefile.maint @@ -0,0 +1,24 @@ +# maintainer -*-Makefile-*- + +LN = ln -s +RM = rm -f + +# ==================== Easily regeneratable files ==================== + +ROFF_MAN = groff -Tutf8 -mandoc + +all : vacall.man \ + vacall-i386-msvc.c + +vacall.man : vacall.3 + $(ROFF_MAN) vacall.3 > vacall.man + +vacall-i386-msvc.c : vacall-i386-macro.S + (echo '#ifdef _MSC_VER' ; echo '#include "vacall.h"' ; echo '#endif' ; cat vacall-i386-macro.S) > vacall-i386-msvc.c + +totally-clean : force + $(RM) vacall.man + $(RM) vacall-i386-msvc.c + + +force : diff --git a/vacall/PLATFORMS b/vacall/PLATFORMS new file mode 100644 index 0000000..01efe52 --- /dev/null +++ b/vacall/PLATFORMS @@ -0,0 +1,51 @@ +Supported CPUs: (Put the GNU config.guess values here.) + i386 i486-unknown-linux (gcc), i686-unknown-gnu0.9 (gcc), + i386-unknown-sysv4.0 (gcc, /usr/bin/cc, /usr/ucb/cc), + i386-pc-solaris2.6 (gcc), i386-pc-solaris2.10 (gcc, cc), + i486-unknown-sco3.2v4.2 (gcc, cc -Of), i386-pc-cygwin32 (gcc), + i386-w64-mingw32 (gcc, MSVC 14), + i586-unknown-freebsd11.0 (cc), i386-unknown-dragonfly3.8 (gcc), + i386-unknown-netbsdelf7.0 (gcc), i386-unknown-openbsd6.0 (gcc), + i586-pc-haiku (gcc-x86), i386-pc-minix (clang) + m68k m68k-next-nextstep3 (cc), m68k-sun-sunos4.0 (cc), + m68k-unknown-linux (gcc) + mips mips-sgi-irix4.0.5 (gcc, cc -ansi, cc -D__STDC__, cc -cckr), + mips-sgi-irix5.2 (gcc, cc -ansi, cc -D__STDC__, cc -cckr), + mips-sgi-irix5.2 (gcc, cc -ansi, cc -D__STDC__, cc -cckr), + mips-sgi-irix6.2 (cc -32), + mips-sgi-irix6.4 (cc -32, cc -n32, cc -64), + mips-sgi-irix6.5 (cc -32, cc -n32, gcc -mabi=n32), + mips-unknown-linux (gcc -mabi=32), + mips64-unknown-linux (gcc -mabi=n32, -mabi=64) + sparc sparc-sun-sunos4.1.1 (gcc, cc), sparc-sun-solaris2.3 (gcc), + sparc-sun-solaris2.4 (gcc, cc), sparc-sun-solaris2.10 (gcc, cc), + sparc64-sun-solaris2.10 (gcc -m64, cc -xarch=generic64), + sparc-unknown-linux (gcc), sparc64-unknown-linux (gcc), + sparc-unknown-netbsdelf7.1 (gcc), + sparc64-unknown-netbsd8.0 (gcc) + alpha alpha-dec-osf3.0 (gcc, cc), alpha-dec-osf4.0 (gcc, cc), + alphaev67-unknown-linux (gcc) + hppa hppa1.0-hp-hpux8.00 (gcc, cc), hppa1.1-hp-hpux9.05 (cc), + hppa1.1-hp-hpux10.01 (cc), hppa2.0-hp-hpux10.20 (cc +DA1.1), + hppa2.0w-hp-hpux11.31 (cc), hppa-unknown-linux (gcc) + hppa64 hppa64-hp-hpux11.31 (cc +DD64) + arm armv5tejl-unknown-linux (gcc), armv6l-unknown-linux (gcc), + armv7l-unknown-linux (gcc) + arm64 aarch64-unknown-linux (gcc), aarch64-apple-darwin20.4.0 (cc) + powerpc powerpc-ibm-aix4.1.4.0 (cc), powerpc-ibm-aix7.1.3.0 (xlc, gcc), + powerpc-unknown-linux (gcc), powerpc-apple-darwin6.8 (gcc), + powerpc-apple-darwin9.8.0 (gcc) + powerpc64 powerpc-ibm-aix7.1.3.0 (gcc -maix64, xlc -q64; AR="ar -X 64"), + powerpc64-unknown-linux (gcc -m64), + powerpc64le-unknown-linux (gcc) + ia64 ia64-unknown-linux (gcc) + x86_64 x86_64-suse-linux (gcc), x86_64-unknown-linux (gcc -mx32), + x86_64-pc-solaris2.10 (gcc -m64, cc -xarch=generic64), + x86_64-pc-cygwin (gcc), x86_64-w64-mingw32 (gcc, MSVC 14), + x86_64-unknown-freebsd11.0 (cc), x86_64-unknown-netbsd7.0 (gcc), + x86_64-unknown-openbsd6.0 (gcc) + s390 s390x-ibm-linux (gcc -m31) + s390x s390x-ibm-linux (gcc) + riscv32 riscv32-unknown-linux (gcc -mabi=ilp32d) + riscv64 riscv64-unknown-linux (gcc -mabi=lp64d) + diff --git a/vacall/README b/vacall/README new file mode 100644 index 0000000..152436d --- /dev/null +++ b/vacall/README @@ -0,0 +1,78 @@ +vacall - C functions called with variable arguments + +This library allows C functions to be called with variable arguments and +to return variable return values. This is much like the varargs(3) facility, +but also allows the return value to be specified at run time. + +A typical use is the implementation of call-back functions in embedded +interpreters. + + +Installation instructions: + + Configure the parent directory. Then: + cd vacall + make + make check + make install + + +Files in this package: + + Documentation: + + README this text + COPYING free software license + PLATFORMS list of supported platforms + vacall.3 manual page in Unix man format + vacall.man manual page + vacall.html manual page in HTML format + + Source: + + vacall.h main include file + vacall-*.c source for the main interface function + vacall-*.[sS] its translation to assembly language + vacall-libapi.c implementation of other library API + vacall-structcpy.c auxiliary function + tests.c test program + + Building: + + Makefile.in Makefile master + + Porting: + + Makefile.devel developer's Makefile + + +This subdirectory produces a static library. Reason: +The vacall-*.c files access global variables. Such accesses causes +portability problems when combined with the option -fPIC (because of +the small/medium/large memory models and platform dependent assembler +syntax to access the GOT). +Therefore Makefile.devel in this directory compiles the files without -fPIC. +Therefore the resulting object files are not suitable for being put into +a shared library. +Therefore this direcory must + - either not use libtool, + - or pass '-static' to $(LIBTOOL_LINK) when creating libvacall.la. + + +Copyright notice: + +Copyright 1995-2017 Bruno Haible + +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, see . + diff --git a/vacall/minitests-c++.cc b/vacall/minitests-c++.cc new file mode 100644 index 0000000..1738e11 --- /dev/null +++ b/vacall/minitests-c++.cc @@ -0,0 +1,18 @@ +/* + * Copyright 2017 Bruno Haible + * + * 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, see . + */ + +#include "minitests.c" diff --git a/vacall/minitests.c b/vacall/minitests.c new file mode 100644 index 0000000..b0f50fe --- /dev/null +++ b/vacall/minitests.c @@ -0,0 +1,19 @@ +/* + * Copyright 1999-2001 Bruno Haible + * + * 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, see . + */ + +#define SKIP_EXTRA_STRUCTS +#include "tests.c" diff --git a/vacall/tests.c b/vacall/tests.c new file mode 100644 index 0000000..4bc610c --- /dev/null +++ b/vacall/tests.c @@ -0,0 +1,2216 @@ +/* Some random tests for vacall. */ + +/* + * Copyright 1993 Bill Triggs + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include +#include +#include +#include "vacall.h" + +#include "testcases.c" + +#if defined(__m68k__) && defined(__GNUC__) +/* "gcc-2.6.3 -freg-struct-return" returns T = struct { char c[3]; } (which + * has size 4 !) in memory, in contrast to struct { char a,b,c; } and + * struct { char c[4]; } and struct { char a,b,c,d; } which have the same + * size and the same alignment but are returned in registers. I don't know why. + */ +#define SKIP_T +#endif +#if defined(__sparc__) && defined(__sun) && defined(__SUNPRO_C) /* SUNWspro cc */ +/* SunPRO cc miscompiles the simulator function for X_BcdB: d.i[1] is + * temporarily stored in %l2 and put onto the stack from %l2, but in between + * the copy of X has used %l2 as a counter without saving and restoring its + * value. + */ +#define SKIP_X +#endif +#if defined(__mipsn32__) && !defined(__GNUC__) +/* The X test crashes for an unknown reason. */ +#define SKIP_X +#endif + + +void* current_function; + +/* This function simulates the behaviour of current_function. */ +void simulator (va_alist alist) +{ + /* void tests */ + if (current_function == (void*)&v_v) + { + va_start_void(alist); + fprintf(out,"void f(void):\n"); + fflush(out); + va_return_void(alist); + } + + /* int tests */ + else if (current_function == (void*)&i_v) + { + va_start_int(alist); + {int r=99; + fprintf(out,"int f(void):"); + fflush(out); + va_return_int(alist, r); + }} + else if (current_function == (void*)&i_i) + { + va_start_int(alist); + {int a = va_arg_int(alist); + int r=a+1; + fprintf(out,"int f(int):(%d)",a); + fflush(out); + va_return_int(alist, r); + }} + else if (current_function == (void*)&i_i2) + { + va_start_int(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int r=a+b; + fprintf(out,"int f(2*int):(%d,%d)",a,b); + fflush(out); + va_return_int(alist, r); + }} + else if (current_function == (void*)&i_i4) + { + va_start_int(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + int d = va_arg_int(alist); + int r=a+b+c+d; + fprintf(out,"int f(4*int):(%d,%d,%d,%d)",a,b,c,d); + fflush(out); + va_return_int(alist, r); + }} + else if (current_function == (void*)&i_i8) + { + va_start_int(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + int d = va_arg_int(alist); + int e = va_arg_int(alist); + int f = va_arg_int(alist); + int g = va_arg_int(alist); + int h = va_arg_int(alist); + int r=a+b+c+d+e+f+g+h; + fprintf(out,"int f(8*int):(%d,%d,%d,%d,%d,%d,%d,%d)",a,b,c,d,e,f,g,h); + fflush(out); + va_return_int(alist, r); + }} + else if (current_function == (void*)&i_i16) + { + va_start_int(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + int d = va_arg_int(alist); + int e = va_arg_int(alist); + int f = va_arg_int(alist); + int g = va_arg_int(alist); + int h = va_arg_int(alist); + int i = va_arg_int(alist); + int j = va_arg_int(alist); + int k = va_arg_int(alist); + int l = va_arg_int(alist); + int m = va_arg_int(alist); + int n = va_arg_int(alist); + int o = va_arg_int(alist); + int p = va_arg_int(alist); + int r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p; + fprintf(out,"int f(16*int):(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)", + a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); + fflush(out); + va_return_int(alist, r); + }} + else if (current_function == (void*)&i_i32) + { + va_start_int(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + int d = va_arg_int(alist); + int e = va_arg_int(alist); + int f = va_arg_int(alist); + int g = va_arg_int(alist); + int h = va_arg_int(alist); + int i = va_arg_int(alist); + int j = va_arg_int(alist); + int k = va_arg_int(alist); + int l = va_arg_int(alist); + int m = va_arg_int(alist); + int n = va_arg_int(alist); + int o = va_arg_int(alist); + int p = va_arg_int(alist); + int aa = va_arg_int(alist); + int ab = va_arg_int(alist); + int ac = va_arg_int(alist); + int ad = va_arg_int(alist); + int ae = va_arg_int(alist); + int af = va_arg_int(alist); + int ag = va_arg_int(alist); + int ah = va_arg_int(alist); + int ai = va_arg_int(alist); + int aj = va_arg_int(alist); + int ak = va_arg_int(alist); + int al = va_arg_int(alist); + int am = va_arg_int(alist); + int an = va_arg_int(alist); + int ao = va_arg_int(alist); + int ap = va_arg_int(alist); + int r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+aa+ab+ac+ad+ae+af+ag+ah+ai+aj+ak+al+am+an+ao+ap; + fprintf(out,"int f(32*int):(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)", + a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,aa,ab,ac,ad,ae,af,ag,ah,ai,aj,ak,al,am,an,ao,ap); + fflush(out); + va_return_int(alist, r); + }} + + /* float tests */ + else if (current_function == (void*)&f_f) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float r=a+1.0; + fprintf(out,"float f(float):(%g)",a); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f2) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float r=a+b; + fprintf(out,"float f(2*float):(%g,%g)",a,b); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f4) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float r=a+b+c+d; + fprintf(out,"float f(4*float):(%g,%g,%g,%g)",a,b,c,d); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f8) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float r=a+b+c+d+e+f+g+h; + fprintf(out,"float f(8*float):(%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f16) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float i = va_arg_float(alist); + float j = va_arg_float(alist); + float k = va_arg_float(alist); + float l = va_arg_float(alist); + float m = va_arg_float(alist); + float n = va_arg_float(alist); + float o = va_arg_float(alist); + float p = va_arg_float(alist); + float r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p; + fprintf(out,"float f(16*float):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f24) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float i = va_arg_float(alist); + float j = va_arg_float(alist); + float k = va_arg_float(alist); + float l = va_arg_float(alist); + float m = va_arg_float(alist); + float n = va_arg_float(alist); + float o = va_arg_float(alist); + float p = va_arg_float(alist); + float q = va_arg_float(alist); + float s = va_arg_float(alist); + float t = va_arg_float(alist); + float u = va_arg_float(alist); + float v = va_arg_float(alist); + float w = va_arg_float(alist); + float x = va_arg_float(alist); + float y = va_arg_float(alist); + float r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+v+w+x+y; + fprintf(out,"float f(24*float):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,v,w,x,y); + fflush(out); + va_return_float(alist, r); + }} + + /* double tests */ + else if (current_function == (void*)&d_d) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double r=a+1.0; + fprintf(out,"double f(double):(%g)",a); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d2) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double r=a+b; + fprintf(out,"double f(2*double):(%g,%g)",a,b); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d4) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double r=a+b+c+d; + fprintf(out,"double f(4*double):(%g,%g,%g,%g)",a,b,c,d); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d8) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + double r=a+b+c+d+e+f+g+h; + fprintf(out,"double f(8*double):(%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d16) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + double i = va_arg_double(alist); + double j = va_arg_double(alist); + double k = va_arg_double(alist); + double l = va_arg_double(alist); + double m = va_arg_double(alist); + double n = va_arg_double(alist); + double o = va_arg_double(alist); + double p = va_arg_double(alist); + double r=a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p; + fprintf(out,"double f(16*double):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p); + fflush(out); + va_return_double(alist, r); + }} + + /* pointer tests */ + else if (current_function == (void*)&vp_vpdpcpsp) + { + va_start_ptr(alist, void*); + {void* a = va_arg_ptr(alist, void*); + double* b = va_arg_ptr(alist, double*); + char* c = va_arg_ptr(alist, char*); + Int* d = va_arg_ptr(alist, Int*); + void* ret = (char*)b + 1; + fprintf(out,"void* f(void*,double*,char*,Int*):(0x%p,0x%p,0x%p,0x%p)",a,b,c,d); + fflush(out); + va_return_ptr(alist, void*, ret); + }} + + /* mixed number tests */ + else if (current_function == (void*)&uc_ucsil) + { + va_start_uchar(alist); + {uchar a = va_arg_uchar(alist); + ushort b = va_arg_ushort(alist); + uint c = va_arg_uint(alist); + ulong d = va_arg_ulong(alist); + uchar r = (uchar)-1; + fprintf(out,"uchar f(uchar,ushort,uint,ulong):(%u,%u,%u,%lu)",a,b,c,d); + fflush(out); + va_return_uchar(alist, r); + }} + else if (current_function == (void*)&d_iidd) + { + va_start_double(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double r=a+b+c+d; + fprintf(out,"double f(int,int,double,double):(%d,%d,%g,%g)",a,b,c,d); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_iiidi) + { + va_start_double(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + double d = va_arg_double(alist); + int e = va_arg_int(alist); + double r=a+b+c+d+e; + fprintf(out,"double f(int,int,int,double,int):(%d,%d,%d,%g,%d)",a,b,c,d,e); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_idid) + { + va_start_double(alist); + {int a = va_arg_int(alist); + double b = va_arg_double(alist); + int c = va_arg_int(alist); + double d = va_arg_double(alist); + double r=a+b+c+d; + fprintf(out,"double f(int,double,int,double):(%d,%g,%d,%g)",a,b,c,d); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_fdi) + { + va_start_double(alist); + {float a = va_arg_float(alist); + double b = va_arg_double(alist); + int c = va_arg_int(alist); + double r=a+b+c; + fprintf(out,"double f(float,double,int):(%g,%g,%d)",a,b,c); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&us_cdcd) + { + va_start_ushort(alist); + {char a = va_arg_char(alist); + double b = va_arg_double(alist); + char c = va_arg_char(alist); + double d = va_arg_double(alist); + ushort r = (ushort)(int)(a + b + c + d); + fprintf(out,"ushort f(char,double,char,double):('%c',%g,'%c',%g)",a,b,c,d); + fflush(out); + va_return_ushort(alist, r); + }} + else if (current_function == (void*)&ll_iiilli) + { + va_start_longlong(alist); + {int a = va_arg_int(alist); + int b = va_arg_int(alist); + int c = va_arg_int(alist); + long long d = va_arg_longlong(alist); + int e = va_arg_int(alist); + long long r = (long long)a + (long long)b + (long long)c + d + (long long)e; + fprintf(out,"long long f(int,int,int,long long,int):(%d,%d,%d,0x%lx%08lx,%d)",a,b,c,(long)(d>>32),(long)(d&0xffffffff),e); + fflush(out); + va_return_longlong(alist, r); + }} + else if (current_function == (void*)&ll_flli) + { + va_start_longlong(alist); + {float a = va_arg_float(alist); + long long b = va_arg_longlong(alist); + int c = va_arg_int(alist); + long long r = (long long)(int)a + b + (long long)c; + fprintf(out,"long long f(float,long long,int):(%g,0x%lx%08lx,0x%lx)",a,(long)(b>>32),(long)(b&0xffffffff),(long)c); + fflush(out); + va_return_longlong(alist, r); + }} + else if (current_function == (void*)&f_fi) + { + va_start_float(alist); + {float a = va_arg_float(alist); + int z = va_arg_int(alist); + float r = a+z; + fprintf(out,"float f(float,int):(%g,%d)",a,z); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f2i) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + int z = va_arg_int(alist); + float r = a+b+z; + fprintf(out,"float f(2*float,int):(%g,%g,%d)",a,b,z); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f3i) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + int z = va_arg_int(alist); + float r = a+b+c+z; + fprintf(out,"float f(3*float,int):(%g,%g,%g,%d)",a,b,c,z); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f4i) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + int z = va_arg_int(alist); + float r = a+b+c+d+z; + fprintf(out,"float f(4*float,int):(%g,%g,%g,%g,%d)",a,b,c,d,z); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f7i) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + int z = va_arg_int(alist); + float r = a+b+c+d+e+f+g+z; + fprintf(out,"float f(7*float,int):(%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,z); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f8i) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + int z = va_arg_int(alist); + float r = a+b+c+d+e+f+g+h+z; + fprintf(out,"float f(8*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,z); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f12i) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float i = va_arg_float(alist); + float j = va_arg_float(alist); + float k = va_arg_float(alist); + float l = va_arg_float(alist); + int z = va_arg_int(alist); + float r = a+b+c+d+e+f+g+h+i+j+k+l+z; + fprintf(out,"float f(12*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,z); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&f_f13i) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float i = va_arg_float(alist); + float j = va_arg_float(alist); + float k = va_arg_float(alist); + float l = va_arg_float(alist); + float m = va_arg_float(alist); + int z = va_arg_int(alist); + float r = a+b+c+d+e+f+g+h+i+j+k+l+m+z; + fprintf(out,"float f(13*float,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,m,z); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&d_di) + { + va_start_double(alist); + {double a = va_arg_double(alist); + int z = va_arg_int(alist); + double r = a+z; + fprintf(out,"double f(double,int):(%g,%d)",a,z); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d2i) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + int z = va_arg_int(alist); + double r = a+b+z; + fprintf(out,"double f(2*double,int):(%g,%g,%d)",a,b,z); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d3i) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + int z = va_arg_int(alist); + double r = a+b+c+z; + fprintf(out,"double f(3*double,int):(%g,%g,%g,%d)",a,b,c,z); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d4i) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + int z = va_arg_int(alist); + double r = a+b+c+d+z; + fprintf(out,"double f(4*double,int):(%g,%g,%g,%g,%d)",a,b,c,d,z); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d7i) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + int z = va_arg_int(alist); + double r = a+b+c+d+e+f+g+z; + fprintf(out,"double f(7*double,int):(%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,z); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d8i) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + int z = va_arg_int(alist); + double r = a+b+c+d+e+f+g+h+z; + fprintf(out,"double f(8*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,z); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d12i) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + double i = va_arg_double(alist); + double j = va_arg_double(alist); + double k = va_arg_double(alist); + double l = va_arg_double(alist); + int z = va_arg_int(alist); + double r = a+b+c+d+e+f+g+h+i+j+k+l+z; + fprintf(out,"double f(12*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,z); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_d13i) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + double i = va_arg_double(alist); + double j = va_arg_double(alist); + double k = va_arg_double(alist); + double l = va_arg_double(alist); + double m = va_arg_double(alist); + int z = va_arg_int(alist); + double r = a+b+c+d+e+f+g+h+i+j+k+l+m+z; + fprintf(out,"double f(13*double,int):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%d)",a,b,c,d,e,f,g,h,i,j,k,l,m,z); + fflush(out); + va_return_double(alist, r); + }} + + /* small structure return tests */ + else if (current_function == (void*)&S1_v) + { + Size1 r; + va_start_struct(alist, Size1, 1); + r = Size1_1; + fprintf(out,"Size1 f(void):"); + fflush(out); + va_return_struct(alist, Size1, r); + } + else if (current_function == (void*)&S2_v) + { + Size2 r; + va_start_struct(alist, Size2, 1); + r = Size2_1; + fprintf(out,"Size2 f(void):"); + fflush(out); + va_return_struct(alist, Size2, r); + } + else if (current_function == (void*)&S3_v) + { + Size3 r; + va_start_struct(alist, Size3, 1); + r = Size3_1; + fprintf(out,"Size3 f(void):"); + fflush(out); + va_return_struct(alist, Size3, r); + } + else if (current_function == (void*)&S4_v) + { + Size4 r; + va_start_struct(alist, Size4, 1); + r = Size4_1; + fprintf(out,"Size4 f(void):"); + fflush(out); + va_return_struct(alist, Size4, r); + } + else if (current_function == (void*)&S7_v) + { + Size7 r; + va_start_struct(alist, Size7, 1); + r = Size7_1; + fprintf(out,"Size7 f(void):"); + fflush(out); + va_return_struct(alist, Size7, r); + } + else if (current_function == (void*)&S8_v) + { + Size8 r; + va_start_struct(alist, Size8, 1); + r = Size8_1; + fprintf(out,"Size8 f(void):"); + fflush(out); + va_return_struct(alist, Size8, r); + } + else if (current_function == (void*)&S12_v) + { + Size12 r; + va_start_struct(alist, Size12, 1); + r = Size12_1; + fprintf(out,"Size12 f(void):"); + fflush(out); + va_return_struct(alist, Size12, r); + } + else if (current_function == (void*)&S15_v) + { + Size15 r; + va_start_struct(alist, Size15, 1); + r = Size15_1; + fprintf(out,"Size15 f(void):"); + fflush(out); + va_return_struct(alist, Size15, r); + } + else if (current_function == (void*)&S16_v) + { + Size16 r; + va_start_struct(alist, Size16, 1); + r = Size16_1; + fprintf(out,"Size16 f(void):"); + fflush(out); + va_return_struct(alist, Size16, r); + } + + /* structure tests */ + else if (current_function == (void*)&I_III) + { + Int a; + Int b; + Int c; + Int r; + va_start_struct(alist, Int, 1); + a = va_arg_struct(alist, Int); + b = va_arg_struct(alist, Int); + c = va_arg_struct(alist, Int); + r.x = a.x + b.x + c.x; + fprintf(out,"Int f(Int,Int,Int):({%d},{%d},{%d})",a.x,b.x,c.x); + fflush(out); + va_return_struct(alist, Int, r); + } +#ifndef SKIP_EXTRA_STRUCTS + else if (current_function == (void*)&C_CdC) + { + Char a; + double b; + Char c; + Char r; + va_start_struct(alist, Char, 1); + a = va_arg_struct(alist, Char); + b = va_arg_double(alist); + c = va_arg_struct(alist, Char); + r.x = (a.x + c.x)/2; + fprintf(out,"Char f(Char,double,Char):({'%c'},%g,{'%c'})",a.x,b,c.x); + fflush(out); + va_return_struct(alist, Char, r); + } + else if (current_function == (void*)&F_Ffd) + { + Float a; + float b; + double c; + Float r; + va_start_struct(alist, Float, va_word_splittable_1(float)); + a = va_arg_struct(alist, Float); + b = va_arg_float(alist); + c = va_arg_double(alist); + r.x = a.x + b + c; + fprintf(out,"Float f(Float,float,double):({%g},%g,%g)",a.x,b,c); + fflush(out); + va_return_struct(alist, Float, r); + } + else if (current_function == (void*)&D_fDd) + { + float a; + Double b; + double c; + Double r; + va_start_struct(alist, Double, va_word_splittable_1(double)); + a = va_arg_float(alist); + b = va_arg_struct(alist, Double); + c = va_arg_double(alist); + r.x = a + b.x + c; + fprintf(out,"Double f(float,Double,double):(%g,{%g},%g)",a,b.x,c); + fflush(out); + va_return_struct(alist, Double, r); + } + else if (current_function == (void*)&D_Dfd) + { + Double a; + float b; + double c; + Double r; + va_start_struct(alist, Double, va_word_splittable_1(double)); + a = va_arg_struct(alist, Double); + b = va_arg_float(alist); + c = va_arg_double(alist); + r.x = a.x + b + c; + fprintf(out,"Double f(Double,float,double):({%g},%g,%g)",a.x,b,c); + fflush(out); + va_return_struct(alist, Double, r); + } +#endif + else if (current_function == (void*)&J_JiJ) + { + J a; + int b; + J c; + J r; + va_start_struct(alist, J, va_word_splittable_2(long,long)); + a = va_arg_struct(alist, J); + b = va_arg_int(alist); + c = va_arg_struct(alist, J); + r.l1 = a.l1+c.l1; r.l2 = a.l2+b+c.l2; + fprintf(out,"J f(J,int,J):({%ld,%ld},%d,{%ld,%ld})",a.l1,a.l2,b,c.l1,c.l2); + fflush(out); + va_return_struct(alist, J, r); + } +#ifndef SKIP_EXTRA_STRUCTS + else if (current_function == (void*)&T_TcT) + { + T a; + char b; + T c; + T r; + va_start_struct(alist, T, 1); + a = va_arg_struct(alist, T); + b = va_arg_char(alist); + c = va_arg_struct(alist, T); + r.c[0]='b'; r.c[1]=c.c[1]; r.c[2]=c.c[2]; + fprintf(out,"T f(T,char,T):({\"%c%c%c\"},'%c',{\"%c%c%c\"})",a.c[0],a.c[1],a.c[2],b,c.c[0],c.c[1],c.c[2]); + fflush(out); + va_return_struct(alist, T, r); + } + else if (current_function == (void*)&X_BcdB) + { + B a; + char b; + double c; + B d; + static X xr={"return val",'R'}; + X r; + va_start_struct(alist, X, 0); + a = va_arg_struct(alist, B); + b = va_arg_char(alist); + c = va_arg_double(alist); + d = va_arg_struct(alist, B); + r = xr; + r.c1 = b; + fprintf(out,"X f(B,char,double,B):({%g,{%d,%d,%d}},'%c',%g,{%g,{%d,%d,%d}})", + a.d,a.i[0],a.i[1],a.i[2],b,c,d.d,d.i[0],d.i[1],d.i[2]); + fflush(out); + va_return_struct(alist, X, r); + } +#endif + + /* gpargs boundary tests */ + else if (current_function == (void*)&l_l0J) + { + va_start_long(alist); + {J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = b.l1 + b.l2 + c; + fprintf(out,"long f(J,long):(%ld,%ld,%ld)",b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l1J) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + b.l1 + b.l2 + c; + fprintf(out,"long f(long,J,long):(%ld,%ld,%ld,%ld)",a1,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l2J) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + b.l1 + b.l2 + c; + fprintf(out,"long f(2*long,J,long):(%ld,%ld,%ld,%ld,%ld)",a1,a2,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l3J) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + b.l1 + b.l2 + c; + fprintf(out,"long f(3*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l4J) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + b.l1 + b.l2 + c; + fprintf(out,"long f(4*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l5J) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + a5 + b.l1 + b.l2 + c; + fprintf(out,"long f(5*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l6J) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + a5 + a6 + b.l1 + b.l2 + c; + fprintf(out,"long f(6*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,a6,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l7J) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + long a7 = va_arg_long(alist); + J b = va_arg_struct(alist, J); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + a5 + a6 + a7 + b.l1 + b.l2 + c; + fprintf(out,"long f(7*long,J,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,a6,a7,b.l1,b.l2,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l0K) + { + va_start_long(alist); + {K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(K,long):(%ld,%ld,%ld,%ld,%ld)",b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l1K) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld)",a1,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l2K) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + a2 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(2*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l3K) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(3*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l4K) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(4*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l5K) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + a5 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(5*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&l_l6K) + { + va_start_long(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + K b = va_arg_struct(alist, K); + long c = va_arg_long(alist); + long r = a1 + a2 + a3 + a4 + a5 + a6 + b.l1 + b.l2 + b.l3 + b.l4 + c; + fprintf(out,"long f(6*long,K,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a1,a2,a3,a4,a5,a6,b.l1,b.l2,b.l3,b.l4,c); + fflush(out); + va_return_long(alist, r); + }} + else if (current_function == (void*)&f_f17l3L) + { + va_start_float(alist); + {float a = va_arg_float(alist); + float b = va_arg_float(alist); + float c = va_arg_float(alist); + float d = va_arg_float(alist); + float e = va_arg_float(alist); + float f = va_arg_float(alist); + float g = va_arg_float(alist); + float h = va_arg_float(alist); + float i = va_arg_float(alist); + float j = va_arg_float(alist); + float k = va_arg_float(alist); + float l = va_arg_float(alist); + float m = va_arg_float(alist); + float n = va_arg_float(alist); + float o = va_arg_float(alist); + float p = va_arg_float(alist); + float q = va_arg_float(alist); + long s = va_arg_long(alist); + long t = va_arg_long(alist); + long u = va_arg_long(alist); + L z = va_arg_struct(alist, L); + float r = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+z.l1+z.l2+z.l3+z.l4+z.l5+z.l6; + fprintf(out,"float f(17*float,3*int,L):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,z.l1,z.l2,z.l3,z.l4,z.l5,z.l6); + fflush(out); + va_return_float(alist, r); + }} + else if (current_function == (void*)&d_d17l3L) + { + va_start_double(alist); + {double a = va_arg_double(alist); + double b = va_arg_double(alist); + double c = va_arg_double(alist); + double d = va_arg_double(alist); + double e = va_arg_double(alist); + double f = va_arg_double(alist); + double g = va_arg_double(alist); + double h = va_arg_double(alist); + double i = va_arg_double(alist); + double j = va_arg_double(alist); + double k = va_arg_double(alist); + double l = va_arg_double(alist); + double m = va_arg_double(alist); + double n = va_arg_double(alist); + double o = va_arg_double(alist); + double p = va_arg_double(alist); + double q = va_arg_double(alist); + long s = va_arg_long(alist); + long t = va_arg_long(alist); + long u = va_arg_long(alist); + L z = va_arg_struct(alist, L); + double r = a+b+c+d+e+f+g+h+i+j+k+l+m+n+o+p+q+s+t+u+z.l1+z.l2+z.l3+z.l4+z.l5+z.l6; + fprintf(out,"double f(17*double,3*int,L):(%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%g,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld,%ld)",a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,s,t,u,z.l1,z.l2,z.l3,z.l4,z.l5,z.l6); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&ll_l2ll) + { + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2) + b + c; + fprintf(out,"long long f(2*long,long long,long):(%ld,%ld,0x%lx%08lx,%ld)",a1,a2,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); + }} + else if (current_function == (void*)&ll_l3ll) + { + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2 + a3) + b + c; + fprintf(out,"long long f(3*long,long long,long):(%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); + }} + else if (current_function == (void*)&ll_l4ll) + { + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2 + a3 + a4) + b + c; + fprintf(out,"long long f(4*long,long long,long):(%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); + }} + else if (current_function == (void*)&ll_l5ll) + { + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2 + a3 + a4 + a5) + b + c; + fprintf(out,"long long f(5*long,long long,long):(%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); + }} + else if (current_function == (void*)&ll_l6ll) + { + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2 + a3 + a4 + a5 + a6) + b + c; + fprintf(out,"long long f(6*long,long long,long):(%ld,%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,a6,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); + }} + else if (current_function == (void*)&ll_l7ll) + { + va_start_longlong(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + long a7 = va_arg_long(alist); + long long b = va_arg_longlong(alist); + long c = va_arg_long(alist); + long long r = (long long) (a1 + a2 + a3 + a4 + a5 + a6 + a7) + b + c; + fprintf(out,"long long f(7*long,long long,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,0x%lx%08lx,%ld)",a1,a2,a3,a4,a5,a6,a7,(long)(b>>32),(long)(b&0xffffffff),c); + fflush(out); + va_return_longlong(alist, r); + }} + else if (current_function == (void*)&d_l2d) + { + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2) + b + c; + fprintf(out,"double f(2*long,double,long):(%ld,%ld,%g,%ld)",a1,a2,b,c); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_l3d) + { + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2 + a3) + b + c; + fprintf(out,"double f(3*long,double,long):(%ld,%ld,%ld,%g,%ld)",a1,a2,a3,b,c); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_l4d) + { + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2 + a3 + a4) + b + c; + fprintf(out,"double f(4*long,double,long):(%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,b,c); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_l5d) + { + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2 + a3 + a4 + a5) + b + c; + fprintf(out,"double f(5*long,double,long):(%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,b,c); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_l6d) + { + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2 + a3 + a4 + a5 + a6) + b + c; + fprintf(out,"double f(6*long,double,long):(%ld,%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,a6,b,c); + fflush(out); + va_return_double(alist, r); + }} + else if (current_function == (void*)&d_l7d) + { + va_start_double(alist); + {long a1 = va_arg_long(alist); + long a2 = va_arg_long(alist); + long a3 = va_arg_long(alist); + long a4 = va_arg_long(alist); + long a5 = va_arg_long(alist); + long a6 = va_arg_long(alist); + long a7 = va_arg_long(alist); + double b = va_arg_double(alist); + long c = va_arg_long(alist); + double r = (double) (a1 + a2 + a3 + a4 + a5 + a6 + a7) + b + c; + fprintf(out,"double f(7*long,double,long):(%ld,%ld,%ld,%ld,%ld,%ld,%ld,%g,%ld)",a1,a2,a3,a4,a5,a6,a7,b,c); + fflush(out); + va_return_double(alist, r); + }} + + /* by-value tests */ + else if (current_function == (void*)&v_clobber_K) + { + va_start_void(alist); + {K k = va_arg_struct(alist, K); + k.l1 += 1; + k.l2 += 10; + k.l3 += 100; + k.l4 += 1000; + va_return_void(alist); + }} + + else + { + fprintf(out,"simulate: unknown function\n"); + fflush(out); + } +} + + +/* + * The way we run these tests - first call the function directly, then + * through vacall() - there is the danger that arguments or results seem + * to be passed correctly, but what we are seeing are in fact the vestiges + * (traces) or the previous call. This may seriously fake the test. + * Avoid this by clearing the registers between the first and the second call. + */ +long clear_traces_i (long a, long b, long c, long d, long e, long f, long g, long h, + long i, long j, long k, long l, long m, long n, long o, long p) +{ return 0; } +float clear_traces_f (float a, float b, float c, float d, float e, float f, float g, + float h, float i, float j, float k, float l, float m, float n, + float o, float p) +{ return 0.0; } +double clear_traces_d (double a, double b, double c, double d, double e, double f, double g, + double h, double i, double j, double k, double l, double m, double n, + double o, double p) +{ return 0.0; } +J clear_traces_J (void) +{ J j; j.l1 = j.l2 = 0; return j; } +void clear_traces (void) +{ clear_traces_i(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); + clear_traces_f(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0); + clear_traces_d(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0); + clear_traces_J(); +} + +int main (void) +{ + out = stdout; + + vacall_function = &simulator; + + /* void tests */ + v_v(); + clear_traces(); + current_function = (void*) &v_v; ((void (*) (void)) vacall) (); + + /* int tests */ + { int ir; + + ir = i_v(); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + current_function = (void*) &i_v; ir = ((int (*) (void)) vacall) (); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i(i1); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + current_function = (void*) &i_i; ir = ((int (*) (int)) vacall) (i1); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i2(i1,i2); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + current_function = (void*) &i_i2; ir = ((int (*) (int,int)) vacall) (i1,i2); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i4(i1,i2,i3,i4); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + current_function = (void*) &i_i4; ir = ((int (*) (int,int,int,int)) vacall) (i1,i2,i3,i4); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i8(i1,i2,i3,i4,i5,i6,i7,i8); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + current_function = (void*) &i_i8; ir = ((int (*) (int,int,int,int,int,int,int,int)) vacall) (i1,i2,i3,i4,i5,i6,i7,i8); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i16(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + current_function = (void*) &i_i16; ir = ((int (*) (int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int)) vacall) (i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16); + fprintf(out,"->%d\n",ir); + fflush(out); + + ir = i_i32(i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17,i18,i19,i20,i21,i22,i23,i24,i25,i26,i27,i28,i29,i30,i31,i32); + fprintf(out,"->%d\n",ir); + fflush(out); + ir = 0; clear_traces(); + current_function = (void*) &i_i32; ir = ((int (*) (int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int)) vacall) (i1,i2,i3,i4,i5,i6,i7,i8,i9,i10,i11,i12,i13,i14,i15,i16,i17,i18,i19,i20,i21,i22,i23,i24,i25,i26,i27,i28,i29,i30,i31,i32); + fprintf(out,"->%d\n",ir); + fflush(out); + } + + /* float tests */ + { float fr; + + fr = f_f(f1); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f; fr = ((float (*) (float)) vacall) (f1); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f2(f1,f2); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f2; fr = ((float (*) (float,float)) vacall) (f1,f2); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f4(f1,f2,f3,f4); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f4; fr = ((float (*) (float,float,float,float)) vacall) (f1,f2,f3,f4); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f8(f1,f2,f3,f4,f5,f6,f7,f8); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f8; fr = ((float (*) (float,float,float,float,float,float,float,float)) vacall) (f1,f2,f3,f4,f5,f6,f7,f8); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f16(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f16; fr = ((float (*) (float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float)) vacall) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f24(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,f21,f22,f23,f24); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f24; fr = ((float (*) (float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float)) vacall) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19,f20,f21,f22,f23,f24); + fprintf(out,"->%g\n",fr); + fflush(out); + } + + /* double tests */ + { double dr; + + dr = d_d(d1); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d; dr = ((double (*) (double)) vacall) (d1); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d2(d1,d2); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d2; dr = ((double (*) (double,double)) vacall) (d1,d2); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d4(d1,d2,d3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d4; dr = ((double (*) (double,double,double,double)) vacall) (d1,d2,d3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d8(d1,d2,d3,d4,d5,d6,d7,d8); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d8; dr = ((double (*) (double,double,double,double,double,double,double,double)) vacall) (d1,d2,d3,d4,d5,d6,d7,d8); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d16(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d16; dr = ((double (*) (double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double)) vacall) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16); + fprintf(out,"->%g\n",dr); + fflush(out); + } + + /* pointer tests */ + { void* vpr; + + vpr = vp_vpdpcpsp(&uc1,&d2,str3,&I4); + fprintf(out,"->0x%p\n",vpr); + fflush(out); + vpr = 0; clear_traces(); + current_function = (void*) &vp_vpdpcpsp; vpr = ((void* (*) (void*,double*,char*,Int*)) vacall) (&uc1,&d2,str3,&I4); + fprintf(out,"->0x%p\n",vpr); + fflush(out); + } + + /* mixed number tests */ + { uchar ucr; + ushort usr; + float fr; + double dr; + long long llr; + + ucr = uc_ucsil(uc1,us2,ui3,ul4); + fprintf(out,"->%u\n",ucr); + fflush(out); + ucr = 0; clear_traces(); + current_function = (void*) &uc_ucsil; ucr = ((uchar (*) (uchar,ushort,uint,ulong)) vacall) (uc1,us2,ui3,ul4); + fprintf(out,"->%u\n",ucr); + fflush(out); + + dr = d_iidd(i1,i2,d3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_iidd; dr = ((double (*) (int,int,double,double)) vacall) (i1,i2,d3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_iiidi(i1,i2,i3,d4,i5); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_iiidi; dr = ((double (*) (int,int,int,double,int)) vacall) (i1,i2,i3,d4,i5); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_idid(i1,d2,i3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_idid; dr = ((double (*) (int,double,int,double)) vacall) (i1,d2,i3,d4); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_fdi(f1,d2,i3); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_fdi; dr = ((double (*) (float,double,int)) vacall) (f1,d2,i3); + fprintf(out,"->%g\n",dr); + fflush(out); + + usr = us_cdcd(c1,d2,c3,d4); + fprintf(out,"->%u\n",usr); + fflush(out); + usr = 0; clear_traces(); + current_function = (void*) &us_cdcd; usr = ((ushort (*) (char,double,char,double)) vacall) (c1,d2,c3,d4); + fprintf(out,"->%u\n",usr); + fflush(out); + + llr = ll_iiilli(i1,i2,i3,ll1,i13); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + current_function = (void*) &ll_iiilli; llr = ((long long (*) (int,int,int,long long,int)) vacall) (i1,i2,i3,ll1,i13); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_flli(f13,ll1,i13); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + current_function = (void*) &ll_flli; llr = ((long long (*) (float,long long,int)) vacall) (f13,ll1,i13); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + fr = f_fi(f1,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_fi; fr = ((float (*) (float,int)) vacall) (f1,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f2i(f1,f2,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f2i; fr = ((float (*) (float,float,int)) vacall) (f1,f2,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f3i(f1,f2,f3,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f3i; fr = ((float (*) (float,float,float,int)) vacall) (f1,f2,f3,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f4i(f1,f2,f3,f4,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f4i; fr = ((float (*) (float,float,float,float,int)) vacall) (f1,f2,f3,f4,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f7i(f1,f2,f3,f4,f5,f6,f7,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f7i; fr = ((float (*) (float,float,float,float,float,float,float,int)) vacall) (f1,f2,f3,f4,f5,f6,f7,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f8i(f1,f2,f3,f4,f5,f6,f7,f8,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f8i; fr = ((float (*) (float,float,float,float,float,float,float,float,int)) vacall) (f1,f2,f3,f4,f5,f6,f7,f8,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f12i(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f12i; fr = ((float (*) (float,float,float,float,float,float,float,float,float,float,float,float,int)) vacall) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + fr = f_f13i(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f13i; fr = ((float (*) (float,float,float,float,float,float,float,float,float,float,float,float,float,int)) vacall) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,i9); + fprintf(out,"->%g\n",fr); + fflush(out); + + dr = d_di(d1,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_di; dr = ((double (*) (double,int)) vacall) (d1,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d2i(d1,d2,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d2i; dr = ((double (*) (double,double,int)) vacall) (d1,d2,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d3i(d1,d2,d3,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d3i; dr = ((double (*) (double,double,double,int)) vacall) (d1,d2,d3,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d4i(d1,d2,d3,d4,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d4i; dr = ((double (*) (double,double,double,double,int)) vacall) (d1,d2,d3,d4,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d7i(d1,d2,d3,d4,d5,d6,d7,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d7i; dr = ((double (*) (double,double,double,double,double,double,double,int)) vacall) (d1,d2,d3,d4,d5,d6,d7,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d8i(d1,d2,d3,d4,d5,d6,d7,d8,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d8i; dr = ((double (*) (double,double,double,double,double,double,double,double,int)) vacall) (d1,d2,d3,d4,d5,d6,d7,d8,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d12i(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d12i; dr = ((double (*) (double,double,double,double,double,double,double,double,double,double,double,double,int)) vacall) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_d13i(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d13i; dr = ((double (*) (double,double,double,double,double,double,double,double,double,double,double,double,double,int)) vacall) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,i9); + fprintf(out,"->%g\n",dr); + fflush(out); + } + + /* small structure return tests */ + { + Size1 r = S1_v(); + fprintf(out,"->{%c}\n",r.x1); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + current_function = (void*) &S1_v; r = ((Size1 (*) (void)) vacall) (); + fprintf(out,"->{%c}\n",r.x1); + fflush(out); + } + { + Size2 r = S2_v(); + fprintf(out,"->{%c%c}\n",r.x1,r.x2); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + current_function = (void*) &S2_v; r = ((Size2 (*) (void)) vacall) (); + fprintf(out,"->{%c%c}\n",r.x1,r.x2); + fflush(out); + } + { + Size3 r = S3_v(); + fprintf(out,"->{%c%c%c}\n",r.x1,r.x2,r.x3); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + current_function = (void*) &S3_v; r = ((Size3 (*) (void)) vacall) (); + fprintf(out,"->{%c%c%c}\n",r.x1,r.x2,r.x3); + fflush(out); + } + { + Size4 r = S4_v(); + fprintf(out,"->{%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + current_function = (void*) &S4_v; r = ((Size4 (*) (void)) vacall) (); + fprintf(out,"->{%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4); + fflush(out); + } + { + Size7 r = S7_v(); + fprintf(out,"->{%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + current_function = (void*) &S7_v; r = ((Size7 (*) (void)) vacall) (); + fprintf(out,"->{%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7); + fflush(out); + } + { + Size8 r = S8_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + current_function = (void*) &S8_v; r = ((Size8 (*) (void)) vacall) (); + fprintf(out,"->{%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8); + fflush(out); + } + { + Size12 r = S12_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + current_function = (void*) &S12_v; r = ((Size12 (*) (void)) vacall) (); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12); + fflush(out); + } + { + Size15 r = S15_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + current_function = (void*) &S15_v; r = ((Size15 (*) (void)) vacall) (); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15); + fflush(out); + } + { + Size16 r = S16_v(); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15,r.x16); + fflush(out); + memset(&r,0,sizeof(r)); clear_traces(); + current_function = (void*) &S16_v; r = ((Size16 (*) (void)) vacall) (); + fprintf(out,"->{%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c}\n",r.x1,r.x2,r.x3,r.x4,r.x5,r.x6,r.x7,r.x8,r.x9,r.x10,r.x11,r.x12,r.x13,r.x14,r.x15,r.x16); + fflush(out); + } + + /* structure tests */ + { Int Ir; + Char Cr; + Float Fr; + Double Dr; + J Jr; + T Tr; + X Xr; + + Ir = I_III(I1,I2,I3); + fprintf(out,"->{%d}\n",Ir.x); + fflush(out); + Ir.x = 0; clear_traces(); + current_function = (void*) &I_III; Ir = ((Int (*) (Int,Int,Int)) vacall) (I1,I2,I3); + fprintf(out,"->{%d}\n",Ir.x); + fflush(out); + +#ifndef SKIP_EXTRA_STRUCTS + Cr = C_CdC(C1,d2,C3); + fprintf(out,"->{'%c'}\n",Cr.x); + fflush(out); + Cr.x = '\0'; clear_traces(); + current_function = (void*) &C_CdC; Cr = ((Char (*) (Char,double,Char)) vacall) (C1,d2,C3); + fprintf(out,"->{'%c'}\n",Cr.x); + fflush(out); + + Fr = F_Ffd(F1,f2,d3); + fprintf(out,"->{%g}\n",Fr.x); + fflush(out); + Fr.x = 0.0; clear_traces(); + current_function = (void*) &F_Ffd; Fr = ((Float (*) (Float,float,double)) vacall) (F1,f2,d3); + fprintf(out,"->{%g}\n",Fr.x); + fflush(out); + + Dr = D_fDd(f1,D2,d3); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); + Dr.x = 0.0; clear_traces(); + current_function = (void*) &D_fDd; Dr = ((Double (*) (float,Double,double)) vacall) (f1,D2,d3); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); + + Dr = D_Dfd(D1,f2,d3); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); + Dr.x = 0.0; clear_traces(); + current_function = (void*) &D_Dfd; Dr = ((Double (*) (Double,float,double)) vacall) (D1,f2,d3); + fprintf(out,"->{%g}\n",Dr.x); + fflush(out); +#endif + + Jr = J_JiJ(J1,i2,J2); + fprintf(out,"->{%ld,%ld}\n",Jr.l1,Jr.l2); + fflush(out); + Jr.l1 = Jr.l2 = 0; clear_traces(); + current_function = (void*) &J_JiJ; Jr = ((J (*) (J,int,J)) vacall) (J1,i2,J2); + fprintf(out,"->{%ld,%ld}\n",Jr.l1,Jr.l2); + fflush(out); + +#ifndef SKIP_EXTRA_STRUCTS +#ifndef SKIP_T + Tr = T_TcT(T1,' ',T2); + fprintf(out,"->{\"%c%c%c\"}\n",Tr.c[0],Tr.c[1],Tr.c[2]); + fflush(out); + Tr.c[0] = Tr.c[1] = Tr.c[2] = 0; clear_traces(); + current_function = (void*) &T_TcT; Tr = ((T (*) (T,char,T)) vacall) (T1,' ',T2); + fprintf(out,"->{\"%c%c%c\"}\n",Tr.c[0],Tr.c[1],Tr.c[2]); + fflush(out); +#endif + +#ifndef SKIP_X + Xr = X_BcdB(B1,c2,d3,B2); + fprintf(out,"->{\"%s\",'%c'}\n",Xr.c,Xr.c1); + fflush(out); + Xr.c[0]=Xr.c1='\0'; clear_traces(); + current_function = (void*) &X_BcdB; Xr = ((X (*) (B,char,double,B)) vacall) (B1,c2,d3,B2); + fprintf(out,"->{\"%s\",'%c'}\n",Xr.c,Xr.c1); + fflush(out); +#endif +#endif + } + + /* gpargs boundary tests */ + { long lr; + long long llr; + float fr; + double dr; + + lr = l_l0J(J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l0J; lr = ((long (*) (J,long)) vacall) (J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l1J(l1,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l1J; lr = ((long (*) (long,J,long)) vacall) (l1,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l2J(l1,l2,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l2J; lr = ((long (*) (long,long,J,long)) vacall) (l1,l2,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l3J(l1,l2,l3,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l3J; lr = ((long (*) (long,long,long,J,long)) vacall) (l1,l2,l3,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l4J(l1,l2,l3,l4,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l4J; lr = ((long (*) (long,long,long,long,J,long)) vacall) (l1,l2,l3,l4,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l5J(l1,l2,l3,l4,l5,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l5J; lr = ((long (*) (long,long,long,long,long,J,long)) vacall) (l1,l2,l3,l4,l5,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l6J(l1,l2,l3,l4,l5,l6,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l6J; lr = ((long (*) (long,long,long,long,long,long,J,long)) vacall) (l1,l2,l3,l4,l5,l6,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l7J(l1,l2,l3,l4,l5,l6,l7,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l7J; lr = ((long (*) (long,long,long,long,long,long,long,J,long)) vacall) (l1,l2,l3,l4,l5,l6,l7,J1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l0K(K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l0K; lr = ((long (*) (K,long)) vacall) (K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l1K(l1,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l1K; lr = ((long (*) (long,K,long)) vacall) (l1,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l2K(l1,l2,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l2K; lr = ((long (*) (long,long,K,long)) vacall) (l1,l2,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l3K(l1,l2,l3,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l3K; lr = ((long (*) (long,long,long,K,long)) vacall) (l1,l2,l3,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l4K(l1,l2,l3,l4,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l4K; lr = ((long (*) (long,long,long,long,K,long)) vacall) (l1,l2,l3,l4,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l5K(l1,l2,l3,l4,l5,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l5K; lr = ((long (*) (long,long,long,long,long,K,long)) vacall) (l1,l2,l3,l4,l5,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + lr = l_l6K(l1,l2,l3,l4,l5,l6,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + lr = 0; clear_traces(); + current_function = (void*) &l_l6K; lr = ((long (*) (long,long,long,long,long,long,K,long)) vacall) (l1,l2,l3,l4,l5,l6,K1,l9); + fprintf(out,"->%ld\n",lr); + fflush(out); + + fr = f_f17l3L(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,l6,l7,l8,L1); + fprintf(out,"->%g\n",fr); + fflush(out); + fr = 0.0; clear_traces(); + current_function = (void*) &f_f17l3L; fr = ((float (*) (float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,float,long,long,long,L)) vacall) (f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,l6,l7,l8,L1); + fprintf(out,"->%g\n",fr); + fflush(out); + + dr = d_d17l3L(d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,l6,l7,l8,L1); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_d17l3L; dr = ((double (*) (double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,double,long,long,long,L)) vacall) (d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15,d16,d17,l6,l7,l8,L1); + fprintf(out,"->%g\n",dr); + fflush(out); + + llr = ll_l2ll(l1,l2,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + current_function = (void*) &ll_l2ll; llr = ((long long (*) (long,long,long long,long)) vacall) (l1,l2,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l3ll(l1,l2,l3,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + current_function = (void*) &ll_l3ll; llr = ((long long (*) (long,long,long,long long,long)) vacall) (l1,l2,l3,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l4ll(l1,l2,l3,l4,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + current_function = (void*) &ll_l4ll; llr = ((long long (*) (long,long,long,long,long long,long)) vacall) (l1,l2,l3,l4,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l5ll(l1,l2,l3,l4,l5,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + current_function = (void*) &ll_l5ll; llr = ((long long (*) (long,long,long,long,long,long long,long)) vacall) (l1,l2,l3,l4,l5,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l6ll(l1,l2,l3,l4,l5,l6,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + current_function = (void*) &ll_l6ll; llr = ((long long (*) (long,long,long,long,long,long,long long,long)) vacall) (l1,l2,l3,l4,l5,l6,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + llr = ll_l7ll(l1,l2,l3,l4,l5,l6,l7,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + llr = 0; clear_traces(); + current_function = (void*) &ll_l7ll; llr = ((long long (*) (long,long,long,long,long,long,long,long long,long)) vacall) (l1,l2,l3,l4,l5,l6,l7,ll1,l9); + fprintf(out,"->0x%lx%08lx\n",(long)(llr>>32),(long)(llr&0xffffffff)); + fflush(out); + + dr = d_l2d(l1,l2,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_l2d; dr = ((double (*) (long,long,double,long)) vacall) (l1,l2,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l3d(l1,l2,l3,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_l3d; dr = ((double (*) (long,long,long,double,long)) vacall) (l1,l2,l3,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l4d(l1,l2,l3,l4,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_l4d; dr = ((double (*) (long,long,long,long,double,long)) vacall) (l1,l2,l3,l4,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l5d(l1,l2,l3,l4,l5,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_l5d; dr = ((double (*) (long,long,long,long,long,double,long)) vacall) (l1,l2,l3,l4,l5,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l6d(l1,l2,l3,l4,l5,l6,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_l6d; dr = ((double (*) (long,long,long,long,long,long,double,long)) vacall) (l1,l2,l3,l4,l5,l6,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + + dr = d_l7d(l1,l2,l3,l4,l5,l6,l7,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + dr = 0.0; clear_traces(); + current_function = (void*) &d_l7d; dr = ((double (*) (long,long,long,long,long,long,long,double,long)) vacall) (l1,l2,l3,l4,l5,l6,l7,ll1,l9); + fprintf(out,"->%g\n",dr); + fflush(out); + } + + /* by-value tests */ + /* This test is trivial, since a copy of k is allocated on the callee's stack. + But anyway... */ + { K k; + + k.l1 = l1; + k.l2 = l2; + k.l3 = l3; + k.l4 = l4; + fprintf(out,"by_value:%ld,%ld,%ld,%ld\n",k.l1,k.l2,k.l3,k.l4); + fflush(out); + clear_traces(); + current_function = (void*) &v_clobber_K; ((void (*) (K)) vacall) (k); + fprintf(out,"by_value:%ld,%ld,%ld,%ld\n",k.l1,k.l2,k.l3,k.l4); + fflush(out); + } + + exit(0); +} diff --git a/vacall/vacall-alpha-linux.s b/vacall/vacall-alpha-linux.s new file mode 100644 index 0000000..85364c8 --- /dev/null +++ b/vacall/vacall-alpha-linux.s @@ -0,0 +1,174 @@ + .set noreorder + .set volatile + .set noat + .set nomacro + .text + .align 2 + .align 4 + .globl vacall_receiver + .ent vacall_receiver +vacall_receiver: + .frame $15,192,$26,48 + .mask 0x4008000,-192 + ldah $29,0($27) !gpdisp!1 + lda $29,0($29) !gpdisp!1 +$vacall_receiver..ng: + lda $30,-192($30) + stq $15,8($30) + mov $30,$15 + lda $3,144($15) + stq $26,0($30) + .prologue 1 + lda $2,88($15) + stq $16,144($15) + subq $2,$3,$2 + ldq $3,vacall_function($29) !literal + stq $2,80($15) + lda $2,192($15) + lda $16,16($15) + stq $2,72($15) + ldq $27,0($3) + lda $2,144($15) + stq $17,152($15) + stq $18,160($15) + stq $19,168($15) + stq $20,176($15) + stq $21,184($15) + stt $f16,88($15) + stt $f17,96($15) + stt $f18,104($15) + stt $f19,112($15) + stt $f20,120($15) + stt $f21,128($15) + stl $31,16($15) + stq $2,40($15) + stq $31,48($15) + stl $31,56($15) + jsr $26,($27),0 + ldah $29,0($26) !gpdisp!2 + lda $29,0($29) !gpdisp!2 + ldl $2,56($15) + beq $2,$L43 + zapnot $2,15,$3 + cmpeq $3,1,$2 + bne $2,$L44 + cmpeq $3,2,$2 + bne $2,$L44 + cmpeq $3,3,$2 + bne $2,$L50 + cmpeq $3,4,$2 + bne $2,$L51 + cmpeq $3,5,$2 + bne $2,$L52 + cmpeq $3,6,$2 + bne $2,$L53 + cmpeq $3,7,$2 + bne $2,$L54 + cmpeq $3,8,$2 + bne $2,$L48 + cmpeq $3,9,$2 + bne $2,$L48 + cmpeq $3,10,$2 + bne $2,$L48 + cmpeq $3,11,$2 + bne $2,$L48 + cmpeq $3,12,$2 + bne $2,$L55 + cmpeq $3,13,$2 + bne $2,$L56 + cmpeq $3,14,$2 + bne $2,$L48 + cmpeq $3,15,$2 + beq $2,$L43 + lda $2,1024($31) + ldl $3,16($15) + and $2,$3,$2 + beq $2,$L43 + ldq $3,64($15) + cmpeq $3,1,$2 + bne $2,$L57 + cmpeq $3,2,$2 + bne $2,$L58 + cmpeq $3,4,$2 + bne $2,$L59 + cmpeq $3,8,$2 + bne $2,$L60 + cmpeq $3,16,$2 + beq $2,$L43 + ldq $2,48($15) + ldq $1,8($2) + ldq $0,0($2) + .align 4 +$L43: + mov $15,$30 + ldq $26,0($30) + ldq $15,8($30) + lda $30,192($30) + ret $31,($26),1 + .align 4 +$L44: + mov $15,$30 + ldl $2,24($15) + ldq $26,0($30) + sll $2,56,$2 + sra $2,56,$0 + ldq $15,8($30) + lda $30,192($30) + ret $31,($26),1 +$L51: + ldl $2,24($15) + sll $2,48,$2 + sra $2,48,$0 + br $31,$L43 +$L50: + ldl $2,24($15) + bis $31,$31,$31 + and $2,0xff,$0 + br $31,$L43 +$L48: + ldq $0,24($15) + br $31,$L43 +$L52: + ldl $2,24($15) + bis $31,$31,$31 + zapnot $2,3,$0 + br $31,$L43 +$L53: + ldl $3,24($15) + bis $31,$31,$31 + mov $3,$0 + br $31,$L43 +$L54: + ldl $2,24($15) + bis $31,$31,$31 + zapnot $2,15,$0 + br $31,$L43 +$L55: + lds $f0,24($15) + br $31,$L43 +$L56: + ldt $f0,24($15) + br $31,$L43 +$L57: + ldq $3,48($15) + ldq_u $2,0($3) + extbl $2,$3,$0 + br $31,$L43 +$L58: + ldq $3,48($15) + ldq_u $2,0($3) + extwl $2,$3,$0 + br $31,$L43 +$L60: + ldq $2,48($15) + bis $31,$31,$31 + ldq $0,0($2) + br $31,$L43 +$L59: + ldq $2,48($15) + ldl $3,0($2) + zapnot $3,15,$0 + br $31,$L43 + .end vacall_receiver + .ident "GCC: (GNU) 4.0.2" + .section .note.GNU-stack,"",@progbits diff --git a/vacall/vacall-alpha-macro.S b/vacall/vacall-alpha-macro.S new file mode 100644 index 0000000..2655035 --- /dev/null +++ b/vacall/vacall-alpha-macro.S @@ -0,0 +1,175 @@ + .set noreorder + .set volatile + .set noat + .set nomacro + .text + .align 2 + .align 4 + .globl vacall_receiver + .ent vacall_receiver +vacall_receiver: + .frame $15,192,$26,48 + .mask 0x4008000,-192 + ldah $29,0($27) !gpdisp!1 + lda $29,0($29) !gpdisp!1 +$vacall_receiver..ng: + lda $30,-192($30) + stq $15,8($30) + mov $30,$15 + lda $3,144($15) + stq $26,0($30) + .prologue 1 + lda $2,88($15) + stq $16,144($15) + subq $2,$3,$2 + ldq $3,vacall_function($29) !literal + stq $2,80($15) + lda $2,192($15) + lda $16,16($15) + stq $2,72($15) + ldq $27,0($3) + lda $2,144($15) + stq $17,152($15) + stq $18,160($15) + stq $19,168($15) + stq $20,176($15) + stq $21,184($15) + stt $f16,88($15) + stt $f17,96($15) + stt $f18,104($15) + stt $f19,112($15) + stt $f20,120($15) + stt $f21,128($15) + stl $31,16($15) + stq $2,40($15) + stq $31,48($15) + stl $31,56($15) + jsr $26,($27),0 + ldah $29,0($26) !gpdisp!2 + lda $29,0($29) !gpdisp!2 + ldl $2,56($15) + beq $2,$L43 + zapnot $2,15,$3 + cmpeq $3,1,$2 + bne $2,$L44 + cmpeq $3,2,$2 + bne $2,$L44 + cmpeq $3,3,$2 + bne $2,$L50 + cmpeq $3,4,$2 + bne $2,$L51 + cmpeq $3,5,$2 + bne $2,$L52 + cmpeq $3,6,$2 + bne $2,$L53 + cmpeq $3,7,$2 + bne $2,$L54 + cmpeq $3,8,$2 + bne $2,$L48 + cmpeq $3,9,$2 + bne $2,$L48 + cmpeq $3,10,$2 + bne $2,$L48 + cmpeq $3,11,$2 + bne $2,$L48 + cmpeq $3,12,$2 + bne $2,$L55 + cmpeq $3,13,$2 + bne $2,$L56 + cmpeq $3,14,$2 + bne $2,$L48 + cmpeq $3,15,$2 + beq $2,$L43 + lda $2,1024($31) + ldl $3,16($15) + and $2,$3,$2 + beq $2,$L43 + ldq $3,64($15) + cmpeq $3,1,$2 + bne $2,$L57 + cmpeq $3,2,$2 + bne $2,$L58 + cmpeq $3,4,$2 + bne $2,$L59 + cmpeq $3,8,$2 + bne $2,$L60 + cmpeq $3,16,$2 + beq $2,$L43 + ldq $2,48($15) + ldq $1,8($2) + ldq $0,0($2) + .align 4 +$L43: + mov $15,$30 + ldq $26,0($30) + ldq $15,8($30) + lda $30,192($30) + ret $31,($26),1 + .align 4 +$L44: + mov $15,$30 + ldl $2,24($15) + ldq $26,0($30) + sll $2,56,$2 + sra $2,56,$0 + ldq $15,8($30) + lda $30,192($30) + ret $31,($26),1 +$L51: + ldl $2,24($15) + sll $2,48,$2 + sra $2,48,$0 + br $31,$L43 +$L50: + ldl $2,24($15) + bis $31,$31,$31 + and $2,0xff,$0 + br $31,$L43 +$L48: + ldq $0,24($15) + br $31,$L43 +$L52: + ldl $2,24($15) + bis $31,$31,$31 + zapnot $2,3,$0 + br $31,$L43 +$L53: + ldl $3,24($15) + bis $31,$31,$31 + mov $3,$0 + br $31,$L43 +$L54: + ldl $2,24($15) + bis $31,$31,$31 + zapnot $2,15,$0 + br $31,$L43 +$L55: + lds $f0,24($15) + br $31,$L43 +$L56: + ldt $f0,24($15) + br $31,$L43 +$L57: + ldq $3,48($15) + ldq_u $2,0($3) + extbl $2,$3,$0 + br $31,$L43 +$L58: + ldq $3,48($15) + ldq_u $2,0($3) + extwl $2,$3,$0 + br $31,$L43 +$L60: + ldq $2,48($15) + bis $31,$31,$31 + ldq $0,0($2) + br $31,$L43 +$L59: + ldq $2,48($15) + ldl $3,0($2) + zapnot $3,15,$0 + br $31,$L43 + .end vacall_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-alpha.c b/vacall/vacall-alpha.c new file mode 100644 index 0000000..b066478 --- /dev/null +++ b/vacall/vacall-alpha.c @@ -0,0 +1,161 @@ +/* vacall function for alpha CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("$1"); +#endif +register __varword arg1 __asm__("$16"); +register __varword arg2 __asm__("$17"); +register __varword arg3 __asm__("$18"); +register __varword arg4 __asm__("$19"); +register __varword arg5 __asm__("$20"); +register __varword arg6 __asm__("$21"); +register double farg1 __asm__("$f16"); +register double farg2 __asm__("$f17"); +register double farg3 __asm__("$f18"); +register double farg4 __asm__("$f19"); +register double farg5 __asm__("$f20"); +register double farg6 __asm__("$f21"); +register __varword iret __asm__("$0"); +register __varword iret2 __asm__("$1"); +register float fret __asm__("$f0"); +register double dret __asm__("$f0"); + +/* The ABI requires that the first 6 general-purpose argument words are + being passed in registers, even if these words belong to a struct. No room + is allocated for these register words on the stack by the caller, but the + callee allocates room for them - at the right place in the stack frame, + that is, above the usual {fp, retaddr} combo - if and only if they are part + of a larger struct that extends to the stack and the address of this struct + is taken. */ +struct gpargsequence { + __vaword word1; /* $16 */ + __vaword word2; /* $17 */ + __vaword word3; /* $18 */ + __vaword word4; /* $19 */ + __vaword word5; /* $20 */ + __vaword word6; /* $21 */ + __vaword firststackword; +}; + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (struct gpargsequence gpargs) +{ + __va_alist list; + /* Move the arguments passed in registers to their stack locations. */ + list.farg[0] = farg1; + list.farg[1] = farg2; + list.farg[2] = farg3; + list.farg[3] = farg4; + list.farg[4] = farg5; + list.farg[5] = farg6; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&gpargs; + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.memargptr = (long)&gpargs.firststackword; + list.farg_offset = (long)&list.farg[0] - list.aptr; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulonglong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + if (list.rsize == sizeof(char)) { + iret = *(unsigned char *) list.raddr; + } else + if (list.rsize == sizeof(short)) { + iret = *(unsigned short *) list.raddr; + } else + if (list.rsize == sizeof(int)) { + iret = *(unsigned int *) list.raddr; + } else + if (list.rsize == sizeof(long)) { + iret = *(unsigned long *) list.raddr; + } else + if (list.rsize == 2*sizeof(__varword)) { + iret = ((__varword *) list.raddr)[0]; + iret2 = ((__varword *) list.raddr)[1]; + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-arm-linux-pic.s b/vacall/vacall-arm-linux-pic.s new file mode 100644 index 0000000..9035020 --- /dev/null +++ b/vacall/vacall-arm-linux-pic.s @@ -0,0 +1,100 @@ + .file "vacall-arm.c" + .text + .align 2 + .global vacall_receiver + .type vacall_receiver,function +vacall_receiver: + @ args = 20, pretend = 16, frame = 32 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + sub sp, sp, #16 + stmfd sp!, {sl, fp, ip, lr, pc} + sub fp, ip, #20 + add ip, fp, #4 + ldr sl, .L41 + sub sp, sp, #32 + stmia ip, {r0, r1, r2, r3} + ldr r3, .L41+4 + mov lr, #0 +.L36: + add sl, pc, sl + ldr r2, [sl, r3] + str ip, [fp, #-32] + str lr, [fp, #-24] + str lr, [fp, #-48] + str lr, [fp, #-28] + bic sp, sp, #7 + sub r0, fp, #48 + mov lr, pc + ldr pc, [r2, #0] + ldr r2, [fp, #-24] + cmp r2, #0 + beq .L1 + cmp r2, #1 + beq .L39 + cmp r2, #2 + ldreqsb r0, [fp, #-40] + beq .L1 + cmp r2, #3 + beq .L39 + cmp r2, #4 + ldreqsh r0, [fp, #-40] + beq .L1 + cmp r2, #5 + ldreqh r0, [fp, #-40] + beq .L1 + cmp r2, #6 + beq .L38 + cmp r2, #7 + beq .L38 + cmp r2, #8 + beq .L38 + cmp r2, #9 + beq .L38 + sub r3, r2, #10 + cmp r3, #1 + bls .L37 + cmp r2, #12 + ldreq r0, [fp, #-40] @ float + beq .L1 + cmp r2, #13 + beq .L37 + cmp r2, #14 + beq .L38 + cmp r2, #15 + beq .L40 +.L1: + ldmea fp, {sl, fp, sp, pc} +.L40: + ldr r3, [fp, #-48] + tst r3, #1024 + beq .L1 + ldr r3, [fp, #-20] + cmp r3, #1 + ldreq r3, [fp, #-28] + ldreqb r0, [r3, #0] @ zero_extendqisi2 + beq .L1 + cmp r3, #2 + ldreq r3, [fp, #-28] + ldrne r3, [fp, #-28] + ldreqh r0, [r3, #0] + ldrne r0, [r3, #0] + b .L1 +.L38: + ldr r0, [fp, #-40] + b .L1 +.L37: + sub r0, fp, #40 + ldmia r0, {r0, r1} @ phole ldm + b .L1 +.L39: + ldrb r0, [fp, #-40] @ zero_extendqisi2 + b .L1 +.L42: + .align 2 +.L41: + .word _GLOBAL_OFFSET_TABLE_-(.L36+8) + .word vacall_function(GOT) +.Lfe1: + .size vacall_receiver,.Lfe1-vacall_receiver + .ident "GCC: (GNU) 3.1" diff --git a/vacall/vacall-arm-linux.s b/vacall/vacall-arm-linux.s new file mode 100644 index 0000000..1c9118b --- /dev/null +++ b/vacall/vacall-arm-linux.s @@ -0,0 +1,95 @@ + .file "vacall-arm.c" + .text + .align 2 + .global vacall_receiver + .type vacall_receiver,function +vacall_receiver: + @ args = 20, pretend = 16, frame = 32 + @ frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + sub sp, sp, #16 + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, #20 + add lr, fp, #4 + mov ip, #0 + sub sp, sp, #32 + stmia lr, {r0, r1, r2, r3} + bic sp, sp, #7 + str lr, [fp, #-28] + str ip, [fp, #-20] + str ip, [fp, #-44] + str ip, [fp, #-24] + sub r0, fp, #44 + ldr r3, .L40 + mov lr, pc + ldr pc, [r3, #0] + ldr r2, [fp, #-20] + cmp r2, #0 + beq .L1 + cmp r2, #1 + beq .L38 + cmp r2, #2 + ldreqsb r0, [fp, #-36] + beq .L1 + cmp r2, #3 + beq .L38 + cmp r2, #4 + ldreqsh r0, [fp, #-36] + beq .L1 + cmp r2, #5 + ldreqh r0, [fp, #-36] + beq .L1 + cmp r2, #6 + beq .L37 + cmp r2, #7 + beq .L37 + cmp r2, #8 + beq .L37 + cmp r2, #9 + beq .L37 + sub r3, r2, #10 + cmp r3, #1 + bls .L36 + cmp r2, #12 + ldreq r0, [fp, #-36] @ float + beq .L1 + cmp r2, #13 + beq .L36 + cmp r2, #14 + beq .L37 + cmp r2, #15 + beq .L39 +.L1: + ldmea fp, {fp, sp, pc} +.L39: + ldr r3, [fp, #-44] + tst r3, #1024 + beq .L1 + ldr r3, [fp, #-16] + cmp r3, #1 + ldreq r3, [fp, #-24] + ldreqb r0, [r3, #0] @ zero_extendqisi2 + beq .L1 + cmp r3, #2 + ldreq r3, [fp, #-24] + ldrne r3, [fp, #-24] + ldreqh r0, [r3, #0] + ldrne r0, [r3, #0] + b .L1 +.L37: + ldr r0, [fp, #-36] + b .L1 +.L36: + sub r0, fp, #36 + ldmia r0, {r0, r1} @ phole ldm + b .L1 +.L38: + ldrb r0, [fp, #-36] @ zero_extendqisi2 + b .L1 +.L41: + .align 2 +.L40: + .word vacall_function +.Lfe1: + .size vacall_receiver,.Lfe1-vacall_receiver + .ident "GCC: (GNU) 3.1" diff --git a/vacall/vacall-arm-macro.S b/vacall/vacall-arm-macro.S new file mode 100644 index 0000000..3ff455b --- /dev/null +++ b/vacall/vacall-arm-macro.S @@ -0,0 +1,198 @@ +#include "asm-arm.h" +#ifdef __PIC__ + .text + .align 2 + .global C(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) + // args = 20, pretend = 16, frame = 32 + // frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + sub sp, sp, $16 + stmfd sp!, {sl, fp, ip, lr, pc} + sub fp, ip, $20 + add ip, fp, $4 + ldr sl, L(41) + sub sp, sp, $32 + stmia ip, {r0, r1, r2, r3} + ldr r3, L(41)+4 + mov lr, $0 +L(36): + add sl, pc, sl + ldr r2, [sl, r3] + str ip, [fp, $-32] + str lr, [fp, $-24] + str lr, [fp, $-48] + str lr, [fp, $-28] + bic sp, sp, $7 + sub r0, fp, $48 + mov lr, pc + ldr pc, [r2, $0] + ldr r2, [fp, $-24] + cmp r2, $0 + beq L(1) + cmp r2, $1 + beq L(39) + cmp r2, $2 + ldreqsb r0, [fp, $-40] + beq L(1) + cmp r2, $3 + beq L(39) + cmp r2, $4 + ldreqsh r0, [fp, $-40] + beq L(1) + cmp r2, $5 + ldreqh r0, [fp, $-40] + beq L(1) + cmp r2, $6 + beq L(38) + cmp r2, $7 + beq L(38) + cmp r2, $8 + beq L(38) + cmp r2, $9 + beq L(38) + sub r3, r2, $10 + cmp r3, $1 + bls L(37) + cmp r2, $12 + ldreq r0, [fp, $-40] // float + beq L(1) + cmp r2, $13 + beq L(37) + cmp r2, $14 + beq L(38) + cmp r2, $15 + beq L(40) +L(1): + ldmea fp, {sl, fp, sp, pc} +L(40): + ldr r3, [fp, $-48] + tst r3, $1024 + beq L(1) + ldr r3, [fp, $-20] + cmp r3, $1 + ldreq r3, [fp, $-28] + ldreqb r0, [r3, $0] // zero_extendqisi2 + beq L(1) + cmp r3, $2 + ldreq r3, [fp, $-28] + ldrne r3, [fp, $-28] + ldreqh r0, [r3, $0] + ldrne r0, [r3, $0] + b L(1) +L(38): + ldr r0, [fp, $-40] + b L(1) +L(37): + sub r0, fp, $40 + ldmia r0, {r0, r1} // phole ldm + b L(1) +L(39): + ldrb r0, [fp, $-40] // zero_extendqisi2 + b L(1) +L(42): + .align 2 +L(41): + .word _GLOBAL_OFFSET_TABLE_-(L(36)+8) + .word C(vacall_function)(GOT) +L(fe1): + FUNEND(vacall_receiver) +#else + .text + .align 2 + .global C(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) + // args = 20, pretend = 16, frame = 32 + // frame_needed = 1, uses_anonymous_args = 0 + mov ip, sp + sub sp, sp, $16 + stmfd sp!, {fp, ip, lr, pc} + sub fp, ip, $20 + add lr, fp, $4 + mov ip, $0 + sub sp, sp, $32 + stmia lr, {r0, r1, r2, r3} + bic sp, sp, $7 + str lr, [fp, $-28] + str ip, [fp, $-20] + str ip, [fp, $-44] + str ip, [fp, $-24] + sub r0, fp, $44 + ldr r3, L(40) + mov lr, pc + ldr pc, [r3, $0] + ldr r2, [fp, $-20] + cmp r2, $0 + beq L(1) + cmp r2, $1 + beq L(38) + cmp r2, $2 + ldreqsb r0, [fp, $-36] + beq L(1) + cmp r2, $3 + beq L(38) + cmp r2, $4 + ldreqsh r0, [fp, $-36] + beq L(1) + cmp r2, $5 + ldreqh r0, [fp, $-36] + beq L(1) + cmp r2, $6 + beq L(37) + cmp r2, $7 + beq L(37) + cmp r2, $8 + beq L(37) + cmp r2, $9 + beq L(37) + sub r3, r2, $10 + cmp r3, $1 + bls L(36) + cmp r2, $12 + ldreq r0, [fp, $-36] // float + beq L(1) + cmp r2, $13 + beq L(36) + cmp r2, $14 + beq L(37) + cmp r2, $15 + beq L(39) +L(1): + ldmea fp, {fp, sp, pc} +L(39): + ldr r3, [fp, $-44] + tst r3, $1024 + beq L(1) + ldr r3, [fp, $-16] + cmp r3, $1 + ldreq r3, [fp, $-24] + ldreqb r0, [r3, $0] // zero_extendqisi2 + beq L(1) + cmp r3, $2 + ldreq r3, [fp, $-24] + ldrne r3, [fp, $-24] + ldreqh r0, [r3, $0] + ldrne r0, [r3, $0] + b L(1) +L(37): + ldr r0, [fp, $-36] + b L(1) +L(36): + sub r0, fp, $36 + ldmia r0, {r0, r1} // phole ldm + b L(1) +L(38): + ldrb r0, [fp, $-36] // zero_extendqisi2 + b L(1) +L(41): + .align 2 +L(40): + .word C(vacall_function) +L(fe1): + FUNEND(vacall_receiver) +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/vacall/vacall-arm.c b/vacall/vacall-arm.c new file mode 100644 index 0000000..144f720 --- /dev/null +++ b/vacall/vacall-arm.c @@ -0,0 +1,149 @@ +/* vacall function for arm CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +typedef struct { void (*vacall_function) (void*,va_alist); void* arg; } env_t; +#endif + +/* armel have only softvfp which uses generic registers */ +register __varword iret __asm__("r0"); +register __varword iret2 __asm__("r1"); +register float fret __asm__("r0"); +register __varword dret1 __asm__("r0"); +register __varword dret2 __asm__("r1"); + +#ifndef REENTRANT +/* The ARM ABI requires that the first 4 general-purpose argument words are + being passed in registers, even if these words belong to a struct. No room + is allocated for these register words on the stack by the caller, but the + callee allocates room for them - at the right place in the stack frame, + that is, above the usual {fp, sp, retaddr, pc} combo - if and only if + they are part of a larger struct that extends to the stack and the address + of this struct is taken. */ +struct gpargsequence { + __vaword word1; /* r0 */ + __vaword word2; /* r1 */ + __vaword word3; /* r2 */ + __vaword word4; /* r3 */ + __vaword firststackword; +}; + +void /* the return type is variable, not void! */ +vacall_receiver (struct gpargsequence gpargs) +#else /* REENTRANT */ +/* The first 4 general-purpose argument words have already been pushed to the + stack by the trampoline. We can ignore them here. */ +static +void /* the return type is variable, not void! */ +vacall_receiver (__vaword ignored1, __vaword ignored2, __vaword ignored3, __vaword ignored4, + env_t* env, __vaword filler, __vaword saved_fp, __vaword saved_sp, __vaword saved_lr, __vaword saved_pc, + __vaword firstword) +#endif +{ + __va_alist list; + + /* Enforce 8-bytes-alignment of the stack pointer. + We need to do it this way because the old GCC that we use to compile + this file does not support the option '-mabi=aapcs'. */ + register unsigned long sp __asm__("r13"); /* C names for registers */ + sp &= -8; + + /* Prepare the va_alist. */ + list.flags = 0; +#ifndef REENTRANT + list.aptr = (long)&gpargs; +#else /* REENTRANT */ + list.aptr = (long)&firstword; +#endif + list.raddr = (void*)0; + list.rtype = __VAvoid; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong || list.rtype == __VAulonglong) { + iret = ((__varword *) &list.tmp._longlong)[0]; + iret2 = ((__varword *) &list.tmp._longlong)[1]; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret1 = ((__varword *) &list.tmp._double)[0]; + dret2 = ((__varword *) &list.tmp._double)[1]; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + /* NB: On arm, all structure sizes are divisible by 4. */ + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + if (list.rsize == sizeof(char)) { /* can't occur */ + iret = *(unsigned char *) list.raddr; + } else + if (list.rsize == sizeof(short)) { /* can't occur */ + iret = *(unsigned short *) list.raddr; + } else + iret = *(unsigned int *) list.raddr; /* struct of size 3 :) */ + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-arm64-macos-macro.S b/vacall/vacall-arm64-macos-macro.S new file mode 100644 index 0000000..56d9252 --- /dev/null +++ b/vacall/vacall-arm64-macos-macro.S @@ -0,0 +1,183 @@ +#include "asm-arm64.h" + .cpu generic+fp+simd + .text + .align 2 + .p2align 3,,7 + .global C(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) + stp x29, x30, [sp, -256]! + adrp x9, GOTPAGE(C(vacall_function)) + add x29, sp, 0 + add x10, x29, 256 + stp s0, s1, [x29, 156] + ldr x9, [x9, GOTPAGEOFF(C(vacall_function))] + GOTINDIR(x9) + stp x0, x1, [x29, 88] + stp s2, s3, [x29, 164] + stp x10, xzr, [x29, 40] + stp s4, s5, [x29, 172] + str x8, [x29, 72] + stp s6, s7, [x29, 180] + stp x2, x3, [x29, 104] + stp d0, d1, [x29, 192] + stp x4, x5, [x29, 120] + stp d2, d3, [x29, 208] + stp x6, x7, [x29, 136] + str wzr, [x29, 24] + add x0, x29, 24 + str wzr, [x29, 56] + str wzr, [x29, 80] + str wzr, [x29, 152] + stp d4, d5, [x29, 224] + stp d6, d7, [x29, 240] + blr x9 + ldr w9, [x29, 56] + cbz w9, L(1) + cmp w9, 1 + beq L(25) + cmp w9, 2 + beq L(29) + cmp w9, 3 + beq L(25) + cmp w9, 4 + beq L(30) + cmp w9, 5 + beq L(31) + cmp w9, 6 + beq L(32) + cmp w9, 7 + beq L(33) + and w10, w9, -3 + cmp w10, 8 + beq L(27) + cmp w10, 9 + beq L(27) + cmp w9, 12 + beq L(34) + cmp w9, 13 + beq L(35) + cmp w9, 14 + beq L(27) + cmp w9, 15 + bne L(1) + ldr w9, [x29, 24] + tbz x9, 10, L(1) + ldr x9, [x29, 64] + sub x10, x9, $1 + cmp x10, 15 + bhi L(1) + ldr x11, [x29, 48] + cmp x9, 8 + and x10, x11, 7 + and x11, x11, -8 + add x9, x9, x10 + bhi L(15) + cmp x9, 8 + lsl w9, w9, 3 + bhi L(16) + mov x12, 2 + sub w9, w9, $1 + lsl x9, x12, x9 + ldr x11, [x11] + sub x9, x9, $1 + lsl w10, w10, 3 + and x9, x9, x11 + asr x0, x9, x10 +L(1): + ldp x29, x30, [sp], 256 + ret + .p2align 3 +L(25): + ldrb w0, [x29, 32] + ldp x29, x30, [sp], 256 + ret + .p2align 3 +L(27): + ldr x0, [x29, 32] + b L(1) + .p2align 3 +L(29): + ldrsb x0, [x29, 32] + b L(1) + .p2align 3 +L(30): + ldrsh x0, [x29, 32] + b L(1) + .p2align 3 +L(31): + ldrh w0, [x29, 32] + b L(1) + .p2align 3 +L(32): + ldrsw x0, [x29, 32] + b L(1) + .p2align 3 +L(33): + ldr w0, [x29, 32] + b L(1) +L(34): + ldr s0, [x29, 32] + b L(1) +L(35): + ldr d0, [x29, 32] + b L(1) +L(15): + cmp x9, 16 + lsl w9, w9, 3 + bls L(36) + mov x13, 2 + sub w9, w9, $129 + ldp x14, x12, [x11, 8] + lsl x9, x13, x9 + lsl w15, w10, 3 + sub x9, x9, $1 + neg w10, w10, lsl 3 + ldr x11, [x11] + add w10, w10, 64 + and x9, x9, x12 + lsl x16, x14, x10 + asr x11, x11, x15 + asr x14, x14, x15 + lsl x10, x9, x10 + orr x0, x11, x16 + orr x1, x10, x14 + b L(1) +L(16): + mov w13, -8 + mov x14, 2 + sub w9, w9, $65 + lsl w15, w10, 3 + ldr x12, [x11, 8] + lsl x9, x14, x9 + mul w10, w13, w10 + sub x9, x9, $1 + ldr x11, [x11] + add w10, w10, 64 + and x9, x9, x12 + asr x11, x11, x15 + lsl x9, x9, x10 + orr x0, x9, x11 + b L(1) +L(36): + mov w13, -4 + mov x14, 2 + sub w9, w9, $65 + lsl w15, w10, 3 + ldr x12, [x11, 8] + lsl x9, x14, x9 + mul w10, w13, w10 + sub x9, x9, $1 + ldr x11, [x11] + add w10, w10, 32 + and x9, x9, x12 + asr x1, x9, x15 + lsl x9, x9, x10 + asr x11, x11, x15 + lsl x9, x9, x10 + orr x0, x11, x9 + b L(1) + FUNEND(vacall_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/vacall/vacall-arm64-macro.S b/vacall/vacall-arm64-macro.S new file mode 100644 index 0000000..e291b31 --- /dev/null +++ b/vacall/vacall-arm64-macro.S @@ -0,0 +1,183 @@ +#include "asm-arm64.h" + .cpu generic+fp+simd + .text + .align 2 + .p2align 3,,7 + .global C(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) + stp x29, x30, [sp, -256]! + adrp x9, GOTPAGE(C(vacall_function)) + add x29, sp, 0 + add x10, x29, 256 + stp s0, s1, [x29, 156] + ldr x9, [x9, GOTPAGEOFF(C(vacall_function))] + GOTINDIR(x9) + stp x0, x1, [x29, 88] + stp s2, s3, [x29, 164] + stp x10, xzr, [x29, 40] + stp s4, s5, [x29, 172] + str x8, [x29, 72] + stp s6, s7, [x29, 180] + stp x2, x3, [x29, 104] + stp d0, d1, [x29, 192] + stp x4, x5, [x29, 120] + stp d2, d3, [x29, 208] + stp x6, x7, [x29, 136] + str wzr, [x29, 16] + add x0, x29, 16 + str wzr, [x29, 56] + str wzr, [x29, 80] + str wzr, [x29, 152] + stp d4, d5, [x29, 224] + stp d6, d7, [x29, 240] + blr x9 + ldr w9, [x29, 56] + cbz w9, L(1) + cmp w9, 1 + beq L(25) + cmp w9, 2 + beq L(29) + cmp w9, 3 + beq L(25) + cmp w9, 4 + beq L(30) + cmp w9, 5 + beq L(31) + cmp w9, 6 + beq L(32) + cmp w9, 7 + beq L(33) + and w10, w9, -3 + cmp w10, 8 + beq L(27) + cmp w10, 9 + beq L(27) + cmp w9, 12 + beq L(34) + cmp w9, 13 + beq L(35) + cmp w9, 14 + beq L(27) + cmp w9, 15 + bne L(1) + ldr w9, [x29, 16] + tbz x9, 10, L(1) + ldr x9, [x29, 64] + sub x10, x9, $1 + cmp x10, 15 + bhi L(1) + ldr x11, [x29, 48] + cmp x9, 8 + and x10, x11, 7 + and x11, x11, -8 + add x9, x9, x10 + bhi L(15) + cmp x9, 8 + lsl w9, w9, 3 + bhi L(16) + mov x12, 2 + sub w9, w9, $1 + lsl x9, x12, x9 + ldr x11, [x11] + sub x9, x9, $1 + lsl w10, w10, 3 + and x9, x9, x11 + asr x0, x9, x10 +L(1): + ldp x29, x30, [sp], 256 + ret + .p2align 3 +L(25): + ldrb w0, [x29, 24] + ldp x29, x30, [sp], 256 + ret + .p2align 3 +L(27): + ldr x0, [x29, 24] + b L(1) + .p2align 3 +L(29): + ldrsb x0, [x29, 24] + b L(1) + .p2align 3 +L(30): + ldrsh x0, [x29, 24] + b L(1) + .p2align 3 +L(31): + ldrh w0, [x29, 24] + b L(1) + .p2align 3 +L(32): + ldrsw x0, [x29, 24] + b L(1) + .p2align 3 +L(33): + ldr w0, [x29, 24] + b L(1) +L(34): + ldr s0, [x29, 24] + b L(1) +L(35): + ldr d0, [x29, 24] + b L(1) +L(15): + cmp x9, 16 + lsl w9, w9, 3 + bls L(36) + mov x13, 2 + sub w9, w9, $129 + ldp x14, x12, [x11, 8] + lsl x9, x13, x9 + lsl w15, w10, 3 + sub x9, x9, $1 + neg w10, w10, lsl 3 + ldr x11, [x11] + add w10, w10, 64 + and x9, x9, x12 + lsl x16, x14, x10 + asr x11, x11, x15 + asr x14, x14, x15 + lsl x10, x9, x10 + orr x0, x11, x16 + orr x1, x10, x14 + b L(1) +L(16): + mov w13, -8 + mov x14, 2 + sub w9, w9, $65 + lsl w15, w10, 3 + ldr x12, [x11, 8] + lsl x9, x14, x9 + mul w10, w13, w10 + sub x9, x9, $1 + ldr x11, [x11] + add w10, w10, 64 + and x9, x9, x12 + asr x11, x11, x15 + lsl x9, x9, x10 + orr x0, x9, x11 + b L(1) +L(36): + mov w13, -4 + mov x14, 2 + sub w9, w9, $65 + lsl w15, w10, 3 + ldr x12, [x11, 8] + lsl x9, x14, x9 + mul w10, w13, w10 + sub x9, x9, $1 + ldr x11, [x11] + add w10, w10, 32 + and x9, x9, x12 + asr x1, x9, x15 + lsl x9, x9, x10 + asr x11, x11, x15 + lsl x9, x9, x10 + orr x0, x11, x9 + b L(1) + FUNEND(vacall_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/vacall/vacall-arm64.c b/vacall/vacall-arm64.c new file mode 100644 index 0000000..d81c8a9 --- /dev/null +++ b/vacall/vacall-arm64.c @@ -0,0 +1,229 @@ +/* vacall function for arm64 (a.k.a. aarch64) CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("x18"); +#endif + +register __vaword* sret __asm__("x8"); /* structure return pointer */ + +register __varword iarg1 __asm__("x0"); +register __varword iarg2 __asm__("x1"); +register __varword iarg3 __asm__("x2"); +register __varword iarg4 __asm__("x3"); +register __varword iarg5 __asm__("x4"); +register __varword iarg6 __asm__("x5"); +register __varword iarg7 __asm__("x6"); +register __varword iarg8 __asm__("x7"); + +register float farg1 __asm__("s0"); +register float farg2 __asm__("s1"); +register float farg3 __asm__("s2"); +register float farg4 __asm__("s3"); +register float farg5 __asm__("s4"); +register float farg6 __asm__("s5"); +register float farg7 __asm__("s6"); +register float farg8 __asm__("s7"); + +register double darg1 __asm__("d0"); +register double darg2 __asm__("d1"); +register double darg3 __asm__("d2"); +register double darg4 __asm__("d3"); +register double darg5 __asm__("d4"); +register double darg6 __asm__("d5"); +register double darg7 __asm__("d6"); +register double darg8 __asm__("d7"); + +register __varword iret __asm__("x0"); +register __varword iret2 __asm__("x1"); +register float fret __asm__("s0"); +register double dret __asm__("d0"); + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, __vaword word6, __vaword word7, __vaword word8, + __vaword firstword) +{ + __va_alist list; + /* Move the arguments passed in registers to temp storage. */ + list.iarg[0] = iarg1; + list.iarg[1] = iarg2; + list.iarg[2] = iarg3; + list.iarg[3] = iarg4; + list.iarg[4] = iarg5; + list.iarg[5] = iarg6; + list.iarg[6] = iarg7; + list.iarg[7] = iarg8; + list.farg[0] = farg1; + list.farg[1] = farg2; + list.farg[2] = farg3; + list.farg[3] = farg4; + list.farg[4] = farg5; + list.farg[5] = farg6; + list.farg[6] = farg7; + list.farg[7] = farg8; + list.darg[0] = darg1; + list.darg[1] = darg2; + list.darg[2] = darg3; + list.darg[3] = darg4; + list.darg[4] = darg5; + list.darg[5] = darg6; + list.darg[6] = darg7; + list.darg[7] = darg8; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&firstword; + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.structraddr = sret; + list.ianum = 0; + list.fanum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong || list.rtype == __VAlonglong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong || list.rtype == __VAulonglong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + /* normal struct return convention */ + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + /* Return structs of size <= 16 in registers. */ + if (list.rsize > 0 && list.rsize <= 16) { + #if 0 /* Unoptimized */ + iret = (__varword)((unsigned char *) list.raddr)[0]; + if (list.rsize >= 2) + iret |= (__varword)((unsigned char *) list.raddr)[1] << 8; + if (list.rsize >= 3) + iret |= (__varword)((unsigned char *) list.raddr)[2] << 16; + if (list.rsize >= 4) + iret |= (__varword)((unsigned char *) list.raddr)[3] << 24; + if (list.rsize >= 5) + iret |= (__varword)((unsigned char *) list.raddr)[4] << 32; + if (list.rsize >= 6) + iret |= (__varword)((unsigned char *) list.raddr)[5] << 40; + if (list.rsize >= 7) + iret |= (__varword)((unsigned char *) list.raddr)[6] << 48; + if (list.rsize >= 8) + iret |= (__varword)((unsigned char *) list.raddr)[7] << 56; + if (list.rsize >= 9) { + iret2 = (__varword)((unsigned char *) list.raddr)[8]; + if (list.rsize >= 10) + iret2 |= (__varword)((unsigned char *) list.raddr)[9] << 8; + if (list.rsize >= 11) + iret2 |= (__varword)((unsigned char *) list.raddr)[10] << 16; + if (list.rsize >= 12) + iret2 |= (__varword)((unsigned char *) list.raddr)[11] << 24; + if (list.rsize >= 13) + iret2 |= (__varword)((unsigned char *) list.raddr)[12] << 32; + if (list.rsize >= 14) + iret2 |= (__varword)((unsigned char *) list.raddr)[13] << 40; + if (list.rsize >= 15) + iret2 |= (__varword)((unsigned char *) list.raddr)[14] << 48; + if (list.rsize >= 16) + iret2 |= (__varword)((unsigned char *) list.raddr)[15] << 56; + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 2*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__varword) */ + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = ((__varword)2 << (end_offset*8-1)) - 1; + iret = (wordaddr[0] & mask0) >> (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) >> (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = ((__varword)2 << (end_offset*8-2*sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] >> (start_offset*8)) | ((wordaddr[2] & mask2) << (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-armhf-linux-pic.s b/vacall/vacall-armhf-linux-pic.s new file mode 100644 index 0000000..b773fb3 --- /dev/null +++ b/vacall/vacall-armhf-linux-pic.s @@ -0,0 +1,155 @@ + .arch armv6 + .eabi_attribute 28, 1 + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 1 + .eabi_attribute 30, 2 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .file "vacall-armhf.c" + .text + .align 2 + .global vacall_receiver + .syntax unified + .arm + .fpu vfpv3-d16 + .type vacall_receiver, %function +vacall_receiver: + @ args = 20, pretend = 16, frame = 176 + @ frame_needed = 1, uses_anonymous_args = 0 + sub sp, sp, #16 + mov ip, #0 + push {r4, r5, r6, fp, lr} + add fp, sp, #16 + ldr r4, .L32 + ldr r5, .L32+4 + add lr, fp, #4 +.LPIC0: + add r4, pc, r4 + add r6, fp, #20 + sub sp, sp, #180 + stm lr, {r0, r1, r2, r3} + vstr.32 s0, [fp, #-152] + vstr.32 s1, [fp, #-148] + vstr.32 s2, [fp, #-144] + vstr.32 s3, [fp, #-140] + vstr.32 s4, [fp, #-136] + vstr.32 s5, [fp, #-132] + vstr.32 s6, [fp, #-128] + vstr.32 s7, [fp, #-124] + vstr.32 s8, [fp, #-120] + vstr.32 s9, [fp, #-116] + vstr.32 s10, [fp, #-112] + vstr.32 s11, [fp, #-108] + vstr.32 s12, [fp, #-104] + vstr.32 s13, [fp, #-100] + vstr.32 s14, [fp, #-96] + vstr.32 s15, [fp, #-92] + vstr.64 d0, [fp, #-84] + vstr.64 d1, [fp, #-76] + vstr.64 d2, [fp, #-68] + vstr.64 d3, [fp, #-60] + vstr.64 d4, [fp, #-52] + vstr.64 d5, [fp, #-44] + vstr.64 d6, [fp, #-36] + vstr.64 d7, [fp, #-28] + str lr, [fp, #-164] + str ip, [fp, #-196] + str ip, [fp, #-160] + str r6, [fp, #-180] + str ip, [fp, #-156] + str ip, [fp, #-176] + strb ip, [fp, #-172] + ldr r2, [r4, r5] + mov r3, r4 + sub r0, fp, #196 + ldr r3, [r2] + blx r3 + ldrb r3, [fp, #-172] @ zero_extendqisi2 + cmp r3, #0 + beq .L1 + cmp r3, #1 + beq .L25 + cmp r3, #2 + ldrsbeq r0, [fp, #-188] + beq .L1 + cmp r3, #3 + beq .L25 + cmp r3, #4 + ldrsheq r0, [fp, #-188] + beq .L1 + cmp r3, #5 + ldrheq r0, [fp, #-188] + beq .L1 + cmp r3, #6 + beq .L27 + cmp r3, #7 + beq .L27 + cmp r3, #8 + beq .L27 + cmp r3, #9 + beq .L27 + sub r2, r3, #10 + cmp r2, #1 + bls .L29 + cmp r3, #12 + vldreq.32 s0, [fp, #-188] + beq .L1 + cmp r3, #13 + beq .L30 + cmp r3, #14 + beq .L27 + cmp r3, #15 + bne .L1 + ldr r3, [fp, #-196] + tst r3, #1024 + beq .L1 + ldr r3, [fp, #-168] + cmp r3, #1 + beq .L31 + cmp r3, #2 + ldr r3, [fp, #-176] + ldrheq r0, [r3] + ldrne r0, [r3] +.L1: + sub sp, fp, #16 + @ sp needed + pop {r4, r5, r6, fp, lr} + add sp, sp, #16 + bx lr +.L25: + ldrb r0, [fp, #-188] @ zero_extendqisi2 + sub sp, fp, #16 + @ sp needed + pop {r4, r5, r6, fp, lr} + add sp, sp, #16 + bx lr +.L27: + ldr r0, [fp, #-188] + sub sp, fp, #16 + @ sp needed + pop {r4, r5, r6, fp, lr} + add sp, sp, #16 + bx lr +.L30: + vldr.64 d0, [fp, #-188] + b .L1 +.L29: + ldr r0, [fp, #-188] + ldr r1, [fp, #-184] + b .L1 +.L31: + ldr r3, [fp, #-176] + ldrb r0, [r3] @ zero_extendqisi2 + b .L1 +.L33: + .align 2 +.L32: + .word _GLOBAL_OFFSET_TABLE_-(.LPIC0+8) + .word vacall_function(GOT) + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 6.5.0" + .section .note.GNU-stack,"",%progbits diff --git a/vacall/vacall-armhf-linux.s b/vacall/vacall-armhf-linux.s new file mode 100644 index 0000000..49ad906 --- /dev/null +++ b/vacall/vacall-armhf-linux.s @@ -0,0 +1,149 @@ + .arch armv6 + .eabi_attribute 28, 1 + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 1 + .eabi_attribute 30, 2 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .file "vacall-armhf.c" + .text + .align 2 + .global vacall_receiver + .syntax unified + .arm + .fpu vfpv3-d16 + .type vacall_receiver, %function +vacall_receiver: + @ args = 20, pretend = 16, frame = 176 + @ frame_needed = 1, uses_anonymous_args = 0 + sub sp, sp, #16 + mov ip, #0 + push {r4, r5, fp, lr} + add fp, sp, #12 + ldr r4, .L32 + add lr, fp, #4 + add r5, fp, #20 + sub sp, sp, #176 + stm lr, {r0, r1, r2, r3} + vstr.32 s0, [fp, #-144] + vstr.32 s1, [fp, #-140] + vstr.32 s2, [fp, #-136] + vstr.32 s3, [fp, #-132] + vstr.32 s4, [fp, #-128] + vstr.32 s5, [fp, #-124] + vstr.32 s6, [fp, #-120] + vstr.32 s7, [fp, #-116] + vstr.32 s8, [fp, #-112] + vstr.32 s9, [fp, #-108] + vstr.32 s10, [fp, #-104] + vstr.32 s11, [fp, #-100] + vstr.32 s12, [fp, #-96] + vstr.32 s13, [fp, #-92] + vstr.32 s14, [fp, #-88] + vstr.32 s15, [fp, #-84] + vstr.64 d0, [fp, #-76] + vstr.64 d1, [fp, #-68] + vstr.64 d2, [fp, #-60] + vstr.64 d3, [fp, #-52] + vstr.64 d4, [fp, #-44] + vstr.64 d5, [fp, #-36] + vstr.64 d6, [fp, #-28] + vstr.64 d7, [fp, #-20] + str lr, [fp, #-156] + str ip, [fp, #-188] + sub r0, fp, #188 + str ip, [fp, #-152] + ldr r3, [r4] + str r5, [fp, #-172] + str ip, [fp, #-148] + str ip, [fp, #-168] + strb ip, [fp, #-164] + blx r3 + ldrb r3, [fp, #-164] @ zero_extendqisi2 + cmp r3, #0 + beq .L1 + cmp r3, #1 + beq .L25 + cmp r3, #2 + ldrsbeq r0, [fp, #-180] + beq .L1 + cmp r3, #3 + beq .L25 + cmp r3, #4 + ldrsheq r0, [fp, #-180] + beq .L1 + cmp r3, #5 + ldrheq r0, [fp, #-180] + beq .L1 + cmp r3, #6 + beq .L27 + cmp r3, #7 + beq .L27 + cmp r3, #8 + beq .L27 + cmp r3, #9 + beq .L27 + sub r2, r3, #10 + cmp r2, #1 + bls .L29 + cmp r3, #12 + vldreq.32 s0, [fp, #-180] + beq .L1 + cmp r3, #13 + beq .L30 + cmp r3, #14 + beq .L27 + cmp r3, #15 + bne .L1 + ldr r3, [fp, #-188] + tst r3, #1024 + beq .L1 + ldr r3, [fp, #-160] + cmp r3, #1 + beq .L31 + cmp r3, #2 + ldr r3, [fp, #-168] + ldrheq r0, [r3] + ldrne r0, [r3] +.L1: + sub sp, fp, #12 + @ sp needed + pop {r4, r5, fp, lr} + add sp, sp, #16 + bx lr +.L25: + ldrb r0, [fp, #-180] @ zero_extendqisi2 + sub sp, fp, #12 + @ sp needed + pop {r4, r5, fp, lr} + add sp, sp, #16 + bx lr +.L27: + ldr r0, [fp, #-180] + sub sp, fp, #12 + @ sp needed + pop {r4, r5, fp, lr} + add sp, sp, #16 + bx lr +.L30: + vldr.64 d0, [fp, #-180] + b .L1 +.L29: + ldr r0, [fp, #-180] + ldr r1, [fp, #-176] + b .L1 +.L31: + ldr r3, [fp, #-168] + ldrb r0, [r3] @ zero_extendqisi2 + b .L1 +.L33: + .align 2 +.L32: + .word vacall_function + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 6.5.0" + .section .note.GNU-stack,"",%progbits diff --git a/vacall/vacall-armhf-macro.S b/vacall/vacall-armhf-macro.S new file mode 100644 index 0000000..b9bbb59 --- /dev/null +++ b/vacall/vacall-armhf-macro.S @@ -0,0 +1,305 @@ +#include "asm-arm.h" +#ifdef __PIC__ + .arch armv6 + .eabi_attribute 28, 1 + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 1 + .eabi_attribute 30, 2 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .text + .align 2 + .global C(vacall_receiver) + .syntax unified + .arm + .fpu vfpv3-d16 + .type vacall_receiver, %function +FUNBEGIN(vacall_receiver) + // args = 20, pretend = 16, frame = 176 + // frame_needed = 1, uses_anonymous_args = 0 + sub sp, sp, $16 + mov ip, $0 + push {r4, r5, r6, fp, lr} + add fp, sp, $16 + ldr r4, L(32) + ldr r5, L(32)+4 + add lr, fp, $4 +L(PIC0): + add r4, pc, r4 + add r6, fp, $20 + sub sp, sp, $180 + stm lr, {r0, r1, r2, r3} + vstr.32 s0, [fp, $-152] + vstr.32 s1, [fp, $-148] + vstr.32 s2, [fp, $-144] + vstr.32 s3, [fp, $-140] + vstr.32 s4, [fp, $-136] + vstr.32 s5, [fp, $-132] + vstr.32 s6, [fp, $-128] + vstr.32 s7, [fp, $-124] + vstr.32 s8, [fp, $-120] + vstr.32 s9, [fp, $-116] + vstr.32 s10, [fp, $-112] + vstr.32 s11, [fp, $-108] + vstr.32 s12, [fp, $-104] + vstr.32 s13, [fp, $-100] + vstr.32 s14, [fp, $-96] + vstr.32 s15, [fp, $-92] + vstr.64 d0, [fp, $-84] + vstr.64 d1, [fp, $-76] + vstr.64 d2, [fp, $-68] + vstr.64 d3, [fp, $-60] + vstr.64 d4, [fp, $-52] + vstr.64 d5, [fp, $-44] + vstr.64 d6, [fp, $-36] + vstr.64 d7, [fp, $-28] + str lr, [fp, $-164] + str ip, [fp, $-196] + str ip, [fp, $-160] + str r6, [fp, $-180] + str ip, [fp, $-156] + str ip, [fp, $-176] + strb ip, [fp, $-172] + ldr r2, [r4, r5] + mov r3, r4 + sub r0, fp, $196 + ldr r3, [r2] + blx r3 + ldrb r3, [fp, $-172] // zero_extendqisi2 + cmp r3, $0 + beq L(1) + cmp r3, $1 + beq L(25) + cmp r3, $2 + ldrsbeq r0, [fp, $-188] + beq L(1) + cmp r3, $3 + beq L(25) + cmp r3, $4 + ldrsheq r0, [fp, $-188] + beq L(1) + cmp r3, $5 + ldrheq r0, [fp, $-188] + beq L(1) + cmp r3, $6 + beq L(27) + cmp r3, $7 + beq L(27) + cmp r3, $8 + beq L(27) + cmp r3, $9 + beq L(27) + sub r2, r3, $10 + cmp r2, $1 + bls L(29) + cmp r3, $12 + vldreq.32 s0, [fp, $-188] + beq L(1) + cmp r3, $13 + beq L(30) + cmp r3, $14 + beq L(27) + cmp r3, $15 + bne L(1) + ldr r3, [fp, $-196] + tst r3, $1024 + beq L(1) + ldr r3, [fp, $-168] + cmp r3, $1 + beq L(31) + cmp r3, $2 + ldr r3, [fp, $-176] + ldrheq r0, [r3] + ldrne r0, [r3] +L(1): + sub sp, fp, $16 + // sp needed + pop {r4, r5, r6, fp, lr} + add sp, sp, $16 + bx lr +L(25): + ldrb r0, [fp, $-188] // zero_extendqisi2 + sub sp, fp, $16 + // sp needed + pop {r4, r5, r6, fp, lr} + add sp, sp, $16 + bx lr +L(27): + ldr r0, [fp, $-188] + sub sp, fp, $16 + // sp needed + pop {r4, r5, r6, fp, lr} + add sp, sp, $16 + bx lr +L(30): + vldr.64 d0, [fp, $-188] + b L(1) +L(29): + ldr r0, [fp, $-188] + ldr r1, [fp, $-184] + b L(1) +L(31): + ldr r3, [fp, $-176] + ldrb r0, [r3] // zero_extendqisi2 + b L(1) +L(33): + .align 2 +L(32): + .word _GLOBAL_OFFSET_TABLE_-(L(PIC0)+8) + .word C(vacall_function)(GOT) + FUNEND(vacall_receiver) +#else + .arch armv6 + .eabi_attribute 28, 1 + .eabi_attribute 20, 1 + .eabi_attribute 21, 1 + .eabi_attribute 23, 3 + .eabi_attribute 24, 1 + .eabi_attribute 25, 1 + .eabi_attribute 26, 1 + .eabi_attribute 30, 2 + .eabi_attribute 34, 1 + .eabi_attribute 18, 4 + .text + .align 2 + .global C(vacall_receiver) + .syntax unified + .arm + .fpu vfpv3-d16 + .type vacall_receiver, %function +FUNBEGIN(vacall_receiver) + // args = 20, pretend = 16, frame = 176 + // frame_needed = 1, uses_anonymous_args = 0 + sub sp, sp, $16 + mov ip, $0 + push {r4, r5, fp, lr} + add fp, sp, $12 + ldr r4, L(32) + add lr, fp, $4 + add r5, fp, $20 + sub sp, sp, $176 + stm lr, {r0, r1, r2, r3} + vstr.32 s0, [fp, $-144] + vstr.32 s1, [fp, $-140] + vstr.32 s2, [fp, $-136] + vstr.32 s3, [fp, $-132] + vstr.32 s4, [fp, $-128] + vstr.32 s5, [fp, $-124] + vstr.32 s6, [fp, $-120] + vstr.32 s7, [fp, $-116] + vstr.32 s8, [fp, $-112] + vstr.32 s9, [fp, $-108] + vstr.32 s10, [fp, $-104] + vstr.32 s11, [fp, $-100] + vstr.32 s12, [fp, $-96] + vstr.32 s13, [fp, $-92] + vstr.32 s14, [fp, $-88] + vstr.32 s15, [fp, $-84] + vstr.64 d0, [fp, $-76] + vstr.64 d1, [fp, $-68] + vstr.64 d2, [fp, $-60] + vstr.64 d3, [fp, $-52] + vstr.64 d4, [fp, $-44] + vstr.64 d5, [fp, $-36] + vstr.64 d6, [fp, $-28] + vstr.64 d7, [fp, $-20] + str lr, [fp, $-156] + str ip, [fp, $-188] + sub r0, fp, $188 + str ip, [fp, $-152] + ldr r3, [r4] + str r5, [fp, $-172] + str ip, [fp, $-148] + str ip, [fp, $-168] + strb ip, [fp, $-164] + blx r3 + ldrb r3, [fp, $-164] // zero_extendqisi2 + cmp r3, $0 + beq L(1) + cmp r3, $1 + beq L(25) + cmp r3, $2 + ldrsbeq r0, [fp, $-180] + beq L(1) + cmp r3, $3 + beq L(25) + cmp r3, $4 + ldrsheq r0, [fp, $-180] + beq L(1) + cmp r3, $5 + ldrheq r0, [fp, $-180] + beq L(1) + cmp r3, $6 + beq L(27) + cmp r3, $7 + beq L(27) + cmp r3, $8 + beq L(27) + cmp r3, $9 + beq L(27) + sub r2, r3, $10 + cmp r2, $1 + bls L(29) + cmp r3, $12 + vldreq.32 s0, [fp, $-180] + beq L(1) + cmp r3, $13 + beq L(30) + cmp r3, $14 + beq L(27) + cmp r3, $15 + bne L(1) + ldr r3, [fp, $-188] + tst r3, $1024 + beq L(1) + ldr r3, [fp, $-160] + cmp r3, $1 + beq L(31) + cmp r3, $2 + ldr r3, [fp, $-168] + ldrheq r0, [r3] + ldrne r0, [r3] +L(1): + sub sp, fp, $12 + // sp needed + pop {r4, r5, fp, lr} + add sp, sp, $16 + bx lr +L(25): + ldrb r0, [fp, $-180] // zero_extendqisi2 + sub sp, fp, $12 + // sp needed + pop {r4, r5, fp, lr} + add sp, sp, $16 + bx lr +L(27): + ldr r0, [fp, $-180] + sub sp, fp, $12 + // sp needed + pop {r4, r5, fp, lr} + add sp, sp, $16 + bx lr +L(30): + vldr.64 d0, [fp, $-180] + b L(1) +L(29): + ldr r0, [fp, $-180] + ldr r1, [fp, $-176] + b L(1) +L(31): + ldr r3, [fp, $-168] + ldrb r0, [r3] // zero_extendqisi2 + b L(1) +L(33): + .align 2 +L(32): + .word C(vacall_function) + FUNEND(vacall_receiver) +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/vacall/vacall-armhf.c b/vacall/vacall-armhf.c new file mode 100644 index 0000000..a92ba78 --- /dev/null +++ b/vacall/vacall-armhf.c @@ -0,0 +1,195 @@ +/* vacall function for arm CPU with -mfloat-abi=hard */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +typedef struct { void (*vacall_function) (void*,va_alist); void* arg; } env_t; +#endif + +/* armhf passes up to 16 float arguments and up to 8 double arguments + in floating-point registers. */ +register float farg0 __asm__("s0"); +register float farg1 __asm__("s1"); +register float farg2 __asm__("s2"); +register float farg3 __asm__("s3"); +register float farg4 __asm__("s4"); +register float farg5 __asm__("s5"); +register float farg6 __asm__("s6"); +register float farg7 __asm__("s7"); +register float farg8 __asm__("s8"); +register float farg9 __asm__("s9"); +register float farg10 __asm__("s10"); +register float farg11 __asm__("s11"); +register float farg12 __asm__("s12"); +register float farg13 __asm__("s13"); +register float farg14 __asm__("s14"); +register float farg15 __asm__("s15"); +register double darg0 __asm__("d0"); /* overlaps s0,s1 */ +register double darg1 __asm__("d1"); /* overlaps s2,s3 */ +register double darg2 __asm__("d2"); /* overlaps s4,s5 */ +register double darg3 __asm__("d3"); /* overlaps s6,s7 */ +register double darg4 __asm__("d4"); /* overlaps s8,s9 */ +register double darg5 __asm__("d5"); /* overlaps s10,s11 */ +register double darg6 __asm__("d6"); /* overlaps s12,s13 */ +register double darg7 __asm__("d7"); /* overlaps s14,s15 */ +register __varword iret __asm__("r0"); +register __varword iret2 __asm__("r1"); +register float fret __asm__("s0"); +register double dret __asm__("d0"); + +#ifndef REENTRANT +/* The ARM ABI requires that the first 4 general-purpose argument words are + being passed in registers, even if these words belong to a struct. No room + is allocated for these register words on the stack by the caller, but the + callee allocates room for them - at the right place in the stack frame, + that is, above the usual {fp, sp, retaddr, pc} combo - if and only if + they are part of a larger struct that extends to the stack and the address + of this struct is taken. */ +struct gpargsequence { + __vaword word1; /* r0 */ + __vaword word2; /* r1 */ + __vaword word3; /* r2 */ + __vaword word4; /* r3 */ + __vaword firststackword; +}; + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (struct gpargsequence gpargs) +#else /* REENTRANT */ +/* The first 4 general-purpose argument words have already been pushed to the + stack by the trampoline. We can ignore them here. */ +void /* the return type is variable, not void! */ +vacall_receiver (__vaword ignored1, __vaword ignored2, __vaword ignored3, __vaword ignored4, + env_t* env, __vaword filler, __vaword saved_fp, __vaword saved_sp, __vaword saved_lr, __vaword saved_pc, + __vaword firstword) +#endif +{ + __va_alist list; + /* Save the floating point argument registers. */ + list.farg[0] = farg0; + list.farg[1] = farg1; + list.farg[2] = farg2; + list.farg[3] = farg3; + list.farg[4] = farg4; + list.farg[5] = farg5; + list.farg[6] = farg6; + list.farg[7] = farg7; + list.farg[8] = farg8; + list.farg[9] = farg9; + list.farg[10] = farg10; + list.farg[11] = farg11; + list.farg[12] = farg12; + list.farg[13] = farg13; + list.farg[14] = farg14; + list.farg[15] = farg15; + list.darg[0] = darg0; + list.darg[1] = darg1; + list.darg[2] = darg2; + list.darg[3] = darg3; + list.darg[4] = darg4; + list.darg[5] = darg5; + list.darg[6] = darg6; + list.darg[7] = darg7; + /* Prepare the va_alist. */ + list.flags = 0; +#ifndef REENTRANT + list.iarg = (__vaword*)&gpargs; +#else /* REENTRANT */ + list.iarg = (__vaword*)&firstword; +#endif + list.aptr = (long)(list.iarg + __VA_IARG_NUM); + list.ianum = 0; + list.fanum = 0; + list.raddr = (void*)0; + list.rtype = __VAvoid; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong || list.rtype == __VAulonglong) { + iret = ((__varword *) &list.tmp._longlong)[0]; + iret2 = ((__varword *) &list.tmp._longlong)[1]; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + /* NB: On arm, all structure sizes are divisible by 4. */ + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + if (list.rsize == sizeof(char)) { /* can't occur */ + iret = *(unsigned char *) list.raddr; + } else + if (list.rsize == sizeof(short)) { /* can't occur */ + iret = *(unsigned short *) list.raddr; + } else + iret = *(unsigned int *) list.raddr; /* struct of size 3 :) */ + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-hppa-linux.s b/vacall/vacall-hppa-linux.s new file mode 100644 index 0000000..fb9c5be --- /dev/null +++ b/vacall/vacall-hppa-linux.s @@ -0,0 +1,182 @@ + .LEVEL 1.1 + .text + .align 4 +.globl vacall_receiver + .type vacall_receiver,@function +vacall_receiver: + .PROC + .CALLINFO FRAME=192,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 + .ENTRY + copy %r3,%r1 + stw %r2,-20(%r30) + copy %r30,%r3 + stwm %r1,192(%r30) + addil LR'vacall_function-$global$,%r27 + ldo -32(%r3),%r2 + ldo 16(%r3),%r22 + sub %r22,%r2,%r20 + ldo 104(%r3),%r19 + ldo 72(%r3),%r21 + ldo 80(%r20),%r31 + fstds %fr5,-16(%r19) + ldo 64(%r20),%r20 + ldo -48(%r3),%r19 + stw %r26,-36(%r3) + copy %r22,%r26 + stw %r20,56(%r3) + fstws %fr7L,-8(%r21) + stw %r19,52(%r3) + stw %r31,60(%r3) + stw %r25,-40(%r3) + stw %r24,-44(%r3) + stw %r23,-48(%r3) + fstds %fr7,8(%r21) + fstws %fr4L,4(%r21) + fstws %fr5L,0(%r21) + fstws %fr6L,-4(%r21) + stw %r0,16(%r3) + stw %r2,32(%r3) + stw %r0,36(%r3) + stw %r0,40(%r3) + stw %r28,48(%r3) + ldw RR'vacall_function-$global$(%r1),%r22 + .CALL ARGW0=GR + bl $$dyncall,%r31 + copy %r31,%r2 + ldw 40(%r3),%r20 + comib,= 0,%r20,.L48 + ldw -20(%r3),%r2 + comib,= 1,%r20,.L49 + ldb 24(%r3),%r19 + comib,=,n 2,%r20,.L49 + comib,=,n 3,%r20,.L43 + comib,=,n 4,%r20,.L44 + comib,=,n 5,%r20,.L45 + comib,=,n 6,%r20,.L41 + comib,=,n 7,%r20,.L41 + comib,=,n 8,%r20,.L41 + comib,= 9,%r20,.L41 + ldo -10(%r20),%r19 + comib,<<,n 1,%r19,.L22 + ldw 24(%r3),%r28 +.L40: + ldw 28(%r3),%r29 +.L1: + ldw -20(%r3),%r2 +.L48: + ldo 64(%r3),%r30 + bv %r0(%r2) + ldwm -64(%r30),%r3 +.L22: + comib,= 12,%r20,.L46 + ldo 40(%r3),%r19 + comib,=,n 13,%r20,.L47 + comib,=,n 14,%r20,.L1 + ldw 24(%r3),%r28 + comib,<> 15,%r20,.L48 + ldw -20(%r3),%r2 + ldw 16(%r3),%r19 + bb,>= %r19,30,.L1 + ldw 44(%r3),%r2 + ldo -1(%r2),%r19 + comib,<< 7,%r19,.L1 + ldw 36(%r3),%r19 + extru %r19,31,2,%r22 + copy %r19,%r31 + depi 0,31,2,%r31 + comib,<< 4,%r2,.L33 + addl %r22,%r2,%r1 + zdep %r22,28,29,%r22 + mtsar %r22 + zvdepi 2,32,%r19 + comib,<< 4,%r1,.L34 + ldo -1(%r19),%r22 + ldw 0(%r31),%r19 + zdep %r1,28,29,%r20 + ldo -1(%r20),%r20 + and %r19,%r22,%r19 + mtsar %r20 + vextrs %r19,32,%r19 + movb,tr %r19,%r28,.L48 + ldw -20(%r3),%r2 +.L34: + ldw 0(%r31),%r19 + zdep %r1,28,29,%r21 + ldw 4(%r31),%r20 + and %r19,%r22,%r19 + ldo -33(%r21),%r31 + subi 63,%r21,%r21 + mtsar %r21 + zvdep %r19,32,%r19 + mtsar %r31 + vextrs %r20,32,%r20 +.L39: + b .L1 + or %r20,%r19,%r28 +.L33: + zdep %r22,28,29,%r22 + mtsar %r22 + zvdepi 2,32,%r19 + comib,<< 8,%r1,.L37 + ldo -1(%r19),%r2 + ldw 0(%r31),%r21 + zdep %r1,29,30,%r19 + and %r21,%r2,%r21 + ldw 4(%r31),%r22 + subi 47,%r19,%r2 + zdep %r1,28,29,%r19 + mtsar %r2 + ldo -33(%r19),%r19 + zvdep %r21,32,%r20 + zvdep %r20,32,%r20 + mtsar %r19 + vextrs %r22,32,%r22 + vextrs %r21,32,%r21 + movb,tr %r21,%r28,.L1 + or %r20,%r22,%r29 +.L37: + ldw 0(%r31),%r20 + zdep %r1,28,29,%r22 + ldw 8(%r31),%r21 + and %r20,%r2,%r20 + ldo -65(%r22),%r2 + ldw 4(%r31),%r19 + mtsar %r2 + subi 95,%r22,%r31 + vextrs %r21,32,%r21 + mtsar %r31 + zvdep %r19,32,%r22 + zvdep %r20,32,%r20 + or %r22,%r21,%r29 + mtsar %r2 + b .L39 + vextrs %r19,32,%r19 +.L41: + b .L1 + ldw 24(%r3),%r28 +.L47: + ldw 24(%r3),%r28 + b .L40 + fldds -16(%r19),%fr4 +.L46: + ldw 24(%r3),%r28 + b .L1 + fldws -16(%r19),%fr4L +.L45: + b .L1 + ldh 24(%r3),%r28 +.L44: + ldh 24(%r3),%r19 + b .L1 + extrs %r19,31,16,%r28 +.L43: + b .L1 + ldb 24(%r3),%r28 +.L49: + b .L1 + extrs %r19,31,8,%r28 + .EXIT + .PROCEND +.Lfe1: + .size vacall_receiver,.Lfe1-vacall_receiver + .ident "GCC: (GNU) 3.1" diff --git a/vacall/vacall-hppa-macro.S b/vacall/vacall-hppa-macro.S new file mode 100644 index 0000000..da42725 --- /dev/null +++ b/vacall/vacall-hppa-macro.S @@ -0,0 +1,188 @@ +#include "asm-hppa.h" + .LEVEL 1.1 + IMPORT_MILLICODE($$dyncall) + TEXT1() + TEXT2() + .align 4 +GLOBL(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) +DEF(vacall_receiver) + .PROC + .CALLINFO FRAME=192,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 + .ENTRY + copy %r3,%r1 + stw %r2,-20(%r30) + copy %r30,%r3 + stwm %r1,192(%r30) + addil LR!vacall_function-$global$,%r27 + ldo -32(%r3),%r2 + ldo 16(%r3),%r22 + sub %r22,%r2,%r20 + ldo 104(%r3),%r19 + ldo 72(%r3),%r21 + ldo 80(%r20),%r31 + fstds %fr5,-16(%r19) + ldo 64(%r20),%r20 + ldo -48(%r3),%r19 + stw %r26,-36(%r3) + copy %r22,%r26 + stw %r20,56(%r3) + fstws %fr7L,-8(%r21) + stw %r19,52(%r3) + stw %r31,60(%r3) + stw %r25,-40(%r3) + stw %r24,-44(%r3) + stw %r23,-48(%r3) + fstds %fr7,8(%r21) + fstws %fr4L,4(%r21) + fstws %fr5L,0(%r21) + fstws %fr6L,-4(%r21) + stw %r0,16(%r3) + stw %r2,32(%r3) + stw %r0,36(%r3) + stw %r0,40(%r3) + stw %r28,48(%r3) + ldw RR!vacall_function-$global$(%r1),%r22 + .CALL ARGW0=GR + bl $$dyncall,%r31 + copy %r31,%r2 + ldw 40(%r3),%r20 + comib,= 0,%r20,L(48) + ldw -20(%r3),%r2 + comib,= 1,%r20,L(49) + ldb 24(%r3),%r19 + comib,=,n 2,%r20,L(49) + comib,=,n 3,%r20,L(43) + comib,=,n 4,%r20,L(44) + comib,=,n 5,%r20,L(45) + comib,=,n 6,%r20,L(41) + comib,=,n 7,%r20,L(41) + comib,=,n 8,%r20,L(41) + comib,= 9,%r20,L(41) + ldo -10(%r20),%r19 + comib,<<,n 1,%r19,L(22) + ldw 24(%r3),%r28 +DEF(L(40)) + ldw 28(%r3),%r29 +DEF(L(1)) + ldw -20(%r3),%r2 +DEF(L(48)) + ldo 64(%r3),%r30 + bv %r0(%r2) + ldwm -64(%r30),%r3 +DEF(L(22)) + comib,= 12,%r20,L(46) + ldo 40(%r3),%r19 + comib,=,n 13,%r20,L(47) + comib,=,n 14,%r20,L(1) + ldw 24(%r3),%r28 + comib,<> 15,%r20,L(48) + ldw -20(%r3),%r2 + ldw 16(%r3),%r19 + bb,>= %r19,30,L(1) + ldw 44(%r3),%r2 + ldo -1(%r2),%r19 + comib,<< 7,%r19,L(1) + ldw 36(%r3),%r19 + extru %r19,31,2,%r22 + copy %r19,%r31 + depi 0,31,2,%r31 + comib,<< 4,%r2,L(33) + addl %r22,%r2,%r1 + zdep %r22,28,29,%r22 + mtsar %r22 + zvdepi 2,32,%r19 + comib,<< 4,%r1,L(34) + ldo -1(%r19),%r22 + ldw 0(%r31),%r19 + zdep %r1,28,29,%r20 + ldo -1(%r20),%r20 + and %r19,%r22,%r19 + mtsar %r20 + vextrs %r19,32,%r19 + movb,tr %r19,%r28,L(48) + ldw -20(%r3),%r2 +DEF(L(34)) + ldw 0(%r31),%r19 + zdep %r1,28,29,%r21 + ldw 4(%r31),%r20 + and %r19,%r22,%r19 + ldo -33(%r21),%r31 + subi 63,%r21,%r21 + mtsar %r21 + zvdep %r19,32,%r19 + mtsar %r31 + vextrs %r20,32,%r20 +DEF(L(39)) + b L(1) + or %r20,%r19,%r28 +DEF(L(33)) + zdep %r22,28,29,%r22 + mtsar %r22 + zvdepi 2,32,%r19 + comib,<< 8,%r1,L(37) + ldo -1(%r19),%r2 + ldw 0(%r31),%r21 + zdep %r1,29,30,%r19 + and %r21,%r2,%r21 + ldw 4(%r31),%r22 + subi 47,%r19,%r2 + zdep %r1,28,29,%r19 + mtsar %r2 + ldo -33(%r19),%r19 + zvdep %r21,32,%r20 + zvdep %r20,32,%r20 + mtsar %r19 + vextrs %r22,32,%r22 + vextrs %r21,32,%r21 + movb,tr %r21,%r28,L(1) + or %r20,%r22,%r29 +DEF(L(37)) + ldw 0(%r31),%r20 + zdep %r1,28,29,%r22 + ldw 8(%r31),%r21 + and %r20,%r2,%r20 + ldo -65(%r22),%r2 + ldw 4(%r31),%r19 + mtsar %r2 + subi 95,%r22,%r31 + vextrs %r21,32,%r21 + mtsar %r31 + zvdep %r19,32,%r22 + zvdep %r20,32,%r20 + or %r22,%r21,%r29 + mtsar %r2 + b L(39) + vextrs %r19,32,%r19 +DEF(L(41)) + b L(1) + ldw 24(%r3),%r28 +DEF(L(47)) + ldw 24(%r3),%r28 + b L(40) + fldds -16(%r19),%fr4 +DEF(L(46)) + ldw 24(%r3),%r28 + b L(1) + fldws -16(%r19),%fr4L +DEF(L(45)) + b L(1) + ldh 24(%r3),%r28 +DEF(L(44)) + ldh 24(%r3),%r19 + b L(1) + extrs %r19,31,16,%r28 +DEF(L(43)) + b L(1) + ldb 24(%r3),%r28 +DEF(L(49)) + b L(1) + extrs %r19,31,8,%r28 + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(vacall_receiver) +IMPORT_DATA(vacall_function) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-hppa.c b/vacall/vacall-hppa.c new file mode 100644 index 0000000..18fbb90 --- /dev/null +++ b/vacall/vacall-hppa.c @@ -0,0 +1,256 @@ +/* vacall function for hppa CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +/*--------------------------------------------------------------------------- + HPPA Argument Passing Conventions: + + The calling conventions for anonymous functions and for explicitly named + functions are different. Only the convention for explicitly named functions + matters here. + + All arguments, except the first 4 words, are passed on the stack + - growing down! - with word alignment. Doubles take two words and force + double alignment. Structures args are passed as true structures embedded + in the argument stack. They force double alignment and - if they don't + fit entirely in the 4 register words - are passed in memory. + The first 2 words are passed like this: + %r26 = first integer arg, %r25 = second integer arg, or + %fr4L = first float arg, %fr5L = second float arg, or + %fr5 = double arg. + Similarly for the next 2 words, passed in %r24 and %r23, or + %fr6L and %fr7L, or + %fr7. + + To return a structure, the called function copies the return value to + the address supplied in register "%r28". +---------------------------------------------------------------------------*/ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("%r29"); +#endif +register void* sret __asm__("%r28"); +register __varword arg1 __asm__("%r26"); +register __varword arg2 __asm__("%r25"); +register __varword arg3 __asm__("%r24"); +register __varword arg4 __asm__("%r23"); +register float farg1 __asm__("%fr4"); /* fr4L */ +register float farg2 __asm__("%fr5"); /* fr5L */ +register float farg3 __asm__("%fr6"); /* fr6L */ +register float farg4 __asm__("%fr7"); /* fr7L */ +register double darg1 __asm__("%fr5"); +register double darg2 __asm__("%fr7"); +register int iret __asm__("%r28"); +register float fret __asm__("%fr4"); /* fr4L */ +register double dret __asm__("%fr4"); +register __varword iret1 __asm__("%r28"); +register __varword iret2 __asm__("%r29"); + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword firstword) +{ + /* gcc-2.6.3 source says: When a parameter is passed in a register, + * stack space is still allocated for it. + */ + /* Note about stack offsets (see vacall-hppa.s): + * &firstword = %r30 - 244, &word4 = %r30 - 240, ..., &word1 = %r30 - 228, + */ + __va_alist list; + /* Move the arguments passed in registers to their stack locations. */ + (&firstword)[4] = word1; + (&firstword)[3] = word2; + (&firstword)[2] = word3; + (&firstword)[1] = word4; + list.darg[1] = darg1; + list.darg[0] = darg2; + list.farg[3] = farg1; + list.farg[2] = farg2; + list.farg[1] = farg3; + list.farg[0] = farg4; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)(&firstword + 5); + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.structraddr = sret; + list.memargptr = (long)(&firstword + 1); + list.farg_offset = (long)&list.farg[4] - list.aptr; + list.darg_offset = (long)&list.darg[2] - list.aptr; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong || list.rtype == __VAulonglong) { + iret1 = ((__varword *) &list.tmp._longlong)[0]; + iret2 = ((__varword *) &list.tmp._longlong)[1]; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + iret1 = list.tmp._words[0]; /* HP cc generates a RTNVAL=GR call */ + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + iret1 = list.tmp._words[0]; /* HP cc generates a RTNVAL=GR call */ + iret2 = list.tmp._words[1]; /* i.e. result is expected in r28,r29 */ + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_SMALL_STRUCT_RETURN) { + /* cc, c89 and gcc >= 2.7 return structs of size <= 8 in registers. */ + /* This is really weird code, unlike all other big-endian platforms. */ + if (list.rsize > 0 && list.rsize <= 8) { + #if 0 /* Unoptimized */ + if (list.rsize == 1) { + iret = ((unsigned char *) list.raddr)[0]; + } else + if (list.rsize == 2) { + iret = (((unsigned char *) list.raddr)[0] << 8) + | ((unsigned char *) list.raddr)[1]; + } else + if (list.rsize == 3) { + iret = (((unsigned char *) list.raddr)[0] << 16) + | (((unsigned char *) list.raddr)[1] << 8) + | ((unsigned char *) list.raddr)[2]; + } else + if (list.rsize == 4) { + iret = (((unsigned char *) list.raddr)[0] << 24) + | (((unsigned char *) list.raddr)[1] << 16) + | (((unsigned char *) list.raddr)[2] << 8) + | ((unsigned char *) list.raddr)[3]; + } else + if (list.rsize == 5) { + iret1 = ((unsigned char *) list.raddr)[0]; + iret2 = (((unsigned char *) list.raddr)[1] << 24) + | (((unsigned char *) list.raddr)[2] << 16) + | (((unsigned char *) list.raddr)[3] << 8) + | ((unsigned char *) list.raddr)[4]; + } else + if (list.rsize == 6) { + iret1 = (((unsigned char *) list.raddr)[0] << 8) + | ((unsigned char *) list.raddr)[1]; + iret2 = (((unsigned char *) list.raddr)[2] << 24) + | (((unsigned char *) list.raddr)[3] << 16) + | (((unsigned char *) list.raddr)[4] << 8) + | ((unsigned char *) list.raddr)[5]; + } else + if (list.rsize == 7) { + iret1 = (((unsigned char *) list.raddr)[0] << 16) + | (((unsigned char *) list.raddr)[1] << 8) + | ((unsigned char *) list.raddr)[2]; + iret2 = (((unsigned char *) list.raddr)[3] << 24) + | (((unsigned char *) list.raddr)[4] << 16) + | (((unsigned char *) list.raddr)[5] << 8) + | ((unsigned char *) list.raddr)[6]; + } else + if (list.rsize == 8) { + iret1 = (((unsigned char *) list.raddr)[0] << 24) + | (((unsigned char *) list.raddr)[1] << 16) + | (((unsigned char *) list.raddr)[2] << 8) + | ((unsigned char *) list.raddr)[3]; + iret2 = (((unsigned char *) list.raddr)[4] << 24) + | (((unsigned char *) list.raddr)[5] << 16) + | (((unsigned char *) list.raddr)[6] << 8) + | ((unsigned char *) list.raddr)[7]; + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 2*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__varword) */ + if (count <= sizeof(__varword)) { + /* Assign iret. */ + __varword mask0 = ((__varword)2 << (sizeof(__varword)*8-start_offset*8-1)) - 1; + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + iret = (wordaddr[0] & mask0) >> (sizeof(__varword)*8-end_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + iret = ((wordaddr[0] & mask0) << (end_offset*8-sizeof(__varword)*8)) + | (wordaddr[1] >> (2*sizeof(__varword)*8-end_offset*8)); + } + } else { + /* Assign iret, iret2. */ + __varword mask0 = ((__varword)2 << (sizeof(__varword)*8-start_offset*8-1)) - 1; + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + iret = (wordaddr[0] & mask0) >> (2*sizeof(__varword)*8-end_offset*8); + iret2 = ((wordaddr[0] & mask0) << (end_offset*4-sizeof(__varword)*4) << (end_offset*4-sizeof(__varword)*4)) + | (wordaddr[1] >> (2*sizeof(__varword)*8-end_offset*8)); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + iret = ((wordaddr[0] & mask0) << (end_offset*8-2*sizeof(__varword)*8)) + | (wordaddr[1] >> (3*sizeof(__varword)*8-end_offset*8)); + iret2 = (wordaddr[1] << (end_offset*8-2*sizeof(__varword)*8)) + | (wordaddr[2] >> (3*sizeof(__varword)*8-end_offset*8)); + } + } + #endif + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-hppa64-linux.s b/vacall/vacall-hppa64-linux.s new file mode 100644 index 0000000..8d1317f --- /dev/null +++ b/vacall/vacall-hppa64-linux.s @@ -0,0 +1,225 @@ + .LEVEL 2.0w + .text + .align 8 +.globl vacall_receiver + .type vacall_receiver,@function +vacall_receiver: + .PROC + .CALLINFO FRAME=384,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=8 + .ENTRY + copy %r3,%r1 + std %r2,-16(%r30) + copy %r30,%r3 + std,ma %r1,384(%r30) + std %r4,224(%r3) + copy %r27,%r4 + std %r8,192(%r3) + std %r7,200(%r3) + std %r6,208(%r3) + std %r5,216(%r3) + std %r26,-64(%r29) + std %r19,-8(%r29) + std %r25,-56(%r29) + std %r24,-48(%r29) + std %r23,-40(%r29) + std %r22,-32(%r29) + std %r21,-24(%r29) + std %r20,-16(%r29) +#APP + fstw %fr4R,88(%r3) + fstw %fr5R,92(%r3) + fstw %fr6R,96(%r3) + fstw %fr7R,100(%r3) + fstw %fr8R,104(%r3) + fstw %fr9R,108(%r3) + fstw %fr10R,112(%r3) + fstw %fr11R,116(%r3) +#NO_APP + fstd %fr10,168(%r3) + addil LT'vacall_function,%r27 + ldo -64(%r29),%r31 + ldd RT'vacall_function(%r1),%r1 + ldo 16(%r3),%r26 + std %r31,40(%r3) + std %r29,80(%r3) + ldo -16(%r30),%r29 + ldd 0(%r1),%r31 + fstd %fr11,176(%r3) + fstd %fr4,120(%r3) + fstd %fr5,128(%r3) + fstd %fr6,136(%r3) + fstd %fr7,144(%r3) + fstd %fr8,152(%r3) + fstd %fr9,160(%r3) + stw %r0,16(%r3) + std %r0,48(%r3) + stw %r0,56(%r3) + ldd 16(%r31),%r2 + ldd 24(%r31),%r27 + bve,l (%r2),%r2 + nop + ldw 56(%r3),%r31 + cmpib,= 0,%r31,.L1 + copy %r4,%r27 + cmpib,=,n 1,%r31,.L43 + cmpib,=,n 2,%r31,.L43 + cmpib,=,n 3,%r31,.L44 + cmpib,=,n 4,%r31,.L45 + cmpib,=,n 5,%r31,.L46 + cmpib,=,n 6,%r31,.L47 + cmpib,=,n 7,%r31,.L41 + cmpib,=,n 8,%r31,.L40 + cmpib,=,n 10,%r31,.L40 + cmpib,=,n 9,%r31,.L40 + cmpib,=,n 11,%r31,.L40 + cmpib,=,n 12,%r31,.L48 + cmpib,=,n 13,%r31,.L49 + cmpib,=,n 14,%r31,.L40 + cmpib,= 15,%r31,.L50 + ldw 16(%r3),%r31 +.L1: + ldd -16(%r3),%r2 + ldd 192(%r3),%r8 + ldd 200(%r3),%r7 + ldd 208(%r3),%r6 + ldd 216(%r3),%r5 + ldd 224(%r3),%r4 + ldo 64(%r3),%r30 + bve (%r2) + ldd,mb -64(%r30),%r3 +.L50: + extrd,u %r31,53+1-1,1,%r31 + cmpib,= 0,%r31,.L1 + ldd 48(%r3),%r28 + ldd 48(%r3),%r31 + ldd 64(%r3),%r2 + extrd,u %r31,63,3,%r6 + copy %r31,%r1 + depdi 0,63,3,%r1 + cmpib,*<< 8,%r2,.L32 + add,l %r6,%r2,%r4 + cmpib,*<< 8,%r4,.L33 + depd,z %r4,60,61,%r31 + subi 64,%r31,%r31 + ldd 0(%r1),%r2 + extrd,s %r31,63,32,%r31 + mtsarcm %r31 + depd,z %r6,60,61,%r4 + depdi,z 1,%sar,64,%r31 + mtsarcm %r4 + sub %r0,%r31,%r31 + and %r2,%r31,%r2 + depd,z %r2,%sar,64,%r2 + b .L1 + copy %r2,%r28 +.L33: + subi 128,%r31,%r31 + depd,z %r6,60,61,%r2 + extrd,s %r31,63,32,%r31 + subi 64,%r2,%r5 + mtsarcm %r31 + subi 63,%r2,%r7 + depdi,z 1,%sar,64,%r31 + mtsar %r7 + ldd 8(%r1),%r4 + sub %r0,%r31,%r31 + extrd,s %r5,63,32,%r5 + ldd 0(%r1),%r2 + subi 63,%r5,%r5 + and %r4,%r31,%r4 + depd,z %r2,%sar,64,%r2 + mtsar %r5 + extrd,s %r4,%sar,64,%r4 +.L39: + b .L1 + or %r4,%r2,%r28 +.L32: + ldi 16,%r31 + cmpb,*<< %r31,%r4,.L36 + depd,z %r4,60,61,%r31 + subi 128,%r31,%r31 + depd,z %r6,61,62,%r2 + extrd,s %r31,63,32,%r31 + subi 32,%r2,%r2 + mtsarcm %r31 + extrd,s %r2,63,32,%r2 + depdi,z 1,%sar,64,%r31 + subi 63,%r2,%r7 + ldd 8(%r1),%r4 + sub %r0,%r31,%r31 + mtsar %r7 + ldd 0(%r1),%r5 + and %r4,%r31,%r4 + depd,z %r6,60,61,%r31 + extrd,s %r4,%sar,64,%r2 + subi 63,%r31,%r31 + extrd,s %r2,%sar,64,%r2 + mtsar %r31 + depd,z %r4,%sar,64,%r4 + depd,z %r5,%sar,64,%r5 + copy %r4,%r29 + b .L1 + or %r5,%r2,%r28 +.L36: + subi 192,%r31,%r31 + depd,z %r6,60,61,%r2 + extrd,s %r31,63,32,%r31 + subi 64,%r2,%r6 + mtsarcm %r31 + subi 63,%r2,%r8 + depdi,z 1,%sar,64,%r31 + mtsar %r8 + ldd 8(%r1),%r2 + sub %r0,%r31,%r31 + ldd 16(%r1),%r5 + extrd,s %r6,63,32,%r6 + subi 63,%r6,%r6 + and %r5,%r31,%r5 + ldd 0(%r1),%r4 + depd,z %r2,%sar,64,%r31 + mtsar %r6 + extrd,s %r5,%sar,64,%r5 + mtsar %r8 + depd,z %r4,%sar,64,%r4 + or %r31,%r5,%r29 + mtsar %r6 + b .L39 + extrd,s %r2,%sar,64,%r2 +.L40: + b .L1 + ldd 24(%r3),%r28 +.L49: + b .L40 + fldd 24(%r3),%fr4 +.L48: +#APP + fldw 24(%r3),%fr4R +#NO_APP +.L41: + ldw 24(%r3),%r31 +.L42: + b .L1 + copy %r31,%r28 +.L47: + ldw 24(%r3),%r31 + b .L1 + extrd,s %r31,63,32,%r28 +.L46: + b .L42 + ldh 24(%r3),%r31 +.L45: + ldh 24(%r3),%r31 + b .L1 + extrd,s %r31,63,16,%r28 +.L44: + b .L42 + ldb 24(%r3),%r31 +.L43: + ldb 24(%r3),%r31 + b .L1 + extrd,s %r31,63,8,%r28 + .EXIT + .PROCEND +.Lfe1: + .size vacall_receiver,.Lfe1-vacall_receiver + .ident "GCC: (GNU) 3.1" diff --git a/vacall/vacall-hppa64-macro.S b/vacall/vacall-hppa64-macro.S new file mode 100644 index 0000000..0bf669b --- /dev/null +++ b/vacall/vacall-hppa64-macro.S @@ -0,0 +1,226 @@ +#include "asm-hppa64.h" + .LEVEL 2.0w + TEXT1() + TEXT2() + .align 8 +GLOBL(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) +DEF(vacall_receiver) + .PROC + .CALLINFO FRAME=384,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=8 + .ENTRY + copy %r3,%r1 + std %r2,-16(%r30) + copy %r30,%r3 + std,ma %r1,384(%r30) + std %r4,224(%r3) + copy %r27,%r4 + std %r8,192(%r3) + std %r7,200(%r3) + std %r6,208(%r3) + std %r5,216(%r3) + std %r26,-64(%r29) + std %r19,-8(%r29) + std %r25,-56(%r29) + std %r24,-48(%r29) + std %r23,-40(%r29) + std %r22,-32(%r29) + std %r21,-24(%r29) + std %r20,-16(%r29) + fstw %fr4R,88(%r3) + fstw %fr5R,92(%r3) + fstw %fr6R,96(%r3) + fstw %fr7R,100(%r3) + fstw %fr8R,104(%r3) + fstw %fr9R,108(%r3) + fstw %fr10R,112(%r3) + fstw %fr11R,116(%r3) + fstd %fr10,168(%r3) + addil LT!vacall_function,%r27 + ldo -64(%r29),%r31 + ldd RT!vacall_function(%r1),%r1 + ldo 16(%r3),%r26 + std %r31,40(%r3) + std %r29,80(%r3) + ldo -16(%r30),%r29 + ldd 0(%r1),%r31 + fstd %fr11,176(%r3) + fstd %fr4,120(%r3) + fstd %fr5,128(%r3) + fstd %fr6,136(%r3) + fstd %fr7,144(%r3) + fstd %fr8,152(%r3) + fstd %fr9,160(%r3) + stw %r0,16(%r3) + std %r0,48(%r3) + stw %r0,56(%r3) + ldd 16(%r31),%r2 + ldd 24(%r31),%r27 + bve,l (%r2),%r2 + nop + ldw 56(%r3),%r31 + cmpib,= 0,%r31,L(1) + copy %r4,%r27 + cmpib,=,n 1,%r31,L(43) + cmpib,=,n 2,%r31,L(43) + cmpib,=,n 3,%r31,L(44) + cmpib,=,n 4,%r31,L(45) + cmpib,=,n 5,%r31,L(46) + cmpib,=,n 6,%r31,L(47) + cmpib,=,n 7,%r31,L(41) + cmpib,=,n 8,%r31,L(40) + cmpib,=,n 10,%r31,L(40) + cmpib,=,n 9,%r31,L(40) + cmpib,=,n 11,%r31,L(40) + cmpib,=,n 12,%r31,L(48) + cmpib,=,n 13,%r31,L(49) + cmpib,=,n 14,%r31,L(40) + cmpib,= 15,%r31,L(50) + ldw 16(%r3),%r31 +DEF(L(1)) + ldd -16(%r3),%r2 + ldd 192(%r3),%r8 + ldd 200(%r3),%r7 + ldd 208(%r3),%r6 + ldd 216(%r3),%r5 + ldd 224(%r3),%r4 + ldo 64(%r3),%r30 + bve (%r2) + ldd,mb -64(%r30),%r3 +DEF(L(50)) + extrd,u %r31,53+1-1,1,%r31 + cmpib,= 0,%r31,L(1) + ldd 48(%r3),%r28 + ldd 48(%r3),%r31 + ldd 64(%r3),%r2 + extrd,u %r31,63,3,%r6 + copy %r31,%r1 + depdi 0,63,3,%r1 + cmpib,*<< 8,%r2,L(32) + add,l %r6,%r2,%r4 + cmpib,*<< 8,%r4,L(33) + depd,z %r4,60,61,%r31 + subi 64,%r31,%r31 + ldd 0(%r1),%r2 + extrd,s %r31,63,32,%r31 + mtsarcm %r31 + depd,z %r6,60,61,%r4 + depdi,z 1,%sar,64,%r31 + mtsarcm %r4 + sub %r0,%r31,%r31 + and %r2,%r31,%r2 + depd,z %r2,%sar,64,%r2 + b L(1) + copy %r2,%r28 +DEF(L(33)) + subi 128,%r31,%r31 + depd,z %r6,60,61,%r2 + extrd,s %r31,63,32,%r31 + subi 64,%r2,%r5 + mtsarcm %r31 + subi 63,%r2,%r7 + depdi,z 1,%sar,64,%r31 + mtsar %r7 + ldd 8(%r1),%r4 + sub %r0,%r31,%r31 + extrd,s %r5,63,32,%r5 + ldd 0(%r1),%r2 + subi 63,%r5,%r5 + and %r4,%r31,%r4 + depd,z %r2,%sar,64,%r2 + mtsar %r5 + extrd,s %r4,%sar,64,%r4 +DEF(L(39)) + b L(1) + or %r4,%r2,%r28 +DEF(L(32)) + ldi 16,%r31 + cmpb,*<< %r31,%r4,L(36) + depd,z %r4,60,61,%r31 + subi 128,%r31,%r31 + depd,z %r6,61,62,%r2 + extrd,s %r31,63,32,%r31 + subi 32,%r2,%r2 + mtsarcm %r31 + extrd,s %r2,63,32,%r2 + depdi,z 1,%sar,64,%r31 + subi 63,%r2,%r7 + ldd 8(%r1),%r4 + sub %r0,%r31,%r31 + mtsar %r7 + ldd 0(%r1),%r5 + and %r4,%r31,%r4 + depd,z %r6,60,61,%r31 + extrd,s %r4,%sar,64,%r2 + subi 63,%r31,%r31 + extrd,s %r2,%sar,64,%r2 + mtsar %r31 + depd,z %r4,%sar,64,%r4 + depd,z %r5,%sar,64,%r5 + copy %r4,%r29 + b L(1) + or %r5,%r2,%r28 +DEF(L(36)) + subi 192,%r31,%r31 + depd,z %r6,60,61,%r2 + extrd,s %r31,63,32,%r31 + subi 64,%r2,%r6 + mtsarcm %r31 + subi 63,%r2,%r8 + depdi,z 1,%sar,64,%r31 + mtsar %r8 + ldd 8(%r1),%r2 + sub %r0,%r31,%r31 + ldd 16(%r1),%r5 + extrd,s %r6,63,32,%r6 + subi 63,%r6,%r6 + and %r5,%r31,%r5 + ldd 0(%r1),%r4 + depd,z %r2,%sar,64,%r31 + mtsar %r6 + extrd,s %r5,%sar,64,%r5 + mtsar %r8 + depd,z %r4,%sar,64,%r4 + or %r31,%r5,%r29 + mtsar %r6 + b L(39) + extrd,s %r2,%sar,64,%r2 +DEF(L(40)) + b L(1) + ldd 24(%r3),%r28 +DEF(L(49)) + b L(40) + fldd 24(%r3),%fr4 +DEF(L(48)) + fldw 24(%r3),%fr4R +DEF(L(41)) + ldw 24(%r3),%r31 +DEF(L(42)) + b L(1) + copy %r31,%r28 +DEF(L(47)) + ldw 24(%r3),%r31 + b L(1) + extrd,s %r31,63,32,%r28 +DEF(L(46)) + b L(42) + ldh 24(%r3),%r31 +DEF(L(45)) + ldh 24(%r3),%r31 + b L(1) + extrd,s %r31,63,16,%r28 +DEF(L(44)) + b L(42) + ldb 24(%r3),%r31 +DEF(L(43)) + ldb 24(%r3),%r31 + b L(1) + extrd,s %r31,63,8,%r28 + .EXIT + .PROCEND +DEF(L(fe1)) + FUNEND(vacall_receiver) +IMPORT_DATA(vacall_function) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-hppa64.c b/vacall/vacall-hppa64.c new file mode 100644 index 0000000..6b3c142 --- /dev/null +++ b/vacall/vacall-hppa64.c @@ -0,0 +1,294 @@ +/* vacall function for hppa64 CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("%r31"); +#endif + +register __varword arg1 __asm__("r26"); +register __varword arg2 __asm__("r25"); +register __varword arg3 __asm__("r24"); +register __varword arg4 __asm__("r23"); +register __varword arg5 __asm__("r22"); +register __varword arg6 __asm__("r21"); +register __varword arg7 __asm__("r20"); +register __varword arg8 __asm__("r19"); + +/*register float farg1 __asm__("fr4R");*/ +/*register float farg2 __asm__("fr5R");*/ +/*register float farg3 __asm__("fr6R");*/ +/*register float farg4 __asm__("fr7R");*/ +/*register float farg5 __asm__("fr8R");*/ +/*register float farg6 __asm__("fr9R");*/ +/*register float farg7 __asm__("fr10R");*/ +/*register float farg8 __asm__("fr11R");*/ + +register double darg1 __asm__("fr4"); +register double darg2 __asm__("fr5"); +register double darg3 __asm__("fr6"); +register double darg4 __asm__("fr7"); +register double darg5 __asm__("fr8"); +register double darg6 __asm__("fr9"); +register double darg7 __asm__("fr10"); +register double darg8 __asm__("fr11"); + +register __varword iret __asm__("r28"); +register __varword iret2 __asm__("r29"); + +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, __vaword word6, __vaword word7, __vaword word8, + __vaword firstword) +{ + __va_alist list; + /* Move the arguments passed in registers to their stack locations. */ + (&firstword)[-8] = word1; + (&firstword)[-7] = word2; + (&firstword)[-6] = word3; + (&firstword)[-5] = word4; + (&firstword)[-4] = word5; + (&firstword)[-3] = word6; + (&firstword)[-2] = word7; + (&firstword)[-1] = word8; + __asm__ __volatile__ ("fstw %%fr4R,%0" : : "m" (list.farg[0])); /* list.farg[0] = farg1; */ + __asm__ __volatile__ ("fstw %%fr5R,%0" : : "m" (list.farg[1])); /* list.farg[1] = farg2; */ + __asm__ __volatile__ ("fstw %%fr6R,%0" : : "m" (list.farg[2])); /* list.farg[2] = farg3; */ + __asm__ __volatile__ ("fstw %%fr7R,%0" : : "m" (list.farg[3])); /* list.farg[3] = farg4; */ + __asm__ __volatile__ ("fstw %%fr8R,%0" : : "m" (list.farg[4])); /* list.farg[4] = farg5; */ + __asm__ __volatile__ ("fstw %%fr9R,%0" : : "m" (list.farg[5])); /* list.farg[5] = farg6; */ + __asm__ __volatile__ ("fstw %%fr10R,%0" : : "m" (list.farg[6])); /* list.farg[6] = farg7; */ + __asm__ __volatile__ ("fstw %%fr11R,%0" : : "m" (list.farg[7])); /* list.farg[7] = farg8; */ + list.darg[0] = darg1; + list.darg[1] = darg2; + list.darg[2] = darg3; + list.darg[3] = darg4; + list.darg[4] = darg5; + list.darg[5] = darg6; + list.darg[6] = darg7; + list.darg[7] = darg8; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)(&firstword - 8); + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.memargptr = (long)&firstword; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong || list.rtype == __VAlonglong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong || list.rtype == __VAulonglong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAfloat) { + __asm__ __volatile__ ("fldw %0,%%fr4R" : : "m" (list.tmp._float)); /* farg1 = list.tmp._float; */ + iret = *(unsigned int *)&list.tmp._float; + } else + if (list.rtype == __VAdouble) { + darg1 = list.tmp._double; + iret = *(unsigned long*)&list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + #if 0 /* Unoptimized */ + if (list.rsize == 1) { + iret = (__varword)((unsigned char *) list.raddr)[0] << 56; + } else + if (list.rsize == 2) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48); + } else + if (list.rsize == 3) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40); + } else + if (list.rsize == 4) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32); + } else + if (list.rsize == 5) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24); + } else + if (list.rsize == 6) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16); + } else + if (list.rsize == 7) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16) + | ((__varword)((unsigned char *) list.raddr)[6] << 8); + } else + if (list.rsize >= 8 && list.rsize <= 16) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16) + | ((__varword)((unsigned char *) list.raddr)[6] << 8) + | (__varword)((unsigned char *) list.raddr)[7]; + if (list.rsize == 8) { + } else + if (list.rsize == 9) { + iret2 = (__varword)((unsigned char *) list.raddr)[8] << 56; + } else + if (list.rsize == 10) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48); + } else + if (list.rsize == 11) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40); + } else + if (list.rsize == 12) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32); + } else + if (list.rsize == 13) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24); + } else + if (list.rsize == 14) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16); + } else + if (list.rsize == 15) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16) + | ((__varword)((unsigned char *) list.raddr)[14] << 8); + } else + if (list.rsize == 16) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16) + | ((__varword)((unsigned char *) list.raddr)[14] << 8) + | (__varword)((unsigned char *) list.raddr)[15]; + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 2*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__varword) */ + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = - ((__varword)1 << (sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] & mask0) << (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = - ((__varword)1 << (2*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | ((wordaddr[1] & mask1) >> (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = - ((__varword)1 << (2*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | ((wordaddr[1] & mask1) >> (sizeof(__varword)*4-start_offset*4) >> (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) << (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = - ((__varword)1 << (3*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | (wordaddr[1] >> (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] << (start_offset*8)) | ((wordaddr[2] & mask2) >> (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + } else { + iret = (long)list.raddr; + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-i386-linux-pic.s b/vacall/vacall-i386-linux-pic.s new file mode 100644 index 0000000..65470a8 --- /dev/null +++ b/vacall/vacall-i386-linux-pic.s @@ -0,0 +1,159 @@ + .file "vacall-i386.c" + .text + .align 2 + .p2align 2,,3 +.globl vacall_receiver + .type vacall_receiver,@function +vacall_receiver: + pushl %ebp + movl %esp, %ebp + pushl %esi + pushl %ebx + subl $48, %esp + call .L44 +.L44: + popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-.L44], %ebx + leal 8(%ebp), %edx + movl %edx, -40(%ebp) + subl $12, %esp + leal -56(%ebp), %edx + movl $0, -56(%ebp) + movl $0, -36(%ebp) + movl $0, -32(%ebp) + movl %ebx, -24(%ebp) + pushl %edx + movl vacall_function@GOT(%ebx), %edx + call *(%edx) + movl -32(%ebp), %ecx + addl $16, %esp + testl %ecx, %ecx + je .L43 + cmpl $1, %ecx + je .L45 + cmpl $2, %ecx + je .L45 + cmpl $3, %ecx + je .L50 + cmpl $4, %ecx + je .L51 + cmpl $5, %ecx + je .L52 + cmpl $6, %ecx + je .L49 + cmpl $7, %ecx + je .L49 + cmpl $8, %ecx + je .L49 + cmpl $9, %ecx + je .L49 + leal -10(%ecx), %edx + cmpl $1, %edx + ja .L22 + movl -48(%ebp), %eax +#APP + movl -44(%ebp),%edx +.L33: + .p2align 2,,3 +#NO_APP +.L43: + movl -56(%ebp), %ecx +.L3: + andl $512, %ecx + je .L1 +#APP + movl 0(%ebp),%ecx +#NO_APP + movl -40(%ebp), %esp +#APP + jmp *%ecx +#NO_APP +.L1: + leal -8(%ebp), %esp + popl %ebx + popl %esi + leave + ret +.L22: + cmpl $12, %ecx + je .L53 + cmpl $13, %ecx + je .L54 + cmpl $14, %ecx + je .L49 + cmpl $15, %ecx + jne .L43 + movl -56(%ebp), %ecx + testl $1024, %ecx + movl %ecx, %esi + je .L31 + movl -28(%ebp), %edx + cmpl $1, %edx + je .L55 + cmpl $2, %edx + je .L56 + cmpl $4, %edx + je .L57 + cmpl $8, %edx + je .L58 +.L31: + andl $16, %esi + movl -36(%ebp), %eax + jne .L3 +#APP + leal -4(%ebp), %esp + popl %esi + leave + ret $4 +#NO_APP + jmp .L3 +.L58: + movl -36(%ebp), %edx + movl (%edx), %eax +#APP + movl 4(%edx),%edx +#NO_APP + jmp .L3 +.L57: + movl -36(%ebp), %edx + movl (%edx), %eax + jmp .L3 +.L56: + movl -36(%ebp), %edx + movzwl (%edx), %eax + jmp .L3 +.L55: + movl -36(%ebp), %edx + movzbl (%edx), %eax + jmp .L3 + .p2align 2,,3 +.L49: + movl -48(%ebp), %eax + jmp .L43 +.L54: +#APP + fldl -48(%ebp) +#NO_APP + jmp .L43 +.L53: +#APP + flds -48(%ebp) +#NO_APP + jmp .L43 + .p2align 2,,3 +.L52: + movzwl -48(%ebp), %eax + jmp .L43 +.L51: + movswl -48(%ebp),%eax + jmp .L43 +.L50: + movzbl -48(%ebp), %eax + jmp .L43 + .p2align 2,,3 +.L45: + movsbl -48(%ebp),%eax + jmp .L43 +.Lfe1: + .size vacall_receiver,.Lfe1-vacall_receiver + .ident "GCC: (GNU) 3.1" diff --git a/vacall/vacall-i386-linux.s b/vacall/vacall-i386-linux.s new file mode 100644 index 0000000..d8c714e --- /dev/null +++ b/vacall/vacall-i386-linux.s @@ -0,0 +1,150 @@ + .file "vacall-i386.c" + .text + .align 2 + .p2align 2,,3 +.globl vacall_receiver + .type vacall_receiver,@function +vacall_receiver: + pushl %ebp + movl %esp, %ebp + leal 8(%ebp), %edx + pushl %esi + subl $64, %esp + movl %edx, -40(%ebp) + leal -56(%ebp), %edx + movl $0, -56(%ebp) + movl $0, -36(%ebp) + movl $0, -32(%ebp) + movl %ebx, -24(%ebp) + pushl %edx + call *vacall_function + movl -32(%ebp), %ecx + addl $16, %esp + testl %ecx, %ecx + je .L43 + cmpl $1, %ecx + je .L44 + cmpl $2, %ecx + je .L44 + cmpl $3, %ecx + je .L49 + cmpl $4, %ecx + je .L50 + cmpl $5, %ecx + je .L51 + cmpl $6, %ecx + je .L48 + cmpl $7, %ecx + je .L48 + cmpl $8, %ecx + je .L48 + cmpl $9, %ecx + je .L48 + leal -10(%ecx), %edx + cmpl $1, %edx + ja .L22 + movl -48(%ebp), %eax +#APP + movl -44(%ebp),%edx +.L33: + .p2align 2,,3 +#NO_APP +.L43: + movl -56(%ebp), %ecx +.L3: + andl $512, %ecx + je .L1 +#APP + movl 0(%ebp),%ecx +#NO_APP + movl -40(%ebp), %esp +#APP + jmp *%ecx +#NO_APP +.L1: + movl -4(%ebp), %esi + leave + ret +.L22: + cmpl $12, %ecx + je .L52 + cmpl $13, %ecx + je .L53 + cmpl $14, %ecx + je .L48 + cmpl $15, %ecx + jne .L43 + movl -56(%ebp), %ecx + testl $1024, %ecx + movl %ecx, %esi + je .L31 + movl -28(%ebp), %edx + cmpl $1, %edx + je .L54 + cmpl $2, %edx + je .L55 + cmpl $4, %edx + je .L56 + cmpl $8, %edx + je .L57 +.L31: + andl $16, %esi + movl -36(%ebp), %eax + jne .L3 +#APP + leal -4(%ebp), %esp + popl %esi + leave + ret $4 +#NO_APP + jmp .L3 +.L57: + movl -36(%ebp), %edx + movl (%edx), %eax +#APP + movl 4(%edx),%edx +#NO_APP + jmp .L3 +.L56: + movl -36(%ebp), %edx + movl (%edx), %eax + jmp .L3 +.L55: + movl -36(%ebp), %edx + movzwl (%edx), %eax + jmp .L3 +.L54: + movl -36(%ebp), %edx + movzbl (%edx), %eax + jmp .L3 + .p2align 2,,3 +.L48: + movl -48(%ebp), %eax + jmp .L43 +.L53: +#APP + fldl -48(%ebp) +#NO_APP + jmp .L43 +.L52: +#APP + flds -48(%ebp) +#NO_APP + jmp .L43 + .p2align 2,,3 +.L51: + movzwl -48(%ebp), %eax + jmp .L43 +.L50: + movswl -48(%ebp),%eax + jmp .L43 +.L49: + movzbl -48(%ebp), %eax + jmp .L43 + .p2align 2,,3 +.L44: + movsbl -48(%ebp),%eax + jmp .L43 +.Lfe1: + .size vacall_receiver,.Lfe1-vacall_receiver + .ident "GCC: (GNU) 3.1" diff --git a/vacall/vacall-i386-macro.S b/vacall/vacall-i386-macro.S new file mode 100644 index 0000000..c352c94 --- /dev/null +++ b/vacall/vacall-i386-macro.S @@ -0,0 +1,288 @@ +#include "asm-i386.h" +#ifdef __PIC__ + TEXT() + ALIGN(2) + P2ALIGN(2,3) +GLOBL(C(vacall_receiver)) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) + INSN1(push,l ,R(ebp)) + INSN2(mov,l ,R(esp), R(ebp)) + INSN1(push,l ,R(esi)) + INSN1(push,l ,R(ebx)) + INSN2(sub,l ,NUM(48), R(esp)) + INSN1(call,_ ,L(44)) +L(44): + INSN1(pop,l ,R(ebx)) +#ifdef __ELF__ + INSN2(add,l ,NUM()_GLOBAL_OFFSET_TABLE_+[.-L(44)],R(ebx)) +#endif + INSN2(lea,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(mov,l ,R(edx),X4 MEM_DISP(ebp,-40)) + INSN2(sub,l ,NUM(12), R(esp)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-56), R(edx)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-56)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-36)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-32)) + INSN2(mov,l ,R(ebx),X4 MEM_DISP(ebp,-24)) + INSN1(push,l ,R(edx)) + INSN2(mov,l ,C(vacall_function)@MEM_DISP(ebx,GOT), R(edx)) + INSN1(call,_ ,INDIR(X4 MEM(edx))) + INSN2(mov,l ,X4 MEM_DISP(ebp,-32), R(ecx)) + INSN2(add,l ,NUM(16), R(esp)) + INSN2(test,l ,R(ecx), R(ecx)) + INSN1(je,_ ,L(43)) + INSN2(cmp,l ,NUM(1), R(ecx)) + INSN1(je,_ ,L(45)) + INSN2(cmp,l ,NUM(2), R(ecx)) + INSN1(je,_ ,L(45)) + INSN2(cmp,l ,NUM(3), R(ecx)) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(4), R(ecx)) + INSN1(je,_ ,L(51)) + INSN2(cmp,l ,NUM(5), R(ecx)) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(6), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(7), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(8), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(9), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(lea,l ,X4 MEM_DISP(ecx,-10), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(ja,_ ,L(22)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-44),R(edx)) +L(33): + P2ALIGN(2,3) +L(43): + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(ecx)) +L(3): + INSN2(and,l ,NUM(512), R(ecx)) + INSN1(je,_ ,L(1)) + INSN2(mov,l ,X4 MEM_DISP(ebp,0),R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-40), R(esp)) + INSN1(jmp,_ ,INDIR(R(ecx))) +L(1): + INSN2(lea,l ,X4 MEM_DISP(ebp,-8), R(esp)) + INSN1(pop,l ,R(ebx)) + INSN1(pop,l ,R(esi)) + leave + ret +L(22): + INSN2(cmp,l ,NUM(12), R(ecx)) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(13), R(ecx)) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(14), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(15), R(ecx)) + INSN1(jne,_ ,L(43)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(ecx)) + INSN2(test,l ,NUM(1024), R(ecx)) + INSN2(mov,l ,R(ecx), R(esi)) + INSN1(je,_ ,L(31)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-28), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(je,_ ,L(55)) + INSN2(cmp,l ,NUM(2), R(edx)) + INSN1(je,_ ,L(56)) + INSN2(cmp,l ,NUM(4), R(edx)) + INSN1(je,_ ,L(57)) + INSN2(cmp,l ,NUM(8), R(edx)) + INSN1(je,_ ,L(58)) +L(31): + INSN2(and,l ,NUM(16), R(esi)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(eax)) + INSN1(jne,_ ,L(3)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-4), R(esp)) + INSN1(pop,l ,R(esi)) + leave + ret NUM(4) + INSN1(jmp,_ ,L(3)) +L(58): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(edx,4),R(edx)) + INSN1(jmp,_ ,L(3)) +L(57): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(56): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,w,X2 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(55): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,b,X1 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) + P2ALIGN(2,3) +L(49): + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(54): + INSN1(fld,l ,X8 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) +L(53): + INSN1(fld,s ,X4 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(52): + INSN2MOVXL(movz,w,X2 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(51): + INSN2MOVXL(movs,w,X2 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(50): + INSN2MOVXL(movz,b,X1 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(45): + INSN2MOVXL(movs,b,X1 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(fe1): + FUNEND(vacall_receiver,L(fe1)-vacall_receiver) + +#else + TEXT() + ALIGN(2) + P2ALIGN(2,3) +GLOBL(C(vacall_receiver)) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) + INSN1(push,l ,R(ebp)) + INSN2(mov,l ,R(esp), R(ebp)) + INSN2(lea,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN1(push,l ,R(esi)) + INSN2(sub,l ,NUM(64), R(esp)) + INSN2(mov,l ,R(edx),X4 MEM_DISP(ebp,-40)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-56), R(edx)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-56)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-36)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-32)) + INSN2(mov,l ,R(ebx),X4 MEM_DISP(ebp,-24)) + INSN1(push,l ,R(edx)) + INSN1(call,_ ,INDIR(X4 C(vacall_function))) + INSN2(mov,l ,X4 MEM_DISP(ebp,-32), R(ecx)) + INSN2(add,l ,NUM(16), R(esp)) + INSN2(test,l ,R(ecx), R(ecx)) + INSN1(je,_ ,L(43)) + INSN2(cmp,l ,NUM(1), R(ecx)) + INSN1(je,_ ,L(44)) + INSN2(cmp,l ,NUM(2), R(ecx)) + INSN1(je,_ ,L(44)) + INSN2(cmp,l ,NUM(3), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(4), R(ecx)) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(5), R(ecx)) + INSN1(je,_ ,L(51)) + INSN2(cmp,l ,NUM(6), R(ecx)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(7), R(ecx)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(8), R(ecx)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(9), R(ecx)) + INSN1(je,_ ,L(48)) + INSN2(lea,l ,X4 MEM_DISP(ecx,-10), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(ja,_ ,L(22)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-44),R(edx)) +L(33): + P2ALIGN(2,3) +L(43): + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(ecx)) +L(3): + INSN2(and,l ,NUM(512), R(ecx)) + INSN1(je,_ ,L(1)) + INSN2(mov,l ,X4 MEM_DISP(ebp,0),R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-40), R(esp)) + INSN1(jmp,_ ,INDIR(R(ecx))) +L(1): + INSN2(mov,l ,X4 MEM_DISP(ebp,-4), R(esi)) + leave + ret +L(22): + INSN2(cmp,l ,NUM(12), R(ecx)) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(13), R(ecx)) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(14), R(ecx)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(15), R(ecx)) + INSN1(jne,_ ,L(43)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(ecx)) + INSN2(test,l ,NUM(1024), R(ecx)) + INSN2(mov,l ,R(ecx), R(esi)) + INSN1(je,_ ,L(31)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-28), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(2), R(edx)) + INSN1(je,_ ,L(55)) + INSN2(cmp,l ,NUM(4), R(edx)) + INSN1(je,_ ,L(56)) + INSN2(cmp,l ,NUM(8), R(edx)) + INSN1(je,_ ,L(57)) +L(31): + INSN2(and,l ,NUM(16), R(esi)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(eax)) + INSN1(jne,_ ,L(3)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-4), R(esp)) + INSN1(pop,l ,R(esi)) + leave + ret NUM(4) + INSN1(jmp,_ ,L(3)) +L(57): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(edx,4),R(edx)) + INSN1(jmp,_ ,L(3)) +L(56): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(55): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,w,X2 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(54): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,b,X1 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) + P2ALIGN(2,3) +L(48): + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(53): + INSN1(fld,l ,X8 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) +L(52): + INSN1(fld,s ,X4 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(51): + INSN2MOVXL(movz,w,X2 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(50): + INSN2MOVXL(movs,w,X2 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(49): + INSN2MOVXL(movz,b,X1 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(44): + INSN2MOVXL(movs,b,X1 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(fe1): + FUNEND(vacall_receiver,L(fe1)-vacall_receiver) + +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-i386-msvc.c b/vacall/vacall-i386-msvc.c new file mode 100644 index 0000000..170067e --- /dev/null +++ b/vacall/vacall-i386-msvc.c @@ -0,0 +1,291 @@ +#ifdef _MSC_VER +#include "vacall.h" +#endif +#include "asm-i386.h" +#ifdef __PIC__ + TEXT() + ALIGN(2) + P2ALIGN(2,3) +GLOBL(C(vacall_receiver)) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) + INSN1(push,l ,R(ebp)) + INSN2(mov,l ,R(esp), R(ebp)) + INSN1(push,l ,R(esi)) + INSN1(push,l ,R(ebx)) + INSN2(sub,l ,NUM(48), R(esp)) + INSN1(call,_ ,L(44)) +L(44): + INSN1(pop,l ,R(ebx)) +#ifdef __ELF__ + INSN2(add,l ,NUM()_GLOBAL_OFFSET_TABLE_+[.-L(44)],R(ebx)) +#endif + INSN2(lea,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN2(mov,l ,R(edx),X4 MEM_DISP(ebp,-40)) + INSN2(sub,l ,NUM(12), R(esp)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-56), R(edx)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-56)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-36)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-32)) + INSN2(mov,l ,R(ebx),X4 MEM_DISP(ebp,-24)) + INSN1(push,l ,R(edx)) + INSN2(mov,l ,C(vacall_function)@MEM_DISP(ebx,GOT), R(edx)) + INSN1(call,_ ,INDIR(X4 MEM(edx))) + INSN2(mov,l ,X4 MEM_DISP(ebp,-32), R(ecx)) + INSN2(add,l ,NUM(16), R(esp)) + INSN2(test,l ,R(ecx), R(ecx)) + INSN1(je,_ ,L(43)) + INSN2(cmp,l ,NUM(1), R(ecx)) + INSN1(je,_ ,L(45)) + INSN2(cmp,l ,NUM(2), R(ecx)) + INSN1(je,_ ,L(45)) + INSN2(cmp,l ,NUM(3), R(ecx)) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(4), R(ecx)) + INSN1(je,_ ,L(51)) + INSN2(cmp,l ,NUM(5), R(ecx)) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(6), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(7), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(8), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(9), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(lea,l ,X4 MEM_DISP(ecx,-10), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(ja,_ ,L(22)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-44),R(edx)) +L(33): + P2ALIGN(2,3) +L(43): + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(ecx)) +L(3): + INSN2(and,l ,NUM(512), R(ecx)) + INSN1(je,_ ,L(1)) + INSN2(mov,l ,X4 MEM_DISP(ebp,0),R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-40), R(esp)) + INSN1(jmp,_ ,INDIR(R(ecx))) +L(1): + INSN2(lea,l ,X4 MEM_DISP(ebp,-8), R(esp)) + INSN1(pop,l ,R(ebx)) + INSN1(pop,l ,R(esi)) + leave + ret +L(22): + INSN2(cmp,l ,NUM(12), R(ecx)) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(13), R(ecx)) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(14), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(15), R(ecx)) + INSN1(jne,_ ,L(43)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(ecx)) + INSN2(test,l ,NUM(1024), R(ecx)) + INSN2(mov,l ,R(ecx), R(esi)) + INSN1(je,_ ,L(31)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-28), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(je,_ ,L(55)) + INSN2(cmp,l ,NUM(2), R(edx)) + INSN1(je,_ ,L(56)) + INSN2(cmp,l ,NUM(4), R(edx)) + INSN1(je,_ ,L(57)) + INSN2(cmp,l ,NUM(8), R(edx)) + INSN1(je,_ ,L(58)) +L(31): + INSN2(and,l ,NUM(16), R(esi)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(eax)) + INSN1(jne,_ ,L(3)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-4), R(esp)) + INSN1(pop,l ,R(esi)) + leave + ret NUM(4) + INSN1(jmp,_ ,L(3)) +L(58): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(edx,4),R(edx)) + INSN1(jmp,_ ,L(3)) +L(57): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(56): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,w,X2 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(55): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,b,X1 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) + P2ALIGN(2,3) +L(49): + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(54): + INSN1(fld,l ,X8 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) +L(53): + INSN1(fld,s ,X4 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(52): + INSN2MOVXL(movz,w,X2 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(51): + INSN2MOVXL(movs,w,X2 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(50): + INSN2MOVXL(movz,b,X1 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(45): + INSN2MOVXL(movs,b,X1 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(fe1): + FUNEND(vacall_receiver,L(fe1)-vacall_receiver) + +#else + TEXT() + ALIGN(2) + P2ALIGN(2,3) +GLOBL(C(vacall_receiver)) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) + INSN1(push,l ,R(ebp)) + INSN2(mov,l ,R(esp), R(ebp)) + INSN2(lea,l ,X4 MEM_DISP(ebp,8), R(edx)) + INSN1(push,l ,R(esi)) + INSN2(sub,l ,NUM(64), R(esp)) + INSN2(mov,l ,R(edx),X4 MEM_DISP(ebp,-40)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-56), R(edx)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-56)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-36)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(ebp,-32)) + INSN2(mov,l ,R(ebx),X4 MEM_DISP(ebp,-24)) + INSN1(push,l ,R(edx)) + INSN1(call,_ ,INDIR(X4 C(vacall_function))) + INSN2(mov,l ,X4 MEM_DISP(ebp,-32), R(ecx)) + INSN2(add,l ,NUM(16), R(esp)) + INSN2(test,l ,R(ecx), R(ecx)) + INSN1(je,_ ,L(43)) + INSN2(cmp,l ,NUM(1), R(ecx)) + INSN1(je,_ ,L(44)) + INSN2(cmp,l ,NUM(2), R(ecx)) + INSN1(je,_ ,L(44)) + INSN2(cmp,l ,NUM(3), R(ecx)) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(4), R(ecx)) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(5), R(ecx)) + INSN1(je,_ ,L(51)) + INSN2(cmp,l ,NUM(6), R(ecx)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(7), R(ecx)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(8), R(ecx)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(9), R(ecx)) + INSN1(je,_ ,L(48)) + INSN2(lea,l ,X4 MEM_DISP(ecx,-10), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(ja,_ ,L(22)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-44),R(edx)) +L(33): + P2ALIGN(2,3) +L(43): + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(ecx)) +L(3): + INSN2(and,l ,NUM(512), R(ecx)) + INSN1(je,_ ,L(1)) + INSN2(mov,l ,X4 MEM_DISP(ebp,0),R(ecx)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-40), R(esp)) + INSN1(jmp,_ ,INDIR(R(ecx))) +L(1): + INSN2(mov,l ,X4 MEM_DISP(ebp,-4), R(esi)) + leave + ret +L(22): + INSN2(cmp,l ,NUM(12), R(ecx)) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(13), R(ecx)) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(14), R(ecx)) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(15), R(ecx)) + INSN1(jne,_ ,L(43)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-56), R(ecx)) + INSN2(test,l ,NUM(1024), R(ecx)) + INSN2(mov,l ,R(ecx), R(esi)) + INSN1(je,_ ,L(31)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-28), R(edx)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(2), R(edx)) + INSN1(je,_ ,L(55)) + INSN2(cmp,l ,NUM(4), R(edx)) + INSN1(je,_ ,L(56)) + INSN2(cmp,l ,NUM(8), R(edx)) + INSN1(je,_ ,L(57)) +L(31): + INSN2(and,l ,NUM(16), R(esi)) + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(eax)) + INSN1(jne,_ ,L(3)) + INSN2(lea,l ,X4 MEM_DISP(ebp,-4), R(esp)) + INSN1(pop,l ,R(esi)) + leave + ret NUM(4) + INSN1(jmp,_ ,L(3)) +L(57): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN2(mov,l ,X4 MEM_DISP(edx,4),R(edx)) + INSN1(jmp,_ ,L(3)) +L(56): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2(mov,l ,X4 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(55): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,w,X2 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) +L(54): + INSN2(mov,l ,X4 MEM_DISP(ebp,-36), R(edx)) + INSN2MOVXL(movz,b,X1 MEM(edx), R(eax)) + INSN1(jmp,_ ,L(3)) + P2ALIGN(2,3) +L(48): + INSN2(mov,l ,X4 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(53): + INSN1(fld,l ,X8 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) +L(52): + INSN1(fld,s ,X4 MEM_DISP(ebp,-48)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(51): + INSN2MOVXL(movz,w,X2 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) +L(50): + INSN2MOVXL(movs,w,X2 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(49): + INSN2MOVXL(movz,b,X1 MEM_DISP(ebp,-48), R(eax)) + INSN1(jmp,_ ,L(43)) + P2ALIGN(2,3) +L(44): + INSN2MOVXL(movs,b,X1 MEM_DISP(ebp,-48),R(eax)) + INSN1(jmp,_ ,L(43)) +L(fe1): + FUNEND(vacall_receiver,L(fe1)-vacall_receiver) + +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-i386.c b/vacall/vacall-i386.c new file mode 100644 index 0000000..9cb2e1d --- /dev/null +++ b/vacall/vacall-i386.c @@ -0,0 +1,163 @@ +/* vacall function for i386 CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +typedef struct { void (*vacall_function) (void*,va_alist); void* arg; } env_t; +register env_t* env __asm__("%ecx"); +#endif +register void* sp __asm__("%esp"); +register void* sret __asm__("%ebx"); +register int iret __asm__("%eax"); + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword firstword) +{ + __va_alist list; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&firstword; + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.structraddr = sret; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong || list.rtype == __VAulonglong) { + /* This code is EXTREMELY fragile!! */ + /* It depends on the register allocation chosen by gcc. */ + iret = ((__varword *) &list.tmp._longlong)[0]; + asm volatile ("movl %0,%%edx" : : "g"(((__varword *) &list.tmp._longlong)[1])); + } else + if (list.rtype == __VAfloat) { + asm volatile ("flds %0": : "m"(list.tmp._float)); + } else + if (list.rtype == __VAdouble) { + asm volatile ("fldl %0": : "m"(list.tmp._double)); + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + if (list.rsize == sizeof(char)) { + iret = *(unsigned char *) list.raddr; + goto done; + } else + if (list.rsize == sizeof(short)) { + iret = *(unsigned short *) list.raddr; + goto done; + } else + if (list.rsize == sizeof(int)) { + iret = *(unsigned int *) list.raddr; + goto done; + } else + if (list.rsize == 2*sizeof(__varword)) { + /* This code is EXTREMELY fragile!! */ + /* It depends on the register allocation chosen by gcc. */ + iret = ((__varword *) list.raddr)[0]; + asm volatile ("movl %0,%%edx" : : "g"(((__varword *) list.raddr)[1])); + goto done; + } + } + /* On MSVC and on FreeBSD, must put the structure address into %eax. + For the other platforms, it does not matter, but doesn't hurt either. */ + iret = (long) list.raddr; + if (!(list.flags & __VA_MSVC_STRUCT_RETURN)) { + /* We have to pop the struct return address off the stack. */ + /* Callers compiled with -fomit-frame-pointer expect this. */ + /* Return via a "ret $4" instruction. */ + /* NOTE: This is EXTREMELY fragile. We must use the same return sequence + * as the one generated by GCC, except that we use a "ret $4" instruction + * in place of the "ret" instruction. Look at the 'pushl' instructions + * at the beginning of the generated code and at the sequence of + * instructions right before the generated "ret" instruction. */ +#ifdef REENTRANT + asm volatile ("leal -8(%ebp), %esp"); + asm volatile ("popl %esi"); + asm volatile ("popl %edi"); + asm volatile ("leave"); +#else + asm volatile ("leal -4(%ebp), %esp"); + asm volatile ("popl %esi"); + asm volatile ("leave"); +#endif + asm volatile ("ret $4"); + /*NOTREACHED*/ + } + done: ; + } + if (list.flags & __VA_STDCALL_CLEANUP) { + /* Return, and at the same time pop the arguments off the stack. */ + /* Normally done through a "ret $n" instruction. */ + /* Be careful not to clobber %eax and %edx. Only %ecx can be used. */ + /* Use *__builtin_frame_address(0), since __builtin_return_address(0) + * is buggy in gcc-2.7.2. */ + asm volatile ("movl %0,%%ecx" : : "g" (*(void**)__builtin_frame_address(0))); + sp = (void*)list.aptr; + asm volatile ("jmp *%ecx"); + /*NOTREACHED*/ + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-ia64-linux.s b/vacall/vacall-ia64-linux.s new file mode 100644 index 0000000..864463e --- /dev/null +++ b/vacall/vacall-ia64-linux.s @@ -0,0 +1,842 @@ + .file "vacall-ia64.c" + .pred.safe_across_calls p1-p5,p16-p63 + .text + .align 16 + .global vacall_receiver# + .proc vacall_receiver# +vacall_receiver: + .prologue 14, 41 + .spill 48 + .mmb + .save ar.pfs, r42 + alloc r42 = ar.pfs, 8, 5, 1, 0 + .vframe r43 + mov r43 = r12 + nop 0 + .mmi + adds r12 = -208, r12 + mov r44 = r1 + .save rp, r41 + mov r41 = b0 + .body + ;; + .mmi + adds r14 = -48, r43 + adds r16 = -48, r43 + adds r40 = -152, r43 + .mmb + adds r45 = -192, r43 + st8 [r43] = r38 + nop 0 + ;; + .mmi + nop 0 + st8 [r14] = r32, 8 + adds r32 = -160, r43 + .mmi + st4 [r40] = r0 + ;; + st8 [r14] = r33 + adds r14 = -32, r43 + .mmi + st4 [r45] = r0 + ;; + st8 [r14] = r34 + addl r14 = @ltoffx(vacall_function#), r1 + .mmb + nop 0 + st8 [r32] = r0 + nop 0 + ;; + .mmi + ld8.mov r14 = [r14], vacall_function# + ;; + ld8 r15 = [r14] + nop 0 + .mmi + adds r14 = -24, r43 + ;; + st8 [r14] = r35 + adds r14 = -16, r43 + ;; + .mfi + st8 [r14] = r36 + nop 0 + adds r14 = -8, r43 + .mmi + nop 0 + ;; + st8 [r14] = r37 + nop 0 + .mmi + adds r14 = 8, r43 + ;; + st8 [r14] = r39 + adds r14 = -112, r43 + ;; + .mfi + stfd [r14] = f8 + nop 0 + adds r14 = -104, r43 + .mmi + nop 0 + ;; + stfd [r14] = f9 + nop 0 + .mmi + adds r14 = -96, r43 + ;; + stfd [r14] = f10 + adds r14 = -88, r43 + ;; + .mfi + stfd [r14] = f11 + nop 0 + adds r14 = -80, r43 + .mmi + nop 0 + ;; + stfd [r14] = f12 + nop 0 + .mmi + adds r14 = -72, r43 + ;; + stfd [r14] = f13 + adds r14 = -64, r43 + ;; + .mfi + stfd [r14] = f14 + nop 0 + adds r14 = -56, r43 + .mmi + nop 0 + ;; + stfd [r14] = f15 + nop 0 + .mmi + adds r14 = -168, r43 + ;; + st8 [r14] = r16 + adds r14 = -128, r43 + ;; + .mii + st8 [r14] = r16 + adds r14 = -120, r43 + ;; + nop 0 + .mii + st4 [r14] = r0 + adds r14 = -136, r43 + ;; + nop 0 + .mmb + st8 [r14] = r8 + ld8 r14 = [r15], 8 + nop 0 + ;; + .mib + nop 0 + mov b6 = r14 + nop 0 + .mbb + ld8 r1 = [r15] + nop 0 + br.call.sptk.many b0 = b6 + ;; + .mmb + mov r1 = r44 + ld4 r40 = [r40] + nop 0 + ;; + .mfb + cmp4.eq p6, p7 = 0, r40 + nop 0 + (p6) br.cond.dpnt .L49 + ;; + .mfb + cmp4.ne p6, p7 = 1, r40 + nop 0 + (p7) br.cond.dpnt .L50 + ;; + .mfb + cmp4.ne p6, p7 = 2, r40 + nop 0 + (p7) br.cond.dpnt .L50 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 3, r40 + ;; + (p7) adds r14 = -184, r43 + ;; + .mfb + (p7) ld1 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 4, r40 + ;; + nop 0 + .mmi + (p7) adds r14 = -184, r43 + ;; + (p7) ld2 r14 = [r14] + nop 0 + ;; + .mib + nop 0 + (p7) sxt2 r8 = r14 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 5, r40 + ;; + (p7) adds r14 = -184, r43 + ;; + .mfb + (p7) ld2 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 6, r40 + ;; + nop 0 + .mmi + (p7) adds r14 = -184, r43 + ;; + (p7) ld4 r14 = [r14] + nop 0 + ;; + .mib + nop 0 + (p7) sxt4 r8 = r14 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 7, r40 + ;; + (p7) adds r14 = -184, r43 + ;; + .mfb + (p7) ld4 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mfb + cmp4.ne p6, p7 = 8, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 9, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 10, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 11, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 12, r40 + ;; + (p7) adds r14 = -184, r43 + ;; + .mfb + (p7) ldfs f8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 13, r40 + ;; + (p7) adds r14 = -184, r43 + ;; + .mfb + (p7) ldfd f8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mfb + cmp4.ne p6, p7 = 14, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mib + nop 0 + cmp4.ne p6, p7 = 15, r40 + (p6) br.cond.dptk .L49 + .mii + nop 0 + adds r15 = -192, r43 + ;; + nop 0 + .mmi + ld4 r14 = [r15] + ;; + nop 0 + tbit.z p6, p7 = r14, 10 + .mfb + adds r14 = -144, r43 + nop 0 + (p6) br.cond.dpnt .L49 + ;; + .mmi + ld8 r21 = [r14] + ;; + adds r14 = -1, r21 + nop 0 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 31, r14 + (p6) br.cond.dpnt .L49 + .mmi + ld8 r14 = [r32] + ;; + and r20 = 7, r14 + and r23 = -8, r14 + .mii + nop 0 + cmp.ltu p6, p7 = 8, r21 + ;; + nop 0 + .mfb + add r14 = r21, r20 + nop 0 + (p6) br.cond.dptk .L35 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 8, r14 + (p6) br.cond.dptk .L37 + .mfi + shladd r15 = r14, 3, r0 + nop 0 + addl r14 = 2, r0 + .mii + ld8 r16 = [r23] + shladd r17 = r20, 3, r0 + ;; + adds r15 = -1, r15 + ;; + .mii + nop 0 + sxt4 r15 = r15 + ;; + shl r14 = r14, r15 + ;; + .mmi + adds r14 = -1, r14 + ;; + and r14 = r16, r14 + nop 0 + .mmi + nop 0 + ;; + nop 0 + shr r8 = r14, r17 +.L49: + .mii + nop 0 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 1 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L50: + .body + .copy_state 1 + .mii + nop 0 + adds r14 = -184, r43 + ;; + nop 0 + .mii + ld1 r14 = [r14] + nop 0 + ;; + sxt1 r8 = r14 + .mii + nop 0 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 2 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L54: + .body + .copy_state 2 + .mmb + nop 0 + adds r14 = -184, r43 + nop 0 + ;; + .mii + ld8 r8 = [r14] + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 3 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L35: + .body + .copy_state 3 + .mib + nop 0 + cmp.ltu p6, p7 = 16, r21 + (p6) br.cond.dptk .L39 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 16, r14 + (p6) br.cond.dptk .L41 + .mmi + shladd r15 = r14, 3, r0 + adds r14 = 8, r23 + shladd r16 = r20, 2, r0 + .mmb + shladd r18 = r20, 3, r0 + ld8 r17 = [r23] + nop 0 + ;; + .mfi + ld8 r19 = [r14] + nop 0 + addl r14 = 2, r0 + .mii + adds r15 = -65, r15 + sub r16 = 32, r16 + ;; + sxt4 r15 = r15 + .mii + nop 0 + sxt4 r16 = r16 + shr r17 = r17, r18 + ;; + .mii + nop 0 + shl r14 = r14, r15 + ;; + adds r14 = -1, r14 + ;; + .mii + nop 0 + and r14 = r19, r14 + ;; + shl r15 = r14, r16 + .mii + nop 0 + shr r9 = r14, r18 + ;; + shl r15 = r15, r16 + ;; + .mii + or r8 = r15, r17 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 4 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L37: + .body + .copy_state 4 + .mfi + shladd r15 = r14, 3, r0 + nop 0 + addl r14 = 2, r0 + .mii + ld8 r17 = [r23], 8 + shladd r18 = r20, 3, r0 + ;; + adds r15 = -65, r15 + .mii + ld8 r19 = [r23] + sub r16 = 64, r18 + ;; + sxt4 r15 = r15 + .mii + nop 0 + sxt4 r16 = r16 + ;; + shl r14 = r14, r15 + .mii + nop 0 + shr r17 = r17, r18 + ;; + adds r14 = -1, r14 + ;; + .mii + nop 0 + and r14 = r19, r14 + ;; + shl r14 = r14, r16 + ;; + .mii + or r8 = r14, r17 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 5 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L39: + .body + .copy_state 5 + .mib + nop 0 + cmp.ltu p6, p7 = 24, r21 + (p6) br.cond.dptk .L43 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 24, r14 + (p6) br.cond.dptk .L45 + .mmi + shladd r15 = r14, 3, r0 + adds r14 = 8, r23 + shladd r16 = r20, 2, r0 + .mmb + shladd r19 = r20, 3, r0 + ld8 r18 = [r23], 16 + nop 0 + ;; + .mmi + ld8 r17 = [r14] + addl r14 = 2, r0 + adds r15 = -65, r15 + .mmb + sub r16 = 32, r16 + ld8 r20 = [r23] + nop 0 + ;; + .mii + nop 0 + sxt4 r15 = r15 + sxt4 r16 = r16 + .mii + nop 0 + shr r18 = r18, r19 + ;; + shl r14 = r14, r15 + .mii + nop 0 + shl r15 = r17, r16 + shr r17 = r17, r19 + ;; + .mii + nop 0 + shl r15 = r15, r16 + adds r14 = -1, r14 + ;; + .mii + and r14 = r20, r14 + or r8 = r15, r18 + ;; + shl r15 = r14, r16 + .mii + nop 0 + shr r10 = r14, r19 + ;; + shl r15 = r15, r16 + ;; + .mii + or r9 = r15, r17 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 6 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L41: + .body + .copy_state 6 + .mfi + shladd r16 = r14, 3, r0 + nop 0 + adds r14 = 8, r23 + .mfi + ld8 r18 = [r23], 16 + nop 0 + shladd r15 = r20, 3, r0 + ;; + .mmi + ld8 r17 = [r14] + addl r14 = 2, r0 + adds r16 = -129, r16 + .mmi + ld8 r20 = [r23] + mov r19 = r15 + sub r15 = 64, r15 + ;; + .mii + nop 0 + sxt4 r16 = r16 + sxt4 r15 = r15 + ;; + .mii + nop 0 + shl r14 = r14, r16 + shr r18 = r18, r19 + .mii + nop 0 + shl r16 = r17, r15 + shr r17 = r17, r19 + ;; + .mmi + adds r14 = -1, r14 + ;; + and r14 = r20, r14 + or r8 = r16, r18 + ;; + .mib + nop 0 + shl r14 = r14, r15 + nop 0 + ;; + .mii + or r9 = r14, r17 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 7 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L45: + .body + .copy_state 7 + .mmi + shladd r16 = r14, 3, r0 + adds r14 = 24, r23 + shladd r15 = r20, 3, r0 + .mmi + adds r18 = 8, r23 + ld8 r20 = [r23] + adds r19 = 16, r23 + ;; + .mmi + ld8 r22 = [r14] + addl r14 = 2, r0 + adds r16 = -129, r16 + .mmi + mov r17 = r15 + ld8 r18 = [r18] + sub r15 = 64, r15 + ;; + .mib + nop 0 + sxt4 r16 = r16 + nop 0 + .mii + ld8 r19 = [r19] + sxt4 r15 = r15 + ;; + shl r14 = r14, r16 + .mii + nop 0 + shr r21 = r19, r17 + shl r16 = r18, r15 + .mii + nop 0 + shr r20 = r20, r17 + shr r18 = r18, r17 + .mii + nop 0 + shl r19 = r19, r15 + ;; + nop 0 + .mmi + adds r14 = -1, r14 + ;; + and r14 = r22, r14 + or r8 = r16, r20 + .mii + nop 0 + or r9 = r19, r18 + ;; + shl r14 = r14, r15 + ;; + .mii + or r10 = r14, r21 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 8 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L43: + .body + .copy_state 8 + .mib + nop 0 + cmp.ltu p6, p7 = 32, r14 + (p6) br.cond.dptk .L47 + .mmi + adds r15 = 24, r23 + shladd r14 = r14, 3, r0 + adds r17 = 8, r23 + .mmi + shladd r16 = r20, 2, r0 + adds r18 = 16, r23 + shladd r20 = r20, 3, r0 + ;; + .mmi + nop 0 + ld8 r22 = [r15] + addl r15 = 2, r0 + .mmi + adds r14 = -65, r14 + ld8 r19 = [r17] + sub r16 = 32, r16 + ;; + .mii + nop 0 + sxt4 r14 = r14 + sxt4 r16 = r16 + .mmb + ld8 r21 = [r18] + ld8 r18 = [r23] + nop 0 + ;; + .mii + nop 0 + shl r15 = r15, r14 + shl r14 = r19, r16 + .mii + nop 0 + shr r18 = r18, r20 + shl r17 = r21, r16 + ;; + .mii + nop 0 + shl r14 = r14, r16 + shr r19 = r19, r20 + .mii + adds r15 = -1, r15 + shl r17 = r17, r16 + shr r21 = r21, r20 + ;; + .mmi + nop 0 + and r15 = r22, r15 + or r8 = r14, r18 + .mmi + or r9 = r17, r19 + ;; + nop 0 + shl r14 = r15, r16 + .mii + nop 0 + shr r11 = r15, r20 + ;; + shl r14 = r14, r16 + ;; + .mii + or r10 = r14, r21 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 9 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L47: + .body + .copy_state 9 + .mmb + shladd r16 = r14, 3, r0 + adds r14 = 32, r23 + nop 0 + .mmi + adds r18 = 8, r23 + adds r19 = 16, r23 + shladd r15 = r20, 3, r0 + ;; + .mfi + ld8 r22 = [r14] + nop 0 + adds r14 = 24, r23 + .mmi + ld8 r20 = [r18] + adds r16 = -129, r16 + mov r17 = r15 + .mfi + ld8 r18 = [r19] + nop 0 + sub r15 = 64, r15 + ;; + .mmi + ld8 r19 = [r14] + addl r14 = 2, r0 + sxt4 r16 = r16 + .mii + nop 0 + sxt4 r15 = r15 + ;; + shl r21 = r20, r15 + .mii + nop 0 + shr r20 = r20, r17 + shl r14 = r14, r16 + .mii + ld8 r16 = [r23] + shr r23 = r19, r17 + shl r19 = r19, r15 + ;; + .mii + nop 0 + shr r16 = r16, r17 + shr r17 = r18, r17 + .mii + adds r14 = -1, r14 + shl r18 = r18, r15 + ;; + and r14 = r22, r14 + .mmi + nop 0 + or r8 = r21, r16 + or r10 = r19, r17 + .mii + nop 0 + or r9 = r18, r20 + ;; + shl r14 = r14, r15 + ;; + .mii + or r11 = r14, r23 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 + .endp vacall_receiver# + .ident "GCC: (GNU) 4.0.1" diff --git a/vacall/vacall-ia64-macro.S b/vacall/vacall-ia64-macro.S new file mode 100644 index 0000000..23fcb30 --- /dev/null +++ b/vacall/vacall-ia64-macro.S @@ -0,0 +1,845 @@ + .file "vacall-ia64.c" + .pred.safe_across_calls p1-p5,p16-p63 + .text + .align 16 + .global vacall_receiver# + .proc vacall_receiver# +vacall_receiver: + .prologue 14, 41 + .spill 48 + .mmb + .save ar.pfs, r42 + alloc r42 = ar.pfs, 8, 5, 1, 0 + .vframe r43 + mov r43 = r12 + nop 0 + .mmi + adds r12 = -208, r12 + mov r44 = r1 + .save rp, r41 + mov r41 = b0 + .body + ;; + .mmi + adds r14 = -48, r43 + adds r16 = -48, r43 + adds r40 = -152, r43 + .mmb + adds r45 = -192, r43 + st8 [r43] = r38 + nop 0 + ;; + .mmi + nop 0 + st8 [r14] = r32, 8 + adds r32 = -160, r43 + .mmi + st4 [r40] = r0 + ;; + st8 [r14] = r33 + adds r14 = -32, r43 + .mmi + st4 [r45] = r0 + ;; + st8 [r14] = r34 + addl r14 = @ltoffx(vacall_function#), r1 + .mmb + nop 0 + st8 [r32] = r0 + nop 0 + ;; + .mmi + ld8.mov r14 = [r14], vacall_function# + ;; + ld8 r15 = [r14] + nop 0 + .mmi + adds r14 = -24, r43 + ;; + st8 [r14] = r35 + adds r14 = -16, r43 + ;; + .mfi + st8 [r14] = r36 + nop 0 + adds r14 = -8, r43 + .mmi + nop 0 + ;; + st8 [r14] = r37 + nop 0 + .mmi + adds r14 = 8, r43 + ;; + st8 [r14] = r39 + adds r14 = -112, r43 + ;; + .mfi + stfd [r14] = f8 + nop 0 + adds r14 = -104, r43 + .mmi + nop 0 + ;; + stfd [r14] = f9 + nop 0 + .mmi + adds r14 = -96, r43 + ;; + stfd [r14] = f10 + adds r14 = -88, r43 + ;; + .mfi + stfd [r14] = f11 + nop 0 + adds r14 = -80, r43 + .mmi + nop 0 + ;; + stfd [r14] = f12 + nop 0 + .mmi + adds r14 = -72, r43 + ;; + stfd [r14] = f13 + adds r14 = -64, r43 + ;; + .mfi + stfd [r14] = f14 + nop 0 + adds r14 = -56, r43 + .mmi + nop 0 + ;; + stfd [r14] = f15 + nop 0 + .mmi + adds r14 = -168, r43 + ;; + st8 [r14] = r16 + adds r14 = -128, r43 + ;; + .mii + st8 [r14] = r16 + adds r14 = -120, r43 + ;; + nop 0 + .mii + st4 [r14] = r0 + adds r14 = -136, r43 + ;; + nop 0 + .mmb + st8 [r14] = r8 + ld8 r14 = [r15], 8 + nop 0 + ;; + .mib + nop 0 + mov b6 = r14 + nop 0 + .mbb + ld8 r1 = [r15] + nop 0 + br.call.sptk.many b0 = b6 + ;; + .mmb + mov r1 = r44 + ld4 r40 = [r40] + nop 0 + ;; + .mfb + cmp4.eq p6, p7 = 0, r40 + nop 0 + (p6) br.cond.dpnt .L49 + ;; + .mfb + cmp4.ne p6, p7 = 1, r40 + nop 0 + (p7) br.cond.dpnt .L50 + ;; + .mfb + cmp4.ne p6, p7 = 2, r40 + nop 0 + (p7) br.cond.dpnt .L50 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 3, r40 + ;; + (p7) adds r14 = -184, r43 + ;; + .mfb + (p7) ld1 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 4, r40 + ;; + nop 0 + .mmi + (p7) adds r14 = -184, r43 + ;; + (p7) ld2 r14 = [r14] + nop 0 + ;; + .mib + nop 0 + (p7) sxt2 r8 = r14 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 5, r40 + ;; + (p7) adds r14 = -184, r43 + ;; + .mfb + (p7) ld2 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 6, r40 + ;; + nop 0 + .mmi + (p7) adds r14 = -184, r43 + ;; + (p7) ld4 r14 = [r14] + nop 0 + ;; + .mib + nop 0 + (p7) sxt4 r8 = r14 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 7, r40 + ;; + (p7) adds r14 = -184, r43 + ;; + .mfb + (p7) ld4 r8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mfb + cmp4.ne p6, p7 = 8, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 9, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 10, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mfb + cmp4.ne p6, p7 = 11, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mii + nop 0 + cmp4.ne p6, p7 = 12, r40 + ;; + (p7) adds r14 = -184, r43 + ;; + .mfb + (p7) ldfs f8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mii + nop 0 + cmp4.ne p6, p7 = 13, r40 + ;; + (p7) adds r14 = -184, r43 + ;; + .mfb + (p7) ldfd f8 = [r14] + nop 0 + (p7) br.cond.dpnt .L49 + .mfb + cmp4.ne p6, p7 = 14, r40 + nop 0 + (p7) br.cond.dpnt .L54 + ;; + .mib + nop 0 + cmp4.ne p6, p7 = 15, r40 + (p6) br.cond.dptk .L49 + .mii + nop 0 + adds r15 = -192, r43 + ;; + nop 0 + .mmi + ld4 r14 = [r15] + ;; + nop 0 + tbit.z p6, p7 = r14, 10 + .mfb + adds r14 = -144, r43 + nop 0 + (p6) br.cond.dpnt .L49 + ;; + .mmi + ld8 r21 = [r14] + ;; + adds r14 = -1, r21 + nop 0 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 31, r14 + (p6) br.cond.dpnt .L49 + .mmi + ld8 r14 = [r32] + ;; + and r20 = 7, r14 + and r23 = -8, r14 + .mii + nop 0 + cmp.ltu p6, p7 = 8, r21 + ;; + nop 0 + .mfb + add r14 = r21, r20 + nop 0 + (p6) br.cond.dptk .L35 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 8, r14 + (p6) br.cond.dptk .L37 + .mfi + shladd r15 = r14, 3, r0 + nop 0 + addl r14 = 2, r0 + .mii + ld8 r16 = [r23] + shladd r17 = r20, 3, r0 + ;; + adds r15 = -1, r15 + ;; + .mii + nop 0 + sxt4 r15 = r15 + ;; + shl r14 = r14, r15 + ;; + .mmi + adds r14 = -1, r14 + ;; + and r14 = r16, r14 + nop 0 + .mmi + nop 0 + ;; + nop 0 + shr r8 = r14, r17 +.L49: + .mii + nop 0 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 1 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L50: + .body + .copy_state 1 + .mii + nop 0 + adds r14 = -184, r43 + ;; + nop 0 + .mii + ld1 r14 = [r14] + nop 0 + ;; + sxt1 r8 = r14 + .mii + nop 0 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 2 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L54: + .body + .copy_state 2 + .mmb + nop 0 + adds r14 = -184, r43 + nop 0 + ;; + .mii + ld8 r8 = [r14] + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 3 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L35: + .body + .copy_state 3 + .mib + nop 0 + cmp.ltu p6, p7 = 16, r21 + (p6) br.cond.dptk .L39 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 16, r14 + (p6) br.cond.dptk .L41 + .mmi + shladd r15 = r14, 3, r0 + adds r14 = 8, r23 + shladd r16 = r20, 2, r0 + .mmb + shladd r18 = r20, 3, r0 + ld8 r17 = [r23] + nop 0 + ;; + .mfi + ld8 r19 = [r14] + nop 0 + addl r14 = 2, r0 + .mii + adds r15 = -65, r15 + sub r16 = 32, r16 + ;; + sxt4 r15 = r15 + .mii + nop 0 + sxt4 r16 = r16 + shr r17 = r17, r18 + ;; + .mii + nop 0 + shl r14 = r14, r15 + ;; + adds r14 = -1, r14 + ;; + .mii + nop 0 + and r14 = r19, r14 + ;; + shl r15 = r14, r16 + .mii + nop 0 + shr r9 = r14, r18 + ;; + shl r15 = r15, r16 + ;; + .mii + or r8 = r15, r17 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 4 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L37: + .body + .copy_state 4 + .mfi + shladd r15 = r14, 3, r0 + nop 0 + addl r14 = 2, r0 + .mii + ld8 r17 = [r23], 8 + shladd r18 = r20, 3, r0 + ;; + adds r15 = -65, r15 + .mii + ld8 r19 = [r23] + sub r16 = 64, r18 + ;; + sxt4 r15 = r15 + .mii + nop 0 + sxt4 r16 = r16 + ;; + shl r14 = r14, r15 + .mii + nop 0 + shr r17 = r17, r18 + ;; + adds r14 = -1, r14 + ;; + .mii + nop 0 + and r14 = r19, r14 + ;; + shl r14 = r14, r16 + ;; + .mii + or r8 = r14, r17 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 5 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L39: + .body + .copy_state 5 + .mib + nop 0 + cmp.ltu p6, p7 = 24, r21 + (p6) br.cond.dptk .L43 + ;; + .mib + nop 0 + cmp.ltu p6, p7 = 24, r14 + (p6) br.cond.dptk .L45 + .mmi + shladd r15 = r14, 3, r0 + adds r14 = 8, r23 + shladd r16 = r20, 2, r0 + .mmb + shladd r19 = r20, 3, r0 + ld8 r18 = [r23], 16 + nop 0 + ;; + .mmi + ld8 r17 = [r14] + addl r14 = 2, r0 + adds r15 = -65, r15 + .mmb + sub r16 = 32, r16 + ld8 r20 = [r23] + nop 0 + ;; + .mii + nop 0 + sxt4 r15 = r15 + sxt4 r16 = r16 + .mii + nop 0 + shr r18 = r18, r19 + ;; + shl r14 = r14, r15 + .mii + nop 0 + shl r15 = r17, r16 + shr r17 = r17, r19 + ;; + .mii + nop 0 + shl r15 = r15, r16 + adds r14 = -1, r14 + ;; + .mii + and r14 = r20, r14 + or r8 = r15, r18 + ;; + shl r15 = r14, r16 + .mii + nop 0 + shr r10 = r14, r19 + ;; + shl r15 = r15, r16 + ;; + .mii + or r9 = r15, r17 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 6 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L41: + .body + .copy_state 6 + .mfi + shladd r16 = r14, 3, r0 + nop 0 + adds r14 = 8, r23 + .mfi + ld8 r18 = [r23], 16 + nop 0 + shladd r15 = r20, 3, r0 + ;; + .mmi + ld8 r17 = [r14] + addl r14 = 2, r0 + adds r16 = -129, r16 + .mmi + ld8 r20 = [r23] + mov r19 = r15 + sub r15 = 64, r15 + ;; + .mii + nop 0 + sxt4 r16 = r16 + sxt4 r15 = r15 + ;; + .mii + nop 0 + shl r14 = r14, r16 + shr r18 = r18, r19 + .mii + nop 0 + shl r16 = r17, r15 + shr r17 = r17, r19 + ;; + .mmi + adds r14 = -1, r14 + ;; + and r14 = r20, r14 + or r8 = r16, r18 + ;; + .mib + nop 0 + shl r14 = r14, r15 + nop 0 + ;; + .mii + or r9 = r14, r17 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 7 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L45: + .body + .copy_state 7 + .mmi + shladd r16 = r14, 3, r0 + adds r14 = 24, r23 + shladd r15 = r20, 3, r0 + .mmi + adds r18 = 8, r23 + ld8 r20 = [r23] + adds r19 = 16, r23 + ;; + .mmi + ld8 r22 = [r14] + addl r14 = 2, r0 + adds r16 = -129, r16 + .mmi + mov r17 = r15 + ld8 r18 = [r18] + sub r15 = 64, r15 + ;; + .mib + nop 0 + sxt4 r16 = r16 + nop 0 + .mii + ld8 r19 = [r19] + sxt4 r15 = r15 + ;; + shl r14 = r14, r16 + .mii + nop 0 + shr r21 = r19, r17 + shl r16 = r18, r15 + .mii + nop 0 + shr r20 = r20, r17 + shr r18 = r18, r17 + .mii + nop 0 + shl r19 = r19, r15 + ;; + nop 0 + .mmi + adds r14 = -1, r14 + ;; + and r14 = r22, r14 + or r8 = r16, r20 + .mii + nop 0 + or r9 = r19, r18 + ;; + shl r14 = r14, r15 + ;; + .mii + or r10 = r14, r21 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 8 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L43: + .body + .copy_state 8 + .mib + nop 0 + cmp.ltu p6, p7 = 32, r14 + (p6) br.cond.dptk .L47 + .mmi + adds r15 = 24, r23 + shladd r14 = r14, 3, r0 + adds r17 = 8, r23 + .mmi + shladd r16 = r20, 2, r0 + adds r18 = 16, r23 + shladd r20 = r20, 3, r0 + ;; + .mmi + nop 0 + ld8 r22 = [r15] + addl r15 = 2, r0 + .mmi + adds r14 = -65, r14 + ld8 r19 = [r17] + sub r16 = 32, r16 + ;; + .mii + nop 0 + sxt4 r14 = r14 + sxt4 r16 = r16 + .mmb + ld8 r21 = [r18] + ld8 r18 = [r23] + nop 0 + ;; + .mii + nop 0 + shl r15 = r15, r14 + shl r14 = r19, r16 + .mii + nop 0 + shr r18 = r18, r20 + shl r17 = r21, r16 + ;; + .mii + nop 0 + shl r14 = r14, r16 + shr r19 = r19, r20 + .mii + adds r15 = -1, r15 + shl r17 = r17, r16 + shr r21 = r21, r20 + ;; + .mmi + nop 0 + and r15 = r22, r15 + or r8 = r14, r18 + .mmi + or r9 = r17, r19 + ;; + nop 0 + shl r14 = r15, r16 + .mii + nop 0 + shr r11 = r15, r20 + ;; + shl r14 = r14, r16 + ;; + .mii + or r10 = r14, r21 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .label_state 9 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 +.L47: + .body + .copy_state 9 + .mmb + shladd r16 = r14, 3, r0 + adds r14 = 32, r23 + nop 0 + .mmi + adds r18 = 8, r23 + adds r19 = 16, r23 + shladd r15 = r20, 3, r0 + ;; + .mfi + ld8 r22 = [r14] + nop 0 + adds r14 = 24, r23 + .mmi + ld8 r20 = [r18] + adds r16 = -129, r16 + mov r17 = r15 + .mfi + ld8 r18 = [r19] + nop 0 + sub r15 = 64, r15 + ;; + .mmi + ld8 r19 = [r14] + addl r14 = 2, r0 + sxt4 r16 = r16 + .mii + nop 0 + sxt4 r15 = r15 + ;; + shl r21 = r20, r15 + .mii + nop 0 + shr r20 = r20, r17 + shl r14 = r14, r16 + .mii + ld8 r16 = [r23] + shr r23 = r19, r17 + shl r19 = r19, r15 + ;; + .mii + nop 0 + shr r16 = r16, r17 + shr r17 = r18, r17 + .mii + adds r14 = -1, r14 + shl r18 = r18, r15 + ;; + and r14 = r22, r14 + .mmi + nop 0 + or r8 = r21, r16 + or r10 = r19, r17 + .mii + nop 0 + or r9 = r18, r20 + ;; + shl r14 = r14, r15 + ;; + .mii + or r11 = r14, r23 + mov ar.pfs = r42 + mov b0 = r41 + .mib + nop 0 + .restore sp + mov r12 = r43 + br.ret.sptk.many b0 + .endp vacall_receiver# + .ident "GCC: (GNU) 4.0.1" +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-ia64.c b/vacall/vacall-ia64.c new file mode 100644 index 0000000..7197c05 --- /dev/null +++ b/vacall/vacall-ia64.c @@ -0,0 +1,282 @@ +/* vacall function for ia64 CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("r15"); +#endif +register double farg1 __asm__("f8"); +register double farg2 __asm__("f9"); +register double farg3 __asm__("f10"); +register double farg4 __asm__("f11"); +register double farg5 __asm__("f12"); +register double farg6 __asm__("f13"); +register double farg7 __asm__("f14"); +register double farg8 __asm__("f15"); +register __vaword* sret __asm__("r8"); +register __varword iret __asm__("r8"); +register __varword iret2 __asm__("r9"); +register __varword iret3 __asm__("r10"); +register __varword iret4 __asm__("r11"); +register float fret __asm__("f8"); +register double dret __asm__("f8"); + +/* The ABI requires that the first 8 general-purpose argument words are + being passed in registers, even if these words belong to a struct. No room + is allocated for these register words on the stack by the caller, but the + callee allocates room for them - at the right place in the stack frame, + that is, above the usual {fp, retaddr} combo - if and only if they are part + of a larger struct that extends to the stack and the address of this struct + is taken. */ +struct gpargsequence { + __vaword word1; /* r32 */ + __vaword word2; /* r33 */ + __vaword word3; /* r34 */ + __vaword word4; /* r35 */ + __vaword word5; /* r36 */ + __vaword word6; /* r37 */ + __vaword word7; /* r38 */ + __vaword word8; /* r39 */ + __vaword firststackword; +}; + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (struct gpargsequence gpargs) +{ + __va_alist list; + /* Move the arguments passed in registers to their stack locations. */ + list.farg[0] = farg1; + list.farg[1] = farg2; + list.farg[2] = farg3; + list.farg[3] = farg4; + list.farg[4] = farg5; + list.farg[5] = farg6; + list.farg[6] = farg7; + list.farg[7] = farg8; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&gpargs; + list.saptr = (__vaword*)&gpargs; + list.fanum = 0; + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.structraddr = sret; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulonglong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + /* Return structs of size <= 32 in registers. */ + if (list.rsize > 0 && list.rsize <= 32) { + #if 0 /* Unoptimized */ + iret = (__varword)((unsigned char *) list.raddr)[0]; + if (list.rsize >= 2) + iret |= (__varword)((unsigned char *) list.raddr)[1] << 8; + if (list.rsize >= 3) + iret |= (__varword)((unsigned char *) list.raddr)[2] << 16; + if (list.rsize >= 4) + iret |= (__varword)((unsigned char *) list.raddr)[3] << 24; + if (list.rsize >= 5) + iret |= (__varword)((unsigned char *) list.raddr)[4] << 32; + if (list.rsize >= 6) + iret |= (__varword)((unsigned char *) list.raddr)[5] << 40; + if (list.rsize >= 7) + iret |= (__varword)((unsigned char *) list.raddr)[6] << 48; + if (list.rsize >= 8) + iret |= (__varword)((unsigned char *) list.raddr)[7] << 56; + if (list.rsize >= 9) { + iret2 = (__varword)((unsigned char *) list.raddr)[8]; + if (list.rsize >= 10) + iret2 |= (__varword)((unsigned char *) list.raddr)[9] << 8; + if (list.rsize >= 11) + iret2 |= (__varword)((unsigned char *) list.raddr)[10] << 16; + if (list.rsize >= 12) + iret2 |= (__varword)((unsigned char *) list.raddr)[11] << 24; + if (list.rsize >= 13) + iret2 |= (__varword)((unsigned char *) list.raddr)[12] << 32; + if (list.rsize >= 14) + iret2 |= (__varword)((unsigned char *) list.raddr)[13] << 40; + if (list.rsize >= 15) + iret2 |= (__varword)((unsigned char *) list.raddr)[14] << 48; + if (list.rsize >= 16) + iret2 |= (__varword)((unsigned char *) list.raddr)[15] << 56; + if (list.rsize >= 17) { + iret3 = (__varword)((unsigned char *) list.raddr)[16]; + if (list.rsize >= 18) + iret3 |= (__varword)((unsigned char *) list.raddr)[17] << 8; + if (list.rsize >= 19) + iret3 |= (__varword)((unsigned char *) list.raddr)[18] << 16; + if (list.rsize >= 20) + iret3 |= (__varword)((unsigned char *) list.raddr)[19] << 24; + if (list.rsize >= 21) + iret3 |= (__varword)((unsigned char *) list.raddr)[20] << 32; + if (list.rsize >= 22) + iret3 |= (__varword)((unsigned char *) list.raddr)[21] << 40; + if (list.rsize >= 23) + iret3 |= (__varword)((unsigned char *) list.raddr)[22] << 48; + if (list.rsize >= 24) + iret3 |= (__varword)((unsigned char *) list.raddr)[23] << 56; + if (list.rsize >= 25) { + iret4 = (__varword)((unsigned char *) list.raddr)[24]; + if (list.rsize >= 26) + iret4 |= (__varword)((unsigned char *) list.raddr)[25] << 8; + if (list.rsize >= 27) + iret4 |= (__varword)((unsigned char *) list.raddr)[26] << 16; + if (list.rsize >= 28) + iret4 |= (__varword)((unsigned char *) list.raddr)[27] << 24; + if (list.rsize >= 29) + iret4 |= (__varword)((unsigned char *) list.raddr)[28] << 32; + if (list.rsize >= 30) + iret4 |= (__varword)((unsigned char *) list.raddr)[29] << 40; + if (list.rsize >= 31) + iret4 |= (__varword)((unsigned char *) list.raddr)[30] << 48; + if (list.rsize >= 32) + iret4 |= (__varword)((unsigned char *) list.raddr)[31] << 56; + } + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 4*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 5*sizeof(__varword) */ + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = ((__varword)2 << (end_offset*8-1)) - 1; + iret = (wordaddr[0] & mask0) >> (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*8-start_offset*8)); + } + } else if (count <= 2*sizeof(__varword)) { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) >> (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = ((__varword)2 << (end_offset*8-2*sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] >> (start_offset*8)) | ((wordaddr[2] & mask2) << (sizeof(__varword)*8-start_offset*8)); + } + } else if (count <= 3*sizeof(__varword)) { + /* Assign iret, iret2, iret3. */ + if (end_offset <= 3*sizeof(__varword)) { + /* 2*sizeof(__varword) < end_offset ≤ 3*sizeof(__varword) */ + __varword mask2 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] >> (start_offset*8)) | ((wordaddr[2] & mask2) << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret3 = (wordaddr[2] & mask2) >> (start_offset*8); + } else { + /* 3*sizeof(__varword) < end_offset < 4*sizeof(__varword), start_offset > 0 */ + __varword mask3 = ((__varword)2 << (end_offset*8-2*sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] >> (start_offset*8)) | (wordaddr[2] << (sizeof(__varword)*8-start_offset*8)); + iret3 = (wordaddr[2] >> (start_offset*8)) | ((wordaddr[3] & mask3) << (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2, iret3, iret4. */ + if (end_offset <= 4*sizeof(__varword)) { + /* 3*sizeof(__varword) < end_offset ≤ 4*sizeof(__varword) */ + __varword mask3 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] >> (start_offset*8)) | (wordaddr[2] << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret3 = (wordaddr[2] >> (start_offset*8)) | ((wordaddr[3] & mask3) << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret4 = (wordaddr[3] & mask3) >> (start_offset*8); + } else { + /* 4*sizeof(__varword) < end_offset < 5*sizeof(__varword), start_offset > 0 */ + __varword mask4 = ((__varword)2 << (end_offset*8-2*sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] >> (start_offset*8)) | (wordaddr[2] << (sizeof(__varword)*8-start_offset*8)); + iret3 = (wordaddr[2] >> (start_offset*8)) | (wordaddr[3] << (sizeof(__varword)*8-start_offset*8)); + iret4 = (wordaddr[3] >> (start_offset*8)) | ((wordaddr[4] & mask4) << (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-internal.h b/vacall/vacall-internal.h new file mode 100644 index 0000000..c196348 --- /dev/null +++ b/vacall/vacall-internal.h @@ -0,0 +1,1213 @@ +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#ifndef _VACALL_INTERNAL_H +#define _VACALL_INTERNAL_H + +/* Get intptr_t, uintptr_t. */ +#include "ffcall-stdint.h" + +/* Include the public definitions, */ +#ifndef REENTRANT +#include "vacall.h" +#else +#include "vacall_r.h" +#endif + + +/* The platform indicator symbols (__i386__, etc.) come from + - "config.h" when compiling vacall-libapi.c, + - the GCC command line options when compiling vacall-$(CPU).c. + */ + +/* These two variants of powerpc ABIs are quite different. */ +#if defined(__powerpc__) && !defined(__powerpc64__) +#if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)) +#define __powerpc_aix__ 1 +#else +#define __powerpc_sysv4__ 1 +#endif +#endif + +/* The Unix and Windows variants of x86_64 ABIs are quite different. */ +#if defined(__x86_64__) +#if defined(_WIN32) || defined(__CYGWIN__) +#define __x86_64_ms__ 1 +#else +#define __x86_64_sysv__ 1 +#endif +#endif + + +/* Max # words in temporary structure storage. + */ +#ifndef __VA_ALIST_WORDS +#define __VA_ALIST_WORDS 256 +#endif + +/* + * Definition of the ‘__va_alist’ type. + */ +/* Note: This struct must not contain members of type 'long' or 'unsigned long', + because in the mingw port we use precompiled code that assumes 'long' is + 64-bit whereas avcall-libapi.c is then compiled by a compiler that has a + 32-bit 'long' type. */ +typedef struct vacall_alist +{ + /* some va_... macros need these flags */ + int flags; + /* temporary storage for return value */ +#if defined(__i386__) || defined(__arm__) || defined(__armhf__) || (defined(__powerpc__) && !defined(__powerpc64__) && defined(__MACH__) && defined(__APPLE__)) + /* Filler word, needed if the numbers of words up to now in this structure */ + /* is odd. */ + /* - On MSVC, alignof(double) = 8, but normally on i386 it is = 4. */ + /* - On ARM, GCC 3.1 produces code for an ABI where alignof(double) = 4 */ + /* and alignof(long long) = 4. But in the newer AAPCS ABI, these */ + /* alignments are 8. */ + /* - On Mac OS X, the Apple compiler has alignof(double) = 8 whereas the */ + /* standard GCC has alignof(double) = 4. */ + __vaword filler1; +#endif + union { + char _char; + signed char _schar; + unsigned char _uchar; + short _short; + unsigned short _ushort; + int _int; + unsigned int _uint; + long _long; + unsigned long _ulong; +#if !(defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppa64__) || defined(__arm64__) || defined(__powerpc64__) || defined(__ia64__) || defined(__riscv64__)) + long long _longlong; + unsigned long long _ulonglong; +#endif + float _float; + double _double; + void* _ptr; + __vaword _words[2]; + } tmp; + /* current pointer into the argument array */ + uintptr_t aptr; + /* structure return pointer, return type, return type size */ + void* raddr; + enum __VAtype rtype; + uintptr_t rsize; +#if defined(__i386__) || defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || defined(__hppa64__) || defined(__arm64__) || defined(__ia64__) + void* structraddr; +#endif +#if (defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)) || defined(__alpha__) || defined(__hppa__) || defined(__hppa64__) + uintptr_t memargptr; +#endif +#if defined(__alpha__) + long farg_offset; + double farg[6]; +#endif +#if defined(__hppa__) && !defined(__hppa64__) + long farg_offset; + long darg_offset; + float farg[4]; + double darg[2]; +#endif +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) + unsigned int anum; +#define __VA_FARG_NUM 2 + unsigned int fanum; + float farg[__VA_FARG_NUM]; + double darg[__VA_FARG_NUM]; +#endif +#if defined(__mipsn32__) || defined(__mips64__) + int anum; +#define __VA_FARG_NUM 8 + float farg[__VA_FARG_NUM]; + double darg[__VA_FARG_NUM]; +#endif +#if defined(__sparc64__) + int anum; + float farg[16]; + double darg[16]; +#endif +#if defined(__hppa64__) +#define __VA_FARG_NUM 8 + float farg[__VA_FARG_NUM]; + double darg[__VA_FARG_NUM]; +#endif +#if defined(__armhf__) +#define __VA_IARG_NUM 4 + /* The first __AV_IARG_NUM integer arguments are passed in registers, even if + some floating-point arguments have already been allocated on the stack. */ + __vaword* iarg; + unsigned int ianum; + unsigned int fanum; + float farg[16]; + double darg[8]; +#endif +#if defined(__arm64__) +#define __VA_IARG_NUM 8 + unsigned int ianum; + __varword iarg[__VA_IARG_NUM]; +#define __VA_FARG_NUM 8 + unsigned int fanum; + float farg[__VA_FARG_NUM]; + double darg[__VA_FARG_NUM]; +#endif +#if defined(__powerpc__) || defined(__powerpc64__) +#if defined(__powerpc_sysv4__) +#define __VA_IARG_NUM 8 + unsigned int ianum; + __varword iarg[__VA_IARG_NUM]; +#define __VA_FARG_NUM 8 +#else +#define __VA_FARG_NUM 13 +#endif + unsigned int fanum; + double farg[__VA_FARG_NUM]; +#endif +#if defined(__ia64__) + __vaword* saptr; +#define __VA_FARG_NUM 8 + unsigned int fanum; + double farg[__VA_FARG_NUM]; +#endif +#if defined(__x86_64_sysv__) +#define __VA_FARG_NUM 8 + unsigned int fanum; + double farg[__VA_FARG_NUM]; +#define __VA_IARG_NUM 6 + unsigned int ianum; + __varword iarg[__VA_IARG_NUM]; +#endif +#if defined(__x86_64_ms__) + int anum; +#define __VA_FARG_NUM 4 + float farg[__VA_FARG_NUM]; + double darg[__VA_FARG_NUM]; +#endif +#if defined(__s390__) && !defined(__s390x__) +#define __VA_IARG_NUM 5 + unsigned int ianum; + __varword iarg[5]; +#define __VA_FARG_NUM 2 + unsigned int fanum; + float farg[__VA_FARG_NUM]; + double darg[__VA_FARG_NUM]; +#endif +#if defined(__s390x__) +#define __VA_IARG_NUM 5 + unsigned int ianum; + __varword iarg[__VA_IARG_NUM]; +#define __VA_FARG_NUM 4 + unsigned int fanum; + float farg[__VA_FARG_NUM]; + double darg[__VA_FARG_NUM]; +#endif +#if defined(__riscv32__) || defined(__riscv64__) +#define __VA_IARG_NUM 8 + unsigned int ianum; + __varword iarg[__VA_IARG_NUM]; + /* Note: iarg[7] == ((__vaword *) (initial aptr))[-1]. */ +#define __VA_FARG_NUM 8 + unsigned int fanum; + float farg[__VA_FARG_NUM]; + double darg[__VA_FARG_NUM]; +#endif +} __va_alist; + + +/* Avoid macro redefinition warnings on DragonFly BSD. */ +#undef __va_start +#undef __va_arg + + +/* + * Definition of the va_start_xxx macros. + */ + +#define __va_start(LIST,RETTYPE,FLAGS) \ + ((LIST)->flags = (FLAGS), \ + (LIST)->rtype = (RETTYPE) \ + ) + +/* + * va_start_struct: Preparing structure return. + */ +#define __va_start_struct(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE,FLAGS) \ + (__va_start(LIST,__VAstruct,FLAGS), \ + (LIST)->rsize = (TYPE_SIZE), \ + ((LIST)->flags & __VA_SUNPROCC_STRUCT_RETURN \ + ? __va_start_struct2(LIST) \ + : ((LIST)->flags & __VA_SUNCC_STRUCT_RETURN \ + ? ((TYPE_SIZE) <= sizeof(vacall_struct_buffer) || (vacall_error_struct_too_large(TYPE_SIZE), 0), \ + (LIST)->raddr = &vacall_struct_buffer, \ + 0 \ + ) \ + : (((LIST)->flags & __VA_SMALL_STRUCT_RETURN) \ + && __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ? ((LIST)->raddr = &(LIST)->tmp, \ + __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + ) \ + : __va_start_struct2(LIST) \ + )) ) ) +/* Determines whether a structure is returned in registers, + * depending on its size and its word-splittable flag. + */ +#if (defined(__i386__) && defined(_WIN32)) +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 \ + || ((TYPE_SIZE) == 8 \ + && (((LIST)->flags & __VA_MSVC_STRUCT_RETURN) \ + || ((TYPE_SPLITTABLE) \ + && ((LIST)->flags & __VA_GCC_STRUCT_RETURN) \ + ) ) ) ) +/* Turn on __VA_REGISTER_STRUCT_RETURN if __VA_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + ((LIST)->flags |= __VA_REGISTER_STRUCT_RETURN, 0) +#endif +#if (defined(__i386__) && !defined(_WIN32)) || defined(__m68k__) || (defined(__powerpc__) && !defined(__powerpc64__)) || (defined(__s390__) && !defined(__s390x__)) +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 \ + || ((TYPE_SIZE) == 8 && (TYPE_SPLITTABLE) \ + && ((LIST)->flags & __VA_GCC_STRUCT_RETURN) \ + ) ) +/* Turn on __VA_REGISTER_STRUCT_RETURN if __VA_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + ((LIST)->flags |= __VA_REGISTER_STRUCT_RETURN, 0) +#endif +#if defined(__arm__) || defined(__armhf__) +/* structs of size 3 also will be returned in register */ +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) <= 4) +/* Turn on __VA_REGISTER_STRUCT_RETURN if __VA_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + ((LIST)->flags |= __VA_REGISTER_STRUCT_RETURN, 0) +#endif +#if defined(__alpha__) +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8 \ + || ((TYPE_SIZE) == 16 && (TYPE_SPLITTABLE) \ + && ((LIST)->flags & __VA_GCC_STRUCT_RETURN) \ + ) ) +/* Turn on __VA_REGISTER_STRUCT_RETURN if __VA_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + ((LIST)->flags |= __VA_REGISTER_STRUCT_RETURN, 0) +#endif +#if (defined(__hppa__) && !defined(__hppa64__)) || defined(__riscv32__) +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) <= 8) +/* Test __VA_SMALL_STRUCT_RETURN at run time. */ +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + 0 +#endif +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) || (defined(__sparc__) && !defined(__sparc64__)) +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4) +/* Test __VA_SMALL_STRUCT_RETURN instead of __VA_REGISTER_STRUCT_RETURN. */ +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + ((LIST)->anum++, \ + 0 \ + ) +#else +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + 0 +#endif +#endif +#if defined(__mipsn32__) || defined(__mips64__) +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((LIST)->flags & __VA_GCC_STRUCT_RETURN \ + ? ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8) \ + : ((TYPE_SIZE) <= 16) \ + ) +/* Turn on __VA_REGISTER_STRUCT_RETURN if __VA_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. Also turn on + * __VA_REGISTER_FLOATSTRUCT_RETURN or __VA_REGISTER_DOUBLESTRUCT_RETURN if + * the struct will be returned in floating-point registers. + */ +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + ((LIST)->flags |= __VA_REGISTER_STRUCT_RETURN, \ + (TYPE_ALIGN) == sizeof(float) && (TYPE_SPLITTABLE) \ + && ((TYPE_SIZE) == sizeof(float) || (TYPE_SIZE) == 2*sizeof(float)) \ + && ((LIST)->flags |= __VA_REGISTER_FLOATSTRUCT_RETURN), \ + (TYPE_ALIGN) == sizeof(double) && (TYPE_SPLITTABLE) \ + && ((TYPE_SIZE) == sizeof(double) || (TYPE_SIZE) == 2*sizeof(double)) \ + && ((LIST)->flags |= __VA_REGISTER_DOUBLESTRUCT_RETURN), \ + 0) +#endif +#if (defined(__powerpc64__) && !defined(__powerpc64_elfv2__)) || defined(__s390x__) +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + 0 +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + 0 +#endif +#if defined(__sparc64__) || defined(__ia64__) +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) <= 32) +/* Turn on __VA_REGISTER_STRUCT_RETURN if __VA_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + ((LIST)->flags |= __VA_REGISTER_STRUCT_RETURN, \ + 0) +#endif +#if defined(__hppa64__) || defined(__arm64__) || (defined(__powerpc64__) && defined(__powerpc64_elfv2__)) || defined(__x86_64_sysv__) || defined(__riscv64__) +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) <= 16) +/* Turn on __VA_REGISTER_STRUCT_RETURN if __VA_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + ((LIST)->flags |= __VA_REGISTER_STRUCT_RETURN, \ + 0) +#endif +#if defined(__x86_64_ms__) +#define __va_reg_struct_return(LIST,TYPE_SIZE,TYPE_SPLITTABLE) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8) +/* Turn on __VA_REGISTER_STRUCT_RETURN if __VA_SMALL_STRUCT_RETURN was set + * and the struct will actually be returned in registers. + */ +#define __va_start_struct1(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + ((LIST)->flags |= __VA_REGISTER_STRUCT_RETURN, \ + 0) +#endif +/* + * Preparing structure return in memory. + */ +#if defined(__i386__) || defined(__alpha__) || (defined(__arm__) && !defined(__armhf__)) || defined(__powerpc_aix__) || defined(__powerpc64__) +/* Return structure pointer is passed as first arg. */ +#define __va_start_struct2(LIST) \ + ((LIST)->raddr = *(void* *)((LIST)->aptr), \ + (LIST)->aptr += sizeof(void*), \ + 0 \ + ) +#endif +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__x86_64_ms__) +/* Return structure pointer is passed as first arg. */ +#define __va_start_struct2(LIST) \ + ((LIST)->raddr = *(void* *)((LIST)->aptr), \ + (LIST)->aptr += sizeof(void*), \ + (LIST)->anum++, \ + 0 \ + ) +#endif +#if defined(__armhf__) +/* Return structure pointer is passed as first arg. */ +#define __va_start_struct2(LIST) \ + ((LIST)->raddr = (void*)(LIST)->iarg[(LIST)->ianum], \ + (LIST)->ianum++, \ + 0 \ + ) +#endif +#if defined(__powerpc_sysv4__) || defined(__x86_64_sysv__) || defined(__s390__) || defined(__s390x__) || defined(__riscv32__) || defined(__riscv64__) +/* Return structure pointer is passed as first arg. */ +#define __va_start_struct2(LIST) \ + ((LIST)->raddr = (void*)((LIST)->iarg[(LIST)->ianum++]), \ + 0 \ + ) +#endif +#if defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__hppa__) || defined(__hppa64__) || defined(__arm64__) || defined(__ia64__) +/* Return structure pointer is passed in a special register. */ +#define __va_start_struct2(LIST) \ + ((LIST)->raddr = (LIST)->structraddr, 0) +#endif + + +/* + * Definition of the va_arg_xxx macros. + */ + +/* Padding of non-struct arguments. */ +#define __va_argsize(TYPE_SIZE) \ + (((TYPE_SIZE) + sizeof(__vaword)-1) & -(intptr_t)sizeof(__vaword)) +#if defined(__i386__) || defined(__m68k__) || (defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)) || (defined(__sparc__) && !defined(__sparc64__)) || defined(__alpha__) || (defined(__arm__) && !defined(__armhf__)) || defined(__arm64__) || defined(__powerpc_aix__) || defined(__powerpc64__) || defined(__ia64__) || defined(__x86_64_sysv__) || defined(__s390__) || defined(__s390x__) || defined(__riscv32__) || defined(__riscv64__) +/* args grow up */ +/* small structures < 1 word are adjusted depending on compiler */ +#define __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->aptr += __va_argsize(TYPE_SIZE), \ + (LIST)->aptr - __va_argsize(TYPE_SIZE) \ + ) +#define __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->aptr += __va_argsize(TYPE_SIZE), \ + (LIST)->aptr - ((TYPE_SIZE) < sizeof(__vaword) \ + ? (TYPE_SIZE) \ + : __va_argsize(TYPE_SIZE) \ + ) \ + ) +#endif +#if defined(__armhf__) +/* args grow up */ +/* small structures < 1 word are adjusted depending on compiler */ +/* the first __VA_IARG_NUM argument words are passed in registers */ +#define __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (((LIST)->ianum + ((TYPE_SIZE) + sizeof(__vaword)-1) / sizeof(__vaword) <= __VA_IARG_NUM \ + ? ((LIST)->ianum += __va_argsize(TYPE_SIZE) / sizeof(__vaword), \ + (char*)&(LIST)->iarg[(LIST)->ianum] \ + ) \ + : (((LIST)->aptr == (uintptr_t)&(LIST)->iarg[__VA_IARG_NUM] \ + ? /* split case */ \ + ((LIST)->aptr = (uintptr_t)&(LIST)->iarg[(LIST)->ianum] + __va_argsize(TYPE_SIZE), \ + 0) \ + : ((LIST)->aptr += __va_argsize(TYPE_SIZE), \ + 0)), \ + (LIST)->ianum = __VA_IARG_NUM, \ + (char*)(LIST)->aptr \ + ) ) \ + - __va_argsize(TYPE_SIZE) \ + ) +#define __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (((LIST)->ianum + ((TYPE_SIZE) + sizeof(__vaword)-1) / sizeof(__vaword) <= __VA_IARG_NUM \ + ? ((LIST)->ianum += __va_argsize(TYPE_SIZE) / sizeof(__vaword), \ + (char*)&(LIST)->iarg[(LIST)->ianum] \ + ) \ + : (((LIST)->aptr == (uintptr_t)&(LIST)->iarg[__VA_IARG_NUM] \ + ? /* split case */ \ + ((LIST)->aptr = (uintptr_t)&(LIST)->iarg[(LIST)->ianum] + __va_argsize(TYPE_SIZE), \ + 0) \ + : ((LIST)->aptr += __va_argsize(TYPE_SIZE), \ + 0)), \ + (LIST)->ianum = __VA_IARG_NUM, \ + (char*)(LIST)->aptr \ + ) ) \ + - ((TYPE_SIZE) < sizeof(__vaword) \ + ? (TYPE_SIZE) \ + : __va_argsize(TYPE_SIZE) \ + ) \ + ) +#endif +#if defined(__powerpc_sysv4__) +/* args grow up */ +/* small structures < 1 word are adjusted depending on compiler */ +/* the first __VA_IARG_NUM argument words are passed in registers */ +#define __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (((LIST)->ianum + ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword) <= __VA_IARG_NUM \ + ? ((LIST)->ianum += __va_argsize(TYPE_SIZE) / sizeof(__varword), \ + (char*)&(LIST)->iarg[(LIST)->ianum] \ + ) \ + : ((LIST)->aptr += __va_argsize(TYPE_SIZE), \ + (char*)(LIST)->aptr \ + ) ) \ + - __va_argsize(TYPE_SIZE) \ + ) +#define __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (((LIST)->ianum + ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword) <= __VA_IARG_NUM \ + ? ((LIST)->ianum += __va_argsize(TYPE_SIZE) / sizeof(__varword), \ + (char*)&(LIST)->iarg[(LIST)->ianum] \ + ) \ + : ((LIST)->aptr += __va_argsize(TYPE_SIZE), \ + (char*)(LIST)->aptr \ + ) ) \ + - ((TYPE_SIZE) < sizeof(__vaword) \ + ? (TYPE_SIZE) \ + : __va_argsize(TYPE_SIZE) \ + ) \ + ) +#endif +#if defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__x86_64_ms__) +/* args grow up */ +/* small structures < 1 word are adjusted depending on compiler */ +#define __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->anum += __va_argsize(TYPE_SIZE)/sizeof(__vaword), \ + (LIST)->aptr += __va_argsize(TYPE_SIZE), \ + (LIST)->aptr - __va_argsize(TYPE_SIZE) \ + ) +#define __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->anum += __va_argsize(TYPE_SIZE)/sizeof(__vaword), \ + (LIST)->aptr += __va_argsize(TYPE_SIZE), \ + (LIST)->aptr - ((TYPE_SIZE) < sizeof(__vaword) \ + ? (TYPE_SIZE) \ + : __va_argsize(TYPE_SIZE) \ + ) \ + ) +#endif +#if defined(__hppa__) && !defined(__hppa64__) +/* args grow down */ +#define __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->aptr = (LIST)->aptr - __va_argsize(TYPE_SIZE), \ + ((TYPE_SIZE) > 4 && ((LIST)->aptr &= -8)), \ + (LIST)->aptr \ + ) +#define __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->aptr = (LIST)->aptr - __va_argsize(TYPE_SIZE), \ + ((TYPE_SIZE) > 4 && ((LIST)->aptr &= -8)), \ + (LIST)->aptr + ((-(TYPE_SIZE)) & 3) \ + ) +#endif +#if defined(__hppa64__) +/* args grow up */ +#define __va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (((TYPE_SIZE) > 8 && ((LIST)->aptr = (((LIST)->aptr +15) & -16))), \ + (LIST)->aptr += __va_argsize(TYPE_SIZE), \ + (LIST)->aptr - __va_argsize(TYPE_SIZE) \ + ) +#define __va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (((TYPE_SIZE) > 8 && ((LIST)->aptr = (((LIST)->aptr +15) & -16))), \ + (LIST)->aptr += __va_argsize(TYPE_SIZE), \ + (LIST)->aptr - ((TYPE_SIZE) < sizeof(__vaword) \ + ? (TYPE_SIZE) \ + : __va_argsize(TYPE_SIZE) \ + ) \ + ) +#endif +#if defined(__i386__) || ((defined(__mipsn32__) || defined(__mips64__)) && defined(_MIPSEL)) || defined(__alpha__) || ((defined(__arm__) || defined(__armhf__)) && defined(__ARMEL__)) || defined(__ia64__) || (defined(__powerpc64__) && defined(_LITTLE_ENDIAN)) || defined(__x86_64_ms__) +/* little endian -> small args < 1 word are adjusted to the left */ +#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) +#endif +#if defined(__m68k__) || ((defined(__mipsn32__) || defined(__mips64__)) && defined(_MIPSEB)) || defined(__sparc__) || defined(__sparc64__) || defined(__hppa__) || defined(__hppa64__) || ((defined(__arm__) || defined(__armhf__)) && !defined(__ARMEL__)) || (defined(__powerpc__) && !defined(__powerpc64__)) || (defined(__powerpc64__) && defined(_BIG_ENDIAN)) +/* big endian -> small args < 1 word are adjusted to the right */ +#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (void*)__va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) +#endif +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) +#ifdef _MIPSEB +/* big endian -> small args < 1 word are adjusted to the right */ +#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->anum++, \ + (void*)__va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)) +#else /* _MIPSEL */ +/* little endian -> small args < 1 word are adjusted to the left */ +#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->anum++, \ + (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)) +#endif +#endif +#if defined(__arm64__) +/* the first __VA_IARG_NUM argument words are passed in registers */ +#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->ianum + ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword) <= __VA_IARG_NUM \ + ? ((LIST)->ianum += ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword), \ + &(LIST)->iarg[(LIST)->ianum - ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword)] \ + ) \ + : ((LIST)->ianum = __VA_IARG_NUM, \ + (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ) ) +#endif +#if defined(__x86_64_sysv__) +/* the first __VA_IARG_NUM argument words are passed in registers */ +#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (((TYPE_SIZE) <= 2*sizeof(__varword) \ + && (LIST)->ianum + ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword) <= __VA_IARG_NUM) \ + ? ((LIST)->ianum += ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword), \ + &(LIST)->iarg[(LIST)->ianum - ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword)] \ + ) \ + : (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ) +#endif +#if defined(__s390__) || defined(__s390x__) +/* the first __VA_IARG_NUM argument words are passed in registers */ +#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->ianum + ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword) <= __VA_IARG_NUM \ + ? ((LIST)->ianum += ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword), \ + (void*)((uintptr_t)&(LIST)->iarg[(LIST)->ianum] - (TYPE_SIZE)) \ + ) \ + : ((LIST)->ianum = __VA_IARG_NUM, \ + (void*)__va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ) ) +#endif +#if defined(__riscv32__) || defined(__riscv64__) +/* the first __VA_IARG_NUM argument words are passed in registers */ +#define __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->ianum + ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword) <= __VA_IARG_NUM \ + ? ((LIST)->ianum += ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword), \ + &(LIST)->iarg[(LIST)->ianum - ((TYPE_SIZE) + sizeof(__varword)-1) / sizeof(__varword)] \ + ) \ + : (((LIST)->ianum < __VA_IARG_NUM \ + ? ((LIST)->aptr -= (__VA_IARG_NUM - (LIST)->ianum) * sizeof(__vaword), \ + (LIST)->ianum = __VA_IARG_NUM, \ + 0) \ + : 0), \ + (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ) ) +#endif +#define __va_arg(LIST,TYPE) \ + *(TYPE*)__va_arg_adjusted(LIST,sizeof(TYPE),__VA_alignof(TYPE)) + +/* Integer arguments. */ + +#define _va_arg_char(LIST) __va_arg(LIST,char) +#define _va_arg_schar(LIST) __va_arg(LIST,signed char) +#define _va_arg_uchar(LIST) __va_arg(LIST,unsigned char) +#define _va_arg_short(LIST) __va_arg(LIST,short) +#define _va_arg_ushort(LIST) __va_arg(LIST,unsigned short) +#define _va_arg_int(LIST) __va_arg(LIST,int) +#define _va_arg_uint(LIST) __va_arg(LIST,unsigned int) +#define _va_arg_long(LIST) __va_arg(LIST,long) +#define _va_arg_ulong(LIST) __va_arg(LIST,unsigned long) + +#if defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppa64__) || defined(__arm64__) || defined(__powerpc64__) || defined(__ia64__) || (defined(__x86_64__) && !defined(__x86_64_x32__) && !defined(__VA_LLP64)) || defined(__s390x__) || defined(__riscv64__) +/* ‘long long’ and ‘long’ are identical. */ +#define _va_arg_longlong _va_arg_long +#define _va_arg_ulonglong _va_arg_ulong +#elif defined(__mipsn32__) || defined(__x86_64_x32__) || (defined(__x86_64__) && defined(__VA_LLP64)) +/* ‘long long’ fits in __vaword. */ +#define _va_arg_longlong(LIST) __va_arg(LIST,long long) +#define _va_arg_ulonglong(LIST) __va_arg(LIST,unsigned long long) +#elif defined(__i386__) || defined(__m68k__) || defined(__mips__) || (defined(__sparc__) && !defined(__sparc64__)) || (defined(__hppa__) && !defined(__hppa64__)) || defined(__arm__) || defined(__armhf__) || defined(__powerpc__) || (defined(__s390__) && !defined(__s390x__)) || defined(__riscv32__) +/* ‘long long’s are passed embedded on the arg stack. */ +#define _va_arg_longlong(LIST) __va_arg_longlong(LIST,long long) +#define _va_arg_ulonglong(LIST) __va_arg_longlong(LIST,unsigned long long) +#if defined(__i386__) || defined(__m68k__) || defined(__powerpc_aix__) +/* ‘long long’s are (at most) word-aligned. */ +#define __va_arg_longlong(LIST,TYPE) __va_arg(LIST,TYPE) +#endif +#if defined(__mips__) || defined(__arm__) +/* ‘long long’s have alignment 8. */ +#define __va_arg_longlong(LIST,TYPE) \ + ((LIST)->aptr = (((LIST)->aptr+__VA_alignof(TYPE)-1) & -(intptr_t)__VA_alignof(TYPE)), \ + __va_arg(LIST,TYPE)) +#endif +#if defined(__armhf__) +/* ‘long long’s have alignment 8. */ +#define __va_arg_longlong(LIST,TYPE) \ + (((LIST)->ianum < __VA_IARG_NUM \ + ? ((LIST)->ianum = (((LIST)->ianum+__VA_alignof(TYPE)/sizeof(__vaword)-1) & -(intptr_t)(__VA_alignof(TYPE)/sizeof(__vaword))), 0) \ + : ((LIST)->aptr = (((LIST)->aptr+__VA_alignof(TYPE)-1) & -(intptr_t)__VA_alignof(TYPE)), 0) \ + ), \ + __va_arg(LIST,TYPE)) +#endif +#if defined(__powerpc_sysv4__) +/* ‘long long’s have alignment 8. */ +#define __va_arg_longlong(LIST,TYPE) \ + (((LIST)->ianum < __VA_IARG_NUM \ + ? ((LIST)->ianum = (((LIST)->ianum+__VA_alignof(TYPE)/sizeof(__varword)-1) & -(intptr_t)(__VA_alignof(TYPE)/sizeof(__varword))), 0) \ + : ((LIST)->aptr = (((LIST)->aptr+__VA_alignof(TYPE)-1) & -(intptr_t)__VA_alignof(TYPE)), 0) \ + ), \ + __va_arg(LIST,TYPE)) +#endif +#if (defined(__s390__) && !defined(__s390x__)) || defined(__riscv32__) +/* Within the arg stack, the alignment is only 4, not 8. */ +#define __va_arg_longlong(LIST,TYPE) __va_arg(LIST,TYPE) +#endif +#if (defined(__sparc__) && !defined(__sparc64__)) +/* Within the arg stack, the alignment is only 4, not 8. */ +/* Beware against unaligned accesses! */ +#define __va_arg_longlong(LIST,TYPE) \ + ((LIST)->tmp._words[0] = ((__vaword*)((LIST)->aptr))[0], \ + (LIST)->tmp._words[1] = ((__vaword*)((LIST)->aptr))[1], \ + (LIST)->aptr += sizeof(TYPE), \ + (TYPE)((LIST)->tmp._longlong) \ + ) +#endif +#if defined(__hppa__) && !defined(__hppa64__) +/* ‘long long’s have alignment 8. */ +#define __va_arg_longlong(LIST,TYPE) \ + ((LIST)->aptr = ((LIST)->aptr & -(intptr_t)__VA_alignof(TYPE)), \ + __va_arg(LIST,TYPE)) +#endif +#endif + +/* Floating point arguments. */ + +#if defined(__i386__) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppa64__) || defined(__arm64__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || defined(__x86_64__) || defined(__s390__) || defined(__s390x__) || defined(__riscv32__) || defined(__riscv64__) +#define __va_align_double(LIST) +#endif +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) || defined(__arm__) || defined(__armhf__) +/* __VA_alignof(double) > sizeof(__vaword) */ +#define __va_align_double(LIST) \ + (LIST)->aptr = ((LIST)->aptr + sizeof(double)-1) & -(intptr_t)sizeof(double), +#endif +#if defined(__hppa__) && !defined(__hppa64__) +#define __va_align_double(LIST) \ + (LIST)->aptr = (LIST)->aptr & -(intptr_t)sizeof(double), +#endif + +#if defined(__sparc__) && !defined(__sparc64__) +/* Beware against unaligned ‘double’ accesses! */ +#define _va_arg_double(LIST) \ + (__va_align_double(LIST) \ + (LIST)->tmp._words[0] = ((__vaword*)((LIST)->aptr))[0], \ + (LIST)->tmp._words[1] = ((__vaword*)((LIST)->aptr))[1], \ + (LIST)->aptr += sizeof(double), \ + (LIST)->tmp._double \ + ) +#endif +#if defined(__alpha__) +/* The first 6 floating point registers have been stored in another place. */ +#define _va_arg_double(LIST) \ + (((LIST)->aptr += sizeof(double)) <= (LIST)->memargptr \ + ? *(double*)((LIST)->aptr - sizeof(double) + (LIST)->farg_offset) \ + : *(double*)((LIST)->aptr - sizeof(double)) \ + ) +#define _va_arg_float(LIST) \ + (((LIST)->aptr += sizeof(double)) <= (LIST)->memargptr \ + ? /* The first 6 args have been put into memory by "stt" instructions */\ + /* (see vacall-alpha.s!). Therefore load them as doubles. */ \ + /* When viewed as floats, the value will be the correct one. */ \ + (float)*(double*)((LIST)->aptr - sizeof(double) + (LIST)->farg_offset) \ + : /* These args have been put into memory by "sts" instructions, */ \ + /* therefore load them as floats. */ \ + *(float*)((LIST)->aptr - sizeof(double)) \ + ) +#endif +#if defined(__hppa__) && !defined(__hppa64__) +/* The floats and doubles among the first 4 argument words are passed + * - in both general registers and floating-point registers when the + * function call is a variadic one, which means: + * - for HP cc: the call is done through a function pointer or + * directly to a function declared with a varargs prototype, + * - for GCC: the function's type is a varargs function. + * - in floating-point registers otherwise. + * Since the code in tests.c uses a function pointer, casted to a non-varargs + * function type, we are in the first case for HP cc, but in the second case + * for GCC. + * Therefore we need to take the values from the floating-point registers. + */ +#define _va_arg_float(LIST) \ + (((LIST)->aptr -= sizeof(float)) >= (LIST)->memargptr \ + ? /* The first 4 float args are stored separately. */ \ + *(float*)((LIST)->aptr + (LIST)->farg_offset) \ + : *(float*)((LIST)->aptr) \ + ) +#define _va_arg_double(LIST) \ + (__va_align_double(LIST) \ + (((LIST)->aptr -= sizeof(double)) >= (LIST)->memargptr \ + ? /* The first 2 double args are stored separately. */ \ + *(double*)((LIST)->aptr + (LIST)->darg_offset) \ + : *(double*)((LIST)->aptr) \ + )) +#endif +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) +/* The first 0,1,2 registers are stored elsewhere if they are floating-point + * parameters. + */ +#define _va_arg_float(LIST) \ + ((LIST)->aptr += sizeof(float), \ + (LIST)->anum++, \ + (LIST)->fanum++, \ + ((LIST)->anum == (LIST)->fanum && (LIST)->fanum <= __VA_FARG_NUM \ + ? /* only floating-point arguments so far */ \ + (LIST)->farg[(LIST)->fanum - 1] \ + : *(float*)((LIST)->aptr - sizeof(float)) \ + )) +#define _va_arg_double(LIST) \ + (__va_align_double(LIST) \ + (LIST)->aptr += sizeof(double), \ + (LIST)->anum++, \ + (LIST)->fanum++, \ + ((LIST)->anum == (LIST)->fanum && (LIST)->fanum <= __VA_FARG_NUM \ + ? /* only floating-point arguments so far */ \ + (LIST)->darg[(LIST)->fanum - 1] \ + : *(double*)((LIST)->aptr - sizeof(double)) \ + )) +#endif +#if defined(__mipsn32__) || defined(__mips64__) || defined(__x86_64_ms__) +/* The first 0,..,8 registers are stored elsewhere if they are floating-point + * parameters. + */ +#define _va_arg_float(LIST) \ + (__va_align_double(LIST) \ + (LIST)->aptr += sizeof(double), \ + (++(LIST)->anum <= __VA_FARG_NUM \ + ? (LIST)->farg[(LIST)->anum - 1] \ + : *(float*)((LIST)->aptr - sizeof(double)) \ + )) +#define _va_arg_double(LIST) \ + (__va_align_double(LIST) \ + (LIST)->aptr += sizeof(double), \ + (++(LIST)->anum <= __VA_FARG_NUM \ + ? (LIST)->darg[(LIST)->anum - 1] \ + : *(double*)((LIST)->aptr - sizeof(double)) \ + )) +#endif +#if defined(__sparc64__) +/* The first 0,..,16 registers are stored elsewhere if they are floating-point + * parameters. + */ +#define _va_arg_float(LIST) \ + (__va_align_double(LIST) \ + (LIST)->aptr += sizeof(double), \ + (++(LIST)->anum <= 16 \ + ? (LIST)->farg[(LIST)->anum - 1] \ + : *(float*)((LIST)->aptr - sizeof(float)) \ + )) +#define _va_arg_double(LIST) \ + (__va_align_double(LIST) \ + (LIST)->aptr += sizeof(double), \ + (++(LIST)->anum <= 16 \ + ? (LIST)->darg[(LIST)->anum - 1] \ + : *(double*)((LIST)->aptr - sizeof(double)) \ + )) +#endif +#if defined(__hppa64__) +/* The floating-point arguments among the first 8 argument words have been + stored elsewhere. */ +#define _va_arg_float(LIST) \ + ((LIST)->aptr += sizeof(double), \ + ((LIST)->aptr <= (LIST)->memargptr \ + ? (LIST)->farg[__VA_FARG_NUM-1-((LIST)->memargptr - (LIST)->aptr)/sizeof(__vaword)] \ + : ((float*)(LIST)->aptr)[-1] \ + )) +#define _va_arg_double(LIST) \ + ((LIST)->aptr += sizeof(double), \ + ((LIST)->aptr <= (LIST)->memargptr \ + ? (LIST)->darg[__VA_FARG_NUM-1-((LIST)->memargptr - (LIST)->aptr)/sizeof(__vaword)] \ + : ((double*)(LIST)->aptr)[-1] \ + )) +#endif +#if defined(__armhf__) +#define _va_arg_float(LIST) \ + ((LIST)->fanum <= 15 \ + ? (LIST)->farg[(LIST)->fanum++] \ + : ((LIST)->aptr += sizeof(float), \ + *(float*)((LIST)->aptr - sizeof(float)) \ + ) ) +#define _va_arg_double(LIST) \ + (((LIST)->fanum % 2 ? (LIST)->fanum++ : 0), \ + ((LIST)->fanum <= 14 \ + ? ((LIST)->fanum += 2, (LIST)->darg[(LIST)->fanum / 2 - 1]) \ + : ((LIST)->aptr += sizeof(double), \ + *(double*)((LIST)->aptr - sizeof(double)) \ + )) ) +#endif +#if defined(__arm64__) +/* The first __VA_FARG_NUM floating-point args have been stored elsewhere. */ +#define _va_arg_float(LIST) \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->farg[(LIST)->fanum++] \ + : ((LIST)->aptr += sizeof(__vaword), \ + *(float*)((LIST)->aptr - sizeof(__vaword)) \ + ) ) +#define _va_arg_double(LIST) \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->darg[(LIST)->fanum++] \ + : ((LIST)->aptr += sizeof(double), \ + *(double*)((LIST)->aptr - sizeof(double)) \ + ) ) +#endif +#if defined(__powerpc_aix__) +/* The first __VA_FARG_NUM floating-point args have been stored elsewhere. */ +#define _va_arg_float(LIST) \ + ((LIST)->aptr += sizeof(float), \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (float) (LIST)->farg[(LIST)->fanum++] \ + : *(float*)((LIST)->aptr - sizeof(float)) \ + )) +#define _va_arg_double(LIST) \ + (__va_align_double(LIST) \ + (LIST)->aptr += sizeof(double), \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->farg[(LIST)->fanum++] \ + : *(double*)((LIST)->aptr - sizeof(double)) \ + )) +#endif +#if defined(__powerpc_sysv4__) +/* The first __VA_FARG_NUM floating-point args have been stored elsewhere. */ +#define _va_arg_float(LIST) \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (float) (LIST)->farg[(LIST)->fanum++] \ + : ((LIST)->aptr += sizeof(float), \ + *(float*)((LIST)->aptr - sizeof(float)) \ + ) ) +#define _va_arg_double(LIST) \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->farg[(LIST)->fanum++] \ + : (__va_align_double(LIST) \ + (LIST)->aptr += sizeof(double), \ + *(double*)((LIST)->aptr - sizeof(double)) \ + ) ) +#endif +#if defined(__powerpc64__) +/* The first __VA_FARG_NUM floating-point args have been stored elsewhere. */ +#if defined(_AIX) +#define _va_arg_float(LIST) \ + ((LIST)->aptr += sizeof(__vaword), \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (float) (LIST)->farg[(LIST)->fanum++] \ + : ((float*)(LIST)->aptr)[(LIST)->flags & __VA_AIXCC_FLOAT_ARGS ? -2 : -1] \ + )) +#elif defined(_LITTLE_ENDIAN) +#define _va_arg_float(LIST) \ + ((LIST)->aptr += sizeof(__vaword), \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (float) (LIST)->farg[(LIST)->fanum++] \ + : ((float*)(LIST)->aptr)[-2] \ + )) +#else /* _BIG_ENDIAN */ +#define _va_arg_float(LIST) \ + ((LIST)->aptr += sizeof(__vaword), \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (float) (LIST)->farg[(LIST)->fanum++] \ + : ((float*)(LIST)->aptr)[-1] \ + )) +#endif +#define _va_arg_double(LIST) \ + (__va_align_double(LIST) \ + (LIST)->aptr += sizeof(double), \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->farg[(LIST)->fanum++] \ + : *(double*)((LIST)->aptr - sizeof(double)) \ + )) +#endif +#if defined(__ia64__) +/* The first 8 floating-point args have been stored elsewhere. */ +#define _va_arg_float(LIST) \ + ((LIST)->aptr += sizeof(__vaword), \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (float) (LIST)->farg[(LIST)->fanum++] \ + : *(float*)((LIST)->aptr - sizeof(__vaword)) \ + )) +#define _va_arg_double(LIST) \ + (__va_align_double(LIST) \ + (LIST)->aptr += sizeof(double), \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->farg[(LIST)->fanum++] \ + : *(double*)((LIST)->aptr - sizeof(double)) \ + )) +#endif +#if defined(__x86_64_sysv__) +/* The first 8 floating-point args have been stored elsewhere. */ +#define _va_arg_float(LIST) \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? *(float*)&(LIST)->farg[(LIST)->fanum++] \ + : ((LIST)->aptr += sizeof(__vaword), \ + *(float*)((LIST)->aptr - sizeof(__vaword)) \ + ) ) +#define _va_arg_double(LIST) \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->farg[(LIST)->fanum++] \ + : ((LIST)->aptr += sizeof(__vaword), \ + *(double*)((LIST)->aptr - sizeof(__vaword)) \ + ) ) +#endif +#if defined(__s390__) || defined(__s390x__) +/* The first __VA_FARG_NUM floating-point args have been stored elsewhere. */ +#define _va_arg_float(LIST) \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->farg[(LIST)->fanum++] \ + : ((LIST)->aptr += sizeof(__vaword), \ + ((float*)(LIST)->aptr)[-1] \ + ) ) +#define _va_arg_double(LIST) \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->darg[(LIST)->fanum++] \ + : ((LIST)->aptr += sizeof(double), \ + *(double*)((LIST)->aptr - sizeof(double)) \ + ) ) +#endif +#if defined(__riscv32__) || defined(__riscv64__) +/* The first __VA_FARG_NUM floating-point args have been stored elsewhere. */ +#define _va_arg_float(LIST) \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->farg[(LIST)->fanum++] \ + : __va_arg((LIST),float) \ + ) +#define _va_arg_double(LIST) \ + ((LIST)->fanum < __VA_FARG_NUM \ + ? (LIST)->darg[(LIST)->fanum++] \ + : __va_arg((LIST),double) \ + ) +#endif +#ifndef _va_arg_float +#define _va_arg_float(LIST) __va_arg(LIST,float) +#endif +#ifndef _va_arg_double +#define _va_arg_double(LIST) \ + (__va_align_double(LIST) __va_arg(LIST,double)) +#endif + +/* Pointer arguments. */ +#define _va_arg_ptr(LIST) __va_arg(LIST,void*) + +/* Structure arguments. */ +/* Structure argument alignment. */ +#if defined(__i386__) && defined(_MSC_VER) +/* In MSVC, doubles inside structures have alignment 8, i.e. + * __VA_alignof(double) = 8, but doubles (and also structures containing + * doubles) are passed on the stack with alignment 4. Looks really weird. + */ +#define __va_struct_alignment(TYPE_ALIGN) \ + ((TYPE_ALIGN) <= 4 ? (TYPE_ALIGN) : 4) +#else +#define __va_struct_alignment(TYPE_ALIGN) \ + (TYPE_ALIGN) +#endif +#define __va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (LIST)->aptr = ((LIST)->aptr + __va_struct_alignment(TYPE_ALIGN)-1) & -(intptr_t)__va_struct_alignment(TYPE_ALIGN), +#if defined(__i386__) || defined(__m68k__) || defined(__alpha__) || defined(__arm__) || defined(__armhf__) || (defined(__powerpc64__) && !defined(_AIX)) || defined(__x86_64_sysv__) +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (__va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ) +#endif +#if defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__) +/* small structures < 1 word are adjusted depending on compiler */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (__va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->flags & __VA_SGICC_STRUCT_ARGS \ + ? /* SGI MIPS cc passes small structures left-adjusted, although big-endian! */\ + (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + : /* SGI MIPS gcc passes small structures within the first four words left- \ + * adjusted, for compatibility with cc. But structures in memory are passed \ + * right-adjusted!! See gcc-2.6.3/config/mips/mips.c:function_arg(). \ + */ \ + ((LIST)->aptr < (LIST)->memargptr \ + ? (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + : (void*)__va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + )) ) +#endif +#if defined(__mipsn32__) || defined(__mips64__) +/* small structures < 1 word are adjusted depending on compiler */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (__va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->flags & __VA_SGICC_STRUCT_ARGS \ + ? /* SGI MIPS cc and gcc >= 3.4 passes small structures left-adjusted, although big-endian! */\ + (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + : /* SGI MIPS gcc < 3.4 passes small structures right-adjusted. */ \ + (void*)__va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + )) +#endif +#if defined(__powerpc_aix__) || (defined(__powerpc64__) && defined(_AIX)) +/* small structures < 1 word are adjusted depending on compiler */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (__va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((LIST)->flags & __VA_AIXCC_STRUCT_ARGS \ + ? /* AIX cc and xlc pass small structures left-adjusted, although big-endian! */\ + (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + : /* gcc passes small structures right-adjusted. */ \ + (void*)__va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + )) +#endif +#if defined(__powerpc_sysv4__) +/* Structures are passed as pointers to caller-made local copies. */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + va_arg_ptr(LIST,void*) +#endif +#if defined(__sparc__) && !defined(__sparc64__) +/* Structures are passed as pointers to caller-made local copies. */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + va_arg_ptr(LIST,void*) +#endif +#if defined(__sparc64__) +/* Small structures are passed left-adjusted, although big-endian! */ +/* Big structures are passed as pointers to caller-made local copies. */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((TYPE_SIZE) <= 16 \ + ? (__va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN)) \ + : va_arg_ptr(LIST,void*) \ + ) +#endif +#if defined(__hppa64__) +/* Structures are passed left-adjusted (although big-endian!). */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (__va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (void*)__va_arg_leftadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ) +#endif +#if defined(__arm64__) || defined(__riscv32__) || defined(__riscv64__) +/* Small structures are passed in registers or on the stack. */ +/* Big structures are passed as pointers to caller-made local copies. */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((TYPE_SIZE) <= 2*sizeof(__varword) \ + ? (void*)__va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + : va_arg_ptr(LIST,void*) \ + ) +#endif +#if defined(__x86_64_ms__) || defined(__s390__) || defined(__s390x__) +/* Structures of 1, 2, 4, 8 bytes are passed as embedded copies on the arg stack. + * Big structures are passed as pointers to caller-made local copies. + */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((TYPE_SIZE) == 1 || (TYPE_SIZE) == 2 || (TYPE_SIZE) == 4 || (TYPE_SIZE) == 8 \ + ? (void*)__va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + : va_arg_ptr(LIST,void*) \ + ) +#endif +#if defined(__hppa__) && !defined(__hppa64__) +/* Structures <= 8 bytes are passed as embedded copies on the arg stack. + * Big structures are passed as pointers (to caller-made local copies + * with GCC >= 8, without copy otherwise). + */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ((TYPE_SIZE) > 8 \ + ? va_arg_ptr(LIST,void*) \ + : /* FIXME: gcc-2.6.3 passes structures <= 4 bytes in memory left-adjusted! ?? */\ + (void*)__va_arg_rightadjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ) +#endif +#if defined(__ia64__) +/* With GCC < 3, types larger than a word have 2-word alignment. */ +#define __va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (__va_align_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + (((LIST)->flags & __VA_OLDGCC_STRUCT_ARGS) && (TYPE_SIZE) > sizeof(__vaword) && (((__vaword*)(LIST)->aptr - (LIST)->saptr) & 1) ? (LIST)->aptr += sizeof(__vaword) : 0), \ + __va_arg_adjusted(LIST,TYPE_SIZE,TYPE_ALIGN) \ + ) +#endif + + +/* + * Definition of the va_return_xxx macros. + */ +#define __va_return(LIST,RETTYPE) \ + (((LIST)->rtype == (RETTYPE)) || (vacall_error_type_mismatch((LIST)->rtype,RETTYPE), 0)) +#define _va_return_void(LIST) \ + __va_return(LIST,__VAvoid) +#define _va_return_char(LIST,VAL) \ + (__va_return(LIST,__VAchar), (LIST)->tmp._char = (VAL)) +#define _va_return_schar(LIST,VAL) \ + (__va_return(LIST,__VAschar), (LIST)->tmp._schar = (VAL)) +#define _va_return_uchar(LIST,VAL) \ + (__va_return(LIST,__VAuchar), (LIST)->tmp._uchar = (VAL)) +#define _va_return_short(LIST,VAL) \ + (__va_return(LIST,__VAshort), (LIST)->tmp._short = (VAL)) +#define _va_return_ushort(LIST,VAL) \ + (__va_return(LIST,__VAushort), (LIST)->tmp._ushort = (VAL)) +#define _va_return_int(LIST,VAL) \ + (__va_return(LIST,__VAint), (LIST)->tmp._int = (VAL)) +#define _va_return_uint(LIST,VAL) \ + (__va_return(LIST,__VAuint), (LIST)->tmp._uint = (VAL)) +#define _va_return_long(LIST,VAL) \ + (__va_return(LIST,__VAlong), (LIST)->tmp._long = (VAL)) +#define _va_return_ulong(LIST,VAL) \ + (__va_return(LIST,__VAulong), (LIST)->tmp._ulong = (VAL)) +#if defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppa64__) || defined(__arm64__) || defined(__powerpc64__) || defined(__ia64__) || (defined(__x86_64__) && !defined(__x86_64_x32__) && !defined(__VA_LLP64)) || defined(__riscv64__) +#define _va_return_longlong(LIST,VAL) \ + (__va_return(LIST,__VAlonglong), (LIST)->tmp._long = (VAL)) +#define _va_return_ulonglong(LIST,VAL) \ + (__va_return(LIST,__VAulonglong), (LIST)->tmp._ulong = (VAL)) +#else +#define _va_return_longlong(LIST,VAL) \ + (__va_return(LIST,__VAlonglong), (LIST)->tmp._longlong = (VAL)) +#define _va_return_ulonglong(LIST,VAL) \ + (__va_return(LIST,__VAulonglong), (LIST)->tmp._ulonglong = (VAL)) +#endif +#define _va_return_float(LIST,VAL) \ + (__va_return(LIST,__VAfloat), (LIST)->tmp._float = (VAL)) +#define _va_return_double(LIST,VAL) \ + (__va_return(LIST,__VAdouble), (LIST)->tmp._double = (VAL)) +#define _va_return_ptr(LIST,VAL) \ + (__va_return(LIST,__VAvoidp), (LIST)->tmp._ptr = (VAL)) +#define __va_return_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL_ADDR) \ + (__va_return(LIST,__VAstruct), \ + vacall_structcpy((void*)((LIST)->raddr),VAL_ADDR,TYPE_SIZE,TYPE_ALIGN) \ + ) + + +/* + * Miscellaneous declarations. + */ +extern void vacall_structcpy (void* dest, const void* src, unsigned long size, unsigned long alignment); + + +#endif /* _VACALL_INTERNAL_H */ diff --git a/vacall/vacall-libapi.c b/vacall/vacall-libapi.c new file mode 100644 index 0000000..385e7be --- /dev/null +++ b/vacall/vacall-libapi.c @@ -0,0 +1,232 @@ +/* + * Copyright 1995-2018 Bruno Haible + * + * 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, see . + */ + +#include "config.h" +#include +#include +#include + +#include "vacall-internal.h" + +/* This is the implementation of the library API. + The symbols that the linker sees are all prefixed with 'vacall', + to avoid potential collisions with other libraries. */ + +#ifndef REENTRANT + +/* This is the function pointer vacall(). A function pointer indirection is + needed because gcc-3.4 generates invalid code when the address of a symbol + is casted to a function pointer with different return type. + (https://gcc.gnu.org/ml/gcc-patches/2003-12/msg01767.html) */ +#ifdef __cplusplus +extern "C" void vacall_receiver (); /* the return type is variable, not void! */ +#else +extern void vacall_receiver (); /* the return type is variable, not void! */ +#endif +void (*vacall) () = vacall_receiver; + +/* This is the function called by vacall(). */ +void (* vacall_function) (va_alist); + +#endif + +/* Room for returning structs according to the Sun C non-reentrant struct return convention. */ +typedef union { __vaword room[__VA_ALIST_WORDS]; double align; } __va_struct_buffer_t; +static __va_struct_buffer_t vacall_struct_buffer; + +static _Noreturn void +vacall_error_type_mismatch (enum __VAtype start_type, enum __VAtype return_type) +{ + /* If you see this, fix your code. */ + fprintf (stderr, "vacall: va_start type %d and va_return type %d disagree.\n", + (int)start_type, (int)return_type); + abort(); +} + +static _Noreturn void +vacall_error_struct_too_large (unsigned int size) +{ + /* If you see this, increase __VA_ALIST_WORDS: */ + fprintf (stderr, "vacall: struct of size %u too large for Sun C struct return.\n", + size); + abort(); +} + +void vacall_start (va_alist list, int rettype, int flags) +{ + __va_start(list,rettype,flags); +} + +void vacall_start_struct (va_alist list, size_t type_size, size_t type_align, int type_splittable, int flags) +{ + __va_start_struct(list,type_size,type_align,type_splittable,flags); +} + +char vacall_arg_char (va_alist list) +{ + return _va_arg_char(list); +} + +signed char vacall_arg_schar (va_alist list) +{ + return _va_arg_schar(list); +} + +unsigned char vacall_arg_uchar (va_alist list) +{ + return _va_arg_uchar(list); +} + +short vacall_arg_short (va_alist list) +{ + return _va_arg_short(list); +} + +unsigned short vacall_arg_ushort (va_alist list) +{ + return _va_arg_ushort(list); +} + +int vacall_arg_int (va_alist list) +{ + return _va_arg_int(list); +} + +unsigned int vacall_arg_uint (va_alist list) +{ + return _va_arg_uint(list); +} + +long vacall_arg_long (va_alist list) +{ + return _va_arg_long(list); +} + +unsigned long vacall_arg_ulong (va_alist list) +{ + return _va_arg_ulong(list); +} + +long long vacall_arg_longlong (va_alist list) +{ + return _va_arg_longlong(list); +} + +unsigned long long vacall_arg_ulonglong (va_alist list) +{ + return _va_arg_ulonglong(list); +} + +float vacall_arg_float (va_alist list) +{ + return _va_arg_float(list); +} + +double vacall_arg_double (va_alist list) +{ + return _va_arg_double(list); +} + +void* vacall_arg_ptr (va_alist list) +{ + return _va_arg_ptr(list); +} + +void* vacall_arg_struct (va_alist list, size_t type_size, size_t type_align) +{ + return __va_arg_struct(list,type_size,type_align); +} + +void vacall_return_void (va_alist list) +{ + _va_return_void(list); +} + +void vacall_return_char (va_alist list, char val) +{ + _va_return_char(list,val); +} + +void vacall_return_schar (va_alist list, signed char val) +{ + _va_return_schar(list,val); +} + +void vacall_return_uchar (va_alist list, unsigned char val) +{ + _va_return_uchar(list,val); +} + +void vacall_return_short (va_alist list, short val) +{ + _va_return_short(list,val); +} + +void vacall_return_ushort (va_alist list, unsigned short val) +{ + _va_return_ushort(list,val); +} + +void vacall_return_int (va_alist list, int val) +{ + _va_return_int(list,val); +} + +void vacall_return_uint (va_alist list, unsigned int val) +{ + _va_return_uint(list,val); +} + +void vacall_return_long (va_alist list, long val) +{ + _va_return_long(list,val); +} + +void vacall_return_ulong (va_alist list, unsigned long val) +{ + _va_return_ulong(list,val); +} + +void vacall_return_longlong (va_alist list, long long val) +{ + _va_return_longlong(list,val); +} + +void vacall_return_ulonglong (va_alist list, unsigned long long val) +{ + _va_return_ulonglong(list,val); +} + +void vacall_return_float (va_alist list, float val) +{ + _va_return_float(list,val); +} + +void vacall_return_double (va_alist list, double val) +{ + _va_return_double(list,val); +} + +void vacall_return_ptr (va_alist list, void* val) +{ + _va_return_ptr(list,val); +} + +void vacall_return_struct (va_alist list, size_t type_size, size_t type_align, const void* val_addr) +{ + __va_return_struct(list,type_size,type_align,val_addr); +} diff --git a/vacall/vacall-m68k-linux.s b/vacall/vacall-m68k-linux.s new file mode 100644 index 0000000..808fd79 --- /dev/null +++ b/vacall/vacall-m68k-linux.s @@ -0,0 +1,171 @@ + .file "vacall-m68k.c" + .text + .align 2 + .globl vacall_receiver + .type vacall_receiver,@function +vacall_receiver: + link.w %a6,#-32 + movm.l #0x3030,-(%sp) + clr.l -32(%a6) + lea (8,%a6),%a2 + move.l %a2,-20(%a6) + clr.l -16(%a6) + clr.l -12(%a6) + move.l %a1,-4(%a6) + pea -32(%a6) + move.l vacall_function,%a2 + jbsr (%a2) + addq.l #4,%sp + move.l -12(%a6),%a3 + tst.l %a3 + jbeq .L1 + moveq.l #1,%d2 + cmp.l %a3,%d2 + jbeq .L46 + moveq.l #2,%d3 + cmp.l %a3,%d3 + jbeq .L46 + moveq.l #3,%d2 + cmp.l %a3,%d2 + jbeq .L47 + moveq.l #4,%d3 + cmp.l %a3,%d3 + jbeq .L48 + moveq.l #5,%d2 + cmp.l %a3,%d2 + jbeq .L49 + moveq.l #6,%d3 + cmp.l %a3,%d3 + jbeq .L45 + moveq.l #7,%d2 + cmp.l %a3,%d2 + jbeq .L45 + moveq.l #8,%d3 + cmp.l %a3,%d3 + jbeq .L45 + moveq.l #9,%d2 + cmp.l %a3,%d2 + jbeq .L45 + lea (-10,%a3),%a2 + moveq.l #1,%d3 + cmp.l %a2,%d3 + jbcs .L22 + move.l -28(%a6),%d0 + move.l -24(%a6),%d1 + jbra .L1 + .align 2 +.L22: + moveq.l #12,%d2 + cmp.l %a3,%d2 + jbeq .L50 + moveq.l #13,%d2 + cmp.l %a3,%d2 + jbeq .L51 + moveq.l #14,%d3 + cmp.l %a3,%d3 + jbeq .L52 + moveq.l #15,%d2 + cmp.l %a3,%d2 + jbne .L1 + btst #2,-30(%a6) + jbeq .L1 + move.l -8(%a6),%d2 + moveq.l #1,%d3 + cmp.l %d2,%d3 + jbeq .L53 + moveq.l #2,%d3 + cmp.l %d2,%d3 + jbeq .L54 + moveq.l #4,%d3 + cmp.l %d2,%d3 + jbeq .L55 + moveq.l #8,%d3 + cmp.l %d2,%d3 + jbne .L1 + move.l -16(%a6),%a2 + move.l (%a2),%d0 + move.l 4(%a2),%d1 + jbra .L1 + .align 2 +.L55: + move.l -16(%a6),%a2 + move.l (%a2),%d0 + jbra .L1 + .align 2 +.L54: + move.l -16(%a6),%a2 + clr.l %d0 + move.w (%a2),%d0 + jbra .L1 + .align 2 +.L53: + move.l -16(%a6),%a2 + clr.l %d0 + move.b (%a2),%d0 + jbra .L1 + .align 2 +.L52: + move.l -28(%a6),%d0 + move.l %d0,%a0 + jbra .L1 + .align 2 +.L51: + btst #6,-29(%a6) + jbeq .L31 + fmove.d -28(%a6),%fp0 + jbra .L1 + .align 2 +.L31: + move.l -28(%a6),%d0 + move.l -24(%a6),%d1 + jbra .L1 + .align 2 +.L50: + move.l -32(%a6),%d2 + btst #6,%d2 + jbeq .L25 + fmove.s -28(%a6),%fp0 + jbra .L1 + .align 2 +.L25: + btst #5,%d2 + jbeq .L27 + fmove.s -28(%a6),%fp1 + fmove.d %fp1,-(%sp) + move.l (%sp)+,%d0 + move.l (%sp)+,%d1 + jbra .L1 + .align 2 +.L27: + move.l -28(%a6),%d0 + jbra .L1 + .align 2 +.L45: + move.l -28(%a6),%d0 + jbra .L1 + .align 2 +.L49: + clr.l %d0 + move.w -28(%a6),%d0 + jbra .L1 + .align 2 +.L48: + move.w -28(%a6),%d0 + ext.l %d0 + jbra .L1 + .align 2 +.L47: + clr.l %d0 + move.b -28(%a6),%d0 + jbra .L1 + .align 2 +.L46: + move.b -28(%a6),%d0 + extb.l %d0 +.L1: + movm.l -48(%a6),#0xc0c + unlk %a6 + rts +.Lfe1: + .size vacall_receiver,.Lfe1-vacall_receiver + .ident "GCC: (GNU) 3.1" diff --git a/vacall/vacall-m68k-sun.s b/vacall/vacall-m68k-sun.s new file mode 100644 index 0000000..07fae31 --- /dev/null +++ b/vacall/vacall-m68k-sun.s @@ -0,0 +1,167 @@ +#NO_APP + .text + .even + .globl _vacall_receiver +_vacall_receiver: + link a6,#-32 + moveml #0x3030,sp@- + clrl a6@(-32) + lea a6@(8),a2 + movel a2,a6@(-20) + clrl a6@(-16) + clrl a6@(-12) + movel a1,a6@(-4) + pea a6@(-32) + movel _vacall_function,a2 + jbsr a2@ + addql #4,sp + movel a6@(-12),a3 + tstl a3 + jeq L1 + moveq #1,d2 + cmpl a3,d2 + jeq L46 + moveq #2,d3 + cmpl a3,d3 + jeq L46 + moveq #3,d2 + cmpl a3,d2 + jeq L47 + moveq #4,d3 + cmpl a3,d3 + jeq L48 + moveq #5,d2 + cmpl a3,d2 + jeq L49 + moveq #6,d3 + cmpl a3,d3 + jeq L45 + moveq #7,d2 + cmpl a3,d2 + jeq L45 + moveq #8,d3 + cmpl a3,d3 + jeq L45 + moveq #9,d2 + cmpl a3,d2 + jeq L45 + lea a3@(-10),a2 + moveq #1,d3 + cmpl a2,d3 + jcs L22 + movel a6@(-28),d0 + movel a6@(-24),d1 + jra L1 + .even +L22: + moveq #12,d2 + cmpl a3,d2 + jeq L50 + moveq #13,d2 + cmpl a3,d2 + jeq L51 + moveq #14,d3 + cmpl a3,d3 + jeq L52 + moveq #15,d2 + cmpl a3,d2 + jne L1 + btst #2,a6@(-30) + jeq L1 + movel a6@(-8),d2 + moveq #1,d3 + cmpl d2,d3 + jeq L53 + moveq #2,d3 + cmpl d2,d3 + jeq L54 + moveq #4,d3 + cmpl d2,d3 + jeq L55 + moveq #8,d3 + cmpl d2,d3 + jne L1 + movel a6@(-16),a2 + movel a2@,d0 + movel a2@(4),d1 + jra L1 + .even +L55: + movel a6@(-16),a2 + movel a2@,d0 + jra L1 + .even +L54: + movel a6@(-16),a2 + clrl d0 + movew a2@,d0 + jra L1 + .even +L53: + movel a6@(-16),a2 + clrl d0 + moveb a2@,d0 + jra L1 + .even +L52: + movel a6@(-28),d0 + movel d0,a0 + jra L1 + .even +L51: + btst #6,a6@(-29) + jeq L31 + fmoved a6@(-28),fp0 + jra L1 + .even +L31: + movel a6@(-28),d0 + movel a6@(-24),d1 + jra L1 + .even +L50: + movel a6@(-32),d2 + btst #6,d2 + jeq L25 + fmoves a6@(-28),fp0 + jra L1 + .even +L25: + btst #5,d2 + jeq L27 + fmoves a6@(-28),fp1 + fmoved fp1,sp@- + movel sp@+,d0 + movel sp@+,d1 + jra L1 + .even +L27: + movel a6@(-28),d0 + jra L1 + .even +L45: + movel a6@(-28),d0 + jra L1 + .even +L49: + clrl d0 + movew a6@(-28),d0 + jra L1 + .even +L48: + movew a6@(-28),d0 + extl d0 + jra L1 + .even +L47: + clrl d0 + moveb a6@(-28),d0 + jra L1 + .even +L46: + moveb a6@(-28),d0 + extbl d0 +L1: + moveml a6@(-48),#0xc0c + unlk a6 + rts diff --git a/vacall/vacall-m68k.c b/vacall/vacall-m68k.c new file mode 100644 index 0000000..671dce4 --- /dev/null +++ b/vacall/vacall-m68k.c @@ -0,0 +1,136 @@ +/* vacall function for m68k CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("a0"); +#endif +register void* sret __asm__("a1"); +register __varword iret __asm__("d0"); +register __varword iret2 __asm__("d1"); +register __varword pret __asm__("a0"); /* some compilers return pointers in a0 */ +register float fret __asm__("d0"); /* d0 */ +register double dret __asm__("d0"); /* d0,d1 */ +register float fp_fret __asm__("fp0"); +register double fp_dret __asm__("fp0"); + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword firstword) +{ + __va_alist list; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&firstword; + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.structraddr = sret; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong || list.rtype == __VAulonglong) { + iret = ((__varword *) &list.tmp._longlong)[0]; + iret2 = ((__varword *) &list.tmp._longlong)[1]; + } else + if (list.rtype == __VAfloat) { + if (list.flags & __VA_FREG_FLOAT_RETURN) { + fp_fret = list.tmp._float; + } else { + if (list.flags & __VA_SUNCC_FLOAT_RETURN) { + dret = (double)list.tmp._float; + } else { + fret = list.tmp._float; + } + } + } else + if (list.rtype == __VAdouble) { + if (list.flags & __VA_FREG_FLOAT_RETURN) { + fp_dret = list.tmp._double; + } else { + dret = list.tmp._double; + } + } else + if (list.rtype == __VAvoidp) { + pret = iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + /* NB: On m68k, all structure sizes are divisible by 2. */ + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + if (list.rsize == sizeof(char)) { /* can't occur */ + iret = *(unsigned char *) list.raddr; + } else + if (list.rsize == sizeof(short)) { + iret = *(unsigned short *) list.raddr; + } else + if (list.rsize == sizeof(int)) { + iret = *(unsigned int *) list.raddr; + } else + if (list.rsize == 2*sizeof(__varword)) { + iret = ((__varword *) list.raddr)[0]; + iret2 = ((__varword *) list.raddr)[1]; + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-m68k.mit.S b/vacall/vacall-m68k.mit.S new file mode 100644 index 0000000..d617c3f --- /dev/null +++ b/vacall/vacall-m68k.mit.S @@ -0,0 +1,172 @@ +#include "asm-m68k.h" + .text + .even + .globl C(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) + link $a6,#-32 + moveml #0x3030,$sp@- + clrl $a6@(-32) + lea $a6@(8),$a2 + movel $a2,$a6@(-20) + clrl $a6@(-16) + clrl $a6@(-12) + movel $a1,$a6@(-4) + pea $a6@(-32) + movel C(vacall_function),$a2 + jbsr $a2@ + addql #4,$sp + movel $a6@(-12),$a3 + tstl $a3 + jeq L(1) + moveq #1,$d2 + cmpl $a3,$d2 + jeq L(46) + moveq #2,$d3 + cmpl $a3,$d3 + jeq L(46) + moveq #3,$d2 + cmpl $a3,$d2 + jeq L(47) + moveq #4,$d3 + cmpl $a3,$d3 + jeq L(48) + moveq #5,$d2 + cmpl $a3,$d2 + jeq L(49) + moveq #6,$d3 + cmpl $a3,$d3 + jeq L(45) + moveq #7,$d2 + cmpl $a3,$d2 + jeq L(45) + moveq #8,$d3 + cmpl $a3,$d3 + jeq L(45) + moveq #9,$d2 + cmpl $a3,$d2 + jeq L(45) + lea $a3@(-10),$a2 + moveq #1,$d3 + cmpl $a2,$d3 + jcs L(22) + movel $a6@(-28),$d0 + movel $a6@(-24),$d1 + jra L(1) + .even +L(22): + moveq #12,$d2 + cmpl $a3,$d2 + jeq L(50) + moveq #13,$d2 + cmpl $a3,$d2 + jeq L(51) + moveq #14,$d3 + cmpl $a3,$d3 + jeq L(52) + moveq #15,$d2 + cmpl $a3,$d2 + jne L(1) + btst #2,$a6@(-30) + jeq L(1) + movel $a6@(-8),$d2 + moveq #1,$d3 + cmpl $d2,$d3 + jeq L(53) + moveq #2,$d3 + cmpl $d2,$d3 + jeq L(54) + moveq #4,$d3 + cmpl $d2,$d3 + jeq L(55) + moveq #8,$d3 + cmpl $d2,$d3 + jne L(1) + movel $a6@(-16),$a2 + movel $a2@,$d0 + movel $a2@(4),$d1 + jra L(1) + .even +L(55): + movel $a6@(-16),$a2 + movel $a2@,$d0 + jra L(1) + .even +L(54): + movel $a6@(-16),$a2 + clrl $d0 + movew $a2@,$d0 + jra L(1) + .even +L(53): + movel $a6@(-16),$a2 + clrl $d0 + moveb $a2@,$d0 + jra L(1) + .even +L(52): + movel $a6@(-28),$d0 + movel $d0,$a0 + jra L(1) + .even +L(51): + btst #6,$a6@(-29) + jeq L(31) + fmoved $a6@(-28),$fp0 + jra L(1) + .even +L(31): + movel $a6@(-28),$d0 + movel $a6@(-24),$d1 + jra L(1) + .even +L(50): + movel $a6@(-32),$d2 + btst #6,$d2 + jeq L(25) + fmoves $a6@(-28),$fp0 + jra L(1) + .even +L(25): + btst #5,$d2 + jeq L(27) + fmoves $a6@(-28),$fp1 + fmoved $fp1,$sp@- + movel $sp@+,$d0 + movel $sp@+,$d1 + jra L(1) + .even +L(27): + movel $a6@(-28),$d0 + jra L(1) + .even +L(45): + movel $a6@(-28),$d0 + jra L(1) + .even +L(49): + clrl $d0 + movew $a6@(-28),$d0 + jra L(1) + .even +L(48): + movew $a6@(-28),$d0 + extl $d0 + jra L(1) + .even +L(47): + clrl $d0 + moveb $a6@(-28),$d0 + jra L(1) + .even +L(46): + moveb $a6@(-28),$d0 + extbl $d0 +L(1): + moveml $a6@(-48),#0xc0c + unlk $a6 + rts +FUNEND(vacall_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-m68k.motorola.S b/vacall/vacall-m68k.motorola.S new file mode 100644 index 0000000..e4beb5b --- /dev/null +++ b/vacall/vacall-m68k.motorola.S @@ -0,0 +1,173 @@ +#include "asm-m68k.h" + .text + .align 2 + .globl C(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) + link.w %a6,#-32 + movm.l #0x3030,-(%sp) + clr.l -32(%a6) + lea (8,%a6),%a2 + move.l %a2,-20(%a6) + clr.l -16(%a6) + clr.l -12(%a6) + move.l %a1,-4(%a6) + pea -32(%a6) + move.l C(vacall_function),%a2 + jbsr (%a2) + addq.l #4,%sp + move.l -12(%a6),%a3 + tst.l %a3 + jbeq L(1) + moveq.l #1,%d2 + cmp.l %a3,%d2 + jbeq L(46) + moveq.l #2,%d3 + cmp.l %a3,%d3 + jbeq L(46) + moveq.l #3,%d2 + cmp.l %a3,%d2 + jbeq L(47) + moveq.l #4,%d3 + cmp.l %a3,%d3 + jbeq L(48) + moveq.l #5,%d2 + cmp.l %a3,%d2 + jbeq L(49) + moveq.l #6,%d3 + cmp.l %a3,%d3 + jbeq L(45) + moveq.l #7,%d2 + cmp.l %a3,%d2 + jbeq L(45) + moveq.l #8,%d3 + cmp.l %a3,%d3 + jbeq L(45) + moveq.l #9,%d2 + cmp.l %a3,%d2 + jbeq L(45) + lea (-10,%a3),%a2 + moveq.l #1,%d3 + cmp.l %a2,%d3 + jbcs L(22) + move.l -28(%a6),%d0 + move.l -24(%a6),%d1 + jbra L(1) + .align 2 +L(22): + moveq.l #12,%d2 + cmp.l %a3,%d2 + jbeq L(50) + moveq.l #13,%d2 + cmp.l %a3,%d2 + jbeq L(51) + moveq.l #14,%d3 + cmp.l %a3,%d3 + jbeq L(52) + moveq.l #15,%d2 + cmp.l %a3,%d2 + jbne L(1) + btst #2,-30(%a6) + jbeq L(1) + move.l -8(%a6),%d2 + moveq.l #1,%d3 + cmp.l %d2,%d3 + jbeq L(53) + moveq.l #2,%d3 + cmp.l %d2,%d3 + jbeq L(54) + moveq.l #4,%d3 + cmp.l %d2,%d3 + jbeq L(55) + moveq.l #8,%d3 + cmp.l %d2,%d3 + jbne L(1) + move.l -16(%a6),%a2 + move.l (%a2),%d0 + move.l 4(%a2),%d1 + jbra L(1) + .align 2 +L(55): + move.l -16(%a6),%a2 + move.l (%a2),%d0 + jbra L(1) + .align 2 +L(54): + move.l -16(%a6),%a2 + clr.l %d0 + move.w (%a2),%d0 + jbra L(1) + .align 2 +L(53): + move.l -16(%a6),%a2 + clr.l %d0 + move.b (%a2),%d0 + jbra L(1) + .align 2 +L(52): + move.l -28(%a6),%d0 + move.l %d0,%a0 + jbra L(1) + .align 2 +L(51): + btst #6,-29(%a6) + jbeq L(31) + fmove.d -28(%a6),%fp0 + jbra L(1) + .align 2 +L(31): + move.l -28(%a6),%d0 + move.l -24(%a6),%d1 + jbra L(1) + .align 2 +L(50): + move.l -32(%a6),%d2 + btst #6,%d2 + jbeq L(25) + fmove.s -28(%a6),%fp0 + jbra L(1) + .align 2 +L(25): + btst #5,%d2 + jbeq L(27) + fmove.s -28(%a6),%fp1 + fmove.d %fp1,-(%sp) + move.l (%sp)+,%d0 + move.l (%sp)+,%d1 + jbra L(1) + .align 2 +L(27): + move.l -28(%a6),%d0 + jbra L(1) + .align 2 +L(45): + move.l -28(%a6),%d0 + jbra L(1) + .align 2 +L(49): + clr.l %d0 + move.w -28(%a6),%d0 + jbra L(1) + .align 2 +L(48): + move.w -28(%a6),%d0 + ext.l %d0 + jbra L(1) + .align 2 +L(47): + clr.l %d0 + move.b -28(%a6),%d0 + jbra L(1) + .align 2 +L(46): + move.b -28(%a6),%d0 + extb.l %d0 +L(1): + movm.l -48(%a6),#0xc0c + unlk %a6 + rts +L(fe1): + FUNEND(vacall_receiver) +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-mips.c b/vacall/vacall-mips.c new file mode 100644 index 0000000..a512798 --- /dev/null +++ b/vacall/vacall-mips.c @@ -0,0 +1,139 @@ +/* vacall function for mips CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifndef REENTRANT +typedef void (*func_pointer)(va_alist); +#else /* REENTRANT */ +#define vacall_receiver callback_receiver +typedef void (*func_pointer)(void*,va_alist); +register struct { func_pointer vacall_function; void* arg; } + * env __asm__("$2"); +#endif +register float farg1 __asm__("$f12"); +register float farg2 __asm__("$f14"); +register double darg1 __asm__("$f12"); +register double darg2 __asm__("$f14"); +register __varword iret __asm__("$2"); +register __varword iret2 __asm__("$3"); +register float fret __asm__("$f0"); +register double dret __asm__("$f0"); + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword firstword) +{ + __va_alist list; + /* gcc-2.6.3 source says: When a parameter is passed in a register, + * stack space is still allocated for it. + */ + /* Move the arguments passed in registers to their stack locations. */ + (&firstword)[-4] = word1; + (&firstword)[-3] = word2; + (&firstword)[-2] = word3; + (&firstword)[-1] = word4; + list.darg[0] = darg1; + list.darg[1] = darg2; + list.farg[0] = farg1; + list.farg[1] = farg2; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)(&firstword - 4); + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.memargptr = (long)&firstword; + list.anum = 0; + list.fanum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong || list.rtype == __VAulonglong) { + iret = ((__varword *) &list.tmp._longlong)[0]; + iret2 = ((__varword *) &list.tmp._longlong)[1]; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_SMALL_STRUCT_RETURN) { + if (list.rsize == sizeof(char)) { + iret = *(unsigned char *) list.raddr; + } else + if (list.rsize == sizeof(short)) { + iret = *(unsigned short *) list.raddr; + } else + if (list.rsize == sizeof(int)) { + iret = *(unsigned int *) list.raddr; + } + } else { + iret = (long)list.raddr; + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-mips64.c b/vacall/vacall-mips64.c new file mode 100644 index 0000000..1adf465 --- /dev/null +++ b/vacall/vacall-mips64.c @@ -0,0 +1,508 @@ +/* vacall function for mips CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifndef REENTRANT +typedef void (*func_pointer)(va_alist); +#else /* REENTRANT */ +#define vacall_receiver callback_receiver +typedef void (*func_pointer)(void*,va_alist); +register struct { func_pointer vacall_function; void* arg; } + * env __asm__("$2"); +#endif +register void* sp __asm__("$sp"); +register __varword iarg0 __asm__("$4"); +register __varword iarg1 __asm__("$5"); +register __varword iarg2 __asm__("$6"); +register __varword iarg3 __asm__("$7"); +register __varword iarg4 __asm__("$8"); +register __varword iarg5 __asm__("$9"); +register __varword iarg6 __asm__("$10"); +register __varword iarg7 __asm__("$11"); +register float farg0 __asm__("$f12"); +register float farg1 __asm__("$f13"); +register float farg2 __asm__("$f14"); +register float farg3 __asm__("$f15"); +register float farg4 __asm__("$f16"); +register float farg5 __asm__("$f17"); +register float farg6 __asm__("$f18"); +register float farg7 __asm__("$f19"); +register double darg0 __asm__("$f12"); +register double darg1 __asm__("$f13"); +register double darg2 __asm__("$f14"); +register double darg3 __asm__("$f15"); +register double darg4 __asm__("$f16"); +register double darg5 __asm__("$f17"); +register double darg6 __asm__("$f18"); +register double darg7 __asm__("$f19"); +register __varword iret __asm__("$2"); +register __varword iret2 __asm__("$3"); +register float fret __asm__("$f0"); +register float fret2 __asm__("$f2"); +register double dret __asm__("$f0"); +register double dret2 __asm__("$f2"); + +/* The ABI requires that the first 8 general-purpose argument words are + being passed in registers, even if these words belong to a struct. No room + is allocated for these register words on the stack by the caller, but the + callee allocates room for them - at the right place in the stack frame, + that is, above the usual {fp, retaddr} combo - if and only if they are part + of a larger struct that extends to the stack and the address of this struct + is taken. */ +struct gpargsequence { + __vaword word1; /* r4 */ + __vaword word2; /* r5 */ + __vaword word3; /* r6 */ + __vaword word4; /* r7 */ + __vaword word5; /* r8 */ + __vaword word6; /* r9 */ + __vaword word7; /* r10 */ + __vaword word8; /* r11 */ + __vaword firststackword; +}; + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (struct gpargsequence gpargs) +{ + __va_alist list; + list.darg[0] = darg0; + list.darg[1] = darg1; + list.darg[2] = darg2; + list.darg[3] = darg3; + list.darg[4] = darg4; + list.darg[5] = darg5; + list.darg[6] = darg6; + list.darg[7] = darg7; + list.farg[0] = farg0; + list.farg[1] = farg1; + list.farg[2] = farg2; + list.farg[3] = farg3; + list.farg[4] = farg4; + list.farg[5] = farg5; + list.farg[6] = farg6; + list.farg[7] = farg7; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&gpargs; + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.anum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulonglong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + if (list.flags & __VA_GCC_STRUCT_RETURN) { + /* gcc returns structs of size 1,2,4,8 in registers. */ + if (list.rsize == sizeof(char)) { + iret = *(unsigned char *) list.raddr; + } else + if (list.rsize == sizeof(short)) { + iret = *(unsigned short *) list.raddr; + } else + if (list.rsize == sizeof(int)) { + iret = *(unsigned int *) list.raddr; + } else + if (list.rsize == sizeof(long)) { + iret = *(unsigned long *) list.raddr; + } + } else { + /* cc returns structs of size <= 16 in registers. */ + /* Maybe this big if cascade could be replaced with + * if (list.rsize > 0 && list.rsize <= 16) + * __asm__ ("ldl $2,%0 ; ldr $2,%1" + * : : "m" (((unsigned char *) list.raddr)[0]), + * "m" (((unsigned char *) list.raddr)[7])); + */ + if (list.rsize > 0 && list.rsize <= 16) { + #if 0 /* Unoptimized */ + if (list.rsize == 1) { + #if defined(_MIPSEL) + iret = (__varword)((unsigned char *) list.raddr)[0]; + #else + iret = (__varword)((unsigned char *) list.raddr)[0] << 56; + #endif + } else + if (list.rsize == 2) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48); + #endif + } else + if (list.rsize == 3) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40); + #endif + } else + if (list.rsize == 4) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32); + #endif + } else + if (list.rsize == 5) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24); + #endif + } else + if (list.rsize == 6) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32) + | ((__varword)((unsigned char *) list.raddr)[5] << 40); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16); + #endif + } else + if (list.rsize == 7) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32) + | ((__varword)((unsigned char *) list.raddr)[5] << 40) + | ((__varword)((unsigned char *) list.raddr)[6] << 48); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16) + | ((__varword)((unsigned char *) list.raddr)[6] << 8); + #endif + } else + if (list.rsize >= 8 && list.rsize <= 16) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32) + | ((__varword)((unsigned char *) list.raddr)[5] << 40) + | ((__varword)((unsigned char *) list.raddr)[6] << 48) + | ((__varword)((unsigned char *) list.raddr)[7] << 56); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16) + | ((__varword)((unsigned char *) list.raddr)[6] << 8) + | (__varword)((unsigned char *) list.raddr)[7]; + #endif + /* Maybe this big if cascade could be replaced with + * if (list.rsize > 8 && list.rsize <= 16) + * __asm__ ("ldl $3,%0 ; ldr $3,%1" + * : : "m" (((unsigned char *) list.raddr)[8]), + * "m" (((unsigned char *) list.raddr)[15])); + */ + if (list.rsize == 8) { + } else + if (list.rsize == 9) { + #if defined(_MIPSEL) + iret2 = (__varword)((unsigned char *) list.raddr)[8]; + #else + iret2 = (__varword)((unsigned char *) list.raddr)[8] << 56; + #endif + } else + if (list.rsize == 10) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48); + #endif + } else + if (list.rsize == 11) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40); + #endif + } else + if (list.rsize == 12) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32); + #endif + } else + if (list.rsize == 13) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24); + #endif + } else + if (list.rsize == 14) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32) + | ((__varword)((unsigned char *) list.raddr)[13] << 40); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16); + #endif + } else + if (list.rsize == 15) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32) + | ((__varword)((unsigned char *) list.raddr)[13] << 40) + | ((__varword)((unsigned char *) list.raddr)[14] << 48); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16) + | ((__varword)((unsigned char *) list.raddr)[14] << 8); + #endif + } else + if (list.rsize == 16) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32) + | ((__varword)((unsigned char *) list.raddr)[13] << 40) + | ((__varword)((unsigned char *) list.raddr)[14] << 48) + | ((__varword)((unsigned char *) list.raddr)[15] << 56); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16) + | ((__varword)((unsigned char *) list.raddr)[14] << 8) + | (__varword)((unsigned char *) list.raddr)[15]; + #endif + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 2*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__varword) */ + #if defined(_MIPSEL) + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = ((__varword)2 << (end_offset*8-1)) - 1; + iret = (wordaddr[0] & mask0) >> (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) >> (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = ((__varword)2 << (end_offset*8-2*sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] >> (start_offset*8)) | ((wordaddr[2] & mask2) << (sizeof(__varword)*8-start_offset*8)); + } + } + #else + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = - ((__varword)1 << (sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] & mask0) << (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = - ((__varword)1 << (2*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | ((wordaddr[1] & mask1) >> (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = - ((__varword)1 << (2*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | ((wordaddr[1] & mask1) >> (sizeof(__varword)*4-start_offset*4) >> (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) << (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = - ((__varword)1 << (3*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | (wordaddr[1] >> (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] << (start_offset*8)) | ((wordaddr[2] & mask2) >> (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + #endif + } + if (list.flags & __VA_REGISTER_FLOATSTRUCT_RETURN) { + if (list.rsize == sizeof(float)) { + fret = *(float*)list.raddr; + } else + if (list.rsize == 2*sizeof(float)) { + fret = *(float*)list.raddr; + fret2 = *(float*)((char*)list.raddr + 4); + } + } + if (list.flags & __VA_REGISTER_DOUBLESTRUCT_RETURN) { + if (list.rsize == sizeof(double)) { + dret = *(double*)list.raddr; + } else + if (list.rsize == 2*sizeof(double)) { + dret = *(double*)list.raddr; + dret2 = *(double*)((char*)list.raddr + 8); + } + } + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-mips64eb-linux.s b/vacall/vacall-mips64eb-linux.s new file mode 100644 index 0000000..caeec7b --- /dev/null +++ b/vacall/vacall-mips64eb-linux.s @@ -0,0 +1,362 @@ + .file 1 "vacall-mips64.c" + .section .mdebug.abi64 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + .frame $fp,272,$31 # vars= 160, regs= 6/0, args= 0, gp= 0 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + daddiu $sp,$sp,-272 + sd $28,184($sp) + lui $28,%hi(%neg(%gp_rel(vacall_receiver))) + daddu $28,$28,$25 + daddiu $28,$28,%lo(%neg(%gp_rel(vacall_receiver))) + ld $12,%got_disp(vacall_function)($28) + sd $fp,192($sp) + move $fp,$sp + ld $25,0($12) + daddiu $12,$fp,208 + sd $31,200($sp) + sd $18,176($sp) + sd $17,168($sp) + sd $16,160($sp) + sd $4,208($fp) + sd $5,216($fp) + sd $6,224($fp) + sd $7,232($fp) + sd $8,240($fp) + sd $9,248($fp) + sd $10,256($fp) + sd $11,264($fp) + sdc1 $f12,96($fp) + sdc1 $f13,104($fp) + sdc1 $f14,112($fp) + sdc1 $f15,120($fp) + sdc1 $f16,128($fp) + sdc1 $f17,136($fp) + sdc1 $f18,144($fp) + sdc1 $f19,152($fp) + swc1 $f12,60($fp) + swc1 $f13,64($fp) + swc1 $f14,68($fp) + swc1 $f15,72($fp) + swc1 $f16,76($fp) + swc1 $f17,80($fp) + swc1 $f18,84($fp) + swc1 $f19,88($fp) + move $4,$fp + sw $0,0($fp) + sd $12,24($fp) + sd $0,32($fp) + sw $0,40($fp) + jalr $25 + sw $0,56($fp) + + lw $12,40($fp) + beq $12,$0,.L1 + li $13,1 # 0x1 + + beq $12,$13,.L43 + li $13,2 # 0x2 + + beq $12,$13,.L43 + li $13,3 # 0x3 + + beq $12,$13,.L46 + li $13,4 # 0x4 + + beq $12,$13,.L47 + li $13,5 # 0x5 + + beq $12,$13,.L48 + li $13,6 # 0x6 + + beq $12,$13,.L49 + li $13,7 # 0x7 + + beq $12,$13,.L50 + li $13,8 # 0x8 + + beq $12,$13,.L44 + li $13,9 # 0x9 + + beq $12,$13,.L44 + li $13,10 # 0xa + + beq $12,$13,.L44 + li $13,11 # 0xb + + beq $12,$13,.L44 + li $13,12 # 0xc + + beq $12,$13,.L51 + li $13,13 # 0xd + + beq $12,$13,.L52 + li $13,14 # 0xe + + beq $12,$13,.L44 + li $13,15 # 0xf + + bnel $12,$13,.L58 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + ld $14,48($fp) + + ld $12,48($fp) + li $13,1 # 0x1 + beq $12,$13,.L53 + li $13,2 # 0x2 + + beq $12,$13,.L54 + li $13,4 # 0x4 + + beq $12,$13,.L55 + li $13,8 # 0x8 + + bnel $12,$13,.L58 + move $sp,$fp + + ld $12,32($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L58: + ld $31,200($sp) + ld $fp,192($sp) + ld $28,184($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L43: + move $sp,$fp + ld $31,200($sp) + ld $28,184($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + lb $2,8($fp) + ld $fp,192($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L44: + b .L1 + ld $2,8($fp) + + .align 3 +.L46: + b .L1 + lbu $2,8($fp) + + .align 3 +.L47: + b .L1 + lh $2,8($fp) + + .align 3 +.L48: + b .L1 + lhu $2,8($fp) + + .align 3 +.L49: + b .L1 + lw $2,8($fp) + + .align 3 +.L51: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L50: + b .L1 + lwu $2,8($fp) + +.L52: + b .L1 + ldc1 $f0,8($fp) + +.L19: + daddiu $13,$14,-1 + sltu $13,$13,16 + beql $13,$0,.L59 + andi $13,$12,0x800 + + ld $13,32($fp) + li $24,-8 # 0xfffffffffffffff8 + sltu $25,$14,9 + andi $15,$13,0x7 + and $24,$13,$24 + beq $25,$0,.L24 + daddu $13,$14,$15 + + sltu $25,$13,9 + sll $13,$13,0 + beq $25,$0,.L25 + subu $13,$0,$13 + + ld $25,0($24) + sll $13,$13,3 + li $24,-1 # 0xffffffffffffffff + dsll $13,$24,$13 + and $13,$13,$25 + sll $15,$15,3 + dsll $2,$13,$15 +.L23: + andi $13,$12,0x800 +.L59: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 # 0x4 + beq $14,$13,.L56 + li $13,8 # 0x8 + + beql $14,$13,.L57 + ld $13,32($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L58 + move $sp,$fp + + li $12,16 # 0x10 +.L60: + bnel $14,$12,.L58 + move $sp,$fp + + ld $12,32($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 # 0x8 + + bne $14,$12,.L60 + li $12,16 # 0x10 + + ld $13,32($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + sll $13,$13,0 + + ld $18,8($24) + subu $13,$0,$13 + move $16,$15 + li $25,-1 # 0xffffffffffffffff + subu $15,$0,$15 + sll $13,$13,3 + dsll $13,$25,$13 + ld $17,0($24) + sll $25,$15,2 + addiu $24,$25,32 + and $13,$13,$18 + sll $15,$16,3 + dsra $25,$13,$24 + dsll $16,$17,$15 + dsra $24,$25,$24 + or $2,$16,$24 + b .L23 + dsll $3,$13,$15 + +.L53: + ld $12,32($fp) + b .L1 + lbu $2,0($12) + +.L54: + ld $12,32($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $18,16($24) + subu $13,$0,$13 + ld $16,8($24) + ld $17,0($24) + subu $25,$0,$15 + sll $13,$13,3 + li $24,-1 # 0xffffffffffffffff + dsll $24,$24,$13 + sll $25,$25,3 + sll $15,$15,3 + addiu $25,$25,64 + and $13,$24,$18 + dsra $13,$13,$25 + dsll $24,$17,$15 + dsra $17,$16,$25 + dsll $15,$16,$15 + or $2,$24,$17 + b .L23 + or $3,$13,$15 + +.L56: + ld $12,32($fp) + b .L1 + lwc1 $f0,0($12) + +.L55: + ld $12,32($fp) + b .L1 + lwu $2,0($12) + +.L25: + ld $16,8($24) + ld $25,0($24) + sll $13,$13,3 + li $24,-1 # 0xffffffffffffffff + dsll $13,$24,$13 + subu $24,$0,$15 + and $13,$13,$16 + sll $24,$24,3 + sll $15,$15,3 + dsra $13,$13,$24 + dsll $15,$25,$15 + b .L23 + or $2,$13,$15 + +.L57: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/vacall/vacall-mips64eb-macro.S b/vacall/vacall-mips64eb-macro.S new file mode 100644 index 0000000..87b6667 --- /dev/null +++ b/vacall/vacall-mips64eb-macro.S @@ -0,0 +1,356 @@ +#include "asm-mips.h" + .file 1 "vacall-mips64.c" + .text + .align 2 + .align 3 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + DECLARE_FUNCTION(vacall_receiver) +vacall_receiver: + .frame $fp,272,$31 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + daddiu $sp,$sp,-272 + sd $28,184($sp) + lui $28,%hi(%neg(%gp_rel(vacall_receiver))) + daddu $28,$28,$25 + daddiu $28,$28,%lo(%neg(%gp_rel(vacall_receiver))) + ld $12,%got_disp(vacall_function)($28) + sd $fp,192($sp) + move $fp,$sp + ld $25,0($12) + daddiu $12,$fp,208 + sd $31,200($sp) + sd $18,176($sp) + sd $17,168($sp) + sd $16,160($sp) + sd $4,208($fp) + sd $5,216($fp) + sd $6,224($fp) + sd $7,232($fp) + sd $8,240($fp) + sd $9,248($fp) + sd $10,256($fp) + sd $11,264($fp) + sdc1 $f12,96($fp) + sdc1 $f13,104($fp) + sdc1 $f14,112($fp) + sdc1 $f15,120($fp) + sdc1 $f16,128($fp) + sdc1 $f17,136($fp) + sdc1 $f18,144($fp) + sdc1 $f19,152($fp) + swc1 $f12,60($fp) + swc1 $f13,64($fp) + swc1 $f14,68($fp) + swc1 $f15,72($fp) + swc1 $f16,76($fp) + swc1 $f17,80($fp) + swc1 $f18,84($fp) + swc1 $f19,88($fp) + move $4,$fp + sw $0,0($fp) + sd $12,24($fp) + sd $0,32($fp) + sw $0,40($fp) + jalr $25 + sw $0,56($fp) + + lw $12,40($fp) + beq $12,$0,.L1 + li $13,1 + + beq $12,$13,.L43 + li $13,2 + + beq $12,$13,.L43 + li $13,3 + + beq $12,$13,.L46 + li $13,4 + + beq $12,$13,.L47 + li $13,5 + + beq $12,$13,.L48 + li $13,6 + + beq $12,$13,.L49 + li $13,7 + + beq $12,$13,.L50 + li $13,8 + + beq $12,$13,.L44 + li $13,9 + + beq $12,$13,.L44 + li $13,10 + + beq $12,$13,.L44 + li $13,11 + + beq $12,$13,.L44 + li $13,12 + + beq $12,$13,.L51 + li $13,13 + + beq $12,$13,.L52 + li $13,14 + + beq $12,$13,.L44 + li $13,15 + + bnel $12,$13,.L58 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + ld $14,48($fp) + + ld $12,48($fp) + li $13,1 + beq $12,$13,.L53 + li $13,2 + + beq $12,$13,.L54 + li $13,4 + + beq $12,$13,.L55 + li $13,8 + + bnel $12,$13,.L58 + move $sp,$fp + + ld $12,32($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L58: + ld $31,200($sp) + ld $fp,192($sp) + ld $28,184($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L43: + move $sp,$fp + ld $31,200($sp) + ld $28,184($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + lb $2,8($fp) + ld $fp,192($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L44: + b .L1 + ld $2,8($fp) + + .align 3 +.L46: + b .L1 + lbu $2,8($fp) + + .align 3 +.L47: + b .L1 + lh $2,8($fp) + + .align 3 +.L48: + b .L1 + lhu $2,8($fp) + + .align 3 +.L49: + b .L1 + lw $2,8($fp) + + .align 3 +.L51: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L50: + b .L1 + lwu $2,8($fp) + +.L52: + b .L1 + ldc1 $f0,8($fp) + +.L19: + daddiu $13,$14,-1 + sltu $13,$13,16 + beql $13,$0,.L59 + andi $13,$12,0x800 + + ld $13,32($fp) + li $24,-8 + sltu $25,$14,9 + andi $15,$13,0x7 + and $24,$13,$24 + beq $25,$0,.L24 + daddu $13,$14,$15 + + sltu $25,$13,9 + sll $13,$13,0 + beq $25,$0,.L25 + subu $13,$0,$13 + + ld $25,0($24) + sll $13,$13,3 + li $24,-1 + dsll $13,$24,$13 + and $13,$13,$25 + sll $15,$15,3 + dsll $2,$13,$15 +.L23: + andi $13,$12,0x800 +.L59: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 + beq $14,$13,.L56 + li $13,8 + + beql $14,$13,.L57 + ld $13,32($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L58 + move $sp,$fp + + li $12,16 +.L60: + bnel $14,$12,.L58 + move $sp,$fp + + ld $12,32($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 + + bne $14,$12,.L60 + li $12,16 + + ld $13,32($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + sll $13,$13,0 + + ld $18,8($24) + subu $13,$0,$13 + move $16,$15 + li $25,-1 + subu $15,$0,$15 + sll $13,$13,3 + dsll $13,$25,$13 + ld $17,0($24) + sll $25,$15,2 + addiu $24,$25,32 + and $13,$13,$18 + sll $15,$16,3 + dsra $25,$13,$24 + dsll $16,$17,$15 + dsra $24,$25,$24 + or $2,$16,$24 + b .L23 + dsll $3,$13,$15 + +.L53: + ld $12,32($fp) + b .L1 + lbu $2,0($12) + +.L54: + ld $12,32($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $18,16($24) + subu $13,$0,$13 + ld $16,8($24) + ld $17,0($24) + subu $25,$0,$15 + sll $13,$13,3 + li $24,-1 + dsll $24,$24,$13 + sll $25,$25,3 + sll $15,$15,3 + addiu $25,$25,64 + and $13,$24,$18 + dsra $13,$13,$25 + dsll $24,$17,$15 + dsra $17,$16,$25 + dsll $15,$16,$15 + or $2,$24,$17 + b .L23 + or $3,$13,$15 + +.L56: + ld $12,32($fp) + b .L1 + lwc1 $f0,0($12) + +.L55: + ld $12,32($fp) + b .L1 + lwu $2,0($12) + +.L25: + ld $16,8($24) + ld $25,0($24) + sll $13,$13,3 + li $24,-1 + dsll $13,$24,$13 + subu $24,$0,$15 + and $13,$13,$16 + sll $24,$24,3 + sll $15,$15,3 + dsra $13,$13,$24 + dsll $15,$25,$15 + b .L23 + or $2,$13,$15 + +.L57: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver diff --git a/vacall/vacall-mips64el-linux.s b/vacall/vacall-mips64el-linux.s new file mode 100644 index 0000000..a2ea9ad --- /dev/null +++ b/vacall/vacall-mips64el-linux.s @@ -0,0 +1,366 @@ + .file 1 "vacall-mips64.c" + .section .mdebug.abi64 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + .frame $fp,272,$31 # vars= 160, regs= 6/0, args= 0, gp= 0 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + daddiu $sp,$sp,-272 + sd $28,184($sp) + lui $28,%hi(%neg(%gp_rel(vacall_receiver))) + daddu $28,$28,$25 + daddiu $28,$28,%lo(%neg(%gp_rel(vacall_receiver))) + ld $12,%got_disp(vacall_function)($28) + sd $fp,192($sp) + move $fp,$sp + ld $25,0($12) + daddiu $12,$fp,208 + sd $31,200($sp) + sd $18,176($sp) + sd $17,168($sp) + sd $16,160($sp) + sd $4,208($fp) + sd $5,216($fp) + sd $6,224($fp) + sd $7,232($fp) + sd $8,240($fp) + sd $9,248($fp) + sd $10,256($fp) + sd $11,264($fp) + sdc1 $f12,96($fp) + sdc1 $f13,104($fp) + sdc1 $f14,112($fp) + sdc1 $f15,120($fp) + sdc1 $f16,128($fp) + sdc1 $f17,136($fp) + sdc1 $f18,144($fp) + sdc1 $f19,152($fp) + swc1 $f12,60($fp) + swc1 $f13,64($fp) + swc1 $f14,68($fp) + swc1 $f15,72($fp) + swc1 $f16,76($fp) + swc1 $f17,80($fp) + swc1 $f18,84($fp) + swc1 $f19,88($fp) + move $4,$fp + sw $0,0($fp) + sd $12,24($fp) + sd $0,32($fp) + sw $0,40($fp) + jalr $25 + sw $0,56($fp) + + lw $12,40($fp) + beq $12,$0,.L1 + li $13,1 # 0x1 + + beq $12,$13,.L43 + li $13,2 # 0x2 + + beq $12,$13,.L43 + li $13,3 # 0x3 + + beq $12,$13,.L46 + li $13,4 # 0x4 + + beq $12,$13,.L47 + li $13,5 # 0x5 + + beq $12,$13,.L48 + li $13,6 # 0x6 + + beq $12,$13,.L49 + li $13,7 # 0x7 + + beq $12,$13,.L50 + li $13,8 # 0x8 + + beq $12,$13,.L44 + li $13,9 # 0x9 + + beq $12,$13,.L44 + li $13,10 # 0xa + + beq $12,$13,.L44 + li $13,11 # 0xb + + beq $12,$13,.L44 + li $13,12 # 0xc + + beq $12,$13,.L51 + li $13,13 # 0xd + + beq $12,$13,.L52 + li $13,14 # 0xe + + beq $12,$13,.L44 + li $13,15 # 0xf + + bnel $12,$13,.L58 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + ld $14,48($fp) + + ld $12,48($fp) + li $13,1 # 0x1 + beq $12,$13,.L53 + li $13,2 # 0x2 + + beq $12,$13,.L54 + li $13,4 # 0x4 + + beq $12,$13,.L55 + li $13,8 # 0x8 + + bnel $12,$13,.L58 + move $sp,$fp + + ld $12,32($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L58: + ld $31,200($sp) + ld $fp,192($sp) + ld $28,184($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L43: + move $sp,$fp + ld $31,200($sp) + ld $28,184($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + lb $2,8($fp) + ld $fp,192($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L44: + b .L1 + ld $2,8($fp) + + .align 3 +.L46: + b .L1 + lbu $2,8($fp) + + .align 3 +.L47: + b .L1 + lh $2,8($fp) + + .align 3 +.L48: + b .L1 + lhu $2,8($fp) + + .align 3 +.L49: + b .L1 + lw $2,8($fp) + + .align 3 +.L51: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L50: + b .L1 + lwu $2,8($fp) + +.L52: + b .L1 + ldc1 $f0,8($fp) + +.L19: + daddiu $13,$14,-1 + sltu $13,$13,16 + beql $13,$0,.L59 + andi $13,$12,0x800 + + ld $13,32($fp) + li $15,-8 # 0xfffffffffffffff8 + sltu $25,$14,9 + andi $24,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + daddu $13,$14,$24 + + sltu $25,$13,9 + beq $25,$0,.L25 + dsll $13,$13,3 + + daddiu $13,$13,-1 + ld $25,0($15) + sll $13,$13,0 + li $15,2 # 0x2 + dsll $13,$15,$13 + daddiu $13,$13,-1 + and $13,$13,$25 + sll $24,$24,3 + dsra $2,$13,$24 +.L23: + andi $13,$12,0x800 +.L59: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 # 0x4 + beq $14,$13,.L56 + li $13,8 # 0x8 + + beql $14,$13,.L57 + ld $13,32($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L58 + move $sp,$fp + + li $12,16 # 0x10 +.L60: + bnel $14,$12,.L58 + move $sp,$fp + + ld $12,32($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 # 0x8 + + bne $14,$12,.L60 + li $12,16 # 0x10 + + ld $13,32($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + dsll $13,$13,3 + + daddiu $13,$13,-65 + ld $17,8($15) + li $25,2 # 0x2 + sll $13,$13,0 + dsll $13,$25,$13 + subu $25,$0,$24 + sll $25,$25,2 + ld $16,0($15) + daddiu $13,$13,-1 + addiu $15,$25,32 + and $13,$13,$17 + sll $24,$24,3 + dsll $25,$13,$15 + dsra $16,$16,$24 + dsll $15,$25,$15 + or $2,$16,$15 + b .L23 + dsra $3,$13,$24 + +.L53: + ld $12,32($fp) + b .L1 + lbu $2,0($12) + +.L54: + ld $12,32($fp) + b .L1 + lhu $2,0($12) + +.L26: + daddiu $13,$13,-129 + ld $16,8($15) + ld $17,0($15) + sll $13,$13,0 + ld $18,16($15) + li $15,2 # 0x2 + subu $25,$0,$24 + dsll $15,$15,$13 + daddiu $15,$15,-1 + sll $25,$25,3 + sll $24,$24,3 + addiu $25,$25,64 + and $13,$15,$18 + dsll $13,$13,$25 + dsra $15,$17,$24 + dsll $17,$16,$25 + dsra $24,$16,$24 + or $2,$15,$17 + b .L23 + or $3,$13,$24 + +.L56: + ld $12,32($fp) + b .L1 + lwc1 $f0,0($12) + +.L55: + ld $12,32($fp) + b .L1 + lwu $2,0($12) + +.L25: + daddiu $13,$13,-65 + li $25,2 # 0x2 + sll $13,$13,0 + ld $17,8($15) + dsll $13,$25,$13 + ld $25,0($15) + daddiu $13,$13,-1 + subu $16,$0,$24 + and $15,$13,$17 + sll $24,$24,3 + sll $13,$16,3 + dsll $13,$15,$13 + dsra $24,$25,$24 + b .L23 + or $2,$13,$24 + +.L57: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/vacall/vacall-mips64el-macro.S b/vacall/vacall-mips64el-macro.S new file mode 100644 index 0000000..63b81f5 --- /dev/null +++ b/vacall/vacall-mips64el-macro.S @@ -0,0 +1,360 @@ +#include "asm-mips.h" + .file 1 "vacall-mips64.c" + .text + .align 2 + .align 3 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + DECLARE_FUNCTION(vacall_receiver) +vacall_receiver: + .frame $fp,272,$31 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + daddiu $sp,$sp,-272 + sd $28,184($sp) + lui $28,%hi(%neg(%gp_rel(vacall_receiver))) + daddu $28,$28,$25 + daddiu $28,$28,%lo(%neg(%gp_rel(vacall_receiver))) + ld $12,%got_disp(vacall_function)($28) + sd $fp,192($sp) + move $fp,$sp + ld $25,0($12) + daddiu $12,$fp,208 + sd $31,200($sp) + sd $18,176($sp) + sd $17,168($sp) + sd $16,160($sp) + sd $4,208($fp) + sd $5,216($fp) + sd $6,224($fp) + sd $7,232($fp) + sd $8,240($fp) + sd $9,248($fp) + sd $10,256($fp) + sd $11,264($fp) + sdc1 $f12,96($fp) + sdc1 $f13,104($fp) + sdc1 $f14,112($fp) + sdc1 $f15,120($fp) + sdc1 $f16,128($fp) + sdc1 $f17,136($fp) + sdc1 $f18,144($fp) + sdc1 $f19,152($fp) + swc1 $f12,60($fp) + swc1 $f13,64($fp) + swc1 $f14,68($fp) + swc1 $f15,72($fp) + swc1 $f16,76($fp) + swc1 $f17,80($fp) + swc1 $f18,84($fp) + swc1 $f19,88($fp) + move $4,$fp + sw $0,0($fp) + sd $12,24($fp) + sd $0,32($fp) + sw $0,40($fp) + jalr $25 + sw $0,56($fp) + + lw $12,40($fp) + beq $12,$0,.L1 + li $13,1 + + beq $12,$13,.L43 + li $13,2 + + beq $12,$13,.L43 + li $13,3 + + beq $12,$13,.L46 + li $13,4 + + beq $12,$13,.L47 + li $13,5 + + beq $12,$13,.L48 + li $13,6 + + beq $12,$13,.L49 + li $13,7 + + beq $12,$13,.L50 + li $13,8 + + beq $12,$13,.L44 + li $13,9 + + beq $12,$13,.L44 + li $13,10 + + beq $12,$13,.L44 + li $13,11 + + beq $12,$13,.L44 + li $13,12 + + beq $12,$13,.L51 + li $13,13 + + beq $12,$13,.L52 + li $13,14 + + beq $12,$13,.L44 + li $13,15 + + bnel $12,$13,.L58 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + ld $14,48($fp) + + ld $12,48($fp) + li $13,1 + beq $12,$13,.L53 + li $13,2 + + beq $12,$13,.L54 + li $13,4 + + beq $12,$13,.L55 + li $13,8 + + bnel $12,$13,.L58 + move $sp,$fp + + ld $12,32($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L58: + ld $31,200($sp) + ld $fp,192($sp) + ld $28,184($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L43: + move $sp,$fp + ld $31,200($sp) + ld $28,184($sp) + ld $18,176($sp) + ld $17,168($sp) + ld $16,160($sp) + lb $2,8($fp) + ld $fp,192($sp) + j $31 + daddiu $sp,$sp,272 + + .align 3 +.L44: + b .L1 + ld $2,8($fp) + + .align 3 +.L46: + b .L1 + lbu $2,8($fp) + + .align 3 +.L47: + b .L1 + lh $2,8($fp) + + .align 3 +.L48: + b .L1 + lhu $2,8($fp) + + .align 3 +.L49: + b .L1 + lw $2,8($fp) + + .align 3 +.L51: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L50: + b .L1 + lwu $2,8($fp) + +.L52: + b .L1 + ldc1 $f0,8($fp) + +.L19: + daddiu $13,$14,-1 + sltu $13,$13,16 + beql $13,$0,.L59 + andi $13,$12,0x800 + + ld $13,32($fp) + li $15,-8 + sltu $25,$14,9 + andi $24,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + daddu $13,$14,$24 + + sltu $25,$13,9 + beq $25,$0,.L25 + dsll $13,$13,3 + + daddiu $13,$13,-1 + ld $25,0($15) + sll $13,$13,0 + li $15,2 + dsll $13,$15,$13 + daddiu $13,$13,-1 + and $13,$13,$25 + sll $24,$24,3 + dsra $2,$13,$24 +.L23: + andi $13,$12,0x800 +.L59: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 + beq $14,$13,.L56 + li $13,8 + + beql $14,$13,.L57 + ld $13,32($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L58 + move $sp,$fp + + li $12,16 +.L60: + bnel $14,$12,.L58 + move $sp,$fp + + ld $12,32($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 + + bne $14,$12,.L60 + li $12,16 + + ld $13,32($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + dsll $13,$13,3 + + daddiu $13,$13,-65 + ld $17,8($15) + li $25,2 + sll $13,$13,0 + dsll $13,$25,$13 + subu $25,$0,$24 + sll $25,$25,2 + ld $16,0($15) + daddiu $13,$13,-1 + addiu $15,$25,32 + and $13,$13,$17 + sll $24,$24,3 + dsll $25,$13,$15 + dsra $16,$16,$24 + dsll $15,$25,$15 + or $2,$16,$15 + b .L23 + dsra $3,$13,$24 + +.L53: + ld $12,32($fp) + b .L1 + lbu $2,0($12) + +.L54: + ld $12,32($fp) + b .L1 + lhu $2,0($12) + +.L26: + daddiu $13,$13,-129 + ld $16,8($15) + ld $17,0($15) + sll $13,$13,0 + ld $18,16($15) + li $15,2 + subu $25,$0,$24 + dsll $15,$15,$13 + daddiu $15,$15,-1 + sll $25,$25,3 + sll $24,$24,3 + addiu $25,$25,64 + and $13,$15,$18 + dsll $13,$13,$25 + dsra $15,$17,$24 + dsll $17,$16,$25 + dsra $24,$16,$24 + or $2,$15,$17 + b .L23 + or $3,$13,$24 + +.L56: + ld $12,32($fp) + b .L1 + lwc1 $f0,0($12) + +.L55: + ld $12,32($fp) + b .L1 + lwu $2,0($12) + +.L25: + daddiu $13,$13,-65 + li $25,2 + sll $13,$13,0 + ld $17,8($15) + dsll $13,$25,$13 + ld $25,0($15) + daddiu $13,$13,-1 + subu $16,$0,$24 + and $15,$13,$17 + sll $24,$24,3 + sll $13,$16,3 + dsll $13,$15,$13 + dsra $24,$25,$24 + b .L23 + or $2,$13,$24 + +.L57: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver diff --git a/vacall/vacall-mipseb-linux.s b/vacall/vacall-mipseb-linux.s new file mode 100644 index 0000000..7cc4184 --- /dev/null +++ b/vacall/vacall-mipseb-linux.s @@ -0,0 +1,295 @@ + .file 1 "vacall-mips.c" + .section .mdebug.abi32 + .previous + .nan legacy + .module fp=xx + .module nooddspreg + .abicalls + .text + .align 2 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + .frame $fp,104,$31 # vars= 72, regs= 2/0, args= 16, gp= 8 + .mask 0xc0000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-104 + sw $fp,96($sp) + move $fp,$sp + sw $31,100($sp) + la $8,vacall_function + sw $4,104($fp) + lw $25,0($8) + addiu $4,$fp,104 + sw $4,40($fp) + addiu $4,$fp,120 + sw $4,56($fp) + .cprestore 16 + addiu $4,$fp,24 + sw $5,108($fp) + sw $6,112($fp) + sw $7,116($fp) + sdc1 $f12,80($fp) + sdc1 $f14,88($fp) + swc1 $f12,68($fp) + swc1 $f14,72($fp) + sw $0,24($fp) + sw $0,44($fp) + sw $0,48($fp) + sw $0,60($fp) + sw $0,64($fp) + jal $25 + lw $4,48($fp) + .set noreorder + .set nomacro + beq $4,$0,$L1 + li $5,1 # 0x1 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,3 # 0x3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L29 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L30 + li $5,5 # 0x5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L31 + li $5,6 # 0x6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,7 # 0x7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,9 # 0x9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + addiu $5,$4,-10 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bne $5,$0,$L32 + li $5,12 # 0xc + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L33 + li $5,13 # 0xd + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L34 + li $5,14 # 0xe + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,15 # 0xf + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,24($fp) + andi $4,$4,0x2 + .set noreorder + .set nomacro + beql $4,$0,$L38 + lw $2,44($fp) + .set macro + .set reorder + + lw $4,52($fp) + li $5,1 # 0x1 + .set noreorder + .set nomacro + beql $4,$5,$L35 + lw $4,44($fp) + .set macro + .set reorder + + li $5,2 # 0x2 + .set noreorder + .set nomacro + beq $4,$5,$L36 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,44($fp) + lw $2,0($4) +$L1: +$L38: + move $sp,$fp +$L37: + lw $31,100($sp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L23: + move $sp,$fp + lw $31,100($sp) + lb $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L27: + move $sp,$fp + lw $31,100($sp) + lw $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L29: + .set noreorder + .set nomacro + b $L1 + lbu $2,32($fp) + .set macro + .set reorder + +$L30: + .set noreorder + .set nomacro + b $L1 + lh $2,32($fp) + .set macro + .set reorder + +$L31: + .set noreorder + .set nomacro + b $L1 + lhu $2,32($fp) + .set macro + .set reorder + +$L34: + .set noreorder + .set nomacro + b $L1 + ldc1 $f0,32($fp) + .set macro + .set reorder + +$L32: + lw $2,32($fp) + .set noreorder + .set nomacro + b $L1 + lw $3,36($fp) + .set macro + .set reorder + +$L33: + .set noreorder + .set nomacro + b $L1 + lwc1 $f0,32($fp) + .set macro + .set reorder + +$L35: + .set noreorder + .set nomacro + b $L1 + lbu $2,0($4) + .set macro + .set reorder + +$L36: + lw $4,44($fp) + .set noreorder + .set nomacro + b $L1 + lhu $2,0($4) + .set macro + .set reorder + + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/vacall/vacall-mipseb-macro.S b/vacall/vacall-mipseb-macro.S new file mode 100644 index 0000000..9255dce --- /dev/null +++ b/vacall/vacall-mipseb-macro.S @@ -0,0 +1,289 @@ +#include "asm-mips.h" + .file 1 "vacall-mips.c" + .text + .align 2 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + DECLARE_FUNCTION(vacall_receiver) +vacall_receiver: + .frame $fp,104,$31 + .mask 0xc0000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-104 + sw $fp,96($sp) + move $fp,$sp + sw $31,100($sp) + la $8,vacall_function + sw $4,104($fp) + lw $25,0($8) + addiu $4,$fp,104 + sw $4,40($fp) + addiu $4,$fp,120 + sw $4,56($fp) + .cprestore 16 + addiu $4,$fp,24 + sw $5,108($fp) + sw $6,112($fp) + sw $7,116($fp) + sdc1 $f12,80($fp) + sdc1 $f14,88($fp) + swc1 $f12,68($fp) + swc1 $f14,72($fp) + sw $0,24($fp) + sw $0,44($fp) + sw $0,48($fp) + sw $0,60($fp) + sw $0,64($fp) + jal $25 + lw $4,48($fp) + .set noreorder + .set nomacro + beq $4,$0,$L1 + li $5,1 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L29 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L30 + li $5,5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L31 + li $5,6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + addiu $5,$4,-10 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bne $5,$0,$L32 + li $5,12 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L33 + li $5,13 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L34 + li $5,14 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,15 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,24($fp) + andi $4,$4,0x2 + .set noreorder + .set nomacro + beql $4,$0,$L38 + lw $2,44($fp) + .set macro + .set reorder + + lw $4,52($fp) + li $5,1 + .set noreorder + .set nomacro + beql $4,$5,$L35 + lw $4,44($fp) + .set macro + .set reorder + + li $5,2 + .set noreorder + .set nomacro + beq $4,$5,$L36 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,44($fp) + lw $2,0($4) +$L1: +$L38: + move $sp,$fp +$L37: + lw $31,100($sp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L23: + move $sp,$fp + lw $31,100($sp) + lb $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L27: + move $sp,$fp + lw $31,100($sp) + lw $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L29: + .set noreorder + .set nomacro + b $L1 + lbu $2,32($fp) + .set macro + .set reorder + +$L30: + .set noreorder + .set nomacro + b $L1 + lh $2,32($fp) + .set macro + .set reorder + +$L31: + .set noreorder + .set nomacro + b $L1 + lhu $2,32($fp) + .set macro + .set reorder + +$L34: + .set noreorder + .set nomacro + b $L1 + ldc1 $f0,32($fp) + .set macro + .set reorder + +$L32: + lw $2,32($fp) + .set noreorder + .set nomacro + b $L1 + lw $3,36($fp) + .set macro + .set reorder + +$L33: + .set noreorder + .set nomacro + b $L1 + lwc1 $f0,32($fp) + .set macro + .set reorder + +$L35: + .set noreorder + .set nomacro + b $L1 + lbu $2,0($4) + .set macro + .set reorder + +$L36: + lw $4,44($fp) + .set noreorder + .set nomacro + b $L1 + lhu $2,0($4) + .set macro + .set reorder + + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver diff --git a/vacall/vacall-mipsel-linux.s b/vacall/vacall-mipsel-linux.s new file mode 100644 index 0000000..7cc4184 --- /dev/null +++ b/vacall/vacall-mipsel-linux.s @@ -0,0 +1,295 @@ + .file 1 "vacall-mips.c" + .section .mdebug.abi32 + .previous + .nan legacy + .module fp=xx + .module nooddspreg + .abicalls + .text + .align 2 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + .frame $fp,104,$31 # vars= 72, regs= 2/0, args= 16, gp= 8 + .mask 0xc0000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-104 + sw $fp,96($sp) + move $fp,$sp + sw $31,100($sp) + la $8,vacall_function + sw $4,104($fp) + lw $25,0($8) + addiu $4,$fp,104 + sw $4,40($fp) + addiu $4,$fp,120 + sw $4,56($fp) + .cprestore 16 + addiu $4,$fp,24 + sw $5,108($fp) + sw $6,112($fp) + sw $7,116($fp) + sdc1 $f12,80($fp) + sdc1 $f14,88($fp) + swc1 $f12,68($fp) + swc1 $f14,72($fp) + sw $0,24($fp) + sw $0,44($fp) + sw $0,48($fp) + sw $0,60($fp) + sw $0,64($fp) + jal $25 + lw $4,48($fp) + .set noreorder + .set nomacro + beq $4,$0,$L1 + li $5,1 # 0x1 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,2 # 0x2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,3 # 0x3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L29 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L30 + li $5,5 # 0x5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L31 + li $5,6 # 0x6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,7 # 0x7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,8 # 0x8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,9 # 0x9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + addiu $5,$4,-10 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bne $5,$0,$L32 + li $5,12 # 0xc + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L33 + li $5,13 # 0xd + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L34 + li $5,14 # 0xe + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,15 # 0xf + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,24($fp) + andi $4,$4,0x2 + .set noreorder + .set nomacro + beql $4,$0,$L38 + lw $2,44($fp) + .set macro + .set reorder + + lw $4,52($fp) + li $5,1 # 0x1 + .set noreorder + .set nomacro + beql $4,$5,$L35 + lw $4,44($fp) + .set macro + .set reorder + + li $5,2 # 0x2 + .set noreorder + .set nomacro + beq $4,$5,$L36 + li $5,4 # 0x4 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,44($fp) + lw $2,0($4) +$L1: +$L38: + move $sp,$fp +$L37: + lw $31,100($sp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L23: + move $sp,$fp + lw $31,100($sp) + lb $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L27: + move $sp,$fp + lw $31,100($sp) + lw $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L29: + .set noreorder + .set nomacro + b $L1 + lbu $2,32($fp) + .set macro + .set reorder + +$L30: + .set noreorder + .set nomacro + b $L1 + lh $2,32($fp) + .set macro + .set reorder + +$L31: + .set noreorder + .set nomacro + b $L1 + lhu $2,32($fp) + .set macro + .set reorder + +$L34: + .set noreorder + .set nomacro + b $L1 + ldc1 $f0,32($fp) + .set macro + .set reorder + +$L32: + lw $2,32($fp) + .set noreorder + .set nomacro + b $L1 + lw $3,36($fp) + .set macro + .set reorder + +$L33: + .set noreorder + .set nomacro + b $L1 + lwc1 $f0,32($fp) + .set macro + .set reorder + +$L35: + .set noreorder + .set nomacro + b $L1 + lbu $2,0($4) + .set macro + .set reorder + +$L36: + lw $4,44($fp) + .set noreorder + .set nomacro + b $L1 + lhu $2,0($4) + .set macro + .set reorder + + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/vacall/vacall-mipsel-macro.S b/vacall/vacall-mipsel-macro.S new file mode 100644 index 0000000..9255dce --- /dev/null +++ b/vacall/vacall-mipsel-macro.S @@ -0,0 +1,289 @@ +#include "asm-mips.h" + .file 1 "vacall-mips.c" + .text + .align 2 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + DECLARE_FUNCTION(vacall_receiver) +vacall_receiver: + .frame $fp,104,$31 + .mask 0xc0000000,-4 + .fmask 0x00000000,0 + .set noreorder + .cpload $25 + .set reorder + addiu $sp,$sp,-104 + sw $fp,96($sp) + move $fp,$sp + sw $31,100($sp) + la $8,vacall_function + sw $4,104($fp) + lw $25,0($8) + addiu $4,$fp,104 + sw $4,40($fp) + addiu $4,$fp,120 + sw $4,56($fp) + .cprestore 16 + addiu $4,$fp,24 + sw $5,108($fp) + sw $6,112($fp) + sw $7,116($fp) + sdc1 $f12,80($fp) + sdc1 $f14,88($fp) + swc1 $f12,68($fp) + swc1 $f14,72($fp) + sw $0,24($fp) + sw $0,44($fp) + sw $0,48($fp) + sw $0,60($fp) + sw $0,64($fp) + jal $25 + lw $4,48($fp) + .set noreorder + .set nomacro + beq $4,$0,$L1 + li $5,1 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,2 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L23 + li $5,3 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L29 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L30 + li $5,5 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L31 + li $5,6 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,7 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,8 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,9 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + addiu $5,$4,-10 + .set macro + .set reorder + + sltu $5,$5,2 + .set noreorder + .set nomacro + bne $5,$0,$L32 + li $5,12 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L33 + li $5,13 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L34 + li $5,14 + .set macro + .set reorder + + .set noreorder + .set nomacro + beq $4,$5,$L27 + li $5,15 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,24($fp) + andi $4,$4,0x2 + .set noreorder + .set nomacro + beql $4,$0,$L38 + lw $2,44($fp) + .set macro + .set reorder + + lw $4,52($fp) + li $5,1 + .set noreorder + .set nomacro + beql $4,$5,$L35 + lw $4,44($fp) + .set macro + .set reorder + + li $5,2 + .set noreorder + .set nomacro + beq $4,$5,$L36 + li $5,4 + .set macro + .set reorder + + .set noreorder + .set nomacro + bnel $4,$5,$L37 + move $sp,$fp + .set macro + .set reorder + + lw $4,44($fp) + lw $2,0($4) +$L1: +$L38: + move $sp,$fp +$L37: + lw $31,100($sp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L23: + move $sp,$fp + lw $31,100($sp) + lb $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L27: + move $sp,$fp + lw $31,100($sp) + lw $2,32($fp) + lw $fp,96($sp) + .set noreorder + .set nomacro + j $31 + addiu $sp,$sp,104 + .set macro + .set reorder + +$L29: + .set noreorder + .set nomacro + b $L1 + lbu $2,32($fp) + .set macro + .set reorder + +$L30: + .set noreorder + .set nomacro + b $L1 + lh $2,32($fp) + .set macro + .set reorder + +$L31: + .set noreorder + .set nomacro + b $L1 + lhu $2,32($fp) + .set macro + .set reorder + +$L34: + .set noreorder + .set nomacro + b $L1 + ldc1 $f0,32($fp) + .set macro + .set reorder + +$L32: + lw $2,32($fp) + .set noreorder + .set nomacro + b $L1 + lw $3,36($fp) + .set macro + .set reorder + +$L33: + .set noreorder + .set nomacro + b $L1 + lwc1 $f0,32($fp) + .set macro + .set reorder + +$L35: + .set noreorder + .set nomacro + b $L1 + lbu $2,0($4) + .set macro + .set reorder + +$L36: + lw $4,44($fp) + .set noreorder + .set nomacro + b $L1 + lhu $2,0($4) + .set macro + .set reorder + + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver diff --git a/vacall/vacall-mipsn32.c b/vacall/vacall-mipsn32.c new file mode 100644 index 0000000..209a69f --- /dev/null +++ b/vacall/vacall-mipsn32.c @@ -0,0 +1,508 @@ +/* vacall function for mips CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifndef REENTRANT +typedef void (*func_pointer)(va_alist); +#else /* REENTRANT */ +#define vacall_receiver callback_receiver +typedef void (*func_pointer)(void*,va_alist); +register struct { func_pointer vacall_function; void* arg; } + * env __asm__("$2"); +#endif +register void* sp __asm__("$sp"); +register __varword iarg0 __asm__("$4"); +register __varword iarg1 __asm__("$5"); +register __varword iarg2 __asm__("$6"); +register __varword iarg3 __asm__("$7"); +register __varword iarg4 __asm__("$8"); +register __varword iarg5 __asm__("$9"); +register __varword iarg6 __asm__("$10"); +register __varword iarg7 __asm__("$11"); +register float farg0 __asm__("$f12"); +register float farg1 __asm__("$f13"); +register float farg2 __asm__("$f14"); +register float farg3 __asm__("$f15"); +register float farg4 __asm__("$f16"); +register float farg5 __asm__("$f17"); +register float farg6 __asm__("$f18"); +register float farg7 __asm__("$f19"); +register double darg0 __asm__("$f12"); +register double darg1 __asm__("$f13"); +register double darg2 __asm__("$f14"); +register double darg3 __asm__("$f15"); +register double darg4 __asm__("$f16"); +register double darg5 __asm__("$f17"); +register double darg6 __asm__("$f18"); +register double darg7 __asm__("$f19"); +register __varword iret __asm__("$2"); +register __varword iret2 __asm__("$3"); +register float fret __asm__("$f0"); +register float fret2 __asm__("$f2"); +register double dret __asm__("$f0"); +register double dret2 __asm__("$f2"); + +/* The ABI requires that the first 8 general-purpose argument words are + being passed in registers, even if these words belong to a struct. No room + is allocated for these register words on the stack by the caller, but the + callee allocates room for them - at the right place in the stack frame, + that is, above the usual {fp, retaddr} combo - if and only if they are part + of a larger struct that extends to the stack and the address of this struct + is taken. */ +struct gpargsequence { + __vaword word1; /* r4 */ + __vaword word2; /* r5 */ + __vaword word3; /* r6 */ + __vaword word4; /* r7 */ + __vaword word5; /* r8 */ + __vaword word6; /* r9 */ + __vaword word7; /* r10 */ + __vaword word8; /* r11 */ + __vaword firststackword; +}; + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (struct gpargsequence gpargs) +{ + __va_alist list; + list.darg[0] = darg0; + list.darg[1] = darg1; + list.darg[2] = darg2; + list.darg[3] = darg3; + list.darg[4] = darg4; + list.darg[5] = darg5; + list.darg[6] = darg6; + list.darg[7] = darg7; + list.farg[0] = farg0; + list.farg[1] = farg1; + list.farg[2] = farg2; + list.farg[3] = farg3; + list.farg[4] = farg4; + list.farg[5] = farg5; + list.farg[6] = farg6; + list.farg[7] = farg7; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&gpargs; + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.anum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong) { + iret = list.tmp._longlong; + } else + if (list.rtype == __VAulonglong) { + iret = list.tmp._ulonglong; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + if (list.flags & __VA_GCC_STRUCT_RETURN) { + /* gcc returns structs of size 1,2,4,8 in registers. */ + if (list.rsize == sizeof(char)) { + iret = *(unsigned char *) list.raddr; + } else + if (list.rsize == sizeof(short)) { + iret = *(unsigned short *) list.raddr; + } else + if (list.rsize == sizeof(int)) { + iret = *(unsigned int *) list.raddr; + } else + if (list.rsize == sizeof(long long)) { + iret = *(unsigned long long *) list.raddr; + } + } else { + /* cc returns structs of size <= 16 in registers. */ + /* Maybe this big if cascade could be replaced with + * if (list.rsize > 0 && list.rsize <= 16) + * __asm__ ("ldl $2,%0 ; ldr $2,%1" + * : : "m" (((unsigned char *) list.raddr)[0]), + * "m" (((unsigned char *) list.raddr)[7])); + */ + if (list.rsize > 0 && list.rsize <= 16) { + #if 0 /* Unoptimized */ + if (list.rsize == 1) { + #if defined(_MIPSEL) + iret = (__varword)((unsigned char *) list.raddr)[0]; + #else + iret = (__varword)((unsigned char *) list.raddr)[0] << 56; + #endif + } else + if (list.rsize == 2) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48); + #endif + } else + if (list.rsize == 3) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40); + #endif + } else + if (list.rsize == 4) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32); + #endif + } else + if (list.rsize == 5) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24); + #endif + } else + if (list.rsize == 6) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32) + | ((__varword)((unsigned char *) list.raddr)[5] << 40); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16); + #endif + } else + if (list.rsize == 7) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32) + | ((__varword)((unsigned char *) list.raddr)[5] << 40) + | ((__varword)((unsigned char *) list.raddr)[6] << 48); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16) + | ((__varword)((unsigned char *) list.raddr)[6] << 8); + #endif + } else + if (list.rsize >= 8 && list.rsize <= 16) { + #if defined(_MIPSEL) + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32) + | ((__varword)((unsigned char *) list.raddr)[5] << 40) + | ((__varword)((unsigned char *) list.raddr)[6] << 48) + | ((__varword)((unsigned char *) list.raddr)[7] << 56); + #else + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16) + | ((__varword)((unsigned char *) list.raddr)[6] << 8) + | (__varword)((unsigned char *) list.raddr)[7]; + #endif + /* Maybe this big if cascade could be replaced with + * if (list.rsize > 8 && list.rsize <= 16) + * __asm__ ("ldl $3,%0 ; ldr $3,%1" + * : : "m" (((unsigned char *) list.raddr)[8]), + * "m" (((unsigned char *) list.raddr)[15])); + */ + if (list.rsize == 8) { + } else + if (list.rsize == 9) { + #if defined(_MIPSEL) + iret2 = (__varword)((unsigned char *) list.raddr)[8]; + #else + iret2 = (__varword)((unsigned char *) list.raddr)[8] << 56; + #endif + } else + if (list.rsize == 10) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48); + #endif + } else + if (list.rsize == 11) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40); + #endif + } else + if (list.rsize == 12) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32); + #endif + } else + if (list.rsize == 13) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24); + #endif + } else + if (list.rsize == 14) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32) + | ((__varword)((unsigned char *) list.raddr)[13] << 40); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16); + #endif + } else + if (list.rsize == 15) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32) + | ((__varword)((unsigned char *) list.raddr)[13] << 40) + | ((__varword)((unsigned char *) list.raddr)[14] << 48); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16) + | ((__varword)((unsigned char *) list.raddr)[14] << 8); + #endif + } else + if (list.rsize == 16) { + #if defined(_MIPSEL) + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32) + | ((__varword)((unsigned char *) list.raddr)[13] << 40) + | ((__varword)((unsigned char *) list.raddr)[14] << 48) + | ((__varword)((unsigned char *) list.raddr)[15] << 56); + #else + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16) + | ((__varword)((unsigned char *) list.raddr)[14] << 8) + | (__varword)((unsigned char *) list.raddr)[15]; + #endif + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 2*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__varword) */ + #if defined(_MIPSEL) + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = ((__varword)2 << (end_offset*8-1)) - 1; + iret = (wordaddr[0] & mask0) >> (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) >> (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = ((__varword)2 << (end_offset*8-2*sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] >> (start_offset*8)) | ((wordaddr[2] & mask2) << (sizeof(__varword)*8-start_offset*8)); + } + } + #else + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = - ((__varword)1 << (sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] & mask0) << (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = - ((__varword)1 << (2*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | ((wordaddr[1] & mask1) >> (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = - ((__varword)1 << (2*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | ((wordaddr[1] & mask1) >> (sizeof(__varword)*4-start_offset*4) >> (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) << (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = - ((__varword)1 << (3*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | (wordaddr[1] >> (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] << (start_offset*8)) | ((wordaddr[2] & mask2) >> (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + #endif + } + if (list.flags & __VA_REGISTER_FLOATSTRUCT_RETURN) { + if (list.rsize == sizeof(float)) { + fret = *(float*)list.raddr; + } else + if (list.rsize == 2*sizeof(float)) { + fret = *(float*)list.raddr; + fret2 = *(float*)((char*)list.raddr + 4); + } + } + if (list.flags & __VA_REGISTER_DOUBLESTRUCT_RETURN) { + if (list.rsize == sizeof(double)) { + dret = *(double*)list.raddr; + } else + if (list.rsize == 2*sizeof(double)) { + dret = *(double*)list.raddr; + dret2 = *(double*)((char*)list.raddr + 8); + } + } + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-mipsn32eb-linux.s b/vacall/vacall-mipsn32eb-linux.s new file mode 100644 index 0000000..9feb329 --- /dev/null +++ b/vacall/vacall-mipsn32eb-linux.s @@ -0,0 +1,357 @@ + .file 1 "vacall-mipsn32.c" + .section .mdebug.abiN32 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + .frame $fp,256,$31 # vars= 144, regs= 6/0, args= 0, gp= 0 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + addiu $sp,$sp,-256 + sd $28,168($sp) + lui $28,%hi(__gnu_local_gp) + addiu $28,$28,%lo(__gnu_local_gp) + lw $12,%got_disp(vacall_function)($28) + sd $fp,176($sp) + move $fp,$sp + lw $25,0($12) + addiu $12,$fp,192 + sd $31,184($sp) + sd $18,160($sp) + sd $17,152($sp) + sd $16,144($sp) + sd $4,192($fp) + sd $5,200($fp) + sd $6,208($fp) + sd $7,216($fp) + sd $8,224($fp) + sd $9,232($fp) + sd $10,240($fp) + sd $11,248($fp) + sdc1 $f12,80($fp) + sdc1 $f13,88($fp) + sdc1 $f14,96($fp) + sdc1 $f15,104($fp) + sdc1 $f16,112($fp) + sdc1 $f17,120($fp) + sdc1 $f18,128($fp) + sdc1 $f19,136($fp) + swc1 $f12,44($fp) + swc1 $f13,48($fp) + swc1 $f14,52($fp) + swc1 $f15,56($fp) + swc1 $f16,60($fp) + swc1 $f17,64($fp) + swc1 $f18,68($fp) + swc1 $f19,72($fp) + move $4,$fp + sw $0,0($fp) + sw $12,24($fp) + sw $0,28($fp) + sw $0,32($fp) + jalr $25 + sw $0,40($fp) + + lw $12,32($fp) + beq $12,$0,.L1 + li $13,1 # 0x1 + + beq $12,$13,.L43 + li $13,2 # 0x2 + + beq $12,$13,.L43 + li $13,3 # 0x3 + + beq $12,$13,.L49 + li $13,4 # 0x4 + + beq $12,$13,.L50 + li $13,5 # 0x5 + + beq $12,$13,.L51 + li $13,6 # 0x6 + + beq $12,$13,.L46 + li $13,7 # 0x7 + + beq $12,$13,.L45 + li $13,8 # 0x8 + + beq $12,$13,.L46 + li $13,9 # 0x9 + + beq $12,$13,.L45 + li $13,10 # 0xa + + beq $12,$13,.L47 + li $13,11 # 0xb + + beq $12,$13,.L47 + li $13,12 # 0xc + + beq $12,$13,.L52 + li $13,13 # 0xd + + beq $12,$13,.L53 + li $13,14 # 0xe + + beq $12,$13,.L46 + li $13,15 # 0xf + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + lw $24,36($fp) + + lw $12,36($fp) + li $13,1 # 0x1 + beq $12,$13,.L54 + li $13,2 # 0x2 + + beq $12,$13,.L55 + li $13,4 # 0x4 + + beq $12,$13,.L56 + li $13,8 # 0x8 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,28($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L59: + ld $31,184($sp) + ld $fp,176($sp) + ld $28,168($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L43: + move $sp,$fp + ld $31,184($sp) + ld $28,168($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + lb $2,8($fp) + ld $fp,176($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L46: + b .L1 + lw $2,8($fp) + + .align 3 +.L49: + b .L1 + lbu $2,8($fp) + + .align 3 +.L50: + b .L1 + lh $2,8($fp) + + .align 3 +.L45: + b .L1 + lwu $2,8($fp) + + .align 3 +.L51: + b .L1 + lhu $2,8($fp) + + .align 3 +.L52: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L47: + b .L1 + ld $2,8($fp) + +.L53: + b .L1 + ldc1 $f0,8($fp) + +.L19: + addiu $13,$24,-1 + sltu $13,$13,16 + beql $13,$0,.L60 + andi $13,$12,0x800 + + lw $13,28($fp) + li $15,-8 # 0xfffffffffffffff8 + sltu $25,$24,9 + andi $14,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + addu $13,$24,$14 + + sltu $25,$13,9 + beq $25,$0,.L25 + subu $13,$0,$13 + + ld $25,0($15) + sll $13,$13,3 + li $15,-1 # 0xffffffffffffffff + dsll $13,$15,$13 + and $13,$13,$25 + sll $14,$14,3 + dsll $2,$13,$14 +.L23: + andi $13,$12,0x800 +.L60: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 # 0x4 + beq $24,$13,.L57 + li $13,8 # 0x8 + + beql $24,$13,.L58 + lw $13,28($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L59 + move $sp,$fp + + li $12,16 # 0x10 +.L61: + bnel $24,$12,.L59 + move $sp,$fp + + lw $12,28($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 # 0x8 + + bne $24,$12,.L61 + li $12,16 # 0x10 + + lw $13,28($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + subu $13,$0,$13 + + ld $17,8($15) + subu $16,$0,$14 + li $25,-1 # 0xffffffffffffffff + sll $13,$13,3 + dsll $13,$25,$13 + sll $25,$16,2 + ld $16,0($15) + and $13,$13,$17 + addiu $15,$25,32 + sll $14,$14,3 + dsra $25,$13,$15 + dsll $16,$16,$14 + dsra $15,$25,$15 + or $2,$16,$15 + b .L23 + dsll $3,$13,$14 + +.L54: + lw $12,28($fp) + b .L1 + lbu $2,0($12) + +.L55: + lw $12,28($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $18,16($15) + ld $16,8($15) + ld $17,0($15) + subu $25,$0,$14 + li $15,-1 # 0xffffffffffffffff + sll $13,$13,3 + sll $25,$25,3 + dsll $13,$15,$13 + sll $14,$14,3 + addiu $15,$25,64 + and $13,$13,$18 + dsll $25,$17,$14 + dsra $13,$13,$15 + dsra $17,$16,$15 + dsll $14,$16,$14 + or $2,$25,$17 + b .L23 + or $3,$13,$14 + +.L57: + lw $12,28($fp) + b .L1 + lwc1 $f0,0($12) + +.L56: + lw $12,28($fp) + b .L1 + lwu $2,0($12) + +.L25: + ld $16,8($15) + ld $25,0($15) + sll $13,$13,3 + li $15,-1 # 0xffffffffffffffff + dsll $13,$15,$13 + subu $15,$0,$14 + and $13,$13,$16 + sll $15,$15,3 + sll $14,$14,3 + dsra $13,$13,$15 + dsll $14,$25,$14 + b .L23 + or $2,$13,$14 + +.L58: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/vacall/vacall-mipsn32eb-macro.S b/vacall/vacall-mipsn32eb-macro.S new file mode 100644 index 0000000..f19511d --- /dev/null +++ b/vacall/vacall-mipsn32eb-macro.S @@ -0,0 +1,351 @@ +#include "asm-mips.h" + .file 1 "vacall-mipsn32.c" + .text + .align 2 + .align 3 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + DECLARE_FUNCTION(vacall_receiver) +vacall_receiver: + .frame $fp,256,$31 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + addiu $sp,$sp,-256 + sd $28,168($sp) + lui $28,%hi(__gnu_local_gp) + addiu $28,$28,%lo(__gnu_local_gp) + lw $12,%got_disp(vacall_function)($28) + sd $fp,176($sp) + move $fp,$sp + lw $25,0($12) + addiu $12,$fp,192 + sd $31,184($sp) + sd $18,160($sp) + sd $17,152($sp) + sd $16,144($sp) + sd $4,192($fp) + sd $5,200($fp) + sd $6,208($fp) + sd $7,216($fp) + sd $8,224($fp) + sd $9,232($fp) + sd $10,240($fp) + sd $11,248($fp) + sdc1 $f12,80($fp) + sdc1 $f13,88($fp) + sdc1 $f14,96($fp) + sdc1 $f15,104($fp) + sdc1 $f16,112($fp) + sdc1 $f17,120($fp) + sdc1 $f18,128($fp) + sdc1 $f19,136($fp) + swc1 $f12,44($fp) + swc1 $f13,48($fp) + swc1 $f14,52($fp) + swc1 $f15,56($fp) + swc1 $f16,60($fp) + swc1 $f17,64($fp) + swc1 $f18,68($fp) + swc1 $f19,72($fp) + move $4,$fp + sw $0,0($fp) + sw $12,24($fp) + sw $0,28($fp) + sw $0,32($fp) + jalr $25 + sw $0,40($fp) + + lw $12,32($fp) + beq $12,$0,.L1 + li $13,1 + + beq $12,$13,.L43 + li $13,2 + + beq $12,$13,.L43 + li $13,3 + + beq $12,$13,.L49 + li $13,4 + + beq $12,$13,.L50 + li $13,5 + + beq $12,$13,.L51 + li $13,6 + + beq $12,$13,.L46 + li $13,7 + + beq $12,$13,.L45 + li $13,8 + + beq $12,$13,.L46 + li $13,9 + + beq $12,$13,.L45 + li $13,10 + + beq $12,$13,.L47 + li $13,11 + + beq $12,$13,.L47 + li $13,12 + + beq $12,$13,.L52 + li $13,13 + + beq $12,$13,.L53 + li $13,14 + + beq $12,$13,.L46 + li $13,15 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + lw $24,36($fp) + + lw $12,36($fp) + li $13,1 + beq $12,$13,.L54 + li $13,2 + + beq $12,$13,.L55 + li $13,4 + + beq $12,$13,.L56 + li $13,8 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,28($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L59: + ld $31,184($sp) + ld $fp,176($sp) + ld $28,168($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L43: + move $sp,$fp + ld $31,184($sp) + ld $28,168($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + lb $2,8($fp) + ld $fp,176($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L46: + b .L1 + lw $2,8($fp) + + .align 3 +.L49: + b .L1 + lbu $2,8($fp) + + .align 3 +.L50: + b .L1 + lh $2,8($fp) + + .align 3 +.L45: + b .L1 + lwu $2,8($fp) + + .align 3 +.L51: + b .L1 + lhu $2,8($fp) + + .align 3 +.L52: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L47: + b .L1 + ld $2,8($fp) + +.L53: + b .L1 + ldc1 $f0,8($fp) + +.L19: + addiu $13,$24,-1 + sltu $13,$13,16 + beql $13,$0,.L60 + andi $13,$12,0x800 + + lw $13,28($fp) + li $15,-8 + sltu $25,$24,9 + andi $14,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + addu $13,$24,$14 + + sltu $25,$13,9 + beq $25,$0,.L25 + subu $13,$0,$13 + + ld $25,0($15) + sll $13,$13,3 + li $15,-1 + dsll $13,$15,$13 + and $13,$13,$25 + sll $14,$14,3 + dsll $2,$13,$14 +.L23: + andi $13,$12,0x800 +.L60: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 + beq $24,$13,.L57 + li $13,8 + + beql $24,$13,.L58 + lw $13,28($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L59 + move $sp,$fp + + li $12,16 +.L61: + bnel $24,$12,.L59 + move $sp,$fp + + lw $12,28($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 + + bne $24,$12,.L61 + li $12,16 + + lw $13,28($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + subu $13,$0,$13 + + ld $17,8($15) + subu $16,$0,$14 + li $25,-1 + sll $13,$13,3 + dsll $13,$25,$13 + sll $25,$16,2 + ld $16,0($15) + and $13,$13,$17 + addiu $15,$25,32 + sll $14,$14,3 + dsra $25,$13,$15 + dsll $16,$16,$14 + dsra $15,$25,$15 + or $2,$16,$15 + b .L23 + dsll $3,$13,$14 + +.L54: + lw $12,28($fp) + b .L1 + lbu $2,0($12) + +.L55: + lw $12,28($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $18,16($15) + ld $16,8($15) + ld $17,0($15) + subu $25,$0,$14 + li $15,-1 + sll $13,$13,3 + sll $25,$25,3 + dsll $13,$15,$13 + sll $14,$14,3 + addiu $15,$25,64 + and $13,$13,$18 + dsll $25,$17,$14 + dsra $13,$13,$15 + dsra $17,$16,$15 + dsll $14,$16,$14 + or $2,$25,$17 + b .L23 + or $3,$13,$14 + +.L57: + lw $12,28($fp) + b .L1 + lwc1 $f0,0($12) + +.L56: + lw $12,28($fp) + b .L1 + lwu $2,0($12) + +.L25: + ld $16,8($15) + ld $25,0($15) + sll $13,$13,3 + li $15,-1 + dsll $13,$15,$13 + subu $15,$0,$14 + and $13,$13,$16 + sll $15,$15,3 + sll $14,$14,3 + dsra $13,$13,$15 + dsll $14,$25,$14 + b .L23 + or $2,$13,$14 + +.L58: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver diff --git a/vacall/vacall-mipsn32el-linux.s b/vacall/vacall-mipsn32el-linux.s new file mode 100644 index 0000000..54a7cdc --- /dev/null +++ b/vacall/vacall-mipsn32el-linux.s @@ -0,0 +1,361 @@ + .file 1 "vacall-mipsn32.c" + .section .mdebug.abiN32 + .previous + .nan legacy + .module fp=64 + .module oddspreg + .abicalls + .text + .align 2 + .align 3 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + .frame $fp,256,$31 # vars= 144, regs= 6/0, args= 0, gp= 0 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + addiu $sp,$sp,-256 + sd $28,168($sp) + lui $28,%hi(__gnu_local_gp) + addiu $28,$28,%lo(__gnu_local_gp) + lw $12,%got_disp(vacall_function)($28) + sd $fp,176($sp) + move $fp,$sp + lw $25,0($12) + addiu $12,$fp,192 + sd $31,184($sp) + sd $18,160($sp) + sd $17,152($sp) + sd $16,144($sp) + sd $4,192($fp) + sd $5,200($fp) + sd $6,208($fp) + sd $7,216($fp) + sd $8,224($fp) + sd $9,232($fp) + sd $10,240($fp) + sd $11,248($fp) + sdc1 $f12,80($fp) + sdc1 $f13,88($fp) + sdc1 $f14,96($fp) + sdc1 $f15,104($fp) + sdc1 $f16,112($fp) + sdc1 $f17,120($fp) + sdc1 $f18,128($fp) + sdc1 $f19,136($fp) + swc1 $f12,44($fp) + swc1 $f13,48($fp) + swc1 $f14,52($fp) + swc1 $f15,56($fp) + swc1 $f16,60($fp) + swc1 $f17,64($fp) + swc1 $f18,68($fp) + swc1 $f19,72($fp) + move $4,$fp + sw $0,0($fp) + sw $12,24($fp) + sw $0,28($fp) + sw $0,32($fp) + jalr $25 + sw $0,40($fp) + + lw $12,32($fp) + beq $12,$0,.L1 + li $13,1 # 0x1 + + beq $12,$13,.L43 + li $13,2 # 0x2 + + beq $12,$13,.L43 + li $13,3 # 0x3 + + beq $12,$13,.L49 + li $13,4 # 0x4 + + beq $12,$13,.L50 + li $13,5 # 0x5 + + beq $12,$13,.L51 + li $13,6 # 0x6 + + beq $12,$13,.L46 + li $13,7 # 0x7 + + beq $12,$13,.L45 + li $13,8 # 0x8 + + beq $12,$13,.L46 + li $13,9 # 0x9 + + beq $12,$13,.L45 + li $13,10 # 0xa + + beq $12,$13,.L47 + li $13,11 # 0xb + + beq $12,$13,.L47 + li $13,12 # 0xc + + beq $12,$13,.L52 + li $13,13 # 0xd + + beq $12,$13,.L53 + li $13,14 # 0xe + + beq $12,$13,.L46 + li $13,15 # 0xf + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + lw $24,36($fp) + + lw $12,36($fp) + li $13,1 # 0x1 + beq $12,$13,.L54 + li $13,2 # 0x2 + + beq $12,$13,.L55 + li $13,4 # 0x4 + + beq $12,$13,.L56 + li $13,8 # 0x8 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,28($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L59: + ld $31,184($sp) + ld $fp,176($sp) + ld $28,168($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L43: + move $sp,$fp + ld $31,184($sp) + ld $28,168($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + lb $2,8($fp) + ld $fp,176($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L46: + b .L1 + lw $2,8($fp) + + .align 3 +.L49: + b .L1 + lbu $2,8($fp) + + .align 3 +.L50: + b .L1 + lh $2,8($fp) + + .align 3 +.L45: + b .L1 + lwu $2,8($fp) + + .align 3 +.L51: + b .L1 + lhu $2,8($fp) + + .align 3 +.L52: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L47: + b .L1 + ld $2,8($fp) + +.L53: + b .L1 + ldc1 $f0,8($fp) + +.L19: + addiu $13,$24,-1 + sltu $13,$13,16 + beql $13,$0,.L60 + andi $13,$12,0x800 + + lw $13,28($fp) + li $15,-8 # 0xfffffffffffffff8 + sltu $25,$24,9 + andi $14,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + addu $13,$24,$14 + + sltu $25,$13,9 + beq $25,$0,.L25 + sll $13,$13,3 + + ld $25,0($15) + addiu $13,$13,-1 + li $15,2 # 0x2 + dsll $13,$15,$13 + daddiu $13,$13,-1 + and $13,$13,$25 + sll $14,$14,3 + dsra $2,$13,$14 +.L23: + andi $13,$12,0x800 +.L60: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 # 0x4 + beq $24,$13,.L57 + li $13,8 # 0x8 + + beql $24,$13,.L58 + lw $13,28($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L59 + move $sp,$fp + + li $12,16 # 0x10 +.L61: + bnel $24,$12,.L59 + move $sp,$fp + + lw $12,28($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 # 0x8 + + bne $24,$12,.L61 + li $12,16 # 0x10 + + lw $13,28($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + sll $13,$13,3 + + ld $17,8($15) + li $25,2 # 0x2 + addiu $13,$13,-65 + dsll $13,$25,$13 + subu $25,$0,$14 + sll $25,$25,2 + ld $16,0($15) + daddiu $13,$13,-1 + addiu $15,$25,32 + and $13,$13,$17 + sll $14,$14,3 + dsll $25,$13,$15 + dsra $16,$16,$14 + dsll $15,$25,$15 + or $2,$16,$15 + b .L23 + dsra $3,$13,$14 + +.L54: + lw $12,28($fp) + b .L1 + lbu $2,0($12) + +.L55: + lw $12,28($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $16,8($15) + ld $17,0($15) + addiu $13,$13,-129 + ld $18,16($15) + li $15,2 # 0x2 + subu $25,$0,$14 + dsll $15,$15,$13 + daddiu $15,$15,-1 + sll $25,$25,3 + sll $14,$14,3 + addiu $25,$25,64 + and $13,$15,$18 + dsll $13,$13,$25 + dsra $15,$17,$14 + dsll $17,$16,$25 + dsra $14,$16,$14 + or $2,$15,$17 + b .L23 + or $3,$13,$14 + +.L57: + lw $12,28($fp) + b .L1 + lwc1 $f0,0($12) + +.L56: + lw $12,28($fp) + b .L1 + lwu $2,0($12) + +.L25: + li $25,2 # 0x2 + addiu $13,$13,-65 + ld $17,8($15) + dsll $13,$25,$13 + ld $25,0($15) + daddiu $13,$13,-1 + subu $16,$0,$14 + and $15,$13,$17 + sll $14,$14,3 + sll $13,$16,3 + dsll $13,$15,$13 + dsra $14,$25,$14 + b .L23 + or $2,$13,$14 + +.L58: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 5.4.0" diff --git a/vacall/vacall-mipsn32el-macro.S b/vacall/vacall-mipsn32el-macro.S new file mode 100644 index 0000000..0aa74c5 --- /dev/null +++ b/vacall/vacall-mipsn32el-macro.S @@ -0,0 +1,355 @@ +#include "asm-mips.h" + .file 1 "vacall-mipsn32.c" + .text + .align 2 + .align 3 + .globl vacall_receiver + .set nomips16 + .set nomicromips + .ent vacall_receiver + DECLARE_FUNCTION(vacall_receiver) +vacall_receiver: + .frame $fp,256,$31 + .mask 0xd0070000,-72 + .fmask 0x00000000,0 + .set noreorder + .set nomacro + addiu $sp,$sp,-256 + sd $28,168($sp) + lui $28,%hi(__gnu_local_gp) + addiu $28,$28,%lo(__gnu_local_gp) + lw $12,%got_disp(vacall_function)($28) + sd $fp,176($sp) + move $fp,$sp + lw $25,0($12) + addiu $12,$fp,192 + sd $31,184($sp) + sd $18,160($sp) + sd $17,152($sp) + sd $16,144($sp) + sd $4,192($fp) + sd $5,200($fp) + sd $6,208($fp) + sd $7,216($fp) + sd $8,224($fp) + sd $9,232($fp) + sd $10,240($fp) + sd $11,248($fp) + sdc1 $f12,80($fp) + sdc1 $f13,88($fp) + sdc1 $f14,96($fp) + sdc1 $f15,104($fp) + sdc1 $f16,112($fp) + sdc1 $f17,120($fp) + sdc1 $f18,128($fp) + sdc1 $f19,136($fp) + swc1 $f12,44($fp) + swc1 $f13,48($fp) + swc1 $f14,52($fp) + swc1 $f15,56($fp) + swc1 $f16,60($fp) + swc1 $f17,64($fp) + swc1 $f18,68($fp) + swc1 $f19,72($fp) + move $4,$fp + sw $0,0($fp) + sw $12,24($fp) + sw $0,28($fp) + sw $0,32($fp) + jalr $25 + sw $0,40($fp) + + lw $12,32($fp) + beq $12,$0,.L1 + li $13,1 + + beq $12,$13,.L43 + li $13,2 + + beq $12,$13,.L43 + li $13,3 + + beq $12,$13,.L49 + li $13,4 + + beq $12,$13,.L50 + li $13,5 + + beq $12,$13,.L51 + li $13,6 + + beq $12,$13,.L46 + li $13,7 + + beq $12,$13,.L45 + li $13,8 + + beq $12,$13,.L46 + li $13,9 + + beq $12,$13,.L45 + li $13,10 + + beq $12,$13,.L47 + li $13,11 + + beq $12,$13,.L47 + li $13,12 + + beq $12,$13,.L52 + li $13,13 + + beq $12,$13,.L53 + li $13,14 + + beq $12,$13,.L46 + li $13,15 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,0($fp) + andi $13,$12,0x400 + beq $13,$0,.L1 + andi $13,$12,0x4 + + beq $13,$0,.L19 + lw $24,36($fp) + + lw $12,36($fp) + li $13,1 + beq $12,$13,.L54 + li $13,2 + + beq $12,$13,.L55 + li $13,4 + + beq $12,$13,.L56 + li $13,8 + + bnel $12,$13,.L59 + move $sp,$fp + + lw $12,28($fp) + ld $2,0($12) +.L1: + move $sp,$fp +.L59: + ld $31,184($sp) + ld $fp,176($sp) + ld $28,168($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L43: + move $sp,$fp + ld $31,184($sp) + ld $28,168($sp) + ld $18,160($sp) + ld $17,152($sp) + ld $16,144($sp) + lb $2,8($fp) + ld $fp,176($sp) + j $31 + addiu $sp,$sp,256 + + .align 3 +.L46: + b .L1 + lw $2,8($fp) + + .align 3 +.L49: + b .L1 + lbu $2,8($fp) + + .align 3 +.L50: + b .L1 + lh $2,8($fp) + + .align 3 +.L45: + b .L1 + lwu $2,8($fp) + + .align 3 +.L51: + b .L1 + lhu $2,8($fp) + + .align 3 +.L52: + b .L1 + lwc1 $f0,8($fp) + + .align 3 +.L47: + b .L1 + ld $2,8($fp) + +.L53: + b .L1 + ldc1 $f0,8($fp) + +.L19: + addiu $13,$24,-1 + sltu $13,$13,16 + beql $13,$0,.L60 + andi $13,$12,0x800 + + lw $13,28($fp) + li $15,-8 + sltu $25,$24,9 + andi $14,$13,0x7 + and $15,$13,$15 + beq $25,$0,.L24 + addu $13,$24,$14 + + sltu $25,$13,9 + beq $25,$0,.L25 + sll $13,$13,3 + + ld $25,0($15) + addiu $13,$13,-1 + li $15,2 + dsll $13,$15,$13 + daddiu $13,$13,-1 + and $13,$13,$25 + sll $14,$14,3 + dsra $2,$13,$14 +.L23: + andi $13,$12,0x800 +.L60: + beql $13,$0,.L27 + andi $12,$12,0x1000 + + li $13,4 + beq $24,$13,.L57 + li $13,8 + + beql $24,$13,.L58 + lw $13,28($fp) + + andi $12,$12,0x1000 + beql $12,$0,.L59 + move $sp,$fp + + li $12,16 +.L61: + bnel $24,$12,.L59 + move $sp,$fp + + lw $12,28($fp) + ldc1 $f0,0($12) + b .L1 + ldc1 $f2,8($12) + +.L27: + beq $12,$0,.L1 + li $12,8 + + bne $24,$12,.L61 + li $12,16 + + lw $13,28($fp) + b .L1 + ldc1 $f0,0($13) + +.L24: + sltu $25,$13,17 + beq $25,$0,.L26 + sll $13,$13,3 + + ld $17,8($15) + li $25,2 + addiu $13,$13,-65 + dsll $13,$25,$13 + subu $25,$0,$14 + sll $25,$25,2 + ld $16,0($15) + daddiu $13,$13,-1 + addiu $15,$25,32 + and $13,$13,$17 + sll $14,$14,3 + dsll $25,$13,$15 + dsra $16,$16,$14 + dsll $15,$25,$15 + or $2,$16,$15 + b .L23 + dsra $3,$13,$14 + +.L54: + lw $12,28($fp) + b .L1 + lbu $2,0($12) + +.L55: + lw $12,28($fp) + b .L1 + lhu $2,0($12) + +.L26: + ld $16,8($15) + ld $17,0($15) + addiu $13,$13,-129 + ld $18,16($15) + li $15,2 + subu $25,$0,$14 + dsll $15,$15,$13 + daddiu $15,$15,-1 + sll $25,$25,3 + sll $14,$14,3 + addiu $25,$25,64 + and $13,$15,$18 + dsll $13,$13,$25 + dsra $15,$17,$14 + dsll $17,$16,$25 + dsra $14,$16,$14 + or $2,$15,$17 + b .L23 + or $3,$13,$14 + +.L57: + lw $12,28($fp) + b .L1 + lwc1 $f0,0($12) + +.L56: + lw $12,28($fp) + b .L1 + lwu $2,0($12) + +.L25: + li $25,2 + addiu $13,$13,-65 + ld $17,8($15) + dsll $13,$25,$13 + ld $25,0($15) + daddiu $13,$13,-1 + subu $16,$0,$14 + and $15,$13,$17 + sll $14,$14,3 + sll $13,$16,3 + dsll $13,$15,$13 + dsra $14,$25,$14 + b .L23 + or $2,$13,$14 + +.L58: + andi $12,$12,0x1000 + lwc1 $f0,0($13) + beq $12,$0,.L1 + lwc1 $f2,4($13) + + b .L1 + ldc1 $f0,0($13) + + .set macro + .set reorder + .end vacall_receiver + .size vacall_receiver, .-vacall_receiver diff --git a/vacall/vacall-powerpc-aix.s b/vacall/vacall-powerpc-aix.s new file mode 100644 index 0000000..b4e3505 --- /dev/null +++ b/vacall/vacall-powerpc-aix.s @@ -0,0 +1,171 @@ + .file "vacall-powerpc.c" + .toc + .csect .text[PR] + .toc +LC..0: + .tc vacall_function[TC],vacall_function[RW] + .csect .text[PR] + .align 2 + .globl vacall_receiver + .globl .vacall_receiver + .csect vacall_receiver[DS] +vacall_receiver: + .long .vacall_receiver, TOC[tc0], 0 + .csect .text[PR] +.vacall_receiver: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + mflr 0 + stw 0,8(1) + stw 29,-12(1) + stw 31,-4(1) + lwz 11,LC..0(2) + stwu 1,-216(1) + mr 31,1 + lwz 29,0(11) + addi 0,31,240 + li 11,0 + stw 9,264(31) + stw 3,240(31) + stw 5,248(31) + stw 6,252(31) + stw 7,256(31) + stw 8,260(31) + stw 10,268(31) + stw 11,88(31) + stw 4,244(31) + stfd 1,92(31) + stfd 2,100(31) + stfd 3,108(31) + stfd 4,116(31) + stfd 5,124(31) + stfd 6,132(31) + stfd 7,140(31) + stfd 8,148(31) + stfd 9,156(31) + stfd 10,164(31) + stfd 11,172(31) + stfd 12,180(31) + stfd 13,188(31) + stw 11,56(31) + stw 11,76(31) + stw 11,80(31) + stw 0,72(31) + lwz 0,0(29) + addi 3,31,56 + stw 2,20(1) + mtctr 0 + lwz 11,8(29) + lwz 2,4(29) + bctrl + lwz 2,20(1) + lwz 9,80(31) + cmpwi 0,9,0 + beq- 0,L..1 + cmpwi 0,9,1 + beq- 0,L..41 + cmpwi 0,9,2 + beq- 0,L..42 + cmpwi 0,9,3 + beq- 0,L..41 + cmpwi 0,9,4 + beq- 0,L..43 + cmpwi 0,9,5 + beq- 0,L..44 + cmpwi 0,9,6 + beq- 0,L..40 + cmpwi 0,9,7 + beq- 0,L..40 + cmpwi 0,9,8 + beq- 0,L..40 + cmpwi 0,9,9 + beq- 0,L..40 + addi 0,9,-10 + cmplwi 0,0,1 + bgt- 0,L..22 + lwz 3,64(31) + lwz 4,68(31) +L..1: + lwz 1,0(1) + lwz 0,8(1) + lwz 29,-12(1) + mtlr 0 + lwz 31,-4(1) + blr +L..22: + cmpwi 0,9,12 + beq- 0,L..45 + cmpwi 0,9,13 + beq- 0,L..46 + cmpwi 0,9,14 + beq- 0,L..40 + cmpwi 0,9,15 + bne+ 0,L..1 + lwz 0,56(31) + andi. 9,0,1024 + beq- 0,L..1 + lwz 0,84(31) + cmpwi 0,0,1 + beq- 0,L..47 + cmpwi 0,0,2 + beq- 0,L..48 + cmpwi 0,0,4 + beq- 0,L..49 + cmpwi 0,0,8 + bne+ 0,L..1 + lwz 9,76(31) + lwz 4,4(9) +L..39: + lwz 3,0(9) + b L..1 +L..49: + lwz 9,76(31) + b L..39 +L..48: + lwz 9,76(31) + lhz 3,0(9) + b L..1 +L..47: + lwz 9,76(31) + lbz 3,0(9) + b L..1 +L..40: + lwz 3,64(31) + b L..1 +L..46: + lfd 1,64(31) + b L..1 +L..45: + lfs 1,64(31) + b L..1 +L..44: + lhz 3,64(31) + b L..1 +L..43: + lha 3,64(31) + b L..1 +L..41: + lbz 3,64(31) + b L..1 +L..42: + lbz 0,64(31) + slwi 0,0,24 + srawi 3,0,24 + b L..1 +LT..vacall_receiver: + .long 0 + .byte 0,0,32,97,128,3,8,0 + .long 0 + .long LT..vacall_receiver-.vacall_receiver + .short 15 + .byte "vacall_receiver" + .byte 31 + .align 2 +_section_.text: + .csect .data[RW],3 + .long _section_.text + .extern vacall_function[RW] diff --git a/vacall/vacall-powerpc-linux-macro.S b/vacall/vacall-powerpc-linux-macro.S new file mode 100644 index 0000000..3d56e0f --- /dev/null +++ b/vacall/vacall-powerpc-linux-macro.S @@ -0,0 +1,143 @@ + .file "vacall-powerpc.c" + .section ".text" + .align 2 + .globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-176(1) + mflr 0 + li 11,0 + stw 0,180(1) + stw 31,172(1) + mr 31,1 + stw 9,76(31) + addi 0,31,184 + lis 9,vacall_function@ha + stw 3,52(31) + lwz 9,vacall_function@l(9) + addi 3,31,16 + stw 5,60(31) + mtctr 9 + stw 6,64(31) + stw 7,68(31) + stw 8,72(31) + stw 10,80(31) + stw 0,32(31) + stw 11,84(31) + stw 4,56(31) + stfd 1,88(31) + stfd 2,96(31) + stfd 3,104(31) + stfd 4,112(31) + stfd 5,120(31) + stfd 6,128(31) + stfd 7,136(31) + stfd 8,144(31) + stw 11,16(31) + stw 11,48(31) + stw 11,36(31) + stw 11,40(31) + bctrl + lwz 9,40(31) + cmpwi 0,9,0 + beq- 0,.L1 + cmpwi 0,9,1 + beq- 0,.L41 + cmpwi 0,9,2 + beq- 0,.L42 + cmpwi 0,9,3 + beq- 0,.L41 + cmpwi 0,9,4 + beq- 0,.L43 + cmpwi 0,9,5 + beq- 0,.L44 + cmpwi 0,9,6 + beq- 0,.L40 + cmpwi 0,9,7 + beq- 0,.L40 + cmpwi 0,9,8 + beq- 0,.L40 + cmpwi 0,9,9 + beq- 0,.L40 + addi 0,9,-10 + cmplwi 0,0,1 + bgt- 0,.L22 + lwz 3,24(31) + lwz 4,28(31) +.L1: + lwz 11,0(1) + lwz 0,4(11) + lwz 31,-4(11) + mtlr 0 + mr 1,11 + blr +.L22: + cmpwi 0,9,12 + beq- 0,.L45 + cmpwi 0,9,13 + beq- 0,.L46 + cmpwi 0,9,14 + beq- 0,.L40 + cmpwi 0,9,15 + bne+ 0,.L1 + lwz 0,16(31) + andi. 9,0,1024 + beq- 0,.L1 + lwz 0,44(31) + cmpwi 0,0,1 + beq- 0,.L47 + cmpwi 0,0,2 + beq- 0,.L48 + cmpwi 0,0,4 + beq- 0,.L49 + cmpwi 0,0,8 + bne+ 0,.L1 + lwz 9,36(31) + lwz 4,4(9) +.L39: + lwz 3,0(9) + b .L1 +.L49: + lwz 9,36(31) + b .L39 +.L48: + lwz 9,36(31) + lhz 3,0(9) + b .L1 +.L47: + lwz 9,36(31) + lbz 3,0(9) + b .L1 +.L40: + lwz 3,24(31) + b .L1 +.L46: + lfd 1,24(31) + b .L1 +.L45: + lfs 1,24(31) + b .L1 +.L44: + lhz 3,24(31) + b .L1 +.L43: + lha 3,24(31) + b .L1 +.L41: + lbz 3,24(31) + b .L1 +.L42: + lbz 0,24(31) + slwi 0,0,24 + srawi 3,0,24 + b .L1 + .size vacall_receiver, .-vacall_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-powerpc-linux.s b/vacall/vacall-powerpc-linux.s new file mode 100644 index 0000000..b40c8aa --- /dev/null +++ b/vacall/vacall-powerpc-linux.s @@ -0,0 +1,142 @@ + .file "vacall-powerpc.c" + .section ".text" + .align 2 + .globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-176(1) + mflr 0 + li 11,0 + stw 0,180(1) + stw 31,172(1) + mr 31,1 + stw 9,76(31) + addi 0,31,184 + lis 9,vacall_function@ha + stw 3,52(31) + lwz 9,vacall_function@l(9) + addi 3,31,16 + stw 5,60(31) + mtctr 9 + stw 6,64(31) + stw 7,68(31) + stw 8,72(31) + stw 10,80(31) + stw 0,32(31) + stw 11,84(31) + stw 4,56(31) + stfd 1,88(31) + stfd 2,96(31) + stfd 3,104(31) + stfd 4,112(31) + stfd 5,120(31) + stfd 6,128(31) + stfd 7,136(31) + stfd 8,144(31) + stw 11,16(31) + stw 11,48(31) + stw 11,36(31) + stw 11,40(31) + bctrl + lwz 9,40(31) + cmpwi 0,9,0 + beq- 0,.L1 + cmpwi 0,9,1 + beq- 0,.L41 + cmpwi 0,9,2 + beq- 0,.L42 + cmpwi 0,9,3 + beq- 0,.L41 + cmpwi 0,9,4 + beq- 0,.L43 + cmpwi 0,9,5 + beq- 0,.L44 + cmpwi 0,9,6 + beq- 0,.L40 + cmpwi 0,9,7 + beq- 0,.L40 + cmpwi 0,9,8 + beq- 0,.L40 + cmpwi 0,9,9 + beq- 0,.L40 + addi 0,9,-10 + cmplwi 0,0,1 + bgt- 0,.L22 + lwz 3,24(31) + lwz 4,28(31) +.L1: + lwz 11,0(1) + lwz 0,4(11) + lwz 31,-4(11) + mtlr 0 + mr 1,11 + blr +.L22: + cmpwi 0,9,12 + beq- 0,.L45 + cmpwi 0,9,13 + beq- 0,.L46 + cmpwi 0,9,14 + beq- 0,.L40 + cmpwi 0,9,15 + bne+ 0,.L1 + lwz 0,16(31) + andi. 9,0,1024 + beq- 0,.L1 + lwz 0,44(31) + cmpwi 0,0,1 + beq- 0,.L47 + cmpwi 0,0,2 + beq- 0,.L48 + cmpwi 0,0,4 + beq- 0,.L49 + cmpwi 0,0,8 + bne+ 0,.L1 + lwz 9,36(31) + lwz 4,4(9) +.L39: + lwz 3,0(9) + b .L1 +.L49: + lwz 9,36(31) + b .L39 +.L48: + lwz 9,36(31) + lhz 3,0(9) + b .L1 +.L47: + lwz 9,36(31) + lbz 3,0(9) + b .L1 +.L40: + lwz 3,24(31) + b .L1 +.L46: + lfd 1,24(31) + b .L1 +.L45: + lfs 1,24(31) + b .L1 +.L44: + lhz 3,24(31) + b .L1 +.L43: + lha 3,24(31) + b .L1 +.L41: + lbz 3,24(31) + b .L1 +.L42: + lbz 0,24(31) + slwi 0,0,24 + srawi 3,0,24 + b .L1 + .size vacall_receiver, .-vacall_receiver + .section .note.GNU-stack,"",@progbits + .ident "GCC: (GNU) 3.3.6" diff --git a/vacall/vacall-powerpc-macos.s b/vacall/vacall-powerpc-macos.s new file mode 100644 index 0000000..a508e75 --- /dev/null +++ b/vacall/vacall-powerpc-macos.s @@ -0,0 +1,142 @@ +.text + .align 2 + .globl _vacall_receiver +_vacall_receiver: + mflr r0 + stmw r29,-12(r1) + bcl 20,31,L1$pb +L1$pb: + stw r0,8(r1) + mflr r31 + stwu r1,-224(r1) + addis r29,r31,ha16(L_vacall_function$non_lazy_ptr-L1$pb) + li r11,0 + lwz r29,lo16(L_vacall_function$non_lazy_ptr-L1$pb)(r29) + mr r30,r1 + addi r0,r30,248 + stw r3,248(r30) + lwz r29,0(r29) + addi r3,r30,64 + stw r9,272(r30) + stw r5,256(r30) + mtctr r29 + stw r6,260(r30) + stw r7,264(r30) + stw r8,268(r30) + stw r10,276(r30) + stw r0,80(r30) + stw r11,96(r30) + stw r4,252(r30) + stfd f1,100(r30) + stfd f2,108(r30) + stfd f3,116(r30) + stfd f4,124(r30) + stfd f5,132(r30) + stfd f6,140(r30) + stfd f7,148(r30) + stfd f8,156(r30) + stfd f9,164(r30) + stfd f10,172(r30) + stfd f11,180(r30) + stfd f12,188(r30) + stfd f13,196(r30) + stw r11,64(r30) + stw r11,84(r30) + stw r11,88(r30) + bctrl + lwz r9,88(r30) + cmpwi cr0,r9,0 + beq- cr0,L1 + cmpwi cr0,r9,1 + beq- cr0,L41 + cmpwi cr0,r9,2 + beq- cr0,L41 + cmpwi cr0,r9,3 + beq- cr0,L42 + cmpwi cr0,r9,4 + beq- cr0,L43 + cmpwi cr0,r9,5 + beq- cr0,L44 + cmpwi cr0,r9,6 + beq- cr0,L40 + cmpwi cr0,r9,7 + beq- cr0,L40 + cmpwi cr0,r9,8 + beq- cr0,L40 + cmpwi cr0,r9,9 + beq- cr0,L40 + addi r0,r9,-10 + cmplwi cr0,r0,1 + bgt- cr0,L22 + lwz r3,72(r30) + lwz r4,76(r30) +L1: + lwz r1,0(r1) + lwz r0,8(r1) + lmw r29,-12(r1) + mtlr r0 + blr +L22: + cmpwi cr0,r9,12 + beq- cr0,L45 + cmpwi cr0,r9,13 + beq- cr0,L46 + cmpwi cr0,r9,14 + beq- cr0,L40 + cmpwi cr0,r9,15 + bne+ cr0,L1 + lwz r0,64(r30) + andi. r9,r0,1024 + beq- cr0,L1 + lwz r0,92(r30) + cmpwi cr0,r0,1 + beq- cr0,L47 + cmpwi cr0,r0,2 + beq- cr0,L48 + cmpwi cr0,r0,4 + beq- cr0,L49 + cmpwi cr0,r0,8 + bne+ cr0,L1 + lwz r9,84(r30) + lwz r4,4(r9) +L39: + lwz r3,0(r9) + b L1 +L49: + lwz r9,84(r30) + b L39 +L48: + lwz r9,84(r30) + lhz r3,0(r9) + b L1 +L47: + lwz r9,84(r30) + lbz r3,0(r9) + b L1 +L40: + lwz r3,72(r30) + b L1 +L46: + lfd f1,72(r30) + b L1 +L45: + lfs f1,72(r30) + b L1 +L44: + lhz r3,72(r30) + b L1 +L43: + lha r3,72(r30) + b L1 +L42: + lbz r3,72(r30) + b L1 +L41: + lbz r0,72(r30) + extsb r3,r0 + b L1 +.data +.non_lazy_symbol_pointer +L_vacall_function$non_lazy_ptr: + .indirect_symbol _vacall_function + .long 0 diff --git a/vacall/vacall-powerpc-sysv4-macro.S b/vacall/vacall-powerpc-sysv4-macro.S new file mode 100644 index 0000000..3d56e0f --- /dev/null +++ b/vacall/vacall-powerpc-sysv4-macro.S @@ -0,0 +1,143 @@ + .file "vacall-powerpc.c" + .section ".text" + .align 2 + .globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + .extern __mulh + .extern __mull + .extern __divss + .extern __divus + .extern __quoss + .extern __quous + stwu 1,-176(1) + mflr 0 + li 11,0 + stw 0,180(1) + stw 31,172(1) + mr 31,1 + stw 9,76(31) + addi 0,31,184 + lis 9,vacall_function@ha + stw 3,52(31) + lwz 9,vacall_function@l(9) + addi 3,31,16 + stw 5,60(31) + mtctr 9 + stw 6,64(31) + stw 7,68(31) + stw 8,72(31) + stw 10,80(31) + stw 0,32(31) + stw 11,84(31) + stw 4,56(31) + stfd 1,88(31) + stfd 2,96(31) + stfd 3,104(31) + stfd 4,112(31) + stfd 5,120(31) + stfd 6,128(31) + stfd 7,136(31) + stfd 8,144(31) + stw 11,16(31) + stw 11,48(31) + stw 11,36(31) + stw 11,40(31) + bctrl + lwz 9,40(31) + cmpwi 0,9,0 + beq- 0,.L1 + cmpwi 0,9,1 + beq- 0,.L41 + cmpwi 0,9,2 + beq- 0,.L42 + cmpwi 0,9,3 + beq- 0,.L41 + cmpwi 0,9,4 + beq- 0,.L43 + cmpwi 0,9,5 + beq- 0,.L44 + cmpwi 0,9,6 + beq- 0,.L40 + cmpwi 0,9,7 + beq- 0,.L40 + cmpwi 0,9,8 + beq- 0,.L40 + cmpwi 0,9,9 + beq- 0,.L40 + addi 0,9,-10 + cmplwi 0,0,1 + bgt- 0,.L22 + lwz 3,24(31) + lwz 4,28(31) +.L1: + lwz 11,0(1) + lwz 0,4(11) + lwz 31,-4(11) + mtlr 0 + mr 1,11 + blr +.L22: + cmpwi 0,9,12 + beq- 0,.L45 + cmpwi 0,9,13 + beq- 0,.L46 + cmpwi 0,9,14 + beq- 0,.L40 + cmpwi 0,9,15 + bne+ 0,.L1 + lwz 0,16(31) + andi. 9,0,1024 + beq- 0,.L1 + lwz 0,44(31) + cmpwi 0,0,1 + beq- 0,.L47 + cmpwi 0,0,2 + beq- 0,.L48 + cmpwi 0,0,4 + beq- 0,.L49 + cmpwi 0,0,8 + bne+ 0,.L1 + lwz 9,36(31) + lwz 4,4(9) +.L39: + lwz 3,0(9) + b .L1 +.L49: + lwz 9,36(31) + b .L39 +.L48: + lwz 9,36(31) + lhz 3,0(9) + b .L1 +.L47: + lwz 9,36(31) + lbz 3,0(9) + b .L1 +.L40: + lwz 3,24(31) + b .L1 +.L46: + lfd 1,24(31) + b .L1 +.L45: + lfs 1,24(31) + b .L1 +.L44: + lhz 3,24(31) + b .L1 +.L43: + lha 3,24(31) + b .L1 +.L41: + lbz 3,24(31) + b .L1 +.L42: + lbz 0,24(31) + slwi 0,0,24 + srawi 3,0,24 + b .L1 + .size vacall_receiver, .-vacall_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-powerpc.c b/vacall/vacall-powerpc.c new file mode 100644 index 0000000..0c40cc4 --- /dev/null +++ b/vacall/vacall-powerpc.c @@ -0,0 +1,181 @@ +/* vacall function for powerpc CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * Copyright 2000 Adam Fedor + * Copyright 2004 Paul Guyot + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("r11"); +#endif +register double farg1 __asm__("fr1"); +register double farg2 __asm__("fr2"); +register double farg3 __asm__("fr3"); +register double farg4 __asm__("fr4"); +register double farg5 __asm__("fr5"); +register double farg6 __asm__("fr6"); +register double farg7 __asm__("fr7"); +register double farg8 __asm__("fr8"); +register double farg9 __asm__("fr9"); +register double farg10 __asm__("fr10"); +register double farg11 __asm__("fr11"); +register double farg12 __asm__("fr12"); +register double farg13 __asm__("fr13"); +register __varword iret __asm__("r3"); +register __varword iret2 __asm__("r4"); +register float fret __asm__("fr1"); +register double dret __asm__("fr1"); + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, __vaword word6, __vaword word7, __vaword word8, + __vaword firstword) +{ + __va_alist list; +#if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)) /* __powerpc_aix__ */ + /* gcc-2.6.3 source says: When a parameter is passed in a register, + * stack space is still allocated for it. + */ + /* Move the arguments passed in registers to their stack locations. */ + (&firstword)[-8] = word1; + (&firstword)[-7] = word2; + (&firstword)[-6] = word3; + (&firstword)[-5] = word4; + (&firstword)[-4] = word5; + (&firstword)[-3] = word6; + (&firstword)[-2] = word7; + (&firstword)[-1] = word8; +#else /* __powerpc_sysv4__ */ + /* Move the arguments passed in registers to temp storage, since + moving them to the stack would mess up the stack */ + list.iarg[0] = word1; + list.iarg[1] = word2; + list.iarg[2] = word3; + list.iarg[3] = word4; + list.iarg[4] = word5; + list.iarg[5] = word6; + list.iarg[6] = word7; + list.iarg[7] = word8; +#endif + list.farg[0] = farg1; + list.farg[1] = farg2; + list.farg[2] = farg3; + list.farg[3] = farg4; + list.farg[4] = farg5; + list.farg[5] = farg6; + list.farg[6] = farg7; + list.farg[7] = farg8; +#if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)) /* __powerpc_aix__ */ + list.farg[8] = farg9; + list.farg[9] = farg10; + list.farg[10] = farg11; + list.farg[11] = farg12; + list.farg[12] = farg13; +#endif + /* Prepare the va_alist. */ + list.flags = 0; +#if defined(_AIX) || (defined(__MACH__) && defined(__APPLE__)) /* __powerpc_aix__ */ + list.aptr = (long)(&firstword - 8); +#else /* __powerpc_sysv4__ */ + list.aptr = (long)(&firstword); + list.ianum = 0; +#endif + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.fanum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong || list.rtype == __VAulonglong) { + iret = ((__varword *) &list.tmp._longlong)[0]; + iret2 = ((__varword *) &list.tmp._longlong)[1]; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + if (list.rsize == sizeof(char)) { + iret = *(unsigned char *) list.raddr; + } else + if (list.rsize == sizeof(short)) { + iret = *(unsigned short *) list.raddr; + } else + if (list.rsize == sizeof(int)) { + iret = *(unsigned int *) list.raddr; + } else + if (list.rsize == 2*sizeof(__varword)) { + iret = ((__varword *) list.raddr)[0]; + iret2 = ((__varword *) list.raddr)[1]; + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-powerpc64-aix.s b/vacall/vacall-powerpc64-aix.s new file mode 100644 index 0000000..bb888b7 --- /dev/null +++ b/vacall/vacall-powerpc64-aix.s @@ -0,0 +1,151 @@ + .file "vacall-powerpc64.c" + .csect .text[PR] + .toc + .csect .text[PR] + .toc +LC..0: + .tc vacall_function[TC],vacall_function[UA] + .csect .text[PR] + .align 2 + .align 4 + .globl vacall_receiver + .globl .vacall_receiver + .csect vacall_receiver[DS],3 +vacall_receiver: + .llong .vacall_receiver, TOC[tc0], 0 + .csect .text[PR] +.vacall_receiver: + mflr 0 + std 31,-8(1) + li 11,0 + std 0,16(1) + li 0,0 + stdu 1,-304(1) + mr 31,1 + std 2,40(1) + stw 0,112(31) + stw 11,152(31) + stw 11,168(31) + std 9,400(31) + addi 9,31,352 + std 3,352(31) + stfd 1,172(31) + std 4,360(31) + std 5,368(31) + std 6,376(31) + std 7,384(31) + std 8,392(31) + stfd 2,180(31) + addi 3,31,112 + stfd 3,188(31) + stfd 4,196(31) + stfd 5,204(31) + stfd 6,212(31) + stfd 7,220(31) + stfd 8,228(31) + stfd 9,236(31) + stfd 10,244(31) + stfd 11,252(31) + stfd 12,260(31) + stfd 13,268(31) + std 9,136(31) + std 11,144(31) + std 10,408(31) + ld 9,LC..0(2) + ld 9,0(9) + ld 10,0(9) + ld 11,16(9) + mtctr 10 + ld 2,8(9) + bctrl + ld 2,40(1) + lwz 9,152(31) + cmpdi 7,9,0 + beq 7,L..1 + cmplwi 7,9,1 + beq 7,L..20 + cmplwi 7,9,2 + beq 7,L..23 + cmplwi 7,9,3 + beq 7,L..20 + cmplwi 7,9,4 + beq 7,L..24 + cmplwi 7,9,5 + beq 7,L..25 + cmplwi 7,9,6 + beq 7,L..26 + cmplwi 7,9,7 + beq 7,L..27 + cmplwi 7,9,8 + beq 7,L..21 + cmplwi 7,9,9 + beq 7,L..21 + cmplwi 7,9,10 + beq 7,L..21 + cmplwi 7,9,11 + beq 7,L..21 + cmplwi 7,9,12 + beq 7,L..28 + cmplwi 7,9,13 + beq 7,L..29 + cmplwi 7,9,14 + beq 7,L..21 +L..1: + addi 1,31,304 + ld 0,16(1) + ld 31,-8(1) + mtlr 0 + blr + .align 4 +L..20: + lbz 3,120(31) + addi 1,31,304 + ld 0,16(1) + ld 31,-8(1) + mtlr 0 + blr + .align 4 +L..23: + lbz 9,120(31) + extsb 3,9 + b L..1 + .align 4 +L..21: + ld 3,120(31) + b L..1 + .align 4 +L..24: + lha 3,120(31) + b L..1 + .align 4 +L..25: + lhz 3,120(31) + b L..1 + .align 4 +L..26: + lwa 3,120(31) + b L..1 + .align 4 +L..28: + lfs 1,120(31) + b L..1 + .align 4 +L..27: + lwz 3,120(31) + b L..1 +L..29: + lfd 1,120(31) + b L..1 +LT..vacall_receiver: + .long 0 + .byte 0,0,32,97,128,1,8,0 + .long 0 + .long LT..vacall_receiver-.vacall_receiver + .short 15 + .byte "vacall_receiver" + .byte 31 + .align 2 +_section_.text: + .csect .data[RW],4 + .llong _section_.text + .extern vacall_function[UA] diff --git a/vacall/vacall-powerpc64-elfv2-linux.S b/vacall/vacall-powerpc64-elfv2-linux.S new file mode 100644 index 0000000..45e391d --- /dev/null +++ b/vacall/vacall-powerpc64-elfv2-linux.S @@ -0,0 +1,225 @@ + .file "vacall-powerpc64.c" + .machine power4 + .abiversion 2 + .section ".toc","aw" + .section ".text" + .section ".toc","aw" +.LC0: + .quad vacall_function + .section ".text" + .align 2 + .p2align 4,,15 + .globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: +0: addis 2,12,.TOC.-0b@ha + addi 2,2,.TOC.-0b@l + .localentry vacall_receiver,.-vacall_receiver + mflr 0 + std 31,-8(1) + addis 11,2,.LC0@toc@ha + ld 12,.LC0@toc@l(11) + li 11,0 + std 0,16(1) + stdu 1,-224(1) + mr 31,1 + ld 0,0(12) + std 2,24(1) + std 9,304(31) + li 9,0 + std 3,256(31) + addi 3,31,32 + std 4,264(31) + std 5,272(31) + mtctr 0 + stw 9,32(31) + std 6,280(31) + std 7,288(31) + std 8,296(31) + std 10,312(31) + stfd 1,96(31) + addi 9,31,256 + stfd 2,104(31) + stfd 3,112(31) + stfd 4,120(31) + stfd 5,128(31) + mr 12,0 + std 9,56(31) + stfd 6,136(31) + stfd 7,144(31) + stfd 8,152(31) + stfd 9,160(31) + stfd 10,168(31) + stfd 11,176(31) + stfd 12,184(31) + stfd 13,192(31) + std 11,64(31) + stw 11,72(31) + stw 11,88(31) + bctrl + ld 2,24(1) + lwz 9,72(31) + cmpdi 7,9,0 + beq 7,.L1 + cmplwi 7,9,1 + beq 7,.L27 + cmplwi 7,9,2 + beq 7,.L30 + cmplwi 7,9,3 + beq 7,.L27 + cmplwi 7,9,4 + beq 7,.L31 + cmplwi 7,9,5 + beq 7,.L32 + cmplwi 7,9,6 + beq 7,.L33 + cmplwi 7,9,7 + beq 7,.L34 + cmplwi 7,9,8 + beq 7,.L28 + cmplwi 7,9,9 + beq 7,.L28 + cmplwi 7,9,10 + beq 7,.L28 + cmplwi 7,9,11 + beq 7,.L28 + cmplwi 7,9,12 + beq 7,.L35 + cmplwi 7,9,13 + beq 7,.L36 + cmplwi 7,9,14 + beq 7,.L28 + cmplwi 7,9,15 + bne 7,.L1 + lwz 9,32(31) + rldicl. 10,9,54,63 + beq 0,.L1 + ld 9,80(31) + addi 10,9,-1 + cmpldi 7,10,15 + bgt 7,.L1 + ld 8,64(31) + cmpldi 7,9,8 + rldicl 10,8,0,61 + rldicr 8,8,0,60 + add 9,9,10 + bgt 7,.L17 + cmpldi 7,9,8 + slwi 9,9,3 + bgt 7,.L18 + ld 7,0(8) + addi 9,9,-1 + li 8,2 + slwi 10,10,3 + sld 9,8,9 + addi 9,9,-1 + and 9,9,7 + srad 3,9,10 +.L1: + addi 1,31,224 + ld 0,16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L27: + addi 1,31,224 + lbz 3,40(31) + ld 0,16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L30: + lbz 9,40(31) + extsb 3,9 + b .L1 + .p2align 4,,15 +.L28: + ld 3,40(31) + b .L1 + .p2align 4,,15 +.L31: + lha 3,40(31) + b .L1 + .p2align 4,,15 +.L32: + lhz 3,40(31) + b .L1 + .p2align 4,,15 +.L33: + lwa 3,40(31) + b .L1 + .p2align 4,,15 +.L35: + lfs 1,40(31) + b .L1 + .p2align 4,,15 +.L34: + lwz 3,40(31) + b .L1 +.L36: + lfd 1,40(31) + b .L1 +.L17: + cmpldi 7,9,16 + rldicl 10,10,0,32 + slwi 9,9,3 + ble 7,.L37 + li 7,2 + addi 9,9,-129 + ld 11,16(8) + ld 5,0(8) + mulli 6,10,-8 + sld 9,7,9 + ld 7,8(8) + addi 8,9,-1 + slwi 9,10,3 + addi 6,6,64 + and 10,8,11 + srad 8,5,9 + sld 5,7,6 + srad 9,7,9 + sld 10,10,6 + or 3,8,5 + or 4,10,9 + b .L1 +.L18: + rldicl 10,10,0,32 + li 7,2 + ld 6,8(8) + ld 8,0(8) + addi 9,9,-65 + sld 9,7,9 + mulli 7,10,-8 + slwi 10,10,3 + addi 9,9,-1 + srad 10,8,10 + and 9,9,6 + addi 7,7,64 + sld 9,9,7 + or 3,9,10 + b .L1 +.L37: + li 7,2 + addi 9,9,-65 + ld 5,8(8) + ld 6,0(8) + sld 9,7,9 + mulli 7,10,-4 + addi 9,9,-1 + addi 7,7,32 + and 8,9,5 + slwi 9,10,3 + sld 10,8,7 + srad 6,6,9 + srad 4,8,9 + sld 7,10,7 + or 3,6,7 + b .L1 + .long 0 + .byte 0,0,0,1,128,1,0,0 + .size vacall_receiver,.-vacall_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-powerpc64-linux.S b/vacall/vacall-powerpc64-linux.S new file mode 100644 index 0000000..0a402ef --- /dev/null +++ b/vacall/vacall-powerpc64-linux.S @@ -0,0 +1,146 @@ + .file "vacall-powerpc64.c" + .machine power4 + .section ".toc","aw" + .section ".text" + .section ".toc","aw" +.LC0: + .quad vacall_function + .section ".text" + .align 2 + .p2align 4,,15 + .globl vacall_receiver + .section ".opd","aw" + .align 3 +vacall_receiver: + .quad .L.vacall_receiver,.TOC.@tocbase,0 + .previous + .type vacall_receiver, @function +.L.vacall_receiver: + mflr 0 + std 31,-8(1) + li 11,0 + std 0,16(1) + stdu 1,-304(1) + li 0,0 + mr 31,1 + std 2,40(1) + stw 11,152(31) + stw 0,112(31) + stw 11,168(31) + std 9,400(31) + std 3,352(31) + std 4,360(31) + std 5,368(31) + std 6,376(31) + std 7,384(31) + std 8,392(31) + std 10,408(31) + stfd 1,176(31) + addi 9,31,352 + stfd 2,184(31) + stfd 3,192(31) + stfd 4,200(31) + stfd 5,208(31) + addis 10,2,.LC0@toc@ha + addi 3,31,112 + stfd 6,216(31) + stfd 7,224(31) + stfd 8,232(31) + stfd 9,240(31) + stfd 10,248(31) + stfd 11,256(31) + stfd 12,264(31) + stfd 13,272(31) + std 9,136(31) + std 11,144(31) + ld 9,.LC0@toc@l(10) + ld 9,0(9) + ld 10,0(9) + ld 11,16(9) + mtctr 10 + ld 2,8(9) + bctrl + ld 2,40(1) + lwz 9,152(31) + cmpdi 7,9,0 + beq 7,.L1 + cmplwi 7,9,1 + beq 7,.L20 + cmplwi 7,9,2 + beq 7,.L23 + cmplwi 7,9,3 + beq 7,.L20 + cmplwi 7,9,4 + beq 7,.L24 + cmplwi 7,9,5 + beq 7,.L25 + cmplwi 7,9,6 + beq 7,.L26 + cmplwi 7,9,7 + beq 7,.L27 + cmplwi 7,9,8 + beq 7,.L21 + cmplwi 7,9,9 + beq 7,.L21 + cmplwi 7,9,10 + beq 7,.L21 + cmplwi 7,9,11 + beq 7,.L21 + cmplwi 7,9,12 + beq 7,.L28 + cmplwi 7,9,13 + beq 7,.L29 + cmplwi 7,9,14 + beq 7,.L21 +.L1: + addi 1,31,304 + ld 0,16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L20: + lbz 3,120(31) + addi 1,31,304 + ld 0,16(1) + ld 31,-8(1) + mtlr 0 + blr + .p2align 4,,15 +.L23: + lbz 9,120(31) + extsb 3,9 + b .L1 + .p2align 4,,15 +.L21: + ld 3,120(31) + b .L1 + .p2align 4,,15 +.L24: + lha 3,120(31) + b .L1 + .p2align 4,,15 +.L25: + lhz 3,120(31) + b .L1 + .p2align 4,,15 +.L26: + lwa 3,120(31) + b .L1 + .p2align 4,,15 +.L28: + lfs 1,120(31) + b .L1 + .p2align 4,,15 +.L27: + lwz 3,120(31) + b .L1 +.L29: + lfd 1,120(31) + b .L1 + .long 0 + .byte 0,0,0,1,128,1,0,0 + .size vacall_receiver,.-.L.vacall_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-powerpc64.c b/vacall/vacall-powerpc64.c new file mode 100644 index 0000000..0b78edf --- /dev/null +++ b/vacall/vacall-powerpc64.c @@ -0,0 +1,293 @@ +/* vacall function for powerpc64 CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * Copyright 2000 Adam Fedor + * Copyright 2004 Paul Guyot + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("r11"); +#endif +register double farg1 __asm__("fr1"); +register double farg2 __asm__("fr2"); +register double farg3 __asm__("fr3"); +register double farg4 __asm__("fr4"); +register double farg5 __asm__("fr5"); +register double farg6 __asm__("fr6"); +register double farg7 __asm__("fr7"); +register double farg8 __asm__("fr8"); +register double farg9 __asm__("fr9"); +register double farg10 __asm__("fr10"); +register double farg11 __asm__("fr11"); +register double farg12 __asm__("fr12"); +register double farg13 __asm__("fr13"); +register __varword iret __asm__("r3"); +register __varword iret2 __asm__("r4"); +register float fret __asm__("fr1"); +register double dret __asm__("fr1"); + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, __vaword word6, __vaword word7, __vaword word8, + __vaword firstword) +{ + __va_alist list; + /* When a parameter is passed in a register, + * stack space is still allocated for it. + */ + /* Move the arguments passed in registers to their stack locations. */ + (&firstword)[-8] = word1; + (&firstword)[-7] = word2; + (&firstword)[-6] = word3; + (&firstword)[-5] = word4; + (&firstword)[-4] = word5; + (&firstword)[-3] = word6; + (&firstword)[-2] = word7; + (&firstword)[-1] = word8; + list.farg[0] = farg1; + list.farg[1] = farg2; + list.farg[2] = farg3; + list.farg[3] = farg4; + list.farg[4] = farg5; + list.farg[5] = farg6; + list.farg[6] = farg7; + list.farg[7] = farg8; + list.farg[8] = farg9; + list.farg[9] = farg10; + list.farg[10] = farg11; + list.farg[11] = farg12; + list.farg[12] = farg13; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)(&firstword - 8); + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.fanum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulonglong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { +#ifdef __powerpc64_elfv2__ + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + /* In the ELFv2 ABI, gcc returns structs of size <= 16 in registers. */ + if (list.rsize > 0 && list.rsize <= 16) { + #if 0 /* Unoptimized */ + if (list.rsize == 1) { + iret = (__varword)((unsigned char *) list.raddr)[0]; + } else + if (list.rsize == 2) { + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8); + } else + if (list.rsize == 3) { + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16); + } else + if (list.rsize == 4) { + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24); + } else + if (list.rsize == 5) { + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32); + } else + if (list.rsize == 6) { + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32) + | ((__varword)((unsigned char *) list.raddr)[5] << 40); + } else + if (list.rsize == 7) { + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32) + | ((__varword)((unsigned char *) list.raddr)[5] << 40) + | ((__varword)((unsigned char *) list.raddr)[6] << 48); + } else + if (list.rsize >= 8 && list.rsize <= 16) { + iret = ((__varword)((unsigned char *) list.raddr)[0]) + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32) + | ((__varword)((unsigned char *) list.raddr)[5] << 40) + | ((__varword)((unsigned char *) list.raddr)[6] << 48) + | ((__varword)((unsigned char *) list.raddr)[7] << 56); + if (list.rsize == 8) { + } else + if (list.rsize == 9) { + iret2 = (__varword)((unsigned char *) list.raddr)[8]; + } else + if (list.rsize == 10) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8); + } else + if (list.rsize == 11) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16); + } else + if (list.rsize == 12) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24); + } else + if (list.rsize == 13) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32); + } else + if (list.rsize == 14) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32) + | ((__varword)((unsigned char *) list.raddr)[13] << 40); + } else + if (list.rsize == 15) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32) + | ((__varword)((unsigned char *) list.raddr)[13] << 40) + | ((__varword)((unsigned char *) list.raddr)[14] << 48); + } else + if (list.rsize == 16) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8]) + | ((__varword)((unsigned char *) list.raddr)[9] << 8) + | ((__varword)((unsigned char *) list.raddr)[10] << 16) + | ((__varword)((unsigned char *) list.raddr)[11] << 24) + | ((__varword)((unsigned char *) list.raddr)[12] << 32) + | ((__varword)((unsigned char *) list.raddr)[13] << 40) + | ((__varword)((unsigned char *) list.raddr)[14] << 48) + | ((__varword)((unsigned char *) list.raddr)[15] << 56); + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 2*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__varword) */ + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = ((__varword)2 << (end_offset*8-1)) - 1; + iret = (wordaddr[0] & mask0) >> (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) >> (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = ((__varword)2 << (end_offset*8-2*sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] >> (start_offset*8)) | ((wordaddr[2] & mask2) << (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + } + } +#endif + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-riscv32-ilp32d-linux.s b/vacall/vacall-riscv32-ilp32d-linux.s new file mode 100644 index 0000000..0982775 --- /dev/null +++ b/vacall/vacall-riscv32-ilp32d-linux.s @@ -0,0 +1,163 @@ + .file "vacall-riscv32.c" + .option nopic + .text + .align 1 + .globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + add sp,sp,-208 + sw ra,188(sp) + sw s0,184(sp) + add s0,sp,192 + lui t1,%hi(vacall_function) + lw t1,%lo(vacall_function)(t1) + sw a0,-148(s0) + add a0,s0,16 + sw a7,12(s0) + sw a1,-144(s0) + sw a2,-140(s0) + sw a3,-136(s0) + sw a4,-132(s0) + sw a5,-128(s0) + sw a6,-124(s0) + sw a7,-120(s0) + fsw fa0,-112(s0) + fsw fa1,-108(s0) + fsw fa2,-104(s0) + fsw fa3,-100(s0) + fsw fa4,-96(s0) + fsw fa5,-92(s0) + fsw fa6,-88(s0) + fsw fa7,-84(s0) + fsd fa0,-80(s0) + fsd fa1,-72(s0) + fsd fa2,-64(s0) + fsd fa3,-56(s0) + fsd fa4,-48(s0) + fsd fa5,-40(s0) + fsd fa6,-32(s0) + fsd fa7,-24(s0) + sw a0,-168(s0) + sw zero,-184(s0) + sw zero,-164(s0) + sw zero,-160(s0) + add a0,s0,-184 + sw zero,-152(s0) + sw zero,-116(s0) + jalr t1 + lw t1,-160(s0) + beqz t1,.L1 + li t3,1 + beq t1,t3,.L22 + li t3,2 + beq t1,t3,.L25 + li t3,3 + beq t1,t3,.L22 + li t3,4 + beq t1,t3,.L26 + li t3,5 + beq t1,t3,.L27 + li t3,6 + beq t1,t3,.L23 + li t3,7 + beq t1,t3,.L23 + li t3,8 + beq t1,t3,.L23 + li t3,9 + beq t1,t3,.L23 + add t3,t1,-10 + li t4,1 + bleu t3,t4,.L28 + li t3,12 + beq t1,t3,.L29 + li t3,13 + beq t1,t3,.L30 + li t3,14 + beq t1,t3,.L23 + li t3,15 + bne t1,t3,.L1 + lw t1,-184(s0) + and t1,t1,2 + beqz t1,.L1 + lw t3,-156(s0) + li t1,7 + add t5,t3,-1 + bgtu t5,t1,.L1 + lw t1,-164(s0) + lbu t5,0(t1) + mv a0,t5 + beq t3,t4,.L1 + lbu t4,1(t1) + li t6,2 + sll t4,t4,8 + or t5,t4,t5 + mv a0,t5 + beq t3,t6,.L1 + lbu t4,2(t1) + li t6,3 + sll t4,t4,16 + or t4,t4,t5 + mv a0,t4 + beq t3,t6,.L1 + lbu a0,3(t1) + li t5,4 + sll a0,a0,24 + or a0,a0,t4 + beq t3,t5,.L1 + lbu t5,4(t1) + li t4,5 + mv a1,t5 + beq t3,t4,.L1 + lbu t4,5(t1) + li t6,6 + sll t4,t4,8 + or t5,t4,t5 + mv a1,t5 + beq t3,t6,.L1 + lbu t4,6(t1) + li t6,8 + sll t4,t4,16 + or t4,t4,t5 + mv a1,t4 + bne t3,t6,.L1 + lbu a1,7(t1) + sll a1,a1,24 + or a1,a1,t4 +.L1: + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L22: + lbu a0,-176(s0) + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L23: + lw a0,-176(s0) + j .L1 +.L25: + lb a0,-176(s0) + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L26: + lh a0,-176(s0) + j .L1 +.L27: + lhu a0,-176(s0) + j .L1 +.L28: + lw a0,-176(s0) + lw a1,-172(s0) + j .L1 +.L29: + flw fa0,-176(s0) + j .L1 +.L30: + fld fa0,-176(s0) + j .L1 + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 7.3.0" diff --git a/vacall/vacall-riscv32-ilp32d-macro.S b/vacall/vacall-riscv32-ilp32d-macro.S new file mode 100644 index 0000000..5142889 --- /dev/null +++ b/vacall/vacall-riscv32-ilp32d-macro.S @@ -0,0 +1,165 @@ + .file "vacall-riscv32.c" + .option nopic + .text + .align 1 + .globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + add sp,sp,-208 + sw ra,188(sp) + sw s0,184(sp) + add s0,sp,192 + lui t1,%hi(vacall_function) + lw t1,%lo(vacall_function)(t1) + sw a0,-148(s0) + add a0,s0,16 + sw a7,12(s0) + sw a1,-144(s0) + sw a2,-140(s0) + sw a3,-136(s0) + sw a4,-132(s0) + sw a5,-128(s0) + sw a6,-124(s0) + sw a7,-120(s0) + fsw fa0,-112(s0) + fsw fa1,-108(s0) + fsw fa2,-104(s0) + fsw fa3,-100(s0) + fsw fa4,-96(s0) + fsw fa5,-92(s0) + fsw fa6,-88(s0) + fsw fa7,-84(s0) + fsd fa0,-80(s0) + fsd fa1,-72(s0) + fsd fa2,-64(s0) + fsd fa3,-56(s0) + fsd fa4,-48(s0) + fsd fa5,-40(s0) + fsd fa6,-32(s0) + fsd fa7,-24(s0) + sw a0,-168(s0) + sw zero,-184(s0) + sw zero,-164(s0) + sw zero,-160(s0) + add a0,s0,-184 + sw zero,-152(s0) + sw zero,-116(s0) + jalr t1 + lw t1,-160(s0) + beqz t1,.L1 + li t3,1 + beq t1,t3,.L22 + li t3,2 + beq t1,t3,.L25 + li t3,3 + beq t1,t3,.L22 + li t3,4 + beq t1,t3,.L26 + li t3,5 + beq t1,t3,.L27 + li t3,6 + beq t1,t3,.L23 + li t3,7 + beq t1,t3,.L23 + li t3,8 + beq t1,t3,.L23 + li t3,9 + beq t1,t3,.L23 + add t3,t1,-10 + li t4,1 + bleu t3,t4,.L28 + li t3,12 + beq t1,t3,.L29 + li t3,13 + beq t1,t3,.L30 + li t3,14 + beq t1,t3,.L23 + li t3,15 + bne t1,t3,.L1 + lw t1,-184(s0) + and t1,t1,2 + beqz t1,.L1 + lw t3,-156(s0) + li t1,7 + add t5,t3,-1 + bgtu t5,t1,.L1 + lw t1,-164(s0) + lbu t5,0(t1) + mv a0,t5 + beq t3,t4,.L1 + lbu t4,1(t1) + li t6,2 + sll t4,t4,8 + or t5,t4,t5 + mv a0,t5 + beq t3,t6,.L1 + lbu t4,2(t1) + li t6,3 + sll t4,t4,16 + or t4,t4,t5 + mv a0,t4 + beq t3,t6,.L1 + lbu a0,3(t1) + li t5,4 + sll a0,a0,24 + or a0,a0,t4 + beq t3,t5,.L1 + lbu t5,4(t1) + li t4,5 + mv a1,t5 + beq t3,t4,.L1 + lbu t4,5(t1) + li t6,6 + sll t4,t4,8 + or t5,t4,t5 + mv a1,t5 + beq t3,t6,.L1 + lbu t4,6(t1) + li t6,8 + sll t4,t4,16 + or t4,t4,t5 + mv a1,t4 + bne t3,t6,.L1 + lbu a1,7(t1) + sll a1,a1,24 + or a1,a1,t4 +.L1: + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L22: + lbu a0,-176(s0) + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L23: + lw a0,-176(s0) + j .L1 +.L25: + lb a0,-176(s0) + lw ra,188(sp) + lw s0,184(sp) + add sp,sp,208 + jr ra +.L26: + lh a0,-176(s0) + j .L1 +.L27: + lhu a0,-176(s0) + j .L1 +.L28: + lw a0,-176(s0) + lw a1,-172(s0) + j .L1 +.L29: + flw fa0,-176(s0) + j .L1 +.L30: + fld fa0,-176(s0) + j .L1 + .size vacall_receiver, .-vacall_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-riscv32.c b/vacall/vacall-riscv32.c new file mode 100644 index 0000000..6c100e5 --- /dev/null +++ b/vacall/vacall-riscv32.c @@ -0,0 +1,226 @@ +/* vacall function for RISC-V 32-bit CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("t2"); +#endif + +register __varword iarg1 __asm__("a0"); +register __varword iarg2 __asm__("a1"); +register __varword iarg3 __asm__("a2"); +register __varword iarg4 __asm__("a3"); +register __varword iarg5 __asm__("a4"); +register __varword iarg6 __asm__("a5"); +register __varword iarg7 __asm__("a6"); +register __varword iarg8 __asm__("a7"); + +register float farg1 __asm__("fa0"); +register float farg2 __asm__("fa1"); +register float farg3 __asm__("fa2"); +register float farg4 __asm__("fa3"); +register float farg5 __asm__("fa4"); +register float farg6 __asm__("fa5"); +register float farg7 __asm__("fa6"); +register float farg8 __asm__("fa7"); + +register double darg1 __asm__("fa0"); +register double darg2 __asm__("fa1"); +register double darg3 __asm__("fa2"); +register double darg4 __asm__("fa3"); +register double darg5 __asm__("fa4"); +register double darg6 __asm__("fa5"); +register double darg7 __asm__("fa6"); +register double darg8 __asm__("fa7"); + +register __varword iret __asm__("a0"); +register __varword iret2 __asm__("a1"); +register float fret __asm__("fa0"); +register double dret __asm__("fa0"); + +/* The ABI requires that the first 8 general-purpose argument words are + being passed in registers, even if these words belong to structs that are + at most 2 words large. No room is allocated for these register words on + the stack by the caller, but the callee allocates room for them - at the + right place in the stack frame, that is, above the retaddr - if and only + if they are part of a struct that extends to the stack and the address of + this struct is taken. */ +struct gpargsequence { + __vaword word8; /* a7 */ + __vaword firststackword; +}; + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, __vaword word6, __vaword word7, + struct gpargsequence gpargs) +{ + __va_alist list; + /* Move the arguments passed in registers to temp storage. */ + list.iarg[0] = iarg1; + list.iarg[1] = iarg2; + list.iarg[2] = iarg3; + list.iarg[3] = iarg4; + list.iarg[4] = iarg5; + list.iarg[5] = iarg6; + list.iarg[6] = iarg7; + list.iarg[7] = iarg8; /* = gpargs.word8 */ + list.farg[0] = farg1; + list.farg[1] = farg2; + list.farg[2] = farg3; + list.farg[3] = farg4; + list.farg[4] = farg5; + list.farg[5] = farg6; + list.farg[6] = farg7; + list.farg[7] = farg8; + list.darg[0] = darg1; + list.darg[1] = darg2; + list.darg[2] = darg3; + list.darg[3] = darg4; + list.darg[4] = darg5; + list.darg[5] = darg6; + list.darg[6] = darg7; + list.darg[7] = darg8; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&gpargs + sizeof(__vaword); + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.ianum = 0; + list.fanum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong || list.rtype == __VAulonglong) { + iret = ((__varword *) &list.tmp._longlong)[0]; + iret2 = ((__varword *) &list.tmp._longlong)[1]; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + /* normal struct return convention */ + if (list.flags & __VA_SMALL_STRUCT_RETURN) { + /* Return structs of size <= 8 in registers. */ + if (list.rsize > 0 && list.rsize <= 8) { + #if 1 /* Unoptimized */ + iret = (__varword)((unsigned char *) list.raddr)[0]; + if (list.rsize >= 2) + iret |= (__varword)((unsigned char *) list.raddr)[1] << 8; + if (list.rsize >= 3) + iret |= (__varword)((unsigned char *) list.raddr)[2] << 16; + if (list.rsize >= 4) + iret |= (__varword)((unsigned char *) list.raddr)[3] << 24; + if (list.rsize >= 5) { + iret2 = (__varword)((unsigned char *) list.raddr)[4]; + if (list.rsize >= 6) + iret2 |= (__varword)((unsigned char *) list.raddr)[5] << 8; + if (list.rsize >= 7) + iret2 |= (__varword)((unsigned char *) list.raddr)[6] << 16; + if (list.rsize >= 8) + iret2 |= (__varword)((unsigned char *) list.raddr)[7] << 24; + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 2*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__varword) */ + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = ((__varword)2 << (end_offset*8-1)) - 1; + iret = (wordaddr[0] & mask0) >> (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) >> (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = ((__varword)2 << (end_offset*8-2*sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] >> (start_offset*8)) | ((wordaddr[2] & mask2) << (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-riscv64-lp64d-linux.s b/vacall/vacall-riscv64-lp64d-linux.s new file mode 100644 index 0000000..65f5bc9 --- /dev/null +++ b/vacall/vacall-riscv64-lp64d-linux.s @@ -0,0 +1,190 @@ + .file "vacall-riscv64.c" + .option nopic + .text + .align 1 + .globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + add sp,sp,-288 + sd ra,264(sp) + sd s0,256(sp) + sd s1,248(sp) + add s0,sp,272 + lui t1,%hi(vacall_function) + ld t1,%lo(vacall_function)(t1) + sd a0,-200(s0) + add a0,s0,16 + sd a7,8(s0) + sd a1,-192(s0) + sd a2,-184(s0) + sd a3,-176(s0) + sd a4,-168(s0) + sd a5,-160(s0) + sd a6,-152(s0) + sd a7,-144(s0) + fsw fa0,-132(s0) + fsw fa1,-128(s0) + fsw fa2,-124(s0) + fsw fa3,-120(s0) + fsw fa4,-116(s0) + fsw fa5,-112(s0) + fsw fa6,-108(s0) + fsw fa7,-104(s0) + fsd fa0,-96(s0) + fsd fa1,-88(s0) + fsd fa2,-80(s0) + fsd fa3,-72(s0) + fsd fa4,-64(s0) + fsd fa5,-56(s0) + fsd fa6,-48(s0) + fsd fa7,-40(s0) + sd a0,-240(s0) + sw zero,-264(s0) + sd zero,-232(s0) + add a0,s0,-264 + sw zero,-224(s0) + sw zero,-208(s0) + sw zero,-136(s0) + jalr t1 + lw t1,-224(s0) + beqz t1,.L1 + li t3,1 + beq t1,t3,.L25 + li t3,2 + beq t1,t3,.L29 + li t3,3 + beq t1,t3,.L25 + li t3,4 + beq t1,t3,.L30 + li t3,5 + beq t1,t3,.L31 + li t3,6 + beq t1,t3,.L32 + li t3,7 + beq t1,t3,.L33 + and t3,t1,-3 + li t4,8 + beq t3,t4,.L27 + li t4,9 + beq t3,t4,.L27 + li t3,12 + beq t1,t3,.L34 + li t3,13 + beq t1,t3,.L35 + li t3,14 + beq t1,t3,.L27 + li t3,15 + bne t1,t3,.L1 + lw t3,-264(s0) + and t3,t3,1024 + beqz t3,.L1 + ld t0,-216(s0) + add t3,t0,-1 + bgtu t3,t1,.L1 + ld t5,-232(s0) + li s1,8 + and t6,t5,7 + add t2,t0,t6 + and t5,t5,-8 + sext.w t6,t6 + sllw t1,t2,3 + ld t4,0(t5) + sll t3,t6,3 + bgtu t0,s1,.L15 + bgtu t2,s1,.L16 + addw t1,t1,-1 + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t4 + sra a0,a0,t3 +.L1: + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + add sp,sp,288 + jr ra +.L25: + lbu a0,-256(s0) + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + add sp,sp,288 + jr ra +.L29: + lb a0,-256(s0) + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + add sp,sp,288 + jr ra +.L30: + lh a0,-256(s0) + j .L1 +.L33: + lwu a0,-256(s0) + j .L1 +.L31: + lhu a0,-256(s0) + j .L1 +.L27: + ld a0,-256(s0) + j .L1 +.L32: + lw a0,-256(s0) + j .L1 +.L34: + flw fa0,-256(s0) + j .L1 +.L35: + fld fa0,-256(s0) + j .L1 +.L15: + li s1,16 + sra t4,t4,t3 + ld t0,8(t5) + bleu t2,s1,.L36 + li a1,-8 + mulw t6,a1,t6 + addw t1,t1,-129 + ld a0,16(t5) + li a1,2 + sll a1,a1,t1 + add a1,a1,-1 + and a1,a1,a0 + sra t3,t0,t3 + addw t1,t6,64 + sll a0,t0,t1 + sll a1,a1,t1 + or a0,a0,t4 + or a1,a1,t3 + j .L1 +.L16: + li a0,-8 + mulw t6,a0,t6 + addw t1,t1,-65 + ld t5,8(t5) + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t5 + sra t4,t4,t3 + sll a0,a0,t6 + or a0,a0,t4 + j .L1 +.L36: + li a1,-4 + mulw t6,a1,t6 + addw t1,t1,-65 + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t0 + sra a1,a0,t3 + addw t1,t6,32 + sll a0,a0,t1 + sll a0,a0,t1 + or a0,a0,t4 + j .L1 + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 7.3.0" diff --git a/vacall/vacall-riscv64-lp64d-macro.S b/vacall/vacall-riscv64-lp64d-macro.S new file mode 100644 index 0000000..25bb90b --- /dev/null +++ b/vacall/vacall-riscv64-lp64d-macro.S @@ -0,0 +1,192 @@ + .file "vacall-riscv64.c" + .option nopic + .text + .align 1 + .globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: + add sp,sp,-288 + sd ra,264(sp) + sd s0,256(sp) + sd s1,248(sp) + add s0,sp,272 + lui t1,%hi(vacall_function) + ld t1,%lo(vacall_function)(t1) + sd a0,-200(s0) + add a0,s0,16 + sd a7,8(s0) + sd a1,-192(s0) + sd a2,-184(s0) + sd a3,-176(s0) + sd a4,-168(s0) + sd a5,-160(s0) + sd a6,-152(s0) + sd a7,-144(s0) + fsw fa0,-132(s0) + fsw fa1,-128(s0) + fsw fa2,-124(s0) + fsw fa3,-120(s0) + fsw fa4,-116(s0) + fsw fa5,-112(s0) + fsw fa6,-108(s0) + fsw fa7,-104(s0) + fsd fa0,-96(s0) + fsd fa1,-88(s0) + fsd fa2,-80(s0) + fsd fa3,-72(s0) + fsd fa4,-64(s0) + fsd fa5,-56(s0) + fsd fa6,-48(s0) + fsd fa7,-40(s0) + sd a0,-240(s0) + sw zero,-264(s0) + sd zero,-232(s0) + add a0,s0,-264 + sw zero,-224(s0) + sw zero,-208(s0) + sw zero,-136(s0) + jalr t1 + lw t1,-224(s0) + beqz t1,.L1 + li t3,1 + beq t1,t3,.L25 + li t3,2 + beq t1,t3,.L29 + li t3,3 + beq t1,t3,.L25 + li t3,4 + beq t1,t3,.L30 + li t3,5 + beq t1,t3,.L31 + li t3,6 + beq t1,t3,.L32 + li t3,7 + beq t1,t3,.L33 + and t3,t1,-3 + li t4,8 + beq t3,t4,.L27 + li t4,9 + beq t3,t4,.L27 + li t3,12 + beq t1,t3,.L34 + li t3,13 + beq t1,t3,.L35 + li t3,14 + beq t1,t3,.L27 + li t3,15 + bne t1,t3,.L1 + lw t3,-264(s0) + and t3,t3,1024 + beqz t3,.L1 + ld t0,-216(s0) + add t3,t0,-1 + bgtu t3,t1,.L1 + ld t5,-232(s0) + li s1,8 + and t6,t5,7 + add t2,t0,t6 + and t5,t5,-8 + sext.w t6,t6 + sllw t1,t2,3 + ld t4,0(t5) + sll t3,t6,3 + bgtu t0,s1,.L15 + bgtu t2,s1,.L16 + addw t1,t1,-1 + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t4 + sra a0,a0,t3 +.L1: + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + add sp,sp,288 + jr ra +.L25: + lbu a0,-256(s0) + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + add sp,sp,288 + jr ra +.L29: + lb a0,-256(s0) + ld ra,264(sp) + ld s0,256(sp) + ld s1,248(sp) + add sp,sp,288 + jr ra +.L30: + lh a0,-256(s0) + j .L1 +.L33: + lwu a0,-256(s0) + j .L1 +.L31: + lhu a0,-256(s0) + j .L1 +.L27: + ld a0,-256(s0) + j .L1 +.L32: + lw a0,-256(s0) + j .L1 +.L34: + flw fa0,-256(s0) + j .L1 +.L35: + fld fa0,-256(s0) + j .L1 +.L15: + li s1,16 + sra t4,t4,t3 + ld t0,8(t5) + bleu t2,s1,.L36 + li a1,-8 + mulw t6,a1,t6 + addw t1,t1,-129 + ld a0,16(t5) + li a1,2 + sll a1,a1,t1 + add a1,a1,-1 + and a1,a1,a0 + sra t3,t0,t3 + addw t1,t6,64 + sll a0,t0,t1 + sll a1,a1,t1 + or a0,a0,t4 + or a1,a1,t3 + j .L1 +.L16: + li a0,-8 + mulw t6,a0,t6 + addw t1,t1,-65 + ld t5,8(t5) + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t5 + sra t4,t4,t3 + sll a0,a0,t6 + or a0,a0,t4 + j .L1 +.L36: + li a1,-4 + mulw t6,a1,t6 + addw t1,t1,-65 + li a0,2 + sll a0,a0,t1 + add a0,a0,-1 + and a0,a0,t0 + sra a1,a0,t3 + addw t1,t6,32 + sll a0,a0,t1 + sll a0,a0,t1 + or a0,a0,t4 + j .L1 + .size vacall_receiver, .-vacall_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-riscv64.c b/vacall/vacall-riscv64.c new file mode 100644 index 0000000..abf3cb3 --- /dev/null +++ b/vacall/vacall-riscv64.c @@ -0,0 +1,238 @@ +/* vacall function for RISC-V 64-bit CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("t2"); +#endif + +register __varword iarg1 __asm__("a0"); +register __varword iarg2 __asm__("a1"); +register __varword iarg3 __asm__("a2"); +register __varword iarg4 __asm__("a3"); +register __varword iarg5 __asm__("a4"); +register __varword iarg6 __asm__("a5"); +register __varword iarg7 __asm__("a6"); +register __varword iarg8 __asm__("a7"); + +register float farg1 __asm__("fa0"); +register float farg2 __asm__("fa1"); +register float farg3 __asm__("fa2"); +register float farg4 __asm__("fa3"); +register float farg5 __asm__("fa4"); +register float farg6 __asm__("fa5"); +register float farg7 __asm__("fa6"); +register float farg8 __asm__("fa7"); + +register double darg1 __asm__("fa0"); +register double darg2 __asm__("fa1"); +register double darg3 __asm__("fa2"); +register double darg4 __asm__("fa3"); +register double darg5 __asm__("fa4"); +register double darg6 __asm__("fa5"); +register double darg7 __asm__("fa6"); +register double darg8 __asm__("fa7"); + +register __varword iret __asm__("a0"); +register __varword iret2 __asm__("a1"); +register float fret __asm__("fa0"); +register double dret __asm__("fa0"); + +/* The ABI requires that the first 8 general-purpose argument words are + being passed in registers, even if these words belong to structs that are + at most 2 words large. No room is allocated for these register words on + the stack by the caller, but the callee allocates room for them - at the + right place in the stack frame, that is, above the retaddr - if and only + if they are part of a struct that extends to the stack and the address of + this struct is taken. */ +struct gpargsequence { + __vaword word8; /* a7 */ + __vaword firststackword; +}; + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, __vaword word6, __vaword word7, + struct gpargsequence gpargs) +{ + __va_alist list; + /* Move the arguments passed in registers to temp storage. */ + list.iarg[0] = iarg1; + list.iarg[1] = iarg2; + list.iarg[2] = iarg3; + list.iarg[3] = iarg4; + list.iarg[4] = iarg5; + list.iarg[5] = iarg6; + list.iarg[6] = iarg7; + list.iarg[7] = iarg8; /* = gpargs.word8 */ + list.farg[0] = farg1; + list.farg[1] = farg2; + list.farg[2] = farg3; + list.farg[3] = farg4; + list.farg[4] = farg5; + list.farg[5] = farg6; + list.farg[6] = farg7; + list.farg[7] = farg8; + list.darg[0] = darg1; + list.darg[1] = darg2; + list.darg[2] = darg3; + list.darg[3] = darg4; + list.darg[4] = darg5; + list.darg[5] = darg6; + list.darg[6] = darg7; + list.darg[7] = darg8; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&gpargs + sizeof(__vaword); + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.ianum = 0; + list.fanum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong || list.rtype == __VAlonglong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong || list.rtype == __VAulonglong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + /* normal struct return convention */ + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + /* Return structs of size <= 16 in registers. */ + if (list.rsize > 0 && list.rsize <= 16) { + #if 0 /* Unoptimized */ + iret = (__varword)((unsigned char *) list.raddr)[0]; + if (list.rsize >= 2) + iret |= (__varword)((unsigned char *) list.raddr)[1] << 8; + if (list.rsize >= 3) + iret |= (__varword)((unsigned char *) list.raddr)[2] << 16; + if (list.rsize >= 4) + iret |= (__varword)((unsigned char *) list.raddr)[3] << 24; + if (list.rsize >= 5) + iret |= (__varword)((unsigned char *) list.raddr)[4] << 32; + if (list.rsize >= 6) + iret |= (__varword)((unsigned char *) list.raddr)[5] << 40; + if (list.rsize >= 7) + iret |= (__varword)((unsigned char *) list.raddr)[6] << 48; + if (list.rsize >= 8) + iret |= (__varword)((unsigned char *) list.raddr)[7] << 56; + if (list.rsize >= 9) { + iret2 = (__varword)((unsigned char *) list.raddr)[8]; + if (list.rsize >= 10) + iret2 |= (__varword)((unsigned char *) list.raddr)[9] << 8; + if (list.rsize >= 11) + iret2 |= (__varword)((unsigned char *) list.raddr)[10] << 16; + if (list.rsize >= 12) + iret2 |= (__varword)((unsigned char *) list.raddr)[11] << 24; + if (list.rsize >= 13) + iret2 |= (__varword)((unsigned char *) list.raddr)[12] << 32; + if (list.rsize >= 14) + iret2 |= (__varword)((unsigned char *) list.raddr)[13] << 40; + if (list.rsize >= 15) + iret2 |= (__varword)((unsigned char *) list.raddr)[14] << 48; + if (list.rsize >= 16) + iret2 |= (__varword)((unsigned char *) list.raddr)[15] << 56; + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 2*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__varword) */ + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = ((__varword)2 << (end_offset*8-1)) - 1; + iret = (wordaddr[0] & mask0) >> (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) >> (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = ((__varword)2 << (end_offset*8-2*sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] >> (start_offset*8)) | ((wordaddr[2] & mask2) << (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-s390-linux.s b/vacall/vacall-s390-linux.s new file mode 100644 index 0000000..0b0038f --- /dev/null +++ b/vacall/vacall-s390-linux.s @@ -0,0 +1,144 @@ + .file "vacall-s390.c" +.text + .align 4 +.globl vacall_receiver + .type vacall_receiver,@function +vacall_receiver: + stm %r6,%r15,24(%r15) + bras %r13,.LTN0_0 +.LT0_0: +.LC0: + .long vacall_function +.LC1: + .long 0 +.LC2: + .long 255 +.LC3: + .long 65535 +.LC4: + .long 1 +.LTN0_0: + l %r1,.LC0-.LT0_0(%r13) + lr %r14,%r15 + ahi %r15,-184 + lr %r11,%r15 + l %r12,0(%r1) + st %r14,0(%r15) + la %r1,280(%r11) + st %r2,132(%r11) + la %r2,96(%r11) + st %r4,140(%r11) + st %r5,144(%r11) + st %r6,148(%r11) + st %r3,136(%r11) + std %f2,176(%r11) + std %f0,168(%r11) + ste %f2,160(%r11) + ste %f0,156(%r11) + mvc 96(4,%r11),.LC1-.LT0_0(%r13) + st %r1,112(%r11) + mvc 116(4,%r11),.LC1-.LT0_0(%r13) + mvc 120(4,%r11),.LC1-.LT0_0(%r13) + mvc 128(4,%r11),.LC1-.LT0_0(%r13) + mvc 152(4,%r11),.LC1-.LT0_0(%r13) + basr %r14,%r12 + icm %r4,15,120(%r11) + je .L1 + chi %r4,1 + je .L43 + chi %r4,2 + je .L44 + chi %r4,3 + je .L43 + chi %r4,4 + je .L45 + chi %r4,5 + je .L46 + chi %r4,6 + je .L40 + chi %r4,7 + je .L40 + chi %r4,8 + je .L40 + chi %r4,9 + je .L40 + lr %r1,%r4 + ahi %r1,-10 + cl %r1,.LC4-.LT0_0(%r13) + jh .L22 + l %r2,104(%r11) + l %r3,108(%r11) +.L1: + l %r4,240(%r11) + lm %r6,%r15,208(%r11) + br %r4 +.L22: + chi %r4,12 + je .L47 + chi %r4,13 + je .L48 + chi %r4,14 + je .L40 + chi %r4,15 + jne .L1 + tm 98(%r11),4 + je .L1 + l %r1,124(%r11) + chi %r1,1 + je .L49 + chi %r1,2 + je .L50 + chi %r1,4 + je .L51 + chi %r1,8 + jne .L1 + l %r1,116(%r11) + l %r3,4(%r1) +.L39: + l %r2,0(%r1) + j .L1 +.L51: + l %r1,116(%r11) + j .L39 +.L50: + l %r1,116(%r11) + lh %r4,0(%r1) + lr %r2,%r4 +.L41: + n %r2,.LC3-.LT0_0(%r13) + j .L1 +.L49: + l %r1,116(%r11) + ic %r4,0(%r1) + lr %r2,%r4 +.L42: + n %r2,.LC2-.LT0_0(%r13) + j .L1 +.L40: + l %r2,104(%r11) + j .L1 +.L48: + ld %f0,104(%r11) + j .L1 +.L47: + le %f0,104(%r11) + j .L1 +.L46: + lh %r1,104(%r11) + lr %r2,%r1 + j .L41 +.L45: + lh %r2,104(%r11) + j .L1 +.L43: + ic %r1,104(%r11) + lr %r2,%r1 + j .L42 +.L44: + icm %r1,8,104(%r11) + lr %r2,%r1 + sra %r2,24 + j .L1 +.Lfe1: + .size vacall_receiver,.Lfe1-vacall_receiver + .ident "GCC: (GNU) 3.1" diff --git a/vacall/vacall-s390-macro.S b/vacall/vacall-s390-macro.S new file mode 100644 index 0000000..de4c35e --- /dev/null +++ b/vacall/vacall-s390-macro.S @@ -0,0 +1,146 @@ + .file "vacall-s390.c" +.text + .align 4 +.globl vacall_receiver + .type vacall_receiver,@function +vacall_receiver: + stm %r6,%r15,24(%r15) + bras %r13,.LTN0_0 +.LT0_0: +.LC0: + .long vacall_function +.LC1: + .long 0 +.LC2: + .long 255 +.LC3: + .long 65535 +.LC4: + .long 1 +.LTN0_0: + l %r1,.LC0-.LT0_0(%r13) + lr %r14,%r15 + ahi %r15,-184 + lr %r11,%r15 + l %r12,0(%r1) + st %r14,0(%r15) + la %r1,280(%r11) + st %r2,132(%r11) + la %r2,96(%r11) + st %r4,140(%r11) + st %r5,144(%r11) + st %r6,148(%r11) + st %r3,136(%r11) + std %f2,176(%r11) + std %f0,168(%r11) + ste %f2,160(%r11) + ste %f0,156(%r11) + mvc 96(4,%r11),.LC1-.LT0_0(%r13) + st %r1,112(%r11) + mvc 116(4,%r11),.LC1-.LT0_0(%r13) + mvc 120(4,%r11),.LC1-.LT0_0(%r13) + mvc 128(4,%r11),.LC1-.LT0_0(%r13) + mvc 152(4,%r11),.LC1-.LT0_0(%r13) + basr %r14,%r12 + icm %r4,15,120(%r11) + je .L1 + chi %r4,1 + je .L43 + chi %r4,2 + je .L44 + chi %r4,3 + je .L43 + chi %r4,4 + je .L45 + chi %r4,5 + je .L46 + chi %r4,6 + je .L40 + chi %r4,7 + je .L40 + chi %r4,8 + je .L40 + chi %r4,9 + je .L40 + lr %r1,%r4 + ahi %r1,-10 + cl %r1,.LC4-.LT0_0(%r13) + jh .L22 + l %r2,104(%r11) + l %r3,108(%r11) +.L1: + l %r4,240(%r11) + lm %r6,%r15,208(%r11) + br %r4 +.L22: + chi %r4,12 + je .L47 + chi %r4,13 + je .L48 + chi %r4,14 + je .L40 + chi %r4,15 + jne .L1 + tm 98(%r11),4 + je .L1 + l %r1,124(%r11) + chi %r1,1 + je .L49 + chi %r1,2 + je .L50 + chi %r1,4 + je .L51 + chi %r1,8 + jne .L1 + l %r1,116(%r11) + l %r3,4(%r1) +.L39: + l %r2,0(%r1) + j .L1 +.L51: + l %r1,116(%r11) + j .L39 +.L50: + l %r1,116(%r11) + lh %r4,0(%r1) + lr %r2,%r4 +.L41: + n %r2,.LC3-.LT0_0(%r13) + j .L1 +.L49: + l %r1,116(%r11) + ic %r4,0(%r1) + lr %r2,%r4 +.L42: + n %r2,.LC2-.LT0_0(%r13) + j .L1 +.L40: + l %r2,104(%r11) + j .L1 +.L48: + ld %f0,104(%r11) + j .L1 +.L47: + le %f0,104(%r11) + j .L1 +.L46: + lh %r1,104(%r11) + lr %r2,%r1 + j .L41 +.L45: + lh %r2,104(%r11) + j .L1 +.L43: + ic %r1,104(%r11) + lr %r2,%r1 + j .L42 +.L44: + icm %r1,8,104(%r11) + lr %r2,%r1 + sra %r2,24 + j .L1 +.Lfe1: + .size vacall_receiver,.Lfe1-vacall_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-s390.c b/vacall/vacall-s390.c new file mode 100644 index 0000000..9574c59 --- /dev/null +++ b/vacall/vacall-s390.c @@ -0,0 +1,142 @@ +/* vacall function for S/390 32-bit CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * Copyright 2000 Adam Fedor + * Copyright 2001 Gerhard Tonn + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("r0"); +#endif +register float farg1 __asm__("f0"); +register float farg2 __asm__("f2"); +register double darg1 __asm__("f0"); +register double darg2 __asm__("f2"); +register __varword iret __asm__("%r2"); +register __varword iret2 __asm__("%r3"); +register float fret __asm__("%f0"); +register double dret __asm__("%f0"); + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, + __vaword firstword) +{ + __va_alist list; + /* Move the arguments passed in registers to temp storage, since + moving them to the stack would mess up the stack */ + list.iarg[0] = word1; + list.iarg[1] = word2; + list.iarg[2] = word3; + list.iarg[3] = word4; + list.iarg[4] = word5; + + list.darg[1] = darg2; + list.darg[0] = darg1; + + list.farg[1] = farg2; + list.farg[0] = farg1; + + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&firstword; + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.ianum = 0; + list.fanum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong || list.rtype == __VAulonglong) { + iret = ((__varword *) &list.tmp._longlong)[0]; + iret2 = ((__varword *) &list.tmp._longlong)[1]; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + if (list.rsize == sizeof(char)) { + iret = *(unsigned char *) list.raddr; + } else + if (list.rsize == sizeof(short)) { + iret = *(unsigned short *) list.raddr; + } else + if (list.rsize == sizeof(int)) { + iret = *(unsigned int *) list.raddr; + } else + if (list.rsize == 2*sizeof(__varword)) { + iret = ((__varword *) list.raddr)[0]; + iret2 = ((__varword *) list.raddr)[1]; + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-s390x-linux.s b/vacall/vacall-s390x-linux.s new file mode 100644 index 0000000..a94a1a8 --- /dev/null +++ b/vacall/vacall-s390x-linux.s @@ -0,0 +1,127 @@ + .file "vacall-s390x.c" +.text + .align 8 +.globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: +.LFB0: + .cfi_startproc + stmg %r11,%r15,88(%r15) + .cfi_offset 11, -72 + .cfi_offset 12, -64 + .cfi_offset 13, -56 + .cfi_offset 14, -48 + .cfi_offset 15, -40 + aghi %r15,-320 + .cfi_def_cfa_offset 480 + lgr %r11,%r15 + .cfi_def_cfa_register 11 + larl %r1,vacall_function + lhi %r0,0 + lg %r1,0(%r1) + st %r0,160(%r11) + la %r0,480(%r11) + stg %r0,184(%r11) + lghi %r0,0 + stg %r2,224(%r11) + stg %r3,232(%r11) + stg %r4,240(%r11) + stg %r5,248(%r11) + stg %r6,256(%r11) + ste %f0,268(%r11) + ste %f2,272(%r11) + ste %f4,276(%r11) + ste %f6,280(%r11) + std %f0,288(%r11) + std %f2,296(%r11) + std %f4,304(%r11) + std %f6,312(%r11) + stg %r0,192(%r11) + st %r0,200(%r11) + st %r0,216(%r11) + st %r0,264(%r11) + la %r2,160(%r11) + basr %r14,%r1 + icm %r1,15,200(%r11) + je .L1 + chi %r1,1 + je .L18 + chi %r1,2 + je .L21 + chi %r1,3 + je .L18 + chi %r1,4 + je .L22 + chi %r1,5 + je .L23 + chi %r1,6 + je .L24 + chi %r1,7 + je .L25 + lr %r0,%r1 + nill %r0,65533 + chi %r0,8 + je .L19 + chi %r0,9 + je .L19 + chi %r1,12 + je .L26 + chi %r1,13 + je .L27 + chi %r1,14 + je .L19 +.L1: + lg %r4,432(%r11) + lmg %r11,%r15,408(%r11) + .cfi_remember_state + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_restore 11 + .cfi_def_cfa 15, 160 + br %r4 +.L18: + .cfi_restore_state + lg %r4,432(%r11) + llgc %r2,168(%r11) + lmg %r11,%r15,408(%r11) + .cfi_remember_state + .cfi_restore 11 + .cfi_restore 12 + .cfi_restore 13 + .cfi_restore 14 + .cfi_restore 15 + .cfi_def_cfa 15, 160 + br %r4 +.L21: + .cfi_restore_state + icmh %r2,8,168(%r11) + srag %r2,%r2,56 + j .L1 +.L19: + lg %r2,168(%r11) + j .L1 +.L22: + lgh %r2,168(%r11) + j .L1 +.L23: + llgh %r2,168(%r11) + j .L1 +.L24: + lgf %r2,168(%r11) + j .L1 +.L26: + le %f0,168(%r11) + j .L1 +.L25: + llgf %r2,168(%r11) + j .L1 +.L27: + ld %f0,168(%r11) + j .L1 + .cfi_endproc +.LFE0: + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/vacall/vacall-s390x-macro.S b/vacall/vacall-s390x-macro.S new file mode 100644 index 0000000..bd0c96c --- /dev/null +++ b/vacall/vacall-s390x-macro.S @@ -0,0 +1,128 @@ + .file "vacall-s390x.c" +.text + .align 8 +.globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: +.LFB0: + .cfi_startproc + stmg %r11,%r15,88(%r15) + .cfi_offset 11, -72 + .cfi_offset 12, -64 + .cfi_offset 13, -56 + .cfi_offset 14, -48 + .cfi_offset 15, -40 + aghi %r15,-320 + .cfi_def_cfa_offset 480 + lgr %r11,%r15 + .cfi_def_cfa_register 11 + larl %r1,vacall_function + lhi %r0,0 + lg %r1,0(%r1) + st %r0,160(%r11) + la %r0,480(%r11) + stg %r0,184(%r11) + lghi %r0,0 + stg %r2,224(%r11) + stg %r3,232(%r11) + stg %r4,240(%r11) + stg %r5,248(%r11) + stg %r6,256(%r11) + ste %f0,268(%r11) + ste %f2,272(%r11) + ste %f4,276(%r11) + ste %f6,280(%r11) + std %f0,288(%r11) + std %f2,296(%r11) + std %f4,304(%r11) + std %f6,312(%r11) + stg %r0,192(%r11) + st %r0,200(%r11) + st %r0,216(%r11) + st %r0,264(%r11) + la %r2,160(%r11) + basr %r14,%r1 + icm %r1,15,200(%r11) + je .L1 + chi %r1,1 + je .L18 + chi %r1,2 + je .L21 + chi %r1,3 + je .L18 + chi %r1,4 + je .L22 + chi %r1,5 + je .L23 + chi %r1,6 + je .L24 + chi %r1,7 + je .L25 + lr %r0,%r1 + nill %r0,65533 + chi %r0,8 + je .L19 + chi %r0,9 + je .L19 + chi %r1,12 + je .L26 + chi %r1,13 + je .L27 + chi %r1,14 + je .L19 +.L1: + lg %r4,432(%r11) + lmg %r11,%r15,408(%r11) + .cfi_remember_state + .cfi_restore 15 + .cfi_restore 14 + .cfi_restore 13 + .cfi_restore 12 + .cfi_restore 11 + .cfi_def_cfa 15, 160 + br %r4 +.L18: + .cfi_restore_state + lg %r4,432(%r11) + llgc %r2,168(%r11) + lmg %r11,%r15,408(%r11) + .cfi_remember_state + .cfi_restore 11 + .cfi_restore 12 + .cfi_restore 13 + .cfi_restore 14 + .cfi_restore 15 + .cfi_def_cfa 15, 160 + br %r4 +.L21: + .cfi_restore_state + icmh %r2,8,168(%r11) + srag %r2,%r2,56 + j .L1 +.L19: + lg %r2,168(%r11) + j .L1 +.L22: + lgh %r2,168(%r11) + j .L1 +.L23: + llgh %r2,168(%r11) + j .L1 +.L24: + lgf %r2,168(%r11) + j .L1 +.L26: + le %f0,168(%r11) + j .L1 +.L25: + llgf %r2,168(%r11) + j .L1 +.L27: + ld %f0,168(%r11) + j .L1 + .cfi_endproc +.LFE0: + .size vacall_receiver, .-vacall_receiver +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-s390x.c b/vacall/vacall-s390x.c new file mode 100644 index 0000000..2a16b4b --- /dev/null +++ b/vacall/vacall-s390x.c @@ -0,0 +1,134 @@ +/* vacall function for s390x (S/390 64-bit) CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("r0"); +#endif + +register __varword iarg1 __asm__("r2"); +register __varword iarg2 __asm__("r3"); +register __varword iarg3 __asm__("r4"); +register __varword iarg4 __asm__("r5"); +register __varword iarg5 __asm__("r6"); + +register float farg1 __asm__("f0"); +register float farg2 __asm__("f2"); +register float farg3 __asm__("f4"); +register float farg4 __asm__("f6"); + +register double darg1 __asm__("f0"); +register double darg2 __asm__("f2"); +register double darg3 __asm__("f4"); +register double darg4 __asm__("f6"); + +register __varword iret __asm__("r2"); +register float fret __asm__("f0"); +register double dret __asm__("f0"); + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, + __vaword firstword) +{ + __va_alist list; + /* Move the arguments passed in registers to temp storage. */ + list.iarg[0] = iarg1; + list.iarg[1] = iarg2; + list.iarg[2] = iarg3; + list.iarg[3] = iarg4; + list.iarg[4] = iarg5; + list.farg[0] = farg1; + list.farg[1] = farg2; + list.farg[2] = farg3; + list.farg[3] = farg4; + list.darg[0] = darg1; + list.darg[1] = darg2; + list.darg[2] = darg3; + list.darg[3] = darg4; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&firstword; + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.ianum = 0; + list.fanum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong || list.rtype == __VAlonglong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong || list.rtype == __VAulonglong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + /* normal struct return convention */ + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-sparc-linux-pic.s b/vacall/vacall-sparc-linux-pic.s new file mode 100644 index 0000000..48f6d61 --- /dev/null +++ b/vacall/vacall-sparc-linux-pic.s @@ -0,0 +1,138 @@ + .file "vacall-sparc.c" + .section ".text" + .align 4 +.LLGETPC0: + retl + add %o7, %l7, %l7 + .align 4 + .global vacall_receiver + .type vacall_receiver,#function + .proc 020 +vacall_receiver: + !#PROLOGUE# 0 + save %sp, -144, %sp + sethi %hi(vacall_function), %o0 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7 + call .LLGETPC0 + add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7 + or %o0, %lo(vacall_function), %o0 + ld [%l7+%o0], %o1 + st %i2, [%fp+76] + ld [%o1], %o2 + add %fp, 68, %o0 + ld [%fp+64], %o1 + st %o0, [%fp-32] + st %o1, [%fp-16] + st %i3, [%fp+80] + st %i4, [%fp+84] + st %i5, [%fp+88] + st %i0, [%fp+68] + st %i1, [%fp+72] + st %g0, [%fp-48] + st %g0, [%fp-28] + st %g0, [%fp-24] + call %o2, 0 + add %fp, -48, %o0 + ld [%fp-24], %o1 + cmp %o1, 0 + be .LL1 + cmp %o1, 1 + be .LL44 + cmp %o1, 2 + be .LL44 + cmp %o1, 3 + be .LL45 + cmp %o1, 4 + be .LL46 + cmp %o1, 5 + be .LL47 + cmp %o1, 6 + be .LL43 + cmp %o1, 7 + be .LL43 + cmp %o1, 8 + be .LL43 + cmp %o1, 9 + be .LL43 + add %o1, -10, %o0 + cmp %o0, 1 + bgu .LL22 + cmp %o1, 12 + ld [%fp-40], %i0 + b .LL1 + ld [%fp-36], %i1 +.LL22: + be .LL48 + cmp %o1, 13 + be .LL49 + cmp %o1, 14 + be .LL43 + cmp %o1, 15 + bne .LL1 + ld [%fp-48], %o0 + andcc %o0, 16, %g0 + be .LL33 + andcc %o0, 2, %g0 + ld [%fp-20], %o0 + ld [%i7+8], %o1 + and %o0, 4095, %o0 + cmp %o0, %o1 + bne .LL1 + ld [%fp-28], %i0 + b .LL1 + add %i7, 4, %i7 +.LL33: + be,a .LL1 + add %i7, 4, %i7 + ld [%fp-20], %o0 + cmp %o0, 1 + be .LL50 + cmp %o0, 2 + be .LL51 + cmp %o0, 4 + bne,a .LL1 + add %i7, 4, %i7 + ld [%fp-28], %o0 + b .LL1 + ld [%o0], %i0 +.LL51: + ld [%fp-28], %o0 + b .LL1 + lduh [%o0], %i0 +.LL50: + ld [%fp-28], %o0 + b .LL1 + ldub [%o0], %i0 +.LL43: + b .LL1 + ld [%fp-40], %i0 +.LL49: + b .LL1 + ldd [%fp-40], %f0 +.LL48: + ld [%fp-48], %o0 + andcc %o0, 32, %g0 + be,a .LL1 + ld [%fp-40], %f0 + ld [%fp-40], %f2 + b .LL1 + fstod %f2, %f0 +.LL47: + b .LL1 + lduh [%fp-40], %i0 +.LL46: + b .LL1 + ldsh [%fp-40], %i0 +.LL45: + b .LL1 + ldub [%fp-40], %i0 +.LL44: + ldsb [%fp-40], %i0 +.LL38: +.LL1: + nop + ret + restore +.LLfe1: + .size vacall_receiver,.LLfe1-vacall_receiver + .ident "GCC: (GNU) 3.1" diff --git a/vacall/vacall-sparc-linux.s b/vacall/vacall-sparc-linux.s new file mode 100644 index 0000000..770fd06 --- /dev/null +++ b/vacall/vacall-sparc-linux.s @@ -0,0 +1,130 @@ + .file "vacall-sparc.c" + .section ".text" + .align 4 + .global vacall_receiver + .type vacall_receiver,#function + .proc 020 +vacall_receiver: + !#PROLOGUE# 0 + save %sp, -144, %sp + !#PROLOGUE# 1 + sethi %hi(vacall_function), %o0 + ld [%o0+%lo(vacall_function)], %o2 + st %i2, [%fp+76] + add %fp, 68, %o0 + ld [%fp+64], %o1 + st %o0, [%fp-32] + st %o1, [%fp-16] + st %i3, [%fp+80] + st %i4, [%fp+84] + st %i5, [%fp+88] + st %i0, [%fp+68] + st %i1, [%fp+72] + st %g0, [%fp-48] + st %g0, [%fp-28] + st %g0, [%fp-24] + call %o2, 0 + add %fp, -48, %o0 + ld [%fp-24], %o1 + cmp %o1, 0 + be .LL1 + cmp %o1, 1 + be .LL44 + cmp %o1, 2 + be .LL44 + cmp %o1, 3 + be .LL45 + cmp %o1, 4 + be .LL46 + cmp %o1, 5 + be .LL47 + cmp %o1, 6 + be .LL43 + cmp %o1, 7 + be .LL43 + cmp %o1, 8 + be .LL43 + cmp %o1, 9 + be .LL43 + add %o1, -10, %o0 + cmp %o0, 1 + bgu .LL22 + cmp %o1, 12 + ld [%fp-40], %i0 + b .LL1 + ld [%fp-36], %i1 +.LL22: + be .LL48 + cmp %o1, 13 + be .LL49 + cmp %o1, 14 + be .LL43 + cmp %o1, 15 + bne .LL1 + ld [%fp-48], %o0 + andcc %o0, 16, %g0 + be .LL33 + andcc %o0, 2, %g0 + ld [%fp-20], %o0 + ld [%i7+8], %o1 + and %o0, 4095, %o0 + cmp %o0, %o1 + bne .LL1 + ld [%fp-28], %i0 + b .LL1 + add %i7, 4, %i7 +.LL33: + be,a .LL1 + add %i7, 4, %i7 + ld [%fp-20], %o0 + cmp %o0, 1 + be .LL50 + cmp %o0, 2 + be .LL51 + cmp %o0, 4 + bne,a .LL1 + add %i7, 4, %i7 + ld [%fp-28], %o0 + b .LL1 + ld [%o0], %i0 +.LL51: + ld [%fp-28], %o0 + b .LL1 + lduh [%o0], %i0 +.LL50: + ld [%fp-28], %o0 + b .LL1 + ldub [%o0], %i0 +.LL43: + b .LL1 + ld [%fp-40], %i0 +.LL49: + b .LL1 + ldd [%fp-40], %f0 +.LL48: + ld [%fp-48], %o0 + andcc %o0, 32, %g0 + be,a .LL1 + ld [%fp-40], %f0 + ld [%fp-40], %f2 + b .LL1 + fstod %f2, %f0 +.LL47: + b .LL1 + lduh [%fp-40], %i0 +.LL46: + b .LL1 + ldsh [%fp-40], %i0 +.LL45: + b .LL1 + ldub [%fp-40], %i0 +.LL44: + ldsb [%fp-40], %i0 +.LL38: +.LL1: + nop + ret + restore +.LLfe1: + .size vacall_receiver,.LLfe1-vacall_receiver + .ident "GCC: (GNU) 3.1" diff --git a/vacall/vacall-sparc-macro.S b/vacall/vacall-sparc-macro.S new file mode 100644 index 0000000..d776589 --- /dev/null +++ b/vacall/vacall-sparc-macro.S @@ -0,0 +1,271 @@ +#include "asm-sparc.h" +#ifdef __PIC__ + .section ".text" + .align 4 +L(LGETPC0): + retl + add %o7, %l7, %l7 + .align 4 + .global C(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) + .proc 020 +FUNBEGIN(vacall_receiver) + !$PROLOGUE$ 0 + save %sp, -144, %sp + sethi %hi(C(vacall_function)), %o0 + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7 + call L(LGETPC0) + add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7 + or %o0, %lo(C(vacall_function)), %o0 + ld [%l7+%o0], %o1 + st %i2, [%fp+76] + ld [%o1], %o2 + add %fp, 68, %o0 + ld [%fp+64], %o1 + st %o0, [%fp-32] + st %o1, [%fp-16] + st %i3, [%fp+80] + st %i4, [%fp+84] + st %i5, [%fp+88] + st %i0, [%fp+68] + st %i1, [%fp+72] + st %g0, [%fp-48] + st %g0, [%fp-28] + st %g0, [%fp-24] + call %o2, 0 + add %fp, -48, %o0 + ld [%fp-24], %o1 + cmp %o1, 0 + be L(L1) + cmp %o1, 1 + be L(L44) + cmp %o1, 2 + be L(L44) + cmp %o1, 3 + be L(L45) + cmp %o1, 4 + be L(L46) + cmp %o1, 5 + be L(L47) + cmp %o1, 6 + be L(L43) + cmp %o1, 7 + be L(L43) + cmp %o1, 8 + be L(L43) + cmp %o1, 9 + be L(L43) + add %o1, -10, %o0 + cmp %o0, 1 + bgu L(L22) + cmp %o1, 12 + ld [%fp-40], %i0 + b L(L1) + ld [%fp-36], %i1 +L(L22): + be L(L48) + cmp %o1, 13 + be L(L49) + cmp %o1, 14 + be L(L43) + cmp %o1, 15 + bne L(L1) + ld [%fp-48], %o0 + andcc %o0, 16, %g0 + be L(L33) + andcc %o0, 2, %g0 + ld [%fp-20], %o0 + ld [%i7+8], %o1 + and %o0, 4095, %o0 + cmp %o0, %o1 + bne L(L1) + ld [%fp-28], %i0 + b L(L1) + add %i7, 4, %i7 +L(L33): + be,a L(L1) + add %i7, 4, %i7 + ld [%fp-20], %o0 + cmp %o0, 1 + be L(L50) + cmp %o0, 2 + be L(L51) + cmp %o0, 4 + bne,a L(L1) + add %i7, 4, %i7 + ld [%fp-28], %o0 + b L(L1) + ld [%o0], %i0 +L(L51): + ld [%fp-28], %o0 + b L(L1) + lduh [%o0], %i0 +L(L50): + ld [%fp-28], %o0 + b L(L1) + ldub [%o0], %i0 +L(L43): + b L(L1) + ld [%fp-40], %i0 +L(L49): + b L(L1) + ldd [%fp-40], %f0 +L(L48): + ld [%fp-48], %o0 + andcc %o0, 32, %g0 + be,a L(L1) + ld [%fp-40], %f0 + ld [%fp-40], %f2 + b L(L1) + fstod %f2, %f0 +L(L47): + b L(L1) + lduh [%fp-40], %i0 +L(L46): + b L(L1) + ldsh [%fp-40], %i0 +L(L45): + b L(L1) + ldub [%fp-40], %i0 +L(L44): + ldsb [%fp-40], %i0 +L(L38): +L(L1): + nop + ret + restore +L(Lfe1): + FUNEND(vacall_receiver) +#else + .section ".text" + .align 4 + .global C(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) + .proc 020 +FUNBEGIN(vacall_receiver) + !$PROLOGUE$ 0 + save %sp, -144, %sp + !$PROLOGUE$ 1 + sethi %hi(C(vacall_function)), %o0 + ld [%o0+%lo(C(vacall_function))], %o2 + st %i2, [%fp+76] + add %fp, 68, %o0 + ld [%fp+64], %o1 + st %o0, [%fp-32] + st %o1, [%fp-16] + st %i3, [%fp+80] + st %i4, [%fp+84] + st %i5, [%fp+88] + st %i0, [%fp+68] + st %i1, [%fp+72] + st %g0, [%fp-48] + st %g0, [%fp-28] + st %g0, [%fp-24] + call %o2, 0 + add %fp, -48, %o0 + ld [%fp-24], %o1 + cmp %o1, 0 + be L(L1) + cmp %o1, 1 + be L(L44) + cmp %o1, 2 + be L(L44) + cmp %o1, 3 + be L(L45) + cmp %o1, 4 + be L(L46) + cmp %o1, 5 + be L(L47) + cmp %o1, 6 + be L(L43) + cmp %o1, 7 + be L(L43) + cmp %o1, 8 + be L(L43) + cmp %o1, 9 + be L(L43) + add %o1, -10, %o0 + cmp %o0, 1 + bgu L(L22) + cmp %o1, 12 + ld [%fp-40], %i0 + b L(L1) + ld [%fp-36], %i1 +L(L22): + be L(L48) + cmp %o1, 13 + be L(L49) + cmp %o1, 14 + be L(L43) + cmp %o1, 15 + bne L(L1) + ld [%fp-48], %o0 + andcc %o0, 16, %g0 + be L(L33) + andcc %o0, 2, %g0 + ld [%fp-20], %o0 + ld [%i7+8], %o1 + and %o0, 4095, %o0 + cmp %o0, %o1 + bne L(L1) + ld [%fp-28], %i0 + b L(L1) + add %i7, 4, %i7 +L(L33): + be,a L(L1) + add %i7, 4, %i7 + ld [%fp-20], %o0 + cmp %o0, 1 + be L(L50) + cmp %o0, 2 + be L(L51) + cmp %o0, 4 + bne,a L(L1) + add %i7, 4, %i7 + ld [%fp-28], %o0 + b L(L1) + ld [%o0], %i0 +L(L51): + ld [%fp-28], %o0 + b L(L1) + lduh [%o0], %i0 +L(L50): + ld [%fp-28], %o0 + b L(L1) + ldub [%o0], %i0 +L(L43): + b L(L1) + ld [%fp-40], %i0 +L(L49): + b L(L1) + ldd [%fp-40], %f0 +L(L48): + ld [%fp-48], %o0 + andcc %o0, 32, %g0 + be,a L(L1) + ld [%fp-40], %f0 + ld [%fp-40], %f2 + b L(L1) + fstod %f2, %f0 +L(L47): + b L(L1) + lduh [%fp-40], %i0 +L(L46): + b L(L1) + ldsh [%fp-40], %i0 +L(L45): + b L(L1) + ldub [%fp-40], %i0 +L(L44): + ldsb [%fp-40], %i0 +L(L38): +L(L1): + nop + ret + restore +L(Lfe1): + FUNEND(vacall_receiver) +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-sparc.c b/vacall/vacall-sparc.c new file mode 100644 index 0000000..26a60c4 --- /dev/null +++ b/vacall/vacall-sparc.c @@ -0,0 +1,141 @@ +/* vacall function for sparc CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("%g2"); +#endif +register __vaword* fp __asm__("%fp"); /* our %fp, caller's %sp */ +register __vaword* ret __asm__("%i7"); /* %i7+8 = return address */ +register __varword iret __asm__("%i0"); +register __varword iret2 __asm__("%i1"); +register float fret __asm__("%f0"); /* %f0 */ +register double dret __asm__("%f0"); /* %f0,%f1 */ + +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, __vaword word6, + __vaword firstword) +{ + __va_alist list; + /* gcc-2.6.3 source says: When a parameter is passed in a register, + * stack space is still allocated for it. + */ + /* Move the arguments passed in registers to their stack locations. */ + (&firstword)[-6] = word1; + (&firstword)[-5] = word2; + (&firstword)[-4] = word3; + (&firstword)[-3] = word4; + (&firstword)[-2] = word5; + (&firstword)[-1] = word6; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)(&firstword - 6); + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.structraddr = (void*)((&firstword)[-7]); /* = (void*) fp[16] */ + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong || list.rtype == __VAulonglong) { + iret = ((__varword *) &list.tmp._longlong)[0]; + iret2 = ((__varword *) &list.tmp._longlong)[1]; + } else + if (list.rtype == __VAfloat) { + if (list.flags & __VA_SUNCC_FLOAT_RETURN) { + dret = (double)list.tmp._float; + } else { + fret = list.tmp._float; + } + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_SUNPROCC_STRUCT_RETURN) { + /* Sun cc struct return convention. */ + /* The desired struct return address was passed in fp[16], later on + * list.raddr = list.structraddr = fp[16]. Now the result has + * already been copied there. No need to copy the result once more. + * The caller expects to receive the struct return address in %o0. + */ + iret = (long) list.raddr; + if ((list.rsize & 0xfff) == ret[2]) + ret++; /* skip the "unimp n" instruction at the return address */ + /* else the "unimp n" instruction will cause a core dump */ + } else { + /* normal struct return convention */ + if (list.flags & __VA_SMALL_STRUCT_RETURN) { + if (list.rsize == sizeof(char)) { + iret = *(unsigned char *) list.raddr; + goto done; + } else + if (list.rsize == sizeof(short)) { + iret = *(unsigned short *) list.raddr; + goto done; + } else + if (list.rsize == sizeof(int)) { + iret = *(unsigned int *) list.raddr; + goto done; + } + } + ret++; /* skip the "unimp n" instruction at the return address */ + done: ; + } + } +} diff --git a/vacall/vacall-sparc64-linux-pic.s b/vacall/vacall-sparc64-linux-pic.s new file mode 100644 index 0000000..6d22787 --- /dev/null +++ b/vacall/vacall-sparc64-linux-pic.s @@ -0,0 +1,328 @@ + .file "vacall-sparc64.c" + .section ".text" + .align 4 +.LLADDPC0: + jmp %o7+8 + add %o7, %l7, %l7 + .align 4 + .global vacall_receiver + .type vacall_receiver, #function + .proc 020 +vacall_receiver: + .register %g2, #scratch + .register %g3, #scratch + save %sp, -448, %sp + add %fp, 2175, %g1 + stx %i0, [%fp+2175] + stx %i1, [%fp+2183] + stx %i2, [%fp+2191] + stx %i3, [%fp+2199] + stx %i4, [%fp+2207] + stx %i5, [%fp+2215] + std %f0, [%fp+1903] + std %f2, [%fp+1911] + std %f4, [%fp+1919] + std %f6, [%fp+1927] + std %f8, [%fp+1935] + std %f10, [%fp+1943] + std %f12, [%fp+1951] + std %f14, [%fp+1959] + std %f16, [%fp+1967] + std %f18, [%fp+1975] + std %f20, [%fp+1983] + std %f22, [%fp+1991] + std %f24, [%fp+1999] + std %f26, [%fp+2007] + std %f28, [%fp+2015] + std %f30, [%fp+2023] + st %f1, [%fp+1835] + st %f3, [%fp+1839] + st %f5, [%fp+1843] + st %f7, [%fp+1847] + st %f9, [%fp+1851] + st %f11, [%fp+1855] + st %f13, [%fp+1859] + st %f15, [%fp+1863] + st %f17, [%fp+1867] + st %f19, [%fp+1871] + st %f21, [%fp+1875] + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7 + call .LLADDPC0 + add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7 + st %f23, [%fp+1879] + stx %g1, [%fp+1799] + sethi %hi(vacall_function), %g1 + or %g1, %lo(vacall_function), %g1 + st %f25, [%fp+1883] + ldx [%l7+%g1], %g2 + st %f27, [%fp+1887] + st %f29, [%fp+1891] + st %f31, [%fp+1895] + st %g0, [%fp+1775] + stx %g0, [%fp+1807] + st %g0, [%fp+1815] + st %g0, [%fp+1831] + ldx [%g2], %g3 + call %g3, 0 + add %fp, 1775, %o0 + lduw [%fp+1815], %g1 + cmp %g1, 0 + be,pn %icc, .LL61 + cmp %g1, 1 + be,pn %icc, .LL50 + cmp %g1, 2 + be,pn %icc, .LL50 + cmp %g1, 3 + be,pn %icc, .LL53 + cmp %g1, 4 + be,pn %icc, .LL54 + cmp %g1, 5 + be,pn %icc, .LL55 + cmp %g1, 6 + be,pn %icc, .LL56 + cmp %g1, 7 + be,pn %icc, .LL57 + cmp %g1, 8 + be,pn %icc, .LL51 + cmp %g1, 9 + be,pn %icc, .LL51 + cmp %g1, 10 + be,pn %icc, .LL51 + cmp %g1, 11 + be,pn %icc, .LL51 + cmp %g1, 12 + be,pn %icc, .LL58 + cmp %g1, 13 + be,pn %icc, .LL59 + cmp %g1, 14 + be,pn %icc, .LL51 + cmp %g1, 15 + bne,pt %icc, .LL61 + lduw [%fp+1775], %g1 + andcc %g1, 1024, %g0 + be,pn %xcc, .LL61 + ldx [%fp+1823], %g5 + add %g5, -1, %g1 + cmp %g1, 31 + bgu,pn %xcc, .LL61 + ldx [%fp+1807], %g1 + cmp %g5, 8 + and %g1, 7, %o2 + and %g1, -8, %l0 + bgu,pt %xcc, .LL35 + add %g5, %o2, %g2 + cmp %g2, 8 + bgu,pt %xcc, .LL37 + sllx %o2, 3, %g4 + sllx %g2, 3, %g2 + ldx [%l0], %g3 + sub %g0, %g2, %g2 + mov -1, %g1 + sllx %g1, %g2, %g1 + and %g1, %g3, %g1 + return %i7+8 + sllx %g1, %g4, %o0 +.LL47: + ldx [%l0], %g1 + sllx %g1, %o4, %g1 + ldx [%l0+8], %g4 + ldx [%l0+16], %g5 + sllx %g4, %o4, %o1 + sllx %g5, %o4, %o0 + ldx [%l0+24], %o5 + sllx %g2, 3, %o3 + sllx %o5, %o4, %o7 + ldx [%l0+32], %o2 + sub %g0, %o3, %o3 + mov 64, %g3 + sub %g3, %o4, %g3 + srax %g4, %g3, %g4 + srax %g5, %g3, %g5 + or %g1, %g4, %i0 + srax %o5, %g3, %o5 + mov -1, %g1 + or %o1, %g5, %i1 + sllx %g1, %o3, %g1 + or %o0, %o5, %i2 + and %g1, %o2, %g1 + srax %g1, %g3, %g1 + or %o7, %g1, %i3 +.LL61: + return %i7+8 + nop +.LL50: + ldsb [%fp+1783], %i0 + return %i7+8 + nop +.LL54: + ldsh [%fp+1783], %i0 + return %i7+8 + nop +.LL53: + ldub [%fp+1783], %i0 + return %i7+8 + nop +.LL51: + ldx [%fp+1783], %i0 + return %i7+8 + nop +.LL55: + lduh [%fp+1783], %i0 + return %i7+8 + nop +.LL56: + ldsw [%fp+1783], %i0 + return %i7+8 + nop +.LL57: + lduw [%fp+1783], %i0 + return %i7+8 + nop +.LL58: + ld [%fp+1783], %f0 + return %i7+8 + nop +.LL59: + ldd [%fp+1783], %f0 + return %i7+8 + nop +.LL35: + cmp %g5, 16 + bgu,pt %xcc, .LL39 + cmp %g5, 24 + cmp %g2, 16 + bgu,pt %xcc, .LL41 + sllx %o2, 3, %o5 + sllx %g2, 3, %g3 + ldx [%l0+8], %g2 + sll %o2, 3, %g5 + sllx %o2, 2, %o5 + sub %g0, %g3, %g3 + ldx [%l0], %g4 + mov -1, %g1 + sllx %g4, %g5, %g4 + sllx %g1, %g3, %g1 + and %g1, %g2, %g1 + mov 32, %g2 + sllx %g1, %g5, %i1 + sub %g2, %o5, %g2 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + return %i7+8 + or %g4, %g1, %o0 +.LL37: + sllx %g2, 3, %g3 + ldx [%l0+8], %g5 + sub %g0, %g3, %g3 + sub %g0, %g4, %o5 + ldx [%l0], %g2 + mov -1, %g1 + sllx %g2, %g4, %g2 + sllx %g1, %g3, %g1 + and %g1, %g5, %g1 + srax %g1, %o5, %g1 + return %i7+8 + or %g2, %g1, %o0 +.LL39: + bgu,pt %xcc, .LL43 + cmp %g2, 32 + cmp %g2, 24 + bgu,pt %xcc, .LL45 + sllx %o2, 3, %o4 + sllx %o2, 2, %g1 + sll %o2, 3, %g5 + sllx %g2, 3, %o5 + ldx [%l0+8], %g3 + ldx [%l0+16], %o4 + sllx %g3, %g5, %o3 + sub %g0, %o5, %o5 + mov 32, %g4 + ldx [%l0], %g2 + sub %g4, %g1, %g4 + sllx %g2, %g5, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + srax %g3, %g4, %g3 + sllx %g1, %o5, %g1 + and %g1, %o4, %g1 + sllx %g1, %g5, %i2 + srax %g1, %g4, %g1 + srax %g1, %g4, %g1 + or %o3, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +.LL41: + sllx %g2, 3, %g5 + ldx [%l0+8], %g3 + ldx [%l0+16], %o4 + sllx %g3, %o5, %o3 + sub %g0, %g5, %g5 + mov 64, %g4 + ldx [%l0], %g2 + sub %g4, %o5, %g4 + sllx %g2, %o5, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + sllx %g1, %g5, %g1 + and %g1, %o4, %g1 + srax %g1, %g4, %g1 + or %o3, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +.LL45: + ldx [%l0], %g1 + sllx %g1, %o4, %g1 + ldx [%l0+8], %g3 + ldx [%l0+16], %g4 + sllx %g3, %o4, %o3 + sllx %g4, %o4, %o1 + sllx %g2, 3, %o5 + ldx [%l0+24], %o2 + sub %g0, %o5, %o5 + mov 64, %g5 + sub %g5, %o4, %g5 + srax %g3, %g5, %g3 + srax %g4, %g5, %g4 + or %g1, %g3, %i0 + or %o3, %g4, %i1 + mov -1, %g1 + sllx %g1, %o5, %g1 + and %g1, %o2, %g1 + srax %g1, %g5, %g1 + or %o1, %g1, %i2 + return %i7+8 + nop +.LL43: + bgu,pt %xcc, .LL47 + sllx %o2, 3, %o4 + sll %o2, 3, %o5 + ldx [%l0], %g1 + sllx %g1, %o5, %g1 + sllx %o2, 2, %o4 + sllx %g2, 3, %g5 + ldx [%l0+8], %g3 + ldx [%l0+16], %g4 + sllx %g3, %o5, %o2 + sllx %g4, %o5, %o1 + ldx [%l0+24], %o3 + sub %g0, %g5, %g5 + mov 32, %g2 + sub %g2, %o4, %g2 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + or %g1, %g3, %i0 + or %o2, %g4, %i1 + mov -1, %g1 + sllx %g1, %g5, %g1 + and %g1, %o3, %g1 + sllx %g1, %o5, %i3 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + or %o1, %g1, %i2 + return %i7+8 + nop + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 4.0.2" + .section ".note.GNU-stack" diff --git a/vacall/vacall-sparc64-linux.s b/vacall/vacall-sparc64-linux.s new file mode 100644 index 0000000..92c18cf --- /dev/null +++ b/vacall/vacall-sparc64-linux.s @@ -0,0 +1,323 @@ + .file "vacall-sparc64.c" + .section ".text" + .align 4 + .global vacall_receiver + .type vacall_receiver, #function + .proc 020 +vacall_receiver: + .register %g2, #scratch + .register %g3, #scratch + save %sp, -448, %sp + add %fp, 2175, %g1 + stx %i0, [%fp+2175] + stx %i1, [%fp+2183] + stx %i2, [%fp+2191] + stx %i3, [%fp+2199] + stx %i4, [%fp+2207] + stx %i5, [%fp+2215] + std %f0, [%fp+1903] + std %f2, [%fp+1911] + std %f4, [%fp+1919] + std %f6, [%fp+1927] + std %f8, [%fp+1935] + std %f10, [%fp+1943] + std %f12, [%fp+1951] + std %f14, [%fp+1959] + std %f16, [%fp+1967] + std %f18, [%fp+1975] + std %f20, [%fp+1983] + std %f22, [%fp+1991] + std %f24, [%fp+1999] + std %f26, [%fp+2007] + std %f28, [%fp+2015] + std %f30, [%fp+2023] + st %f1, [%fp+1835] + st %f3, [%fp+1839] + st %f5, [%fp+1843] + st %f7, [%fp+1847] + st %f9, [%fp+1851] + st %f11, [%fp+1855] + st %f13, [%fp+1859] + st %f15, [%fp+1863] + st %f17, [%fp+1867] + st %f19, [%fp+1871] + st %f21, [%fp+1875] + sethi %lm(vacall_function), %g2 + st %f23, [%fp+1879] + stx %g1, [%fp+1799] + st %f25, [%fp+1883] + st %f27, [%fp+1887] + st %f29, [%fp+1891] + st %f31, [%fp+1895] + st %g0, [%fp+1775] + stx %g0, [%fp+1807] + st %g0, [%fp+1815] + st %g0, [%fp+1831] + sethi %hh(vacall_function), %g1 + or %g1, %hm(vacall_function), %g1 + sllx %g1, 32, %g1 + add %g1, %g2, %g1 + ldx [%g1+%lo(vacall_function)], %g3 + call %g3, 0 + add %fp, 1775, %o0 + lduw [%fp+1815], %g1 + cmp %g1, 0 + be,pn %icc, .LL61 + cmp %g1, 1 + be,pn %icc, .LL50 + cmp %g1, 2 + be,pn %icc, .LL50 + cmp %g1, 3 + be,pn %icc, .LL53 + cmp %g1, 4 + be,pn %icc, .LL54 + cmp %g1, 5 + be,pn %icc, .LL55 + cmp %g1, 6 + be,pn %icc, .LL56 + cmp %g1, 7 + be,pn %icc, .LL57 + cmp %g1, 8 + be,pn %icc, .LL51 + cmp %g1, 9 + be,pn %icc, .LL51 + cmp %g1, 10 + be,pn %icc, .LL51 + cmp %g1, 11 + be,pn %icc, .LL51 + cmp %g1, 12 + be,pn %icc, .LL58 + cmp %g1, 13 + be,pn %icc, .LL59 + cmp %g1, 14 + be,pn %icc, .LL51 + cmp %g1, 15 + bne,pt %icc, .LL61 + lduw [%fp+1775], %g1 + andcc %g1, 1024, %g0 + be,pn %xcc, .LL61 + ldx [%fp+1823], %g5 + add %g5, -1, %g1 + cmp %g1, 31 + bgu,pn %xcc, .LL61 + ldx [%fp+1807], %g1 + cmp %g5, 8 + and %g1, 7, %o2 + and %g1, -8, %l0 + bgu,pt %xcc, .LL35 + add %g5, %o2, %g2 + cmp %g2, 8 + bgu,pt %xcc, .LL37 + sllx %o2, 3, %g4 + sllx %g2, 3, %g2 + ldx [%l0], %g3 + sub %g0, %g2, %g2 + mov -1, %g1 + sllx %g1, %g2, %g1 + and %g1, %g3, %g1 + return %i7+8 + sllx %g1, %g4, %o0 +.LL47: + ldx [%l0], %g1 + sllx %g1, %o4, %g1 + ldx [%l0+8], %g4 + ldx [%l0+16], %g5 + sllx %g4, %o4, %o1 + sllx %g5, %o4, %o0 + ldx [%l0+24], %o5 + sllx %g2, 3, %o3 + sllx %o5, %o4, %o7 + ldx [%l0+32], %o2 + sub %g0, %o3, %o3 + mov 64, %g3 + sub %g3, %o4, %g3 + srax %g4, %g3, %g4 + srax %g5, %g3, %g5 + or %g1, %g4, %i0 + srax %o5, %g3, %o5 + mov -1, %g1 + or %o1, %g5, %i1 + sllx %g1, %o3, %g1 + or %o0, %o5, %i2 + and %g1, %o2, %g1 + srax %g1, %g3, %g1 + or %o7, %g1, %i3 +.LL61: + return %i7+8 + nop +.LL50: + ldsb [%fp+1783], %i0 + return %i7+8 + nop +.LL54: + ldsh [%fp+1783], %i0 + return %i7+8 + nop +.LL53: + ldub [%fp+1783], %i0 + return %i7+8 + nop +.LL51: + ldx [%fp+1783], %i0 + return %i7+8 + nop +.LL55: + lduh [%fp+1783], %i0 + return %i7+8 + nop +.LL56: + ldsw [%fp+1783], %i0 + return %i7+8 + nop +.LL57: + lduw [%fp+1783], %i0 + return %i7+8 + nop +.LL58: + ld [%fp+1783], %f0 + return %i7+8 + nop +.LL59: + ldd [%fp+1783], %f0 + return %i7+8 + nop +.LL35: + cmp %g5, 16 + bgu,pt %xcc, .LL39 + cmp %g5, 24 + cmp %g2, 16 + bgu,pt %xcc, .LL41 + sllx %o2, 3, %o5 + sllx %g2, 3, %g3 + ldx [%l0+8], %g2 + sll %o2, 3, %g5 + sllx %o2, 2, %o5 + sub %g0, %g3, %g3 + ldx [%l0], %g4 + mov -1, %g1 + sllx %g4, %g5, %g4 + sllx %g1, %g3, %g1 + and %g1, %g2, %g1 + mov 32, %g2 + sllx %g1, %g5, %i1 + sub %g2, %o5, %g2 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + return %i7+8 + or %g4, %g1, %o0 +.LL37: + sllx %g2, 3, %g3 + ldx [%l0+8], %g5 + sub %g0, %g3, %g3 + sub %g0, %g4, %o5 + ldx [%l0], %g2 + mov -1, %g1 + sllx %g2, %g4, %g2 + sllx %g1, %g3, %g1 + and %g1, %g5, %g1 + srax %g1, %o5, %g1 + return %i7+8 + or %g2, %g1, %o0 +.LL39: + bgu,pt %xcc, .LL43 + cmp %g2, 32 + cmp %g2, 24 + bgu,pt %xcc, .LL45 + sllx %o2, 3, %o4 + sllx %o2, 2, %g1 + sll %o2, 3, %g5 + sllx %g2, 3, %o5 + ldx [%l0+8], %g3 + ldx [%l0+16], %o4 + sllx %g3, %g5, %o3 + sub %g0, %o5, %o5 + mov 32, %g4 + ldx [%l0], %g2 + sub %g4, %g1, %g4 + sllx %g2, %g5, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + srax %g3, %g4, %g3 + sllx %g1, %o5, %g1 + and %g1, %o4, %g1 + sllx %g1, %g5, %i2 + srax %g1, %g4, %g1 + srax %g1, %g4, %g1 + or %o3, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +.LL41: + sllx %g2, 3, %g5 + ldx [%l0+8], %g3 + ldx [%l0+16], %o4 + sllx %g3, %o5, %o3 + sub %g0, %g5, %g5 + mov 64, %g4 + ldx [%l0], %g2 + sub %g4, %o5, %g4 + sllx %g2, %o5, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + sllx %g1, %g5, %g1 + and %g1, %o4, %g1 + srax %g1, %g4, %g1 + or %o3, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +.LL45: + ldx [%l0], %g1 + sllx %g1, %o4, %g1 + ldx [%l0+8], %g3 + ldx [%l0+16], %g4 + sllx %g3, %o4, %o3 + sllx %g4, %o4, %o1 + sllx %g2, 3, %o5 + ldx [%l0+24], %o2 + sub %g0, %o5, %o5 + mov 64, %g5 + sub %g5, %o4, %g5 + srax %g3, %g5, %g3 + srax %g4, %g5, %g4 + or %g1, %g3, %i0 + or %o3, %g4, %i1 + mov -1, %g1 + sllx %g1, %o5, %g1 + and %g1, %o2, %g1 + srax %g1, %g5, %g1 + or %o1, %g1, %i2 + return %i7+8 + nop +.LL43: + bgu,pt %xcc, .LL47 + sllx %o2, 3, %o4 + sll %o2, 3, %o5 + ldx [%l0], %g1 + sllx %g1, %o5, %g1 + sllx %o2, 2, %o4 + sllx %g2, 3, %g5 + ldx [%l0+8], %g3 + ldx [%l0+16], %g4 + sllx %g3, %o5, %o2 + sllx %g4, %o5, %o1 + ldx [%l0+24], %o3 + sub %g0, %g5, %g5 + mov 32, %g2 + sub %g2, %o4, %g2 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + or %g1, %g3, %i0 + or %o2, %g4, %i1 + mov -1, %g1 + sllx %g1, %g5, %g1 + and %g1, %o3, %g1 + sllx %g1, %o5, %i3 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + or %o1, %g1, %i2 + return %i7+8 + nop + .size vacall_receiver, .-vacall_receiver + .ident "GCC: (GNU) 4.0.2" + .section ".note.GNU-stack" diff --git a/vacall/vacall-sparc64-macro.S b/vacall/vacall-sparc64-macro.S new file mode 100644 index 0000000..841398d --- /dev/null +++ b/vacall/vacall-sparc64-macro.S @@ -0,0 +1,652 @@ +#include "asm-sparc.h" +#ifdef __PIC__ + .section ".text" + .align 4 +L(LADDPC0): + jmp %o7+8 + add %o7, %l7, %l7 + .align 4 + .global C(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) + .proc 020 +FUNBEGIN(vacall_receiver) + .register %g2, $scratch + .register %g3, $scratch + save %sp, -448, %sp + add %fp, 2175, %g1 + stx %i0, [%fp+2175] + stx %i1, [%fp+2183] + stx %i2, [%fp+2191] + stx %i3, [%fp+2199] + stx %i4, [%fp+2207] + stx %i5, [%fp+2215] + std %f0, [%fp+1903] + std %f2, [%fp+1911] + std %f4, [%fp+1919] + std %f6, [%fp+1927] + std %f8, [%fp+1935] + std %f10, [%fp+1943] + std %f12, [%fp+1951] + std %f14, [%fp+1959] + std %f16, [%fp+1967] + std %f18, [%fp+1975] + std %f20, [%fp+1983] + std %f22, [%fp+1991] + std %f24, [%fp+1999] + std %f26, [%fp+2007] + std %f28, [%fp+2015] + std %f30, [%fp+2023] + st %f1, [%fp+1835] + st %f3, [%fp+1839] + st %f5, [%fp+1843] + st %f7, [%fp+1847] + st %f9, [%fp+1851] + st %f11, [%fp+1855] + st %f13, [%fp+1859] + st %f15, [%fp+1863] + st %f17, [%fp+1867] + st %f19, [%fp+1871] + st %f21, [%fp+1875] + sethi %hi(_GLOBAL_OFFSET_TABLE_-4), %l7 + call L(LADDPC0) + add %l7, %lo(_GLOBAL_OFFSET_TABLE_+4), %l7 + st %f23, [%fp+1879] + stx %g1, [%fp+1799] + sethi %hi(C(vacall_function)), %g1 + or %g1, %lo(C(vacall_function)), %g1 + st %f25, [%fp+1883] + ldx [%l7+%g1], %g2 + st %f27, [%fp+1887] + st %f29, [%fp+1891] + st %f31, [%fp+1895] + st %g0, [%fp+1775] + stx %g0, [%fp+1807] + st %g0, [%fp+1815] + st %g0, [%fp+1831] + ldx [%g2], %g3 + call %g3, 0 + add %fp, 1775, %o0 + lduw [%fp+1815], %g1 + cmp %g1, 0 + be,pn %icc, L(L61) + cmp %g1, 1 + be,pn %icc, L(L50) + cmp %g1, 2 + be,pn %icc, L(L50) + cmp %g1, 3 + be,pn %icc, L(L53) + cmp %g1, 4 + be,pn %icc, L(L54) + cmp %g1, 5 + be,pn %icc, L(L55) + cmp %g1, 6 + be,pn %icc, L(L56) + cmp %g1, 7 + be,pn %icc, L(L57) + cmp %g1, 8 + be,pn %icc, L(L51) + cmp %g1, 9 + be,pn %icc, L(L51) + cmp %g1, 10 + be,pn %icc, L(L51) + cmp %g1, 11 + be,pn %icc, L(L51) + cmp %g1, 12 + be,pn %icc, L(L58) + cmp %g1, 13 + be,pn %icc, L(L59) + cmp %g1, 14 + be,pn %icc, L(L51) + cmp %g1, 15 + bne,pt %icc, L(L61) + lduw [%fp+1775], %g1 + andcc %g1, 1024, %g0 + be,pn %xcc, L(L61) + ldx [%fp+1823], %g5 + add %g5, -1, %g1 + cmp %g1, 31 + bgu,pn %xcc, L(L61) + ldx [%fp+1807], %g1 + cmp %g5, 8 + and %g1, 7, %o2 + and %g1, -8, %l0 + bgu,pt %xcc, L(L35) + add %g5, %o2, %g2 + cmp %g2, 8 + bgu,pt %xcc, L(L37) + sllx %o2, 3, %g4 + sllx %g2, 3, %g2 + ldx [%l0], %g3 + sub %g0, %g2, %g2 + mov -1, %g1 + sllx %g1, %g2, %g1 + and %g1, %g3, %g1 + return %i7+8 + sllx %g1, %g4, %o0 +L(L47): + ldx [%l0], %g1 + sllx %g1, %o4, %g1 + ldx [%l0+8], %g4 + ldx [%l0+16], %g5 + sllx %g4, %o4, %o1 + sllx %g5, %o4, %o0 + ldx [%l0+24], %o5 + sllx %g2, 3, %o3 + sllx %o5, %o4, %o7 + ldx [%l0+32], %o2 + sub %g0, %o3, %o3 + mov 64, %g3 + sub %g3, %o4, %g3 + srax %g4, %g3, %g4 + srax %g5, %g3, %g5 + or %g1, %g4, %i0 + srax %o5, %g3, %o5 + mov -1, %g1 + or %o1, %g5, %i1 + sllx %g1, %o3, %g1 + or %o0, %o5, %i2 + and %g1, %o2, %g1 + srax %g1, %g3, %g1 + or %o7, %g1, %i3 +L(L61): + return %i7+8 + nop +L(L50): + ldsb [%fp+1783], %i0 + return %i7+8 + nop +L(L54): + ldsh [%fp+1783], %i0 + return %i7+8 + nop +L(L53): + ldub [%fp+1783], %i0 + return %i7+8 + nop +L(L51): + ldx [%fp+1783], %i0 + return %i7+8 + nop +L(L55): + lduh [%fp+1783], %i0 + return %i7+8 + nop +L(L56): + ldsw [%fp+1783], %i0 + return %i7+8 + nop +L(L57): + lduw [%fp+1783], %i0 + return %i7+8 + nop +L(L58): + ld [%fp+1783], %f0 + return %i7+8 + nop +L(L59): + ldd [%fp+1783], %f0 + return %i7+8 + nop +L(L35): + cmp %g5, 16 + bgu,pt %xcc, L(L39) + cmp %g5, 24 + cmp %g2, 16 + bgu,pt %xcc, L(L41) + sllx %o2, 3, %o5 + sllx %g2, 3, %g3 + ldx [%l0+8], %g2 + sll %o2, 3, %g5 + sllx %o2, 2, %o5 + sub %g0, %g3, %g3 + ldx [%l0], %g4 + mov -1, %g1 + sllx %g4, %g5, %g4 + sllx %g1, %g3, %g1 + and %g1, %g2, %g1 + mov 32, %g2 + sllx %g1, %g5, %i1 + sub %g2, %o5, %g2 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + return %i7+8 + or %g4, %g1, %o0 +L(L37): + sllx %g2, 3, %g3 + ldx [%l0+8], %g5 + sub %g0, %g3, %g3 + sub %g0, %g4, %o5 + ldx [%l0], %g2 + mov -1, %g1 + sllx %g2, %g4, %g2 + sllx %g1, %g3, %g1 + and %g1, %g5, %g1 + srax %g1, %o5, %g1 + return %i7+8 + or %g2, %g1, %o0 +L(L39): + bgu,pt %xcc, L(L43) + cmp %g2, 32 + cmp %g2, 24 + bgu,pt %xcc, L(L45) + sllx %o2, 3, %o4 + sllx %o2, 2, %g1 + sll %o2, 3, %g5 + sllx %g2, 3, %o5 + ldx [%l0+8], %g3 + ldx [%l0+16], %o4 + sllx %g3, %g5, %o3 + sub %g0, %o5, %o5 + mov 32, %g4 + ldx [%l0], %g2 + sub %g4, %g1, %g4 + sllx %g2, %g5, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + srax %g3, %g4, %g3 + sllx %g1, %o5, %g1 + and %g1, %o4, %g1 + sllx %g1, %g5, %i2 + srax %g1, %g4, %g1 + srax %g1, %g4, %g1 + or %o3, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +L(L41): + sllx %g2, 3, %g5 + ldx [%l0+8], %g3 + ldx [%l0+16], %o4 + sllx %g3, %o5, %o3 + sub %g0, %g5, %g5 + mov 64, %g4 + ldx [%l0], %g2 + sub %g4, %o5, %g4 + sllx %g2, %o5, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + sllx %g1, %g5, %g1 + and %g1, %o4, %g1 + srax %g1, %g4, %g1 + or %o3, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +L(L45): + ldx [%l0], %g1 + sllx %g1, %o4, %g1 + ldx [%l0+8], %g3 + ldx [%l0+16], %g4 + sllx %g3, %o4, %o3 + sllx %g4, %o4, %o1 + sllx %g2, 3, %o5 + ldx [%l0+24], %o2 + sub %g0, %o5, %o5 + mov 64, %g5 + sub %g5, %o4, %g5 + srax %g3, %g5, %g3 + srax %g4, %g5, %g4 + or %g1, %g3, %i0 + or %o3, %g4, %i1 + mov -1, %g1 + sllx %g1, %o5, %g1 + and %g1, %o2, %g1 + srax %g1, %g5, %g1 + or %o1, %g1, %i2 + return %i7+8 + nop +L(L43): + bgu,pt %xcc, L(L47) + sllx %o2, 3, %o4 + sll %o2, 3, %o5 + ldx [%l0], %g1 + sllx %g1, %o5, %g1 + sllx %o2, 2, %o4 + sllx %g2, 3, %g5 + ldx [%l0+8], %g3 + ldx [%l0+16], %g4 + sllx %g3, %o5, %o2 + sllx %g4, %o5, %o1 + ldx [%l0+24], %o3 + sub %g0, %g5, %g5 + mov 32, %g2 + sub %g2, %o4, %g2 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + or %g1, %g3, %i0 + or %o2, %g4, %i1 + mov -1, %g1 + sllx %g1, %g5, %g1 + and %g1, %o3, %g1 + sllx %g1, %o5, %i3 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + or %o1, %g1, %i2 + return %i7+8 + nop + FUNEND(vacall_receiver) +#else + .section ".text" + .align 4 + .global C(vacall_receiver) + DECLARE_FUNCTION(vacall_receiver) + .proc 020 +FUNBEGIN(vacall_receiver) + .register %g2, $scratch + .register %g3, $scratch + save %sp, -448, %sp + add %fp, 2175, %g1 + stx %i0, [%fp+2175] + stx %i1, [%fp+2183] + stx %i2, [%fp+2191] + stx %i3, [%fp+2199] + stx %i4, [%fp+2207] + stx %i5, [%fp+2215] + std %f0, [%fp+1903] + std %f2, [%fp+1911] + std %f4, [%fp+1919] + std %f6, [%fp+1927] + std %f8, [%fp+1935] + std %f10, [%fp+1943] + std %f12, [%fp+1951] + std %f14, [%fp+1959] + std %f16, [%fp+1967] + std %f18, [%fp+1975] + std %f20, [%fp+1983] + std %f22, [%fp+1991] + std %f24, [%fp+1999] + std %f26, [%fp+2007] + std %f28, [%fp+2015] + std %f30, [%fp+2023] + st %f1, [%fp+1835] + st %f3, [%fp+1839] + st %f5, [%fp+1843] + st %f7, [%fp+1847] + st %f9, [%fp+1851] + st %f11, [%fp+1855] + st %f13, [%fp+1859] + st %f15, [%fp+1863] + st %f17, [%fp+1867] + st %f19, [%fp+1871] + st %f21, [%fp+1875] + sethi %lm(C(vacall_function)), %g2 + st %f23, [%fp+1879] + stx %g1, [%fp+1799] + st %f25, [%fp+1883] + st %f27, [%fp+1887] + st %f29, [%fp+1891] + st %f31, [%fp+1895] + st %g0, [%fp+1775] + stx %g0, [%fp+1807] + st %g0, [%fp+1815] + st %g0, [%fp+1831] + sethi %hh(C(vacall_function)), %g1 + or %g1, %hm(C(vacall_function)), %g1 + sllx %g1, 32, %g1 + add %g1, %g2, %g1 + ldx [%g1+%lo(C(vacall_function))], %g3 + call %g3, 0 + add %fp, 1775, %o0 + lduw [%fp+1815], %g1 + cmp %g1, 0 + be,pn %icc, L(L61) + cmp %g1, 1 + be,pn %icc, L(L50) + cmp %g1, 2 + be,pn %icc, L(L50) + cmp %g1, 3 + be,pn %icc, L(L53) + cmp %g1, 4 + be,pn %icc, L(L54) + cmp %g1, 5 + be,pn %icc, L(L55) + cmp %g1, 6 + be,pn %icc, L(L56) + cmp %g1, 7 + be,pn %icc, L(L57) + cmp %g1, 8 + be,pn %icc, L(L51) + cmp %g1, 9 + be,pn %icc, L(L51) + cmp %g1, 10 + be,pn %icc, L(L51) + cmp %g1, 11 + be,pn %icc, L(L51) + cmp %g1, 12 + be,pn %icc, L(L58) + cmp %g1, 13 + be,pn %icc, L(L59) + cmp %g1, 14 + be,pn %icc, L(L51) + cmp %g1, 15 + bne,pt %icc, L(L61) + lduw [%fp+1775], %g1 + andcc %g1, 1024, %g0 + be,pn %xcc, L(L61) + ldx [%fp+1823], %g5 + add %g5, -1, %g1 + cmp %g1, 31 + bgu,pn %xcc, L(L61) + ldx [%fp+1807], %g1 + cmp %g5, 8 + and %g1, 7, %o2 + and %g1, -8, %l0 + bgu,pt %xcc, L(L35) + add %g5, %o2, %g2 + cmp %g2, 8 + bgu,pt %xcc, L(L37) + sllx %o2, 3, %g4 + sllx %g2, 3, %g2 + ldx [%l0], %g3 + sub %g0, %g2, %g2 + mov -1, %g1 + sllx %g1, %g2, %g1 + and %g1, %g3, %g1 + return %i7+8 + sllx %g1, %g4, %o0 +L(L47): + ldx [%l0], %g1 + sllx %g1, %o4, %g1 + ldx [%l0+8], %g4 + ldx [%l0+16], %g5 + sllx %g4, %o4, %o1 + sllx %g5, %o4, %o0 + ldx [%l0+24], %o5 + sllx %g2, 3, %o3 + sllx %o5, %o4, %o7 + ldx [%l0+32], %o2 + sub %g0, %o3, %o3 + mov 64, %g3 + sub %g3, %o4, %g3 + srax %g4, %g3, %g4 + srax %g5, %g3, %g5 + or %g1, %g4, %i0 + srax %o5, %g3, %o5 + mov -1, %g1 + or %o1, %g5, %i1 + sllx %g1, %o3, %g1 + or %o0, %o5, %i2 + and %g1, %o2, %g1 + srax %g1, %g3, %g1 + or %o7, %g1, %i3 +L(L61): + return %i7+8 + nop +L(L50): + ldsb [%fp+1783], %i0 + return %i7+8 + nop +L(L54): + ldsh [%fp+1783], %i0 + return %i7+8 + nop +L(L53): + ldub [%fp+1783], %i0 + return %i7+8 + nop +L(L51): + ldx [%fp+1783], %i0 + return %i7+8 + nop +L(L55): + lduh [%fp+1783], %i0 + return %i7+8 + nop +L(L56): + ldsw [%fp+1783], %i0 + return %i7+8 + nop +L(L57): + lduw [%fp+1783], %i0 + return %i7+8 + nop +L(L58): + ld [%fp+1783], %f0 + return %i7+8 + nop +L(L59): + ldd [%fp+1783], %f0 + return %i7+8 + nop +L(L35): + cmp %g5, 16 + bgu,pt %xcc, L(L39) + cmp %g5, 24 + cmp %g2, 16 + bgu,pt %xcc, L(L41) + sllx %o2, 3, %o5 + sllx %g2, 3, %g3 + ldx [%l0+8], %g2 + sll %o2, 3, %g5 + sllx %o2, 2, %o5 + sub %g0, %g3, %g3 + ldx [%l0], %g4 + mov -1, %g1 + sllx %g4, %g5, %g4 + sllx %g1, %g3, %g1 + and %g1, %g2, %g1 + mov 32, %g2 + sllx %g1, %g5, %i1 + sub %g2, %o5, %g2 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + return %i7+8 + or %g4, %g1, %o0 +L(L37): + sllx %g2, 3, %g3 + ldx [%l0+8], %g5 + sub %g0, %g3, %g3 + sub %g0, %g4, %o5 + ldx [%l0], %g2 + mov -1, %g1 + sllx %g2, %g4, %g2 + sllx %g1, %g3, %g1 + and %g1, %g5, %g1 + srax %g1, %o5, %g1 + return %i7+8 + or %g2, %g1, %o0 +L(L39): + bgu,pt %xcc, L(L43) + cmp %g2, 32 + cmp %g2, 24 + bgu,pt %xcc, L(L45) + sllx %o2, 3, %o4 + sllx %o2, 2, %g1 + sll %o2, 3, %g5 + sllx %g2, 3, %o5 + ldx [%l0+8], %g3 + ldx [%l0+16], %o4 + sllx %g3, %g5, %o3 + sub %g0, %o5, %o5 + mov 32, %g4 + ldx [%l0], %g2 + sub %g4, %g1, %g4 + sllx %g2, %g5, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + srax %g3, %g4, %g3 + sllx %g1, %o5, %g1 + and %g1, %o4, %g1 + sllx %g1, %g5, %i2 + srax %g1, %g4, %g1 + srax %g1, %g4, %g1 + or %o3, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +L(L41): + sllx %g2, 3, %g5 + ldx [%l0+8], %g3 + ldx [%l0+16], %o4 + sllx %g3, %o5, %o3 + sub %g0, %g5, %g5 + mov 64, %g4 + ldx [%l0], %g2 + sub %g4, %o5, %g4 + sllx %g2, %o5, %g2 + srax %g3, %g4, %g3 + mov -1, %g1 + sllx %g1, %g5, %g1 + and %g1, %o4, %g1 + srax %g1, %g4, %g1 + or %o3, %g1, %i1 + return %i7+8 + or %g2, %g3, %o0 +L(L45): + ldx [%l0], %g1 + sllx %g1, %o4, %g1 + ldx [%l0+8], %g3 + ldx [%l0+16], %g4 + sllx %g3, %o4, %o3 + sllx %g4, %o4, %o1 + sllx %g2, 3, %o5 + ldx [%l0+24], %o2 + sub %g0, %o5, %o5 + mov 64, %g5 + sub %g5, %o4, %g5 + srax %g3, %g5, %g3 + srax %g4, %g5, %g4 + or %g1, %g3, %i0 + or %o3, %g4, %i1 + mov -1, %g1 + sllx %g1, %o5, %g1 + and %g1, %o2, %g1 + srax %g1, %g5, %g1 + or %o1, %g1, %i2 + return %i7+8 + nop +L(L43): + bgu,pt %xcc, L(L47) + sllx %o2, 3, %o4 + sll %o2, 3, %o5 + ldx [%l0], %g1 + sllx %g1, %o5, %g1 + sllx %o2, 2, %o4 + sllx %g2, 3, %g5 + ldx [%l0+8], %g3 + ldx [%l0+16], %g4 + sllx %g3, %o5, %o2 + sllx %g4, %o5, %o1 + ldx [%l0+24], %o3 + sub %g0, %g5, %g5 + mov 32, %g2 + sub %g2, %o4, %g2 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + srax %g3, %g2, %g3 + srax %g4, %g2, %g4 + or %g1, %g3, %i0 + or %o2, %g4, %i1 + mov -1, %g1 + sllx %g1, %g5, %g1 + and %g1, %o3, %g1 + sllx %g1, %o5, %i3 + srax %g1, %g2, %g1 + srax %g1, %g2, %g1 + or %o1, %g1, %i2 + return %i7+8 + nop + FUNEND(vacall_receiver) +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-sparc64.c b/vacall/vacall-sparc64.c new file mode 100644 index 0000000..727b3ce --- /dev/null +++ b/vacall/vacall-sparc64.c @@ -0,0 +1,460 @@ +/* vacall function for sparc64 CPU */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("%g5"); +#endif +register __vaword* fp __asm__("%fp"); /* our %fp, caller's %sp */ +register __vaword* ret __asm__("%i7"); /* %i7+8 = return address */ +register float farg0 __asm__("%f1"); +register float farg1 __asm__("%f3"); +register float farg2 __asm__("%f5"); +register float farg3 __asm__("%f7"); +register float farg4 __asm__("%f9"); +register float farg5 __asm__("%f11"); +register float farg6 __asm__("%f13"); +register float farg7 __asm__("%f15"); +register float farg8 __asm__("%f17"); +register float farg9 __asm__("%f19"); +register float farg10 __asm__("%f21"); +register float farg11 __asm__("%f23"); +register float farg12 __asm__("%f25"); +register float farg13 __asm__("%f27"); +register float farg14 __asm__("%f29"); +register float farg15 __asm__("%f31"); +register double darg0 __asm__("%f0"); +register double darg1 __asm__("%f2"); +register double darg2 __asm__("%f4"); +register double darg3 __asm__("%f6"); +register double darg4 __asm__("%f8"); +register double darg5 __asm__("%f10"); +register double darg6 __asm__("%f12"); +register double darg7 __asm__("%f14"); +register double darg8 __asm__("%f16"); +register double darg9 __asm__("%f18"); +register double darg10 __asm__("%f20"); +register double darg11 __asm__("%f22"); +register double darg12 __asm__("%f24"); +register double darg13 __asm__("%f26"); +register double darg14 __asm__("%f28"); +register double darg15 __asm__("%f30"); +register __varword iret __asm__("%i0"); +register __varword o1 __asm__("%i1"); +register __varword o2 __asm__("%i2"); +register __varword o3 __asm__("%i3"); +register __varword o4 __asm__("%i4"); +register __varword o5 __asm__("%i5"); +register float fret __asm__("%f0"); /* %f0 */ +register double dret __asm__("%f0"); /* %f0,%f1 */ + +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, __vaword word6, + __vaword firstword) +{ + __va_alist list; + /* Move the arguments passed in registers to their stack locations. */ + (&firstword)[-6] = word1; + (&firstword)[-5] = word2; + (&firstword)[-4] = word3; + (&firstword)[-3] = word4; + (&firstword)[-2] = word5; + (&firstword)[-1] = word6; + list.darg[0] = darg0; + list.darg[1] = darg1; + list.darg[2] = darg2; + list.darg[3] = darg3; + list.darg[4] = darg4; + list.darg[5] = darg5; + list.darg[6] = darg6; + list.darg[7] = darg7; + list.darg[8] = darg8; + list.darg[9] = darg9; + list.darg[10] = darg10; + list.darg[11] = darg11; + list.darg[12] = darg12; + list.darg[13] = darg13; + list.darg[14] = darg14; + list.darg[15] = darg15; + list.farg[0] = farg0; + list.farg[1] = farg1; + list.farg[2] = farg2; + list.farg[3] = farg3; + list.farg[4] = farg4; + list.farg[5] = farg5; + list.farg[6] = farg6; + list.farg[7] = farg7; + list.farg[8] = farg8; + list.farg[9] = farg9; + list.farg[10] = farg10; + list.farg[11] = farg11; + list.farg[12] = farg12; + list.farg[13] = farg13; + list.farg[14] = farg14; + list.farg[15] = farg15; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)(&firstword - 6); + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.anum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulonglong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + /* Return structs of size <= 32 in registers. */ + #define iret2 o1 + #define iret3 o2 + #define iret4 o3 + if (list.rsize > 0 && list.rsize <= 32) { + #if 0 /* Unoptimized */ + if (list.rsize == 1) { + iret = (__varword)((unsigned char *) list.raddr)[0] << 56; + } else + if (list.rsize == 2) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48); + } else + if (list.rsize == 3) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40); + } else + if (list.rsize == 4) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32); + } else + if (list.rsize == 5) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24); + } else + if (list.rsize == 6) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16); + } else + if (list.rsize == 7) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16) + | ((__varword)((unsigned char *) list.raddr)[6] << 8); + } else + if (list.rsize >= 8 && list.rsize <= 32) { + iret = ((__varword)((unsigned char *) list.raddr)[0] << 56) + | ((__varword)((unsigned char *) list.raddr)[1] << 48) + | ((__varword)((unsigned char *) list.raddr)[2] << 40) + | ((__varword)((unsigned char *) list.raddr)[3] << 32) + | ((__varword)((unsigned char *) list.raddr)[4] << 24) + | ((__varword)((unsigned char *) list.raddr)[5] << 16) + | ((__varword)((unsigned char *) list.raddr)[6] << 8) + | (__varword)((unsigned char *) list.raddr)[7]; + if (list.rsize == 8) { + } else + if (list.rsize == 9) { + iret2 = (__varword)((unsigned char *) list.raddr)[8] << 56; + } else + if (list.rsize == 10) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48); + } else + if (list.rsize == 11) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40); + } else + if (list.rsize == 12) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32); + } else + if (list.rsize == 13) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24); + } else + if (list.rsize == 14) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16); + } else + if (list.rsize == 15) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16) + | ((__varword)((unsigned char *) list.raddr)[14] << 8); + } else + if (list.rsize >= 16 && list.rsize <= 32) { + iret2 = ((__varword)((unsigned char *) list.raddr)[8] << 56) + | ((__varword)((unsigned char *) list.raddr)[9] << 48) + | ((__varword)((unsigned char *) list.raddr)[10] << 40) + | ((__varword)((unsigned char *) list.raddr)[11] << 32) + | ((__varword)((unsigned char *) list.raddr)[12] << 24) + | ((__varword)((unsigned char *) list.raddr)[13] << 16) + | ((__varword)((unsigned char *) list.raddr)[14] << 8) + | (__varword)((unsigned char *) list.raddr)[15]; + if (list.rsize == 16) { + } else + if (list.rsize == 17) { + iret3 = (__varword)((unsigned char *) list.raddr)[16] << 56; + } else + if (list.rsize == 18) { + iret3 = ((__varword)((unsigned char *) list.raddr)[16] << 56) + | ((__varword)((unsigned char *) list.raddr)[17] << 48); + } else + if (list.rsize == 19) { + iret3 = ((__varword)((unsigned char *) list.raddr)[16] << 56) + | ((__varword)((unsigned char *) list.raddr)[17] << 48) + | ((__varword)((unsigned char *) list.raddr)[18] << 40); + } else + if (list.rsize == 20) { + iret3 = ((__varword)((unsigned char *) list.raddr)[16] << 56) + | ((__varword)((unsigned char *) list.raddr)[17] << 48) + | ((__varword)((unsigned char *) list.raddr)[18] << 40) + | ((__varword)((unsigned char *) list.raddr)[19] << 32); + } else + if (list.rsize == 21) { + iret3 = ((__varword)((unsigned char *) list.raddr)[16] << 56) + | ((__varword)((unsigned char *) list.raddr)[17] << 48) + | ((__varword)((unsigned char *) list.raddr)[18] << 40) + | ((__varword)((unsigned char *) list.raddr)[19] << 32) + | ((__varword)((unsigned char *) list.raddr)[20] << 24); + } else + if (list.rsize == 22) { + iret3 = ((__varword)((unsigned char *) list.raddr)[16] << 56) + | ((__varword)((unsigned char *) list.raddr)[17] << 48) + | ((__varword)((unsigned char *) list.raddr)[18] << 40) + | ((__varword)((unsigned char *) list.raddr)[19] << 32) + | ((__varword)((unsigned char *) list.raddr)[20] << 24) + | ((__varword)((unsigned char *) list.raddr)[21] << 16); + } else + if (list.rsize == 23) { + iret3 = ((__varword)((unsigned char *) list.raddr)[16] << 56) + | ((__varword)((unsigned char *) list.raddr)[17] << 48) + | ((__varword)((unsigned char *) list.raddr)[18] << 40) + | ((__varword)((unsigned char *) list.raddr)[19] << 32) + | ((__varword)((unsigned char *) list.raddr)[20] << 24) + | ((__varword)((unsigned char *) list.raddr)[21] << 16) + | ((__varword)((unsigned char *) list.raddr)[22] << 8); + } else + if (list.rsize >= 24 && list.rsize <= 32) { + iret3 = ((__varword)((unsigned char *) list.raddr)[16] << 56) + | ((__varword)((unsigned char *) list.raddr)[17] << 48) + | ((__varword)((unsigned char *) list.raddr)[18] << 40) + | ((__varword)((unsigned char *) list.raddr)[19] << 32) + | ((__varword)((unsigned char *) list.raddr)[20] << 24) + | ((__varword)((unsigned char *) list.raddr)[21] << 16) + | ((__varword)((unsigned char *) list.raddr)[22] << 8) + | (__varword)((unsigned char *) list.raddr)[23]; + if (list.rsize == 24) { + } else + if (list.rsize == 25) { + iret4 = (__varword)((unsigned char *) list.raddr)[24] << 56; + } else + if (list.rsize == 26) { + iret4 = ((__varword)((unsigned char *) list.raddr)[24] << 56) + | ((__varword)((unsigned char *) list.raddr)[25] << 48); + } else + if (list.rsize == 27) { + iret4 = ((__varword)((unsigned char *) list.raddr)[24] << 56) + | ((__varword)((unsigned char *) list.raddr)[25] << 48) + | ((__varword)((unsigned char *) list.raddr)[26] << 40); + } else + if (list.rsize == 28) { + iret4 = ((__varword)((unsigned char *) list.raddr)[24] << 56) + | ((__varword)((unsigned char *) list.raddr)[25] << 48) + | ((__varword)((unsigned char *) list.raddr)[26] << 40) + | ((__varword)((unsigned char *) list.raddr)[27] << 32); + } else + if (list.rsize == 29) { + iret4 = ((__varword)((unsigned char *) list.raddr)[24] << 56) + | ((__varword)((unsigned char *) list.raddr)[25] << 48) + | ((__varword)((unsigned char *) list.raddr)[26] << 40) + | ((__varword)((unsigned char *) list.raddr)[27] << 32) + | ((__varword)((unsigned char *) list.raddr)[28] << 24); + } else + if (list.rsize == 30) { + iret4 = ((__varword)((unsigned char *) list.raddr)[24] << 56) + | ((__varword)((unsigned char *) list.raddr)[25] << 48) + | ((__varword)((unsigned char *) list.raddr)[26] << 40) + | ((__varword)((unsigned char *) list.raddr)[27] << 32) + | ((__varword)((unsigned char *) list.raddr)[28] << 24) + | ((__varword)((unsigned char *) list.raddr)[29] << 16); + } else + if (list.rsize == 31) { + iret4 = ((__varword)((unsigned char *) list.raddr)[24] << 56) + | ((__varword)((unsigned char *) list.raddr)[25] << 48) + | ((__varword)((unsigned char *) list.raddr)[26] << 40) + | ((__varword)((unsigned char *) list.raddr)[27] << 32) + | ((__varword)((unsigned char *) list.raddr)[28] << 24) + | ((__varword)((unsigned char *) list.raddr)[29] << 16) + | ((__varword)((unsigned char *) list.raddr)[30] << 8); + } else + if (list.rsize == 32) { + iret4 = ((__varword)((unsigned char *) list.raddr)[24] << 56) + | ((__varword)((unsigned char *) list.raddr)[25] << 48) + | ((__varword)((unsigned char *) list.raddr)[26] << 40) + | ((__varword)((unsigned char *) list.raddr)[27] << 32) + | ((__varword)((unsigned char *) list.raddr)[28] << 24) + | ((__varword)((unsigned char *) list.raddr)[29] << 16) + | ((__varword)((unsigned char *) list.raddr)[30] << 8) + | (__varword)((unsigned char *) list.raddr)[31]; + } + } + } + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 4*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 5*sizeof(__varword) */ + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = - ((__varword)1 << (sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] & mask0) << (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = - ((__varword)1 << (2*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | ((wordaddr[1] & mask1) >> (sizeof(__varword)*8-start_offset*8)); + } + } else if (count <= 2*sizeof(__varword)) { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = - ((__varword)1 << (2*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | ((wordaddr[1] & mask1) >> (sizeof(__varword)*4-start_offset*4) >> (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) << (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = - ((__varword)1 << (3*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | (wordaddr[1] >> (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] << (start_offset*8)) | ((wordaddr[2] & mask2) >> (sizeof(__varword)*8-start_offset*8)); + } + } else if (count <= 3*sizeof(__varword)) { + /* Assign iret, iret2, iret3. */ + if (end_offset <= 3*sizeof(__varword)) { + /* 2*sizeof(__varword) < end_offset ≤ 3*sizeof(__varword) */ + __varword mask2 = - ((__varword)1 << (3*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | (wordaddr[1] >> (sizeof(__varword)*4-start_offset*4) >> (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] << (start_offset*8)) | ((wordaddr[2] & mask2) >> (sizeof(__varword)*4-start_offset*4) >> (sizeof(__varword)*4-start_offset*4)); + iret3 = (wordaddr[2] & mask2) << (start_offset*8); + } else { + /* 3*sizeof(__varword) < end_offset < 4*sizeof(__varword), start_offset > 0 */ + __varword mask3 = - ((__varword)1 << (4*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | (wordaddr[1] >> (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] << (start_offset*8)) | (wordaddr[2] >> (sizeof(__varword)*8-start_offset*8)); + iret3 = (wordaddr[2] << (start_offset*8)) | ((wordaddr[3] & mask3) >> (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2, iret3, iret4. */ + if (end_offset <= 4*sizeof(__varword)) { + /* 3*sizeof(__varword) < end_offset ≤ 4*sizeof(__varword) */ + __varword mask3 = - ((__varword)1 << (4*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | (wordaddr[1] >> (sizeof(__varword)*4-start_offset*4) >> (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] << (start_offset*8)) | (wordaddr[2] >> (sizeof(__varword)*4-start_offset*4) >> (sizeof(__varword)*4-start_offset*4)); + iret3 = (wordaddr[2] << (start_offset*8)) | ((wordaddr[3] & mask3) >> (sizeof(__varword)*4-start_offset*4) >> (sizeof(__varword)*4-start_offset*4)); + iret4 = (wordaddr[3] & mask3) << (start_offset*8); + } else { + /* 4*sizeof(__varword) < end_offset < 5*sizeof(__varword), start_offset > 0 */ + __varword mask4 = - ((__varword)1 << (5*sizeof(__varword)*8-end_offset*8)); + iret = (wordaddr[0] << (start_offset*8)) | (wordaddr[1] >> (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] << (start_offset*8)) | (wordaddr[2] >> (sizeof(__varword)*8-start_offset*8)); + iret3 = (wordaddr[2] << (start_offset*8)) | (wordaddr[3] >> (sizeof(__varword)*8-start_offset*8)); + iret4 = (wordaddr[3] << (start_offset*8)) | ((wordaddr[4] & mask4) >> (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + } + } + } +} diff --git a/vacall/vacall-structcpy.c b/vacall/vacall-structcpy.c new file mode 100644 index 0000000..b6ffb90 --- /dev/null +++ b/vacall/vacall-structcpy.c @@ -0,0 +1,22 @@ +/* copy structs */ + +/* + * Copyright 2016 Bruno Haible + * + * 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, see . + */ + +#define __structcpy vacall_structcpy + +#include "structcpy.c" diff --git a/vacall/vacall-x86_64-linux.s b/vacall/vacall-x86_64-linux.s new file mode 100644 index 0000000..aaaa1c5 --- /dev/null +++ b/vacall/vacall-x86_64-linux.s @@ -0,0 +1,258 @@ + .file "vacall-x86_64.c" + .text + .p2align 4,,15 +.globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: +.LFB2: + pushq %rbp +.LCFI0: + movq %rsp, %rbp +.LCFI1: + pushq %r12 +.LCFI2: + subq $200, %rsp +.LCFI3: + movq %rcx, -48(%rbp) + leaq 16(%rbp), %rcx + movq %rdi, -72(%rbp) + movq %rsi, -64(%rbp) + movsd %xmm0, -144(%rbp) + movq %rcx, -184(%rbp) + movq %rdx, -56(%rbp) + movsd %xmm1, -136(%rbp) + movq %r8, -40(%rbp) + movsd %xmm2, -128(%rbp) + leaq -208(%rbp), %rdi + movq %r9, -32(%rbp) + movsd %xmm3, -120(%rbp) + movsd %xmm4, -112(%rbp) + movl $0, -208(%rbp) + movsd %xmm5, -104(%rbp) + movq $0, -176(%rbp) + movsd %xmm6, -96(%rbp) + movl $0, -168(%rbp) + movsd %xmm7, -88(%rbp) + movl $0, -80(%rbp) + movl $0, -152(%rbp) + call *vacall_function(%rip) + movl -168(%rbp), %ecx + testl %ecx, %ecx + je .L41 + cmpl $1, %ecx + je .L42 + cmpl $2, %ecx + je .L42 + cmpl $3, %ecx + .p2align 4,,5 + je .L48 + cmpl $4, %ecx + .p2align 4,,5 + je .L49 + cmpl $5, %ecx + .p2align 4,,5 + je .L50 + cmpl $6, %ecx + .p2align 4,,5 + je .L51 + cmpl $7, %ecx + .p2align 4,,5 + je .L52 + cmpl $8, %ecx + .p2align 4,,5 + je .L46 + cmpl $9, %ecx + .p2align 4,,5 + je .L46 + cmpl $10, %ecx + .p2align 4,,5 + je .L46 + cmpl $11, %ecx + .p2align 4,,5 + je .L46 + cmpl $12, %ecx + .p2align 4,,5 + je .L53 + cmpl $13, %ecx + .p2align 4,,5 + je .L54 + cmpl $14, %ecx + .p2align 4,,5 + je .L46 + cmpl $15, %ecx + .p2align 4,,5 + jne .L41 + testb $4, -207(%rbp) + .p2align 4,,2 + je .L41 + movq -160(%rbp), %rsi + leaq -1(%rsi), %rcx + cmpq $15, %rcx + ja .L41 + movq -176(%rbp), %rcx + movq %rcx, %r11 + movq %rcx, %r8 + andl $7, %r8d + andq $-8, %r11 + cmpq $8, %rsi + leaq (%rsi,%r8), %r10 + ja .L35 + cmpq $8, %r10 + ja .L37 + leal -1(,%r10,8), %ecx + movl $2, %esi + salq %cl, %rsi + leal 0(,%r8,8), %ecx + decq %rsi + andq (%r11), %rsi + movq %rsi, %rax + sarq %cl, %rax + .p2align 4,,7 +.L41: + addq $200, %rsp + popq %r12 + leave + ret + .p2align 4,,7 +.L42: + movsbq -200(%rbp),%rax + addq $200, %rsp + popq %r12 + leave + ret +.L49: + movswq -200(%rbp),%rax + jmp .L41 +.L48: + movzbq -200(%rbp), %rax + jmp .L41 +.L46: + movq -200(%rbp), %rax + jmp .L41 +.L50: + movzwq -200(%rbp), %rax + jmp .L41 +.L51: + movslq -200(%rbp),%rax + jmp .L41 +.L52: + mov -200(%rbp), %eax + jmp .L41 +.L53: + movss -200(%rbp), %xmm0 + jmp .L41 +.L54: + movlpd -200(%rbp), %xmm0 + jmp .L41 +.L35: + cmpq $16, %r10 + ja .L39 + leal -65(,%r10,8), %ecx + movl $2, %esi + leal 0(,%r8,8), %r9d + movl $32, %edi + salq %cl, %rsi + leaq 0(,%r8,4), %rcx + movq (%r11), %r8 + decq %rsi + andq 8(%r11), %rsi + subl %ecx, %edi + movl %r9d, %ecx + sarq %cl, %r8 + movl %edi, %ecx + movq %r8, %rax + movq %rsi, %r10 + movq %rsi, %rdx + salq %cl, %r10 + salq %cl, %r10 + movl %r9d, %ecx + orq %r10, %rax + sarq %cl, %rdx + jmp .L41 +.L37: + movq (%r11), %rdi + leal -65(,%r10,8), %esi + salq $3, %r8 + movl %r8d, %ecx + movl $2, %r10d + sarq %cl, %rdi + movl %esi, %ecx + movl $64, %esi + salq %cl, %r10 + subl %r8d, %esi + movq %rdi, %rax + decq %r10 + andq 8(%r11), %r10 + movl %esi, %ecx + salq %cl, %r10 + orq %r10, %rax + jmp .L41 +.L39: + leaq 0(,%r8,8), %rcx + movq (%r11), %r12 + movq 8(%r11), %r8 + movl $64, %edi + subl %ecx, %edi + movl %ecx, %r9d + sarq %cl, %r12 + movq %r8, %rsi + movl %edi, %ecx + salq %cl, %rsi + movq %r12, %rax + movl %r9d, %ecx + orq %rsi, %rax + leal -129(,%r10,8), %esi + sarq %cl, %r8 + movl $2, %r9d + movq %r8, %rdx + movl %esi, %ecx + salq %cl, %r9 + movl %edi, %ecx + leaq -1(%r9), %rsi + andq 16(%r11), %rsi + salq %cl, %rsi + orq %rsi, %rdx + jmp .L41 +.LFE2: + .size vacall_receiver, .-vacall_receiver + .section .eh_frame,"a",@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 +.LSCIE1: + .long 0x0 + .byte 0x1 + .string "" + .uleb128 0x1 + .sleb128 -8 + .byte 0x10 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + .quad .LFB2 + .quad .LFE2-.LFB2 + .byte 0x4 + .long .LCFI0-.LFB2 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI3-.LCFI1 + .byte 0x8c + .uleb128 0x3 + .align 8 +.LEFDE1: + .ident "GCC: (GNU) 4.0.2" + .section .note.GNU-stack,"",@progbits diff --git a/vacall/vacall-x86_64-macro.S b/vacall/vacall-x86_64-macro.S new file mode 100644 index 0000000..2f5f959 --- /dev/null +++ b/vacall/vacall-x86_64-macro.S @@ -0,0 +1,525 @@ +#include "asm-x86_64.h" +#if defined __OpenBSD__ + TEXT() + P2ALIGN(4,15) +GLOBL(C(vacall_receiver)) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) +L(FB2): + INSN1(push,q ,R(rbp)) +L(CFI0): + INSN2(mov,q ,R(rsp), R(rbp)) +L(CFI1): + INSN1(push,q ,R(r12)) +L(CFI2): + INSN2(sub,q ,NUM(200), R(rsp)) +L(CFI3): + INSN2(mov,q ,R(rcx),X8 MEM_DISP(rbp,-48)) + INSN2(lea,q ,X8 MEM_DISP(rbp,16), R(rcx)) + INSN2(mov,q ,R(rdi),X8 MEM_DISP(rbp,-72)) + INSN2(mov,q ,R(rsi),X8 MEM_DISP(rbp,-64)) + INSN2S(movs,d ,R(xmm0),X8 MEM_DISP(rbp,-144)) + INSN2(mov,q ,R(rcx),X8 MEM_DISP(rbp,-184)) + INSN2(mov,q ,vacall_function@MEM_PCRELATIVE(C(GOTPCREL)), R(rcx)) + INSN2S(movs,d ,R(xmm1),X8 MEM_DISP(rbp,-136)) + INSN2(mov,q ,R(rdx),X8 MEM_DISP(rbp,-56)) + INSN2S(movs,d ,R(xmm2),X8 MEM_DISP(rbp,-128)) + INSN2(lea,q ,X8 MEM_DISP(rbp,-208), R(rdi)) + INSN2(mov,q ,R(r8),X8 MEM_DISP(rbp,-40)) + INSN2S(movs,d ,R(xmm3),X8 MEM_DISP(rbp,-120)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2S(movs,d ,R(xmm4),X8 MEM_DISP(rbp,-112)) + INSN2S(movs,d ,R(xmm5),X8 MEM_DISP(rbp,-104)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-208)) + INSN2S(movs,d ,R(xmm6),X8 MEM_DISP(rbp,-96)) + INSN2(mov,q ,NUM(0),X8 MEM_DISP(rbp,-176)) + INSN2S(movs,d ,R(xmm7),X8 MEM_DISP(rbp,-88)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-168)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-80)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-152)) + INSN1(call,_ ,INDIR(X8 MEM(rcx))) + INSN2(mov,l ,X4 MEM_DISP(rbp,-168), R(ecx)) + INSN2(test,l ,R(ecx), R(ecx)) + INSN1(je,_ ,L(41)) + INSN2(cmp,l ,NUM(1), R(ecx)) + INSN1(je,_ ,L(42)) + INSN2(cmp,l ,NUM(2), R(ecx)) + INSN1(je,_ ,L(42)) + INSN2(cmp,l ,NUM(3), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(4), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(5), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(6), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(51)) + INSN2(cmp,l ,NUM(7), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(8), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(9), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(10), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(11), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(12), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(13), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(14), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(15), R(ecx)) + P2ALIGN(4,5) + INSN1(jne,_ ,L(41)) + INSN2(test,b ,NUM(4),X1 MEM_DISP(rbp,-207)) + P2ALIGN(4,2) + INSN1(je,_ ,L(41)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-160), R(rsi)) + INSN2(lea,q ,X8 MEM_DISP(rsi,-1), R(rcx)) + INSN2(cmp,q ,NUM(15), R(rcx)) + INSN1(ja,_ ,L(41)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-176), R(rcx)) + INSN2(mov,q ,R(rcx), R(r11)) + INSN2(mov,q ,R(rcx), R(r8)) + INSN2(and,l ,NUM(7), R(r8d)) + INSN2(and,q ,NUM(-8), R(r11)) + INSN2(cmp,q ,NUM(8), R(rsi)) + INSN2(lea,q ,X8 MEM_INDEX(rsi,r8), R(r10)) + INSN1(ja,_ ,L(35)) + INSN2(cmp,q ,NUM(8), R(r10)) + INSN1(ja,_ ,L(37)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-1,r10,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(esi)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,r8,8), R(ecx)) + INSN1(dec,q ,R(rsi)) + INSN2(and,q ,X8 MEM(r11), R(rsi)) + INSN2(mov,q ,R(rsi), R(rax)) + INSN2(sar,q ,R(cl), R(rax)) + P2ALIGN(4,7) +L(41): + INSN2(add,q ,NUM(200), R(rsp)) + INSN1(pop,q ,R(r12)) + leave + ret + P2ALIGN(4,7) +L(42): + INSN2MOVXQ(movs,b,X1 MEM_DISP(rbp,-200),R(rax)) + INSN2(add,q ,NUM(200), R(rsp)) + INSN1(pop,q ,R(r12)) + leave + ret +L(49): + INSN2MOVXQ(movs,w,X2 MEM_DISP(rbp,-200),R(rax)) + INSN1(jmp,_ ,L(41)) +L(48): + INSN2MOVXQ(movz,b,X1 MEM_DISP(rbp,-200), R(rax)) + INSN1(jmp,_ ,L(41)) +L(46): + INSN2(mov,q ,X8 MEM_DISP(rbp,-200), R(rax)) + INSN1(jmp,_ ,L(41)) +L(50): + INSN2MOVXQ(movz,w,X2 MEM_DISP(rbp,-200), R(rax)) + INSN1(jmp,_ ,L(41)) +L(51): + INSN2MOVXLQ(movs,l,X4 MEM_DISP(rbp,-200),R(rax)) + INSN1(jmp,_ ,L(41)) +L(52): + INSN2(mov,l ,X4 MEM_DISP(rbp,-200), R(eax)) + INSN1(jmp,_ ,L(41)) +L(53): + INSN2S(movs,s ,X4 MEM_DISP(rbp,-200), R(xmm0)) + INSN1(jmp,_ ,L(41)) +L(54): + INSN2(movlp,d ,X8 MEM_DISP(rbp,-200), R(xmm0)) + INSN1(jmp,_ ,L(41)) +L(35): + INSN2(cmp,q ,NUM(16), R(r10)) + INSN1(ja,_ ,L(39)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,r10,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(esi)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,r8,8), R(r9d)) + INSN2(mov,l ,NUM(32), R(edi)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(lea,q ,X8 MEM_DISP_SHINDEX0(0,r8,4), R(rcx)) + INSN2(mov,q ,X8 MEM(r11), R(r8)) + INSN1(dec,q ,R(rsi)) + INSN2(and,q ,X8 MEM_DISP(r11,8), R(rsi)) + INSN2(sub,l ,R(ecx), R(edi)) + INSN2(mov,l ,R(r9d), R(ecx)) + INSN2(sar,q ,R(cl), R(r8)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(mov,q ,R(r8), R(rax)) + INSN2(mov,q ,R(rsi), R(r10)) + INSN2(mov,q ,R(rsi), R(rdx)) + INSN2(sal,q ,R(cl), R(r10)) + INSN2(sal,q ,R(cl), R(r10)) + INSN2(mov,l ,R(r9d), R(ecx)) + INSN2(or,q ,R(r10), R(rax)) + INSN2(sar,q ,R(cl), R(rdx)) + INSN1(jmp,_ ,L(41)) +L(37): + INSN2(mov,q ,X8 MEM(r11), R(rdi)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,r10,8), R(esi)) + INSN2(sal,q ,NUM(3), R(r8)) + INSN2(mov,l ,R(r8d), R(ecx)) + INSN2(mov,l ,NUM(2), R(r10d)) + INSN2(sar,q ,R(cl), R(rdi)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(mov,l ,NUM(64), R(esi)) + INSN2(sal,q ,R(cl), R(r10)) + INSN2(sub,l ,R(r8d), R(esi)) + INSN2(mov,q ,R(rdi), R(rax)) + INSN1(dec,q ,R(r10)) + INSN2(and,q ,X8 MEM_DISP(r11,8), R(r10)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(sal,q ,R(cl), R(r10)) + INSN2(or,q ,R(r10), R(rax)) + INSN1(jmp,_ ,L(41)) +L(39): + INSN2(lea,q ,X8 MEM_DISP_SHINDEX0(0,r8,8), R(rcx)) + INSN2(mov,q ,X8 MEM(r11), R(r12)) + INSN2(mov,q ,X8 MEM_DISP(r11,8), R(r8)) + INSN2(mov,l ,NUM(64), R(edi)) + INSN2(sub,l ,R(ecx), R(edi)) + INSN2(mov,l ,R(ecx), R(r9d)) + INSN2(sar,q ,R(cl), R(r12)) + INSN2(mov,q ,R(r8), R(rsi)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(mov,q ,R(r12), R(rax)) + INSN2(mov,l ,R(r9d), R(ecx)) + INSN2(or,q ,R(rsi), R(rax)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-129,r10,8), R(esi)) + INSN2(sar,q ,R(cl), R(r8)) + INSN2(mov,l ,NUM(2), R(r9d)) + INSN2(mov,q ,R(r8), R(rdx)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(sal,q ,R(cl), R(r9)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(lea,q ,X8 MEM_DISP(r9,-1), R(rsi)) + INSN2(and,q ,X8 MEM_DISP(r11,16), R(rsi)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(or,q ,R(rsi), R(rdx)) + INSN1(jmp,_ ,L(41)) +L(FE2): + FUNEND(vacall_receiver, .-vacall_receiver) +#if !(defined __sun || (defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __CYGWIN__)) + .section EH_FRAME_SECTION +L(frame1): + .long L(ECIE1)-.LSCIE1 +L(SCIE1): + .long 0x0 + .byte 0x1 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .byte 0x10 + .uleb128 0x1 + .byte 0x1b + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +L(ECIE1): +L(SFDE1): + .long L(EFDE1)-.LASFDE1 +L(ASFDE1): + .long L(ASFDE1)-.Lframe1 + .long L(FB2)-. + .long L(FE2)-.LFB2 + .uleb128 0x0 + .byte 0x4 + .long L(CFI0)-.LFB2 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long L(CFI1)-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long L(CFI3)-.LCFI1 + .byte 0x8c + .uleb128 0x3 + .align 8 +L(EFDE1): +#endif +#else + TEXT() + P2ALIGN(4,15) +GLOBL(C(vacall_receiver)) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) +L(FB2): + INSN1(push,q ,R(rbp)) +L(CFI0): + INSN2(mov,q ,R(rsp), R(rbp)) +L(CFI1): + INSN1(push,q ,R(r12)) +L(CFI2): + INSN2(sub,q ,NUM(200), R(rsp)) +L(CFI3): + INSN2(mov,q ,R(rcx),X8 MEM_DISP(rbp,-48)) + INSN2(lea,q ,X8 MEM_DISP(rbp,16), R(rcx)) + INSN2(mov,q ,R(rdi),X8 MEM_DISP(rbp,-72)) + INSN2(mov,q ,R(rsi),X8 MEM_DISP(rbp,-64)) + INSN2S(movs,d ,R(xmm0),X8 MEM_DISP(rbp,-144)) + INSN2(mov,q ,R(rcx),X8 MEM_DISP(rbp,-184)) + INSN2(mov,q ,R(rdx),X8 MEM_DISP(rbp,-56)) + INSN2S(movs,d ,R(xmm1),X8 MEM_DISP(rbp,-136)) + INSN2(mov,q ,R(r8),X8 MEM_DISP(rbp,-40)) + INSN2S(movs,d ,R(xmm2),X8 MEM_DISP(rbp,-128)) + INSN2(lea,q ,X8 MEM_DISP(rbp,-208), R(rdi)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,-32)) + INSN2S(movs,d ,R(xmm3),X8 MEM_DISP(rbp,-120)) + INSN2S(movs,d ,R(xmm4),X8 MEM_DISP(rbp,-112)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-208)) + INSN2S(movs,d ,R(xmm5),X8 MEM_DISP(rbp,-104)) + INSN2(mov,q ,NUM(0),X8 MEM_DISP(rbp,-176)) + INSN2S(movs,d ,R(xmm6),X8 MEM_DISP(rbp,-96)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-168)) + INSN2S(movs,d ,R(xmm7),X8 MEM_DISP(rbp,-88)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-80)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-152)) + INSN1(call,_ ,INDIR(X8 MEM_PCRELATIVE(C(vacall_function)))) + INSN2(mov,l ,X4 MEM_DISP(rbp,-168), R(ecx)) + INSN2(test,l ,R(ecx), R(ecx)) + INSN1(je,_ ,L(41)) + INSN2(cmp,l ,NUM(1), R(ecx)) + INSN1(je,_ ,L(42)) + INSN2(cmp,l ,NUM(2), R(ecx)) + INSN1(je,_ ,L(42)) + INSN2(cmp,l ,NUM(3), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(48)) + INSN2(cmp,l ,NUM(4), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(49)) + INSN2(cmp,l ,NUM(5), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(50)) + INSN2(cmp,l ,NUM(6), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(51)) + INSN2(cmp,l ,NUM(7), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(52)) + INSN2(cmp,l ,NUM(8), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(9), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(10), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(11), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(12), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(53)) + INSN2(cmp,l ,NUM(13), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(54)) + INSN2(cmp,l ,NUM(14), R(ecx)) + P2ALIGN(4,5) + INSN1(je,_ ,L(46)) + INSN2(cmp,l ,NUM(15), R(ecx)) + P2ALIGN(4,5) + INSN1(jne,_ ,L(41)) + INSN2(test,b ,NUM(4),X1 MEM_DISP(rbp,-207)) + P2ALIGN(4,2) + INSN1(je,_ ,L(41)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-160), R(rsi)) + INSN2(lea,q ,X8 MEM_DISP(rsi,-1), R(rcx)) + INSN2(cmp,q ,NUM(15), R(rcx)) + INSN1(ja,_ ,L(41)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-176), R(rcx)) + INSN2(mov,q ,R(rcx), R(r11)) + INSN2(mov,q ,R(rcx), R(r8)) + INSN2(and,l ,NUM(7), R(r8d)) + INSN2(and,q ,NUM(-8), R(r11)) + INSN2(cmp,q ,NUM(8), R(rsi)) + INSN2(lea,q ,X8 MEM_INDEX(rsi,r8), R(r10)) + INSN1(ja,_ ,L(35)) + INSN2(cmp,q ,NUM(8), R(r10)) + INSN1(ja,_ ,L(37)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-1,r10,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(esi)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,r8,8), R(ecx)) + INSN1(dec,q ,R(rsi)) + INSN2(and,q ,X8 MEM(r11), R(rsi)) + INSN2(mov,q ,R(rsi), R(rax)) + INSN2(sar,q ,R(cl), R(rax)) + P2ALIGN(4,7) +L(41): + INSN2(add,q ,NUM(200), R(rsp)) + INSN1(pop,q ,R(r12)) + leave + ret + P2ALIGN(4,7) +L(42): + INSN2MOVXQ(movs,b,X1 MEM_DISP(rbp,-200),R(rax)) + INSN2(add,q ,NUM(200), R(rsp)) + INSN1(pop,q ,R(r12)) + leave + ret +L(49): + INSN2MOVXQ(movs,w,X2 MEM_DISP(rbp,-200),R(rax)) + INSN1(jmp,_ ,L(41)) +L(48): + INSN2MOVXQ(movz,b,X1 MEM_DISP(rbp,-200), R(rax)) + INSN1(jmp,_ ,L(41)) +L(46): + INSN2(mov,q ,X8 MEM_DISP(rbp,-200), R(rax)) + INSN1(jmp,_ ,L(41)) +L(50): + INSN2MOVXQ(movz,w,X2 MEM_DISP(rbp,-200), R(rax)) + INSN1(jmp,_ ,L(41)) +L(51): + INSN2MOVXLQ(movs,l,X4 MEM_DISP(rbp,-200),R(rax)) + INSN1(jmp,_ ,L(41)) +L(52): + INSN2(mov,l ,X4 MEM_DISP(rbp,-200), R(eax)) + INSN1(jmp,_ ,L(41)) +L(53): + INSN2S(movs,s ,X4 MEM_DISP(rbp,-200), R(xmm0)) + INSN1(jmp,_ ,L(41)) +L(54): + INSN2(movlp,d ,X8 MEM_DISP(rbp,-200), R(xmm0)) + INSN1(jmp,_ ,L(41)) +L(35): + INSN2(cmp,q ,NUM(16), R(r10)) + INSN1(ja,_ ,L(39)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,r10,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(esi)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,r8,8), R(r9d)) + INSN2(mov,l ,NUM(32), R(edi)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(lea,q ,X8 MEM_DISP_SHINDEX0(0,r8,4), R(rcx)) + INSN2(mov,q ,X8 MEM(r11), R(r8)) + INSN1(dec,q ,R(rsi)) + INSN2(and,q ,X8 MEM_DISP(r11,8), R(rsi)) + INSN2(sub,l ,R(ecx), R(edi)) + INSN2(mov,l ,R(r9d), R(ecx)) + INSN2(sar,q ,R(cl), R(r8)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(mov,q ,R(r8), R(rax)) + INSN2(mov,q ,R(rsi), R(r10)) + INSN2(mov,q ,R(rsi), R(rdx)) + INSN2(sal,q ,R(cl), R(r10)) + INSN2(sal,q ,R(cl), R(r10)) + INSN2(mov,l ,R(r9d), R(ecx)) + INSN2(or,q ,R(r10), R(rax)) + INSN2(sar,q ,R(cl), R(rdx)) + INSN1(jmp,_ ,L(41)) +L(37): + INSN2(mov,q ,X8 MEM(r11), R(rdi)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,r10,8), R(esi)) + INSN2(sal,q ,NUM(3), R(r8)) + INSN2(mov,l ,R(r8d), R(ecx)) + INSN2(mov,l ,NUM(2), R(r10d)) + INSN2(sar,q ,R(cl), R(rdi)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(mov,l ,NUM(64), R(esi)) + INSN2(sal,q ,R(cl), R(r10)) + INSN2(sub,l ,R(r8d), R(esi)) + INSN2(mov,q ,R(rdi), R(rax)) + INSN1(dec,q ,R(r10)) + INSN2(and,q ,X8 MEM_DISP(r11,8), R(r10)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(sal,q ,R(cl), R(r10)) + INSN2(or,q ,R(r10), R(rax)) + INSN1(jmp,_ ,L(41)) +L(39): + INSN2(lea,q ,X8 MEM_DISP_SHINDEX0(0,r8,8), R(rcx)) + INSN2(mov,q ,X8 MEM(r11), R(r12)) + INSN2(mov,q ,X8 MEM_DISP(r11,8), R(r8)) + INSN2(mov,l ,NUM(64), R(edi)) + INSN2(sub,l ,R(ecx), R(edi)) + INSN2(mov,l ,R(ecx), R(r9d)) + INSN2(sar,q ,R(cl), R(r12)) + INSN2(mov,q ,R(r8), R(rsi)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(mov,q ,R(r12), R(rax)) + INSN2(mov,l ,R(r9d), R(ecx)) + INSN2(or,q ,R(rsi), R(rax)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-129,r10,8), R(esi)) + INSN2(sar,q ,R(cl), R(r8)) + INSN2(mov,l ,NUM(2), R(r9d)) + INSN2(mov,q ,R(r8), R(rdx)) + INSN2(mov,l ,R(esi), R(ecx)) + INSN2(sal,q ,R(cl), R(r9)) + INSN2(mov,l ,R(edi), R(ecx)) + INSN2(lea,q ,X8 MEM_DISP(r9,-1), R(rsi)) + INSN2(and,q ,X8 MEM_DISP(r11,16), R(rsi)) + INSN2(sal,q ,R(cl), R(rsi)) + INSN2(or,q ,R(rsi), R(rdx)) + INSN1(jmp,_ ,L(41)) +L(FE2): + FUNEND(vacall_receiver, .-vacall_receiver) +#if !(defined __sun || (defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __CYGWIN__)) + .section EH_FRAME_SECTION +L(frame1): + .long L(ECIE1)-.LSCIE1 +L(SCIE1): + .long 0x0 + .byte 0x1 + .string "" + .uleb128 0x1 + .sleb128 -8 + .byte 0x10 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +L(ECIE1): +L(SFDE1): + .long L(EFDE1)-.LASFDE1 +L(ASFDE1): + .long L(ASFDE1)-.Lframe1 + .quad L(FB2) + .quad L(FE2)-.LFB2 + .byte 0x4 + .long L(CFI0)-.LFB2 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long L(CFI1)-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long L(CFI3)-.LCFI1 + .byte 0x8c + .uleb128 0x3 + .align 8 +L(EFDE1): +#endif +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-x86_64-windows-macro.S b/vacall/vacall-x86_64-windows-macro.S new file mode 100644 index 0000000..d3e076a --- /dev/null +++ b/vacall/vacall-x86_64-windows-macro.S @@ -0,0 +1,350 @@ +#include "asm-x86_64.h" + TEXT() + P2ALIGN(4,15) + GLOBL(C(vacall_receiver)) + DECLARE_FUNCTION(vacall_receiver) +FUNBEGIN(vacall_receiver) +L(FB0): + INSN1(push,q ,R(rbp)) +L(CFI0): + INSN2(mov,q ,R(rsp), R(rbp)) +L(CFI1): + INSN2(sub,q ,NUM(144), R(rsp)) + INSN2(mov,q ,R(rcx),X8 MEM_DISP(rbp,16)) + INSN2(lea,q ,X8 MEM_DISP(rbp,16), R(rcx)) + INSN2(mov,q ,R(rdx),X8 MEM_DISP(rbp,24)) + INSN2(mov,q ,R(r8),X8 MEM_DISP(rbp,32)) + INSN2(mov,q ,R(r9),X8 MEM_DISP(rbp,40)) + INSN2S(movs,s ,R(xmm0),X4 MEM_DISP(rbp,-52)) + INSN2(mov,q ,R(rcx),X8 MEM_DISP(rbp,-88)) + INSN2S(movs,s ,R(xmm1),X4 MEM_DISP(rbp,-48)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-112)) + INSN2S(movs,s ,R(xmm2),X4 MEM_DISP(rbp,-44)) + INSN2(mov,q ,NUM(0),X8 MEM_DISP(rbp,-80)) + INSN2(lea,q ,X8 MEM_DISP(rbp,-112), R(rcx)) + INSN2S(movs,s ,R(xmm3),X4 MEM_DISP(rbp,-40)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-72)) + INSN2S(movs,d ,R(xmm0),X8 MEM_DISP(rbp,-32)) + INSN2(mov,l ,NUM(0),X4 MEM_DISP(rbp,-56)) + INSN2S(movs,d ,R(xmm1),X8 MEM_DISP(rbp,-24)) + INSN2S(movs,d ,R(xmm2),X8 MEM_DISP(rbp,-16)) + INSN2S(movs,d ,R(xmm3),X8 MEM_DISP(rbp,-8)) + INSN1(call,_ ,INDIR(X8 MEM_PCRELATIVE(C(vacall_function)))) + INSN2(mov,l ,X4 MEM_DISP(rbp,-72), R(edx)) + INSN2(test,l ,R(edx), R(edx)) + INSN1(je,_ ,L(1)) + INSN2(cmp,l ,NUM(1), R(edx)) + INSN1(je,_ ,L(34)) + INSN2(cmp,l ,NUM(2), R(edx)) + INSN1(je,_ ,L(34)) + INSN2(cmp,l ,NUM(3), R(edx)) + INSN1(je,_ ,L(37)) + INSN2(cmp,l ,NUM(4), R(edx)) + INSN1(je,_ ,L(38)) + INSN2(cmp,l ,NUM(5), R(edx)) + INSN1(je,_ ,L(39)) + INSN2(cmp,l ,NUM(6), R(edx)) + INSN1(je,_ ,L(40)) + INSN2(cmp,l ,NUM(7), R(edx)) + INSN1(je,_ ,L(41)) + INSN2(cmp,l ,NUM(8), R(edx)) + INSN1(je,_ ,L(35)) + INSN2(cmp,l ,NUM(9), R(edx)) + INSN1(je,_ ,L(35)) + INSN2(cmp,l ,NUM(10), R(edx)) + INSN1(je,_ ,L(35)) + INSN2(cmp,l ,NUM(11), R(edx)) + INSN1(je,_ ,L(35)) + INSN2(cmp,l ,NUM(12), R(edx)) + INSN1(je,_ ,L(42)) + INSN2(cmp,l ,NUM(13), R(edx)) + INSN1(je,_ ,L(43)) + INSN2(cmp,l ,NUM(14), R(edx)) + INSN1(je,_ ,L(35)) + INSN2(cmp,l ,NUM(15), R(edx)) + INSN1(jne,_ ,L(1)) + INSN2(test,b ,NUM(4),X1 MEM_DISP(rbp,-111)) + INSN1(je,_ ,L(17)) + INSN2(mov,q ,X8 MEM_DISP(rbp,-64), R(rdx)) + INSN2(lea,q ,X8 MEM_DISP(rdx,-4), R(rcx)) + INSN2(test,q ,NUM(-5), R(rcx)) + INSN1(je,_ ,L(20)) + INSN2(lea,q ,X8 MEM_DISP(rdx,-1), R(rcx)) + INSN2(cmp,q ,NUM(1), R(rcx)) + INSN1(ja,_ ,L(1)) +L(20): + INSN2(mov,q ,X8 MEM_DISP(rbp,-80), R(r8)) + INSN2(mov,q ,R(r8), R(r9)) + INSN2(and,l ,NUM(7), R(r8d)) + INSN2(add,q ,R(r8), R(rdx)) + INSN2(and,q ,NUM(-8), R(r9)) + INSN2(cmp,q ,NUM(8), R(rdx)) + INSN1(ja,_ ,L(19)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-1,rdx,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(edx)) + INSN2(sal,q ,R(cl), R(rdx)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,r8,8), R(ecx)) + INSN2(sub,q ,NUM(1), R(rdx)) + INSN2(and,q ,X8 MEM(r9), R(rdx)) + INSN2(sar,q ,R(cl), R(rdx)) + INSN2(mov,q ,R(rdx), R(rax)) +L(1): + leave +L(CFI2): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(34): +L(CFI3): + INSN2MOVXQ(movs,b,X1 MEM_DISP(rbp,-104), R(rax)) + leave +L(CFI4): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(35): +L(CFI5): + INSN2(mov,q ,X8 MEM_DISP(rbp,-104), R(rax)) + leave +L(CFI6): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(37): +L(CFI7): + INSN2MOVXL(movz,b,X1 MEM_DISP(rbp,-104), R(eax)) + leave +L(CFI8): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(38): +L(CFI9): + INSN2MOVXQ(movs,w,X2 MEM_DISP(rbp,-104), R(rax)) + leave +L(CFI10): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(39): +L(CFI11): + INSN2MOVXL(movz,w,X2 MEM_DISP(rbp,-104), R(eax)) + leave +L(CFI12): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(40): +L(CFI13): + INSN2MOVXLQ(movs,l,X4 MEM_DISP(rbp,-104), R(rax)) + leave +L(CFI14): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(42): +L(CFI15): + INSN2S(movs,s ,X4 MEM_DISP(rbp,-104), R(xmm0)) + leave +L(CFI16): + ret + P2ALIGN(4,10) + P2ALIGN(3,7) +L(41): +L(CFI17): + INSN2(mov,l ,X4 MEM_DISP(rbp,-104), R(eax)) + leave +L(CFI18): + ret +L(43): +L(CFI19): + INSN2S(movs,d ,X8 MEM_DISP(rbp,-104), R(xmm0)) + leave +L(CFI20): + ret +L(17): +L(CFI21): + INSN2(mov,q ,X8 MEM_DISP(rbp,-80), R(rax)) + leave +L(CFI22): + ret +L(19): +L(CFI23): + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(-65,rdx,8), R(ecx)) + INSN2(mov,l ,NUM(2), R(edx)) + INSN2(sal,q ,R(cl), R(rdx)) + INSN2(mov,l ,R(r8d), R(ecx)) + INSN2(sub,q ,NUM(1), R(rdx)) + INSN2(and,q ,X8 MEM_DISP(r9,8), R(rdx)) + INSN1(neg,l ,R(ecx)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(64,rcx,8), R(ecx)) + INSN2(sal,q ,R(cl), R(rdx)) + INSN2(lea,l ,X4 MEM_DISP_SHINDEX0(0,r8,8), R(ecx)) + INSN2(mov,q ,X8 MEM(r9), R(r8)) + leave +L(CFI24): + INSN2(sar,q ,R(cl), R(r8)) + INSN2(or,q ,R(r8), R(rdx)) + INSN2(mov,q ,R(rdx), R(rax)) + ret +L(FE0): + FUNEND(vacall_receiver, .-vacall_receiver) +#if !(defined __sun || (defined __APPLE__ && defined __MACH__) || (defined _WIN32 || defined __CYGWIN__)) + .section EH_FRAME_SECTION +L(frame1): + .long L(ECIE1)-.LSCIE1 +L(SCIE1): + .long 0 + .byte 0x3 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .uleb128 0x10 + .uleb128 0x1 + .byte 0x3 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +L(ECIE1): +L(SFDE1): + .long L(EFDE1)-.LASFDE1 +L(ASFDE1): + .long L(ASFDE1)-.Lframe1 + .long L(FB0) + .long L(FE0)-.LFB0 + .uleb128 0 + .byte 0x4 + .long L(CFI0)-.LFB0 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long L(CFI1)-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long L(CFI2)-.LCFI1 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI3)-.LCFI2 + .byte 0xb + .byte 0x4 + .long L(CFI4)-.LCFI3 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI5)-.LCFI4 + .byte 0xb + .byte 0x4 + .long L(CFI6)-.LCFI5 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI7)-.LCFI6 + .byte 0xb + .byte 0x4 + .long L(CFI8)-.LCFI7 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI9)-.LCFI8 + .byte 0xb + .byte 0x4 + .long L(CFI10)-.LCFI9 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI11)-.LCFI10 + .byte 0xb + .byte 0x4 + .long L(CFI12)-.LCFI11 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI13)-.LCFI12 + .byte 0xb + .byte 0x4 + .long L(CFI14)-.LCFI13 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI15)-.LCFI14 + .byte 0xb + .byte 0x4 + .long L(CFI16)-.LCFI15 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI17)-.LCFI16 + .byte 0xb + .byte 0x4 + .long L(CFI18)-.LCFI17 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI19)-.LCFI18 + .byte 0xb + .byte 0x4 + .long L(CFI20)-.LCFI19 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI21)-.LCFI20 + .byte 0xb + .byte 0x4 + .long L(CFI22)-.LCFI21 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long L(CFI23)-.LCFI22 + .byte 0xb + .byte 0x4 + .long L(CFI24)-.LCFI23 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .align 8 +L(EFDE1): +#endif +#if defined __linux__ || defined __FreeBSD__ || defined __FreeBSD_kernel__ || defined __DragonFly__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/vacall/vacall-x86_64-windows.c b/vacall/vacall-x86_64-windows.c new file mode 100644 index 0000000..a1ee543 --- /dev/null +++ b/vacall/vacall-x86_64-windows.c @@ -0,0 +1,191 @@ +/* vacall function for x86_64 CPU with the Windows ABI ('gcc -mabi=ms') */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("r10"); +#endif + +/*register __varword iarg1 __asm__("rcx");*/ +/*register __varword iarg2 __asm__("rdx");*/ +/*register __varword iarg3 __asm__("r8");*/ +/*register __varword iarg4 __asm__("r9");*/ + +register float farg1 __asm__("xmm0"); +register float farg2 __asm__("xmm1"); +register float farg3 __asm__("xmm2"); +register float farg4 __asm__("xmm3"); + +register double darg1 __asm__("xmm0"); +register double darg2 __asm__("xmm1"); +register double darg3 __asm__("xmm2"); +register double darg4 __asm__("xmm3"); + +register __varword iret __asm__("rax"); +register float fret __asm__("xmm0"); +register double dret __asm__("xmm0"); + +/* + * Tell gcc to not use the call-saved registers %rbx, %rsi, %rdi. + * This ensures that the return sequence does not need to restore registers + * from the stack. + */ +register void* dummy1 __asm__("%rbx"); +register void* dummy2 __asm__("%rsi"); +register void* dummy3 __asm__("%rdi"); + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword firstword) +{ + __va_alist list; + /* Move the arguments passed in registers to their stack locations. */ + (&firstword)[-4] = word1; + (&firstword)[-3] = word2; + (&firstword)[-2] = word3; + (&firstword)[-1] = word4; + /* Move the floating-point arguments passed in registers to temp storage. */ + list.farg[0] = farg1; + list.farg[1] = farg2; + list.farg[2] = farg3; + list.farg[3] = farg4; + list.darg[0] = darg1; + list.darg[1] = darg2; + list.darg[2] = darg3; + list.darg[3] = darg4; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)(&firstword - 4); + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.anum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulonglong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { + iret = (long)list.tmp._ptr; + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + /* Return structs of size 1, 2, 4, 8 in registers. */ + #if 0 /* Unoptimized */ + if (list.rsize == 1) { + iret = (__varword)((unsigned char *) list.raddr)[0]; + } else + if (list.rsize == 2) { + iret = (__varword)((unsigned char *) list.raddr)[0] + | ((__varword)((unsigned char *) list.raddr)[1] << 8); + } else + if (list.rsize == 4) { + iret = (__varword)((unsigned char *) list.raddr)[0] + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24); + } else + if (list.rsize == 8) { + iret = (__varword)((unsigned char *) list.raddr)[0] + | ((__varword)((unsigned char *) list.raddr)[1] << 8) + | ((__varword)((unsigned char *) list.raddr)[2] << 16) + | ((__varword)((unsigned char *) list.raddr)[3] << 24) + | ((__varword)((unsigned char *) list.raddr)[4] << 32) + | ((__varword)((unsigned char *) list.raddr)[5] << 40) + | ((__varword)((unsigned char *) list.raddr)[6] << 48) + | ((__varword)((unsigned char *) list.raddr)[7] << 56); + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ sizeof(__varword) */ + if (count == 1 || count == 2 || count == 4 || count == 8) { + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 2*sizeof(__varword) */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = ((__varword)2 << (end_offset*8-1)) - 1; + iret = (wordaddr[0] & mask0) >> (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + } else { + iret = (long)list.raddr; + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall-x86_64-windows.s b/vacall/vacall-x86_64-windows.s new file mode 100644 index 0000000..e1cadfb --- /dev/null +++ b/vacall/vacall-x86_64-windows.s @@ -0,0 +1,347 @@ + .file "vacall-x86_64-windows.c" + .text + .p2align 4,,15 + .globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: +.LFB0: + pushq %rbp +.LCFI0: + movq %rsp, %rbp +.LCFI1: + subq $144, %rsp + movq %rcx, 16(%rbp) + leaq 16(%rbp), %rcx + movq %rdx, 24(%rbp) + movq %r8, 32(%rbp) + movq %r9, 40(%rbp) + movss %xmm0, -52(%rbp) + movq %rcx, -88(%rbp) + movss %xmm1, -48(%rbp) + movl $0, -112(%rbp) + movss %xmm2, -44(%rbp) + movq $0, -80(%rbp) + leaq -112(%rbp), %rcx + movss %xmm3, -40(%rbp) + movl $0, -72(%rbp) + movsd %xmm0, -32(%rbp) + movl $0, -56(%rbp) + movsd %xmm1, -24(%rbp) + movsd %xmm2, -16(%rbp) + movsd %xmm3, -8(%rbp) + call *vacall_function(%rip) + movl -72(%rbp), %edx + testl %edx, %edx + je .L1 + cmpl $1, %edx + je .L34 + cmpl $2, %edx + je .L34 + cmpl $3, %edx + je .L37 + cmpl $4, %edx + je .L38 + cmpl $5, %edx + je .L39 + cmpl $6, %edx + je .L40 + cmpl $7, %edx + je .L41 + cmpl $8, %edx + je .L35 + cmpl $9, %edx + je .L35 + cmpl $10, %edx + je .L35 + cmpl $11, %edx + je .L35 + cmpl $12, %edx + je .L42 + cmpl $13, %edx + je .L43 + cmpl $14, %edx + je .L35 + cmpl $15, %edx + jne .L1 + testb $4, -111(%rbp) + je .L17 + movq -64(%rbp), %rdx + leaq -4(%rdx), %rcx + testq $-5, %rcx + je .L20 + leaq -1(%rdx), %rcx + cmpq $1, %rcx + ja .L1 +.L20: + movq -80(%rbp), %r8 + movq %r8, %r9 + andl $7, %r8d + addq %r8, %rdx + andq $-8, %r9 + cmpq $8, %rdx + ja .L19 + leal -1(,%rdx,8), %ecx + movl $2, %edx + salq %cl, %rdx + leal 0(,%r8,8), %ecx + subq $1, %rdx + andq (%r9), %rdx + sarq %cl, %rdx + movq %rdx, %rax +.L1: + leave +.LCFI2: + ret + .p2align 4,,10 + .p2align 3 +.L34: +.LCFI3: + movsbq -104(%rbp), %rax + leave +.LCFI4: + ret + .p2align 4,,10 + .p2align 3 +.L35: +.LCFI5: + movq -104(%rbp), %rax + leave +.LCFI6: + ret + .p2align 4,,10 + .p2align 3 +.L37: +.LCFI7: + movzbl -104(%rbp), %eax + leave +.LCFI8: + ret + .p2align 4,,10 + .p2align 3 +.L38: +.LCFI9: + movswq -104(%rbp), %rax + leave +.LCFI10: + ret + .p2align 4,,10 + .p2align 3 +.L39: +.LCFI11: + movzwl -104(%rbp), %eax + leave +.LCFI12: + ret + .p2align 4,,10 + .p2align 3 +.L40: +.LCFI13: + movslq -104(%rbp), %rax + leave +.LCFI14: + ret + .p2align 4,,10 + .p2align 3 +.L42: +.LCFI15: + movss -104(%rbp), %xmm0 + leave +.LCFI16: + ret + .p2align 4,,10 + .p2align 3 +.L41: +.LCFI17: + movl -104(%rbp), %eax + leave +.LCFI18: + ret +.L43: +.LCFI19: + movsd -104(%rbp), %xmm0 + leave +.LCFI20: + ret +.L17: +.LCFI21: + movq -80(%rbp), %rax + leave +.LCFI22: + ret +.L19: +.LCFI23: + leal -65(,%rdx,8), %ecx + movl $2, %edx + salq %cl, %rdx + movl %r8d, %ecx + subq $1, %rdx + andq 8(%r9), %rdx + negl %ecx + leal 64(,%rcx,8), %ecx + salq %cl, %rdx + leal 0(,%r8,8), %ecx + movq (%r9), %r8 + leave +.LCFI24: + sarq %cl, %r8 + orq %r8, %rdx + movq %rdx, %rax + ret +.LFE0: + .size vacall_receiver, .-vacall_receiver + .section .eh_frame,"a",@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 +.LSCIE1: + .long 0 + .byte 0x3 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .uleb128 0x10 + .uleb128 0x1 + .byte 0x3 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 8 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + .long .LFB0 + .long .LFE0-.LFB0 + .uleb128 0 + .byte 0x4 + .long .LCFI0-.LFB0 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI2-.LCFI1 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI3-.LCFI2 + .byte 0xb + .byte 0x4 + .long .LCFI4-.LCFI3 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI5-.LCFI4 + .byte 0xb + .byte 0x4 + .long .LCFI6-.LCFI5 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI7-.LCFI6 + .byte 0xb + .byte 0x4 + .long .LCFI8-.LCFI7 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI9-.LCFI8 + .byte 0xb + .byte 0x4 + .long .LCFI10-.LCFI9 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI11-.LCFI10 + .byte 0xb + .byte 0x4 + .long .LCFI12-.LCFI11 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI13-.LCFI12 + .byte 0xb + .byte 0x4 + .long .LCFI14-.LCFI13 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI15-.LCFI14 + .byte 0xb + .byte 0x4 + .long .LCFI16-.LCFI15 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI17-.LCFI16 + .byte 0xb + .byte 0x4 + .long .LCFI18-.LCFI17 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI19-.LCFI18 + .byte 0xb + .byte 0x4 + .long .LCFI20-.LCFI19 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI21-.LCFI20 + .byte 0xb + .byte 0x4 + .long .LCFI22-.LCFI21 + .byte 0xa + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI23-.LCFI22 + .byte 0xb + .byte 0x4 + .long .LCFI24-.LCFI23 + .byte 0xc6 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .align 8 +.LEFDE1: + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/vacall/vacall-x86_64-x32-linux.s b/vacall/vacall-x86_64-x32-linux.s new file mode 100644 index 0000000..127f761 --- /dev/null +++ b/vacall/vacall-x86_64-x32-linux.s @@ -0,0 +1,286 @@ + .file "vacall-x86_64.c" + .section .text.unlikely,"ax",@progbits +.LCOLDB0: + .text +.LHOTB0: + .p2align 4,,15 + .globl vacall_receiver + .type vacall_receiver, @function +vacall_receiver: +.LFB0: + pushq %rbp +.LCFI0: + movl %esp, %ebp +.LCFI1: + pushq %r14 + subl $184, %esp +.LCFI2: + movq %rsi, -64(%ebp) + leal 16(%rbp), %esi + movq %rcx, -48(%ebp) + movl vacall_function(%rip), %ecx + movsd %xmm0, -144(%ebp) + movq %rdi, -72(%ebp) + movq %rdx, -56(%ebp) + movsd %xmm1, -136(%ebp) + movq %r8, -40(%ebp) + movsd %xmm2, -128(%ebp) + leal -192(%rbp), %edi + movq %r9, -32(%ebp) + movsd %xmm3, -120(%ebp) + movsd %xmm4, -112(%ebp) + movl $0, -192(%ebp) + movsd %xmm5, -104(%ebp) + movl %esi, -168(%ebp) + movsd %xmm6, -96(%ebp) + movl $0, -164(%ebp) + movsd %xmm7, -88(%ebp) + movl $0, -160(%ebp) + movl $0, -80(%ebp) + movl $0, -152(%ebp) + call *%rcx + movl -160(%ebp), %ecx + testl %ecx, %ecx + je .L1 + cmpl $1, %ecx + je .L27 + cmpl $2, %ecx + je .L27 + cmpl $3, %ecx + je .L33 + cmpl $4, %ecx + je .L34 + cmpl $5, %ecx + je .L35 + cmpl $6, %ecx + je .L28 + cmpl $7, %ecx + je .L30 + cmpl $8, %ecx + je .L28 + cmpl $9, %ecx + je .L30 + cmpl $10, %ecx + je .L31 + cmpl $11, %ecx + je .L31 + cmpl $12, %ecx + je .L36 + cmpl $13, %ecx + je .L37 + cmpl $14, %ecx + je .L30 + cmpl $15, %ecx + jne .L1 + testb $4, -191(%ebp) + je .L1 + movl -156(%ebp), %ecx + leal -1(%rcx), %esi + cmpl $15, %esi + ja .L1 + movl -164(%ebp), %esi + movl %esi, %edi + andl $7, %esi + andl $-8, %edi + cmpl $8, %ecx + leal (%rcx,%rsi), %r10d + ja .L17 + cmpl $8, %r10d + ja .L18 + leal -1(,%r10,8), %ecx + movl $2, %r8d + salq %cl, %r8 + movq %r8, %rcx + subq $1, %rcx + andq (%edi), %rcx + movq %rcx, %rdi + leal 0(,%rsi,8), %ecx + sarq %cl, %rdi + movq %rdi, %rax +.L1: + addl $184, %esp + popq %r14 + popq %rbp +.LCFI3: + ret + .p2align 4,,10 + .p2align 3 +.L27: +.LCFI4: + movsbq -184(%ebp), %rax + addl $184, %esp + popq %r14 + popq %rbp +.LCFI5: + ret + .p2align 4,,10 + .p2align 3 +.L28: +.LCFI6: + movslq -184(%ebp), %rax + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L33: + movzbl -184(%ebp), %eax + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L34: + movswq -184(%ebp), %rax + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L30: + movl -184(%ebp), %eax + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L35: + movzwl -184(%ebp), %eax + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L36: + movss -184(%ebp), %xmm0 + jmp .L1 + .p2align 4,,10 + .p2align 3 +.L31: + movq -184(%ebp), %rax + jmp .L1 +.L37: + movsd -184(%ebp), %xmm0 + jmp .L1 +.L17: + cmpl $16, %r10d + leal 0(,%rsi,8), %r9d + jbe .L38 + negl %esi + movq 8(%edi), %r8 + movl %r9d, %ecx + leal 64(,%rsi,8), %r11d + movq (%edi), %rsi + movq %r8, %r14 + sarq %cl, %rsi + movl %r11d, %ecx + salq %cl, %r14 + leal -129(,%r10,8), %ecx + orq %r14, %rsi + movq %rsi, %rax + movl $2, %esi + salq %cl, %rsi + movl %r11d, %ecx + subq $1, %rsi + andq 16(%edi), %rsi + salq %cl, %rsi + movl %r9d, %ecx + sarq %cl, %r8 + orq %r8, %rsi + movq %rsi, %rdx + jmp .L1 +.L18: + leal -65(,%r10,8), %ecx + movl $2, %r8d + salq %cl, %r8 + movl %esi, %ecx + subq $1, %r8 + andq 8(%edi), %r8 + negl %ecx + leal 64(,%rcx,8), %ecx + movq (%edi), %rdi + salq %cl, %r8 + leal 0(,%rsi,8), %ecx + sarq %cl, %rdi + orq %rdi, %r8 + movq %r8, %rax + jmp .L1 +.L38: + leal -65(,%r10,8), %ecx + movl $2, %r8d + movq (%edi), %r10 + imull $-4, %esi, %esi + salq %cl, %r8 + movl %r9d, %ecx + subq $1, %r8 + andq 8(%edi), %r8 + sarq %cl, %r10 + addl $32, %esi + movl %esi, %ecx + movq %r8, %rdi + salq %cl, %rdi + salq %cl, %rdi + movl %r9d, %ecx + orq %rdi, %r10 + sarq %cl, %r8 + movq %r10, %rax + movq %r8, %rdx + jmp .L1 +.LFE0: + .size vacall_receiver, .-vacall_receiver + .section .text.unlikely +.LCOLDE0: + .text +.LHOTE0: + .section .eh_frame,"a",@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 +.LSCIE1: + .long 0 + .byte 0x3 + .string "zR" + .uleb128 0x1 + .sleb128 -8 + .uleb128 0x10 + .uleb128 0x1 + .byte 0x3 + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x90 + .uleb128 0x1 + .align 4 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 +.LASFDE1: + .long .LASFDE1-.Lframe1 + .long .LFB0 + .long .LFE0-.LFB0 + .uleb128 0 + .byte 0x4 + .long .LCFI0-.LFB0 + .byte 0xe + .uleb128 0x10 + .byte 0x86 + .uleb128 0x2 + .byte 0x4 + .long .LCFI1-.LCFI0 + .byte 0xd + .uleb128 0x6 + .byte 0x4 + .long .LCFI2-.LCFI1 + .byte 0x8e + .uleb128 0x3 + .byte 0x4 + .long .LCFI3-.LCFI2 + .byte 0xa + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI4-.LCFI3 + .byte 0xb + .byte 0x4 + .long .LCFI5-.LCFI4 + .byte 0xa + .byte 0xc + .uleb128 0x7 + .uleb128 0x8 + .byte 0x4 + .long .LCFI6-.LCFI5 + .byte 0xb + .align 4 +.LEFDE1: + .ident "GCC: (GNU) 5.4.0" + .section .note.GNU-stack,"",@progbits diff --git a/vacall/vacall-x86_64.c b/vacall/vacall-x86_64.c new file mode 100644 index 0000000..c4694fb --- /dev/null +++ b/vacall/vacall-x86_64.c @@ -0,0 +1,234 @@ +/* vacall function for x86_64 CPU with the Unix ABI ('gcc -mabi=sysv') */ + +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#include "vacall-internal.h" + +#ifdef REENTRANT +#define vacall_receiver callback_receiver +register struct { void (*vacall_function) (void*,va_alist); void* arg; } + * env __asm__("r10"); +#endif + +/*register __varword iarg1 __asm__("rdi");*/ +/*register __varword iarg2 __asm__("rsi");*/ +/*register __varword iarg3 __asm__("rdx");*/ +/*register __varword iarg4 __asm__("rcx");*/ +/*register __varword iarg5 __asm__("r8");*/ +/*register __varword iarg6 __asm__("r9");*/ + +register double farg1 __asm__("xmm0"); +register double farg2 __asm__("xmm1"); +register double farg3 __asm__("xmm2"); +register double farg4 __asm__("xmm3"); +register double farg5 __asm__("xmm4"); +register double farg6 __asm__("xmm5"); +register double farg7 __asm__("xmm6"); +register double farg8 __asm__("xmm7"); + +register __varword iret __asm__("rax"); +register __varword iret2 __asm__("rdx"); +register float fret __asm__("xmm0"); +register double dret __asm__("xmm0"); + +/* + * Tell gcc to not use the call-saved registers %rbx, %rbp. + * This ensures that the return sequence does not need to restore registers + * from the stack. + */ +register void* dummy1 __asm__("%rbx"); +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9) +register void* dummy2 __asm__("%rbp"); +#endif + +#ifdef REENTRANT +static +#endif +void /* the return type is variable, not void! */ +vacall_receiver (__vaword word1, __vaword word2, __vaword word3, __vaword word4, + __vaword word5, __vaword word6, + __vaword firstword) +{ + __va_alist list; + /* Move the arguments passed in registers to temp storage. */ + list.iarg[0] = word1; + list.iarg[1] = word2; + list.iarg[2] = word3; + list.iarg[3] = word4; + list.iarg[4] = word5; + list.iarg[5] = word6; + list.farg[0] = farg1; + list.farg[1] = farg2; + list.farg[2] = farg3; + list.farg[3] = farg4; + list.farg[4] = farg5; + list.farg[5] = farg6; + list.farg[6] = farg7; + list.farg[7] = farg8; + /* Prepare the va_alist. */ + list.flags = 0; + list.aptr = (long)&firstword; + list.raddr = (void*)0; + list.rtype = __VAvoid; + list.ianum = 0; + list.fanum = 0; + /* Call vacall_function. The macros do all the rest. */ +#ifndef REENTRANT + (*vacall_function) (&list); +#else /* REENTRANT */ + (*env->vacall_function) (env->arg,&list); +#endif + /* Put return value into proper register. */ + if (list.rtype == __VAvoid) { + } else + if (list.rtype == __VAchar) { + iret = list.tmp._char; + } else + if (list.rtype == __VAschar) { + iret = list.tmp._schar; + } else + if (list.rtype == __VAuchar) { + iret = list.tmp._uchar; + } else + if (list.rtype == __VAshort) { + iret = list.tmp._short; + } else + if (list.rtype == __VAushort) { + iret = list.tmp._ushort; + } else + if (list.rtype == __VAint) { + iret = list.tmp._int; + } else + if (list.rtype == __VAuint) { + iret = list.tmp._uint; + } else + if (list.rtype == __VAlong) { + iret = list.tmp._long; + } else + if (list.rtype == __VAulong) { + iret = list.tmp._ulong; + } else + if (list.rtype == __VAlonglong) { +#ifdef __x86_64_x32__ + iret = list.tmp._longlong; +#else + iret = list.tmp._long; +#endif + } else + if (list.rtype == __VAulonglong) { +#ifdef __x86_64_x32__ + iret = list.tmp._ulonglong; +#else + iret = list.tmp._ulong; +#endif + } else + if (list.rtype == __VAfloat) { + fret = list.tmp._float; + } else + if (list.rtype == __VAdouble) { + dret = list.tmp._double; + } else + if (list.rtype == __VAvoidp) { +#ifdef __x86_64_x32__ + /* The x86_64 ABI, section 10.1, specifies that pointers are zero-extended + from 32 bits to 64 bits. */ + iret = (unsigned long long)(unsigned long)list.tmp._ptr; +#else + iret = (long)list.tmp._ptr; +#endif + } else + if (list.rtype == __VAstruct) { + if (list.flags & __VA_REGISTER_STRUCT_RETURN) { + /* Return structs of size <= 16 in registers. */ + if (list.rsize > 0 && list.rsize <= 16) { + #if 0 /* Unoptimized */ + iret = (__varword)((unsigned char *) list.raddr)[0]; + if (list.rsize >= 2) + iret |= (__varword)((unsigned char *) list.raddr)[1] << 8; + if (list.rsize >= 3) + iret |= (__varword)((unsigned char *) list.raddr)[2] << 16; + if (list.rsize >= 4) + iret |= (__varword)((unsigned char *) list.raddr)[3] << 24; + if (list.rsize >= 5) + iret |= (__varword)((unsigned char *) list.raddr)[4] << 32; + if (list.rsize >= 6) + iret |= (__varword)((unsigned char *) list.raddr)[5] << 40; + if (list.rsize >= 7) + iret |= (__varword)((unsigned char *) list.raddr)[6] << 48; + if (list.rsize >= 8) + iret |= (__varword)((unsigned char *) list.raddr)[7] << 56; + if (list.rsize >= 9) { + iret2 = (__varword)((unsigned char *) list.raddr)[8]; + if (list.rsize >= 10) + iret2 |= (__varword)((unsigned char *) list.raddr)[9] << 8; + if (list.rsize >= 11) + iret2 |= (__varword)((unsigned char *) list.raddr)[10] << 16; + if (list.rsize >= 12) + iret2 |= (__varword)((unsigned char *) list.raddr)[11] << 24; + if (list.rsize >= 13) + iret2 |= (__varword)((unsigned char *) list.raddr)[12] << 32; + if (list.rsize >= 14) + iret2 |= (__varword)((unsigned char *) list.raddr)[13] << 40; + if (list.rsize >= 15) + iret2 |= (__varword)((unsigned char *) list.raddr)[14] << 48; + if (list.rsize >= 16) + iret2 |= (__varword)((unsigned char *) list.raddr)[15] << 56; + } + #else /* Optimized: fewer conditional jumps, fewer memory accesses */ + uintptr_t count = list.rsize; /* > 0, ≤ 2*sizeof(__varword) */ + __varword* wordaddr = (__varword*)((uintptr_t)list.raddr & ~(uintptr_t)(sizeof(__varword)-1)); + uintptr_t start_offset = (uintptr_t)list.raddr & (uintptr_t)(sizeof(__varword)-1); /* ≥ 0, < sizeof(__varword) */ + uintptr_t end_offset = start_offset + count; /* > 0, < 3*sizeof(__varword) */ + if (count <= sizeof(__varword)) { + /* Assign iret. */ + if (end_offset <= sizeof(__varword)) { + /* 0 < end_offset ≤ sizeof(__varword) */ + __varword mask0 = ((__varword)2 << (end_offset*8-1)) - 1; + iret = (wordaddr[0] & mask0) >> (start_offset*8); + } else { + /* sizeof(__varword) < end_offset < 2*sizeof(__varword), start_offset > 0 */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*8-start_offset*8)); + } + } else { + /* Assign iret, iret2. */ + if (end_offset <= 2*sizeof(__varword)) { + /* sizeof(__varword) < end_offset ≤ 2*sizeof(__varword) */ + __varword mask1 = ((__varword)2 << (end_offset*8-sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | ((wordaddr[1] & mask1) << (sizeof(__varword)*4-start_offset*4) << (sizeof(__varword)*4-start_offset*4)); + iret2 = (wordaddr[1] & mask1) >> (start_offset*8); + } else { + /* 2*sizeof(__varword) < end_offset < 3*sizeof(__varword), start_offset > 0 */ + __varword mask2 = ((__varword)2 << (end_offset*8-2*sizeof(__varword)*8-1)) - 1; + iret = (wordaddr[0] >> (start_offset*8)) | (wordaddr[1] << (sizeof(__varword)*8-start_offset*8)); + iret2 = (wordaddr[1] >> (start_offset*8)) | ((wordaddr[2] & mask2) << (sizeof(__varword)*8-start_offset*8)); + } + } + #endif + } + } + } +} + +#ifdef REENTRANT +__vacall_r_t +callback_get_receiver (void) +{ + return (__vacall_r_t)(void*)&callback_receiver; +} +#endif diff --git a/vacall/vacall.3 b/vacall/vacall.3 new file mode 100644 index 0000000..2737b2c --- /dev/null +++ b/vacall/vacall.3 @@ -0,0 +1,295 @@ +.\" Copyright (C) 1995-2017 Bruno Haible +.\" +.\" This manual is free documentation. It is dually licensed under the +.\" GNU FDL and the GNU GPL. This means that you can redistribute this +.\" manual under either of these two licenses, at your choice. +.\" +.\" This manual is covered by the GNU FDL. Permission is granted to copy, +.\" distribute and/or modify this document under the terms of the +.\" GNU Free Documentation License (FDL), either version 1.2 of the +.\" License, or (at your option) any later version published by the +.\" Free Software Foundation (FSF); with no Invariant Sections, with no +.\" Front-Cover Text, and with no Back-Cover Texts. +.\" A copy of the license is at . +.\" +.\" This manual is covered by the GNU GPL. You can redistribute it and/or +.\" modify it under the terms of the GNU General Public License (GPL), either +.\" version 2 of the License, or (at your option) any later version published +.\" by the Free Software Foundation (FSF). +.\" A copy of the license is at . +.\" +.TH VACALL 3 "1 January 2017" +.SH NAME +vacall \- C functions called with variable arguments +.SH SYNOPSIS +.B #include +.LP +.B extern void* vacall_function; +.LP +.nf +.BI "void " function " (va_alist" alist ")" +.BI "{" +.BI " va_start_" type "(" alist "[, " return_type "]);" +.BI " " arg " = va_arg_" type "(" alist "[, " arg_type "]);" +.BI " va_return_" type "(" alist "[[, " return_type "], " return_value "]);" +.BI "}" +.fi +.LP +.BI "vacall_function = " "&function" ";" +.LP +.IB "val" " = ((" return_type " (*) ()) vacall) (" arg1 , arg2 , ... ");" +.SH DESCRIPTION +This set of macros permit a C function +.I function +to be called with variable arguments and to return variable return values. +This is much like the +.BR stdarg (3) +facility, but also allows the return value to be specified at run time. + +Function calling conventions differ considerably on different machines, and +.I vacall +attempts to provide some degree of isolation from such architecture +dependencies. + +The function that can be called with any number and type of arguments +and which will return any type of return value is +.BR vacall . +It will do some magic and call the function stored in the variable +.BR vacall_function . +If you want to make more than one use of +.IR vacall , +use the +.IR trampoline (3) +facility to store +.I &function +into +.B vacall_function +just before calling +.BR vacall . + +Within +.IR function , +the following macros can be used to walk through the argument list and +specify a return value: +.RS 0 +.TP +.BI "va_start_" type "(" alist "[, " return_type "]);" +starts the walk through the argument list and specifies the return type. +.TP +.IB arg " = va_arg_" type "(" alist "[, " arg_type "]);" +fetches the next argument from the argument list. +.TP +.BI "va_return_" type "(" alist "[[, " return_type "], " return_value "]);" +ends the walk through the argument list and specifies the return value. +.RE + +The +.I type +in +.BI va_start_ type +and +.BI va_return_ type +shall be one of +.BR void ", " int ", " uint ", " long ", " ulong ", " longlong ", " ulonglong ", " double ", " struct ", " ptr +or (for ANSI C calling conventions only) +.BR char ", " schar ", " uchar ", " short ", " ushort ", " float , +depending on the class of +.IR return_type . + +The +.I type +specifiers in +.BI va_start_ type +and +.BI va_return_ type +must be the same. +The +.I return_type +specifiers passed to +.BI va_start_ type +and +.BI va_return_ type +must be the same. + +The +.I type +in +.BI va_arg_ type +shall be one of +.BR int ", " uint ", " long ", " ulong ", " longlong ", " ulonglong ", " double ", " struct ", " ptr +or (for ANSI C calling conventions only) +.BR char ", " schar ", " uchar ", " short ", " ushort ", " float , +depending on the class of +.IR arg_type . + +In +.BI "va_start_struct(" alist ", " return_type ", " splittable ); +the +.I splittable +flag specifies whether the struct +.I return_type +can be returned in registers such that every struct field fits entirely in +a single register. This needs to be specified for structs of size +2*sizeof(long). For structs of size <= sizeof(long), +.I splittable +is ignored and assumed to be 1. For structs of size > 2*sizeof(long), +.I splittable +is ignored and assumed to be 0. There are some handy macros for this: +.nf +.BI "va_word_splittable_1 (" type1 ) +.BI "va_word_splittable_2 (" type1 ", " type2 ) +.BI "va_word_splittable_3 (" type1 ", " type2 ", " type3 ) +.BI "va_word_splittable_4 (" type1 ", " type2 ", " type3 ", " type4 ) +.fi +For a struct with three slots +.nf +.BI "struct { " "type1 id1" "; " "type2 id2" "; " "type3 id3" "; }" +.fi +you can specify +.I splittable +as +.BI "va_word_splittable_3 (" type1 ", " type2 ", " type3 ) +.RB . + +.SH NOTES + +Functions which want to emulate Kernighan & Ritchie style functions (i.e., +in ANSI C, functions without a typed argument list) cannot use the +.I type +values +.BR char ", " schar ", " uchar ", " short ", " ushort ", " float . +As prescribed by the default K&R C expression promotions, they have +to use +.B int +instead of +.BR char ", " schar ", " uchar ", " short ", " ushort +and +.B double +instead of +.BR float . + +The macros +.BR va_start_longlong(\|) , +.BR va_start_ulonglong(\|) , +.BR va_return_longlong(\|) , +.BR va_return_ulonglong(\|) , +.B va_arg_longlong(\|) +and +.B va_arg_ulonglong(\|) +work only if the C compiler has a working +.B long long +64-bit integer type. + +The struct types used in +.B va_start_struct(\|) +and +.B va_struct(\|) +must only contain (signed or unsigned) int, long, long long or pointer fields. +Struct types containing (signed or unsigned) char, short, float, double or +other structs are not supported. + +.SH EXAMPLE + +This example, a possible implementation of +.BR execl (3) +on top of +.BR execv (2) +using +.BR stdarg (3), + +.nf +.ft B +#include +#define MAXARGS 100 +/* execl is called by execl(file, arg1, arg2, ..., (char *)0); */ +int execl (...) +{ + va_list ap; + char* file; + char* args[MAXARGS]; + int argno = 0; + va_start (ap); + file = va_arg(ap, char*); + while ((args[argno] = va_arg(ap, char*)) != (char *)0) + argno++; + va_end (ap); + return execv(file, args); +} +.ft +.fi + +looks like this using +.BR vacall (3): + +.nf +.ft B +#include +#define MAXARGS 100 +/* execl is called by vacall(file, arg1, arg2, ..., (char *)0); */ +void execl (va_alist ap) +{ + char* file; + char* args[MAXARGS]; + int argno = 0; + int retval; + va_start_int (ap); + file = va_arg_ptr(ap, char*); + while ((args[argno] = va_arg_ptr(ap, char*)) != (char *)0) + argno++; + retval = execv(file, args); + va_return_int (ap, retval); +} +vacall_function = &execl; +.ft +.fi + +.SH SEE ALSO +.BR stdarg (3), +.BR trampoline (3), +.BR callback (3). + +.SH BUGS + +The current implementations have been tested on a selection of common +cases but there are probably still many bugs. + +There are typically built-in limits on the size of the argument-list, +which may also include the size of any structure arguments. + +The decision whether a struct is to be returned in registers or in memory +considers only the struct's size and alignment. This is inaccurate: for +example, gcc on m68k-next returns +.B "struct { char a,b,c; }" +in registers and +.B "struct { char a[3]; }" +in memory, although both types have the same size and the same alignment. + +The argument list can only be walked once. + +The use of the global variable +.B vacall_function +is not reentrant. This is fixed in the +.BR callback (3) +package. + +.SH PORTING + +Knowledge about argument passing conventions can be found in the gcc +source, file +.RI gcc-2.6.3/config/ cpu / cpu .h, +section "Stack layout; function entry, exit and calling." + +The implementation of varargs for gcc can be found in the gcc source, files +gcc-2.6.3/ginclude/va*.h. + +gcc's __builtin_saveregs() function is defined in the gcc source, file +gcc-2.6.3/libgcc2.c. + +.SH AUTHOR + +Bruno Haible + +.SH ACKNOWLEDGEMENTS + +Many ideas and a lot of code were cribbed from the gcc source. + diff --git a/vacall/vacall.h b/vacall/vacall.h new file mode 100644 index 0000000..9d14d4a --- /dev/null +++ b/vacall/vacall.h @@ -0,0 +1,465 @@ +/* + * Copyright 1995-2021 Bruno Haible + * + * 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, see . + */ + +#ifndef _VACALL_H +#define _VACALL_H + +#include + +#include "ffcall-version.h" +#include "ffcall-abi.h" + + +/* Determine whether the current ABI is LLP64 + ('long' = 32-bit, 'long long' = 'void*' = 64-bit). */ +#if defined(__x86_64__) && defined(_WIN32) && !defined(__CYGWIN__) +#define __VA_LLP64 1 +#endif + +/* Determine the alignment of a type at compile time. + */ +#if defined(__GNUC__) || defined(__IBM__ALIGNOF__) +#define __VA_alignof __alignof__ +#elif defined(__cplusplus) +template struct __VA_alignof_helper { char __slot1; type __slot2; }; +#define __VA_alignof(type) offsetof (__VA_alignof_helper, __slot2) +#elif defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) /* SGI compiler */ +#define __VA_alignof __builtin_alignof +#else +#define __VA_offsetof(type,ident) ((unsigned long)&(((type*)0)->ident)) +#define __VA_alignof(type) __VA_offsetof(struct { char __slot1; type __slot2; }, __slot2) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* __vaword represents a single word that can be pushed on the stack. + * __varword represents a general-purpose register. + */ +#if defined(__arm64__) && defined(__APPLE__) && defined(__MACH__) +typedef int __vaword; +typedef long __varword; +#elif defined(__mipsn32__) || defined(__x86_64_x32__) || defined(__VA_LLP64) +typedef long long __vaword; +typedef long long __varword; +#else +typedef long __vaword; +typedef long __varword; +#endif + +/* C builtin types. + */ +enum __VAtype +{ + __VAvoid, + __VAchar, + __VAschar, + __VAuchar, + __VAshort, + __VAushort, + __VAint, + __VAuint, + __VAlong, + __VAulong, + __VAlonglong, + __VAulonglong, + __VAfloat, + __VAdouble, + __VAvoidp, + __VAstruct +}; + +enum __VA_alist_flags +{ + + /* how to return structs */ + /* There are basically 3 ways to return structs: + * a. The called function returns a pointer to static data. Not reentrant. + * Not supported any more. + * b. The caller passes the return structure address in a dedicated register + * or as a first (or last), invisible argument. The called function stores + * its result there. + * c. Like b, and the called function also returns the return structure + * address in the return value register. (This is not very distinguishable + * from b.) + * Independently of this, + * r. small structures (<= 4 or <= 8 bytes) may be returned in the return + * value register(s), or + * m. even small structures are passed in memory. + */ + /* gcc-2.6.3 employs the following strategy: + * - If PCC_STATIC_STRUCT_RETURN is defined in the machine description + * it uses method a, else method c. + * - If flag_pcc_struct_return is set (either by -fpcc-struct-return or if + * DEFAULT_PCC_STRUCT_RETURN is defined to 1 in the machine description) + * it uses method m, else (either by -freg-struct-return or if + * DEFAULT_PCC_STRUCT_RETURN is defined to 0 in the machine description) + * method r. + */ + __VA_SMALL_STRUCT_RETURN = 1<<1, /* r: special case for small structs */ + __VA_GCC_STRUCT_RETURN = 1<<2, /* consider 8 byte structs as small */ +#if defined(__sparc__) && !defined(__sparc64__) + __VA_SUNCC_STRUCT_RETURN = 1<<3, + __VA_SUNPROCC_STRUCT_RETURN = 1<<4, +#else + __VA_SUNCC_STRUCT_RETURN = 0, + __VA_SUNPROCC_STRUCT_RETURN = 0, +#endif +#if defined(__i386__) + __VA_MSVC_STRUCT_RETURN = 1<<4, +#endif + /* the default way to return structs */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another struct returning convention, + * just #define __VA_STRUCT_RETURN ... + * before or after #including . + */ +#ifndef __VA_STRUCT_RETURN + __VA_STRUCT_RETURN = +#if defined(__sparc__) && !defined(__sparc64__) && defined(__sun) && (defined(__SUNPRO_C) || defined(__SUNPRO_CC)) /* SUNWspro cc or CC */ + __VA_SUNPROCC_STRUCT_RETURN, +#else +#if (defined(__i386__) && (defined(_WIN32) || defined(__CYGWIN__) || (defined(__MACH__) && defined(__APPLE__)) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__))) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__hppa__) || defined(__hppa64__) || defined(__arm__) || defined(__armhf__) || defined(__arm64__) || defined(__powerpc64_elfv2__) || defined(__ia64__) || defined(__x86_64__) || defined(__riscv32__) || defined(__riscv64__) + __VA_SMALL_STRUCT_RETURN | +#endif +#if defined(__GNUC__) && !((defined(__mipsn32__) || defined(__mips64__)) && ((__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3))) + __VA_GCC_STRUCT_RETURN | +#endif +#if defined(__i386__) && defined(_WIN32) && !defined(__CYGWIN__) /* native Windows */ + __VA_MSVC_STRUCT_RETURN | +#endif + 0, +#endif +#endif + + /* how to return floats */ +#if defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__)) + __VA_SUNCC_FLOAT_RETURN = 1<<5, +#endif +#if defined(__m68k__) + __VA_FREG_FLOAT_RETURN = 1<<6, +#endif + /* the default way to return floats */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another float returning convention, + * just #define __VA_FLOAT_RETURN ... + * before or after #including . + */ +#ifndef __VA_FLOAT_RETURN +#if (defined(__m68k__) || (defined(__sparc__) && !defined(__sparc64__))) && !defined(__GNUC__) && defined(__sun) && !(defined(__SUNPRO_C) || defined(__SUNPRO_CC)) /* Sun cc or CC */ + __VA_FLOAT_RETURN = __VA_SUNCC_FLOAT_RETURN, +#elif defined(__m68k__) + __VA_FLOAT_RETURN = __VA_FREG_FLOAT_RETURN, +#else + __VA_FLOAT_RETURN = 0, +#endif +#endif + + /* how to pass structs */ +#if defined(__mips__) || defined(__mipsn32__) || defined(__mips64__) + __VA_SGICC_STRUCT_ARGS = 1<<7, +#endif +#if defined(__powerpc__) || defined(__powerpc64__) + __VA_AIXCC_STRUCT_ARGS = 1<<7, +#endif +#if defined(__ia64__) + __VA_OLDGCC_STRUCT_ARGS = 1<<7, +#endif + /* the default way to pass structs */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another structs passing convention, + * just #define __VA_STRUCT_ARGS ... + * before or after #including . + */ +#ifndef __VA_STRUCT_ARGS +#if (defined(__mips__) && !defined(__mipsn32__) && !defined(__mips64__)) && !defined(__GNUC__) /* SGI mips cc */ + __VA_STRUCT_ARGS = __VA_SGICC_STRUCT_ARGS, +#else +#if (defined(__mipsn32__) || defined(__mips64__)) && (!defined(__GNUC__) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ > 3)) /* SGI mips cc or gcc >= 3.4 */ + __VA_STRUCT_ARGS = __VA_SGICC_STRUCT_ARGS, +#else +#if defined(__powerpc__) && !defined(__powerpc64__) && defined(_AIX) && !defined(__GNUC__) /* AIX 32-bit cc, xlc */ + __VA_STRUCT_ARGS = __VA_AIXCC_STRUCT_ARGS, +#else +#if defined(__powerpc64__) && defined(_AIX) /* AIX 64-bit cc, xlc, gcc, xlclang */ + __VA_STRUCT_ARGS = __VA_AIXCC_STRUCT_ARGS, +#else +#if defined(__ia64__) && !(defined(__GNUC__) && (__GNUC__ >= 3)) + __VA_STRUCT_ARGS = __VA_OLDGCC_STRUCT_ARGS, +#else + __VA_STRUCT_ARGS = 0, +#endif +#endif +#endif +#endif +#endif +#endif + + /* how to pass floats */ + /* ANSI C compilers and GNU gcc pass floats as floats. + * K&R C compilers pass floats as doubles. We don't support them any more. + */ +#if defined(__powerpc64__) + __VA_AIXCC_FLOAT_ARGS = 1<<8, /* pass floats in the low 4 bytes of an 8-bytes word */ +#endif + /* the default way to pass floats */ + /* This choice here is based on the assumption that the function you are + * going to call has been compiled with the same compiler you are using to + * include this file. + * If you want to call functions with another float passing convention, + * just #define __VA_FLOAT_ARGS ... + * before or after #including . + */ +#ifndef __VA_FLOAT_ARGS +#if defined(__powerpc64__) && defined(_AIX) && (defined(__ibmxl__) || !defined(__GNUC__)) /* AIX 64-bit xlc, xlclang */ + __VA_FLOAT_ARGS = __VA_AIXCC_FLOAT_ARGS, +#else + __VA_FLOAT_ARGS = 0, +#endif +#endif + + /* how to pass and return small integer arguments */ + __VA_ANSI_INTEGERS = 0, /* no promotions */ + __VA_TRADITIONAL_INTEGERS = 0, /* promote [u]char, [u]short to [u]int */ + /* Fortunately these two methods are compatible. Our macros work with both. */ + + /* stack cleanup policy */ + __VA_CDECL_CLEANUP = 0, /* caller pops args after return */ + __VA_STDCALL_CLEANUP = 1<<9, /* callee pops args before return */ + /* currently only supported on __i386__ */ +#ifndef __VA_CLEANUP + __VA_CLEANUP = __VA_CDECL_CLEANUP, +#endif + + /* These are for internal use only */ +#if defined(__i386__) || defined(__m68k__) || defined(__mipsn32__) || defined(__mips64__) || defined(__sparc64__) || defined(__alpha__) || defined(__hppa64__) || defined(__arm__) || defined(__armhf__) || defined(__arm64__) || defined(__powerpc__) || defined(__powerpc64__) || defined(__ia64__) || defined(__x86_64__) || (defined(__s390__) && !defined(__s390x__)) || defined(__riscv64__) + __VA_REGISTER_STRUCT_RETURN = 1<<10, +#endif +#if defined(__mipsn32__) || defined(__mips64__) + __VA_REGISTER_FLOATSTRUCT_RETURN = 1<<11, + __VA_REGISTER_DOUBLESTRUCT_RETURN = 1<<12, +#endif + + __VA_flag_for_broken_compilers_that_dont_like_trailing_commas +}; + +/* + * Definition of the ‘va_alist’ type. + */ +struct vacall_alist; +typedef struct vacall_alist * va_alist; + + +/* + * Definition of the va_start_xxx macros. + */ +#define __VA_START_FLAGS \ + __VA_STRUCT_RETURN | __VA_FLOAT_RETURN | __VA_STRUCT_ARGS | __VA_FLOAT_ARGS | __VA_CLEANUP + +extern void vacall_start (va_alist /* LIST */, int /* RETTYPE */, int /* FLAGS */); + +#define va_start_void(LIST) vacall_start(LIST,__VAvoid, __VA_START_FLAGS) +#define va_start_char(LIST) vacall_start(LIST,__VAchar, __VA_START_FLAGS) +#define va_start_schar(LIST) vacall_start(LIST,__VAschar, __VA_START_FLAGS) +#define va_start_uchar(LIST) vacall_start(LIST,__VAuchar, __VA_START_FLAGS) +#define va_start_short(LIST) vacall_start(LIST,__VAshort, __VA_START_FLAGS) +#define va_start_ushort(LIST) vacall_start(LIST,__VAushort, __VA_START_FLAGS) +#define va_start_int(LIST) vacall_start(LIST,__VAint, __VA_START_FLAGS) +#define va_start_uint(LIST) vacall_start(LIST,__VAuint, __VA_START_FLAGS) +#define va_start_long(LIST) vacall_start(LIST,__VAlong, __VA_START_FLAGS) +#define va_start_ulong(LIST) vacall_start(LIST,__VAulong, __VA_START_FLAGS) +#define va_start_longlong(LIST) vacall_start(LIST,__VAlonglong, __VA_START_FLAGS) +#define va_start_ulonglong(LIST) vacall_start(LIST,__VAulonglong,__VA_START_FLAGS) +#define va_start_float(LIST) vacall_start(LIST,__VAfloat, __VA_START_FLAGS) +#define va_start_double(LIST) vacall_start(LIST,__VAdouble, __VA_START_FLAGS) +#define va_start_ptr(LIST,TYPE) vacall_start(LIST,__VAvoidp, __VA_START_FLAGS) + +/* + * va_start_struct: Preparing structure return. + */ +extern void vacall_start_struct (va_alist /* LIST */, size_t /* TYPE_SIZE */, size_t /* TYPE_ALIGN */, int /* TYPE_SPLITTABLE */, int /* FLAGS */); + +#define va_start_struct(LIST,TYPE,TYPE_SPLITTABLE) \ + _va_start_struct(LIST,sizeof(TYPE),__VA_alignof(TYPE),TYPE_SPLITTABLE) +/* _va_start_struct() is like va_start_struct(), except that you pass + * the type's size and alignment instead of the type itself. + * Undocumented, but used by GNU clisp. + */ +#define _va_start_struct(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE) \ + vacall_start_struct(LIST,TYPE_SIZE,TYPE_ALIGN,TYPE_SPLITTABLE,__VA_START_FLAGS) + + +/* + * Definition of the va_arg_xxx macros. + */ + +extern char vacall_arg_char (va_alist /* LIST */); +extern signed char vacall_arg_schar (va_alist /* LIST */); +extern unsigned char vacall_arg_uchar (va_alist /* LIST */); +extern short vacall_arg_short (va_alist /* LIST */); +extern unsigned short vacall_arg_ushort (va_alist /* LIST */); +extern int vacall_arg_int (va_alist /* LIST */); +extern unsigned int vacall_arg_uint (va_alist /* LIST */); +extern long vacall_arg_long (va_alist /* LIST */); +extern unsigned long vacall_arg_ulong (va_alist /* LIST */); + +#define va_arg_char(LIST) vacall_arg_char(LIST) +#define va_arg_schar(LIST) vacall_arg_schar(LIST) +#define va_arg_uchar(LIST) vacall_arg_uchar(LIST) +#define va_arg_short(LIST) vacall_arg_short(LIST) +#define va_arg_ushort(LIST) vacall_arg_ushort(LIST) +#define va_arg_int(LIST) vacall_arg_int(LIST) +#define va_arg_uint(LIST) vacall_arg_uint(LIST) +#define va_arg_long(LIST) vacall_arg_long(LIST) +#define va_arg_ulong(LIST) vacall_arg_ulong(LIST) + +extern long long vacall_arg_longlong (va_alist /* LIST */); +extern unsigned long long vacall_arg_ulonglong (va_alist /* LIST */); + +#define va_arg_longlong(LIST) vacall_arg_longlong(LIST) +#define va_arg_ulonglong(LIST) vacall_arg_ulonglong(LIST) + +/* Floating point arguments. */ + +extern float vacall_arg_float (va_alist /* LIST */); +extern double vacall_arg_double (va_alist /* LIST */); + +#define va_arg_float(LIST) vacall_arg_float(LIST) +#define va_arg_double(LIST) vacall_arg_double(LIST) + +/* Pointer arguments. */ + +extern void* vacall_arg_ptr (va_alist /* LIST */); +#define va_arg_ptr(LIST,TYPE) ((TYPE)vacall_arg_ptr(LIST)) + +/* Structure arguments. */ + +extern void* vacall_arg_struct (va_alist /* LIST */, size_t /* TYPE_SIZE */, size_t /* TYPE_ALIGN */); + +#define va_arg_struct(LIST,TYPE) \ + *(TYPE*)vacall_arg_struct(LIST,sizeof(TYPE),__VA_alignof(TYPE)) +/* _va_arg_struct() is like va_arg_struct(), except that you pass the type's + * size and alignment instead of the type and get the value's address instead + * of the value itself. + * Undocumented, but used by GNU clisp. + */ +#define _va_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) \ + vacall_arg_struct(LIST,TYPE_SIZE,TYPE_ALIGN) + + +/* + * Definition of the va_return_xxx macros. + */ + +extern void vacall_return_void (va_alist /* LIST */); +#define va_return_void(LIST) vacall_return_void(LIST) + +extern void vacall_return_char (va_alist /* LIST */, char /* VAL */); +extern void vacall_return_schar (va_alist /* LIST */, signed char /* VAL */); +extern void vacall_return_uchar (va_alist /* LIST */, unsigned char /* VAL */); +extern void vacall_return_short (va_alist /* LIST */, short /* VAL */); +extern void vacall_return_ushort (va_alist /* LIST */, unsigned short /* VAL */); +extern void vacall_return_int (va_alist /* LIST */, int /* VAL */); +extern void vacall_return_uint (va_alist /* LIST */, unsigned int /* VAL */); +extern void vacall_return_long (va_alist /* LIST */, long /* VAL */); +extern void vacall_return_ulong (va_alist /* LIST */, unsigned long /* VAL */); +#define va_return_char(LIST,VAL) vacall_return_char(LIST,VAL) +#define va_return_schar(LIST,VAL) vacall_return_schar(LIST,VAL) +#define va_return_uchar(LIST,VAL) vacall_return_uchar(LIST,VAL) +#define va_return_short(LIST,VAL) vacall_return_short(LIST,VAL) +#define va_return_ushort(LIST,VAL) vacall_return_ushort(LIST,VAL) +#define va_return_int(LIST,VAL) vacall_return_int(LIST,VAL) +#define va_return_uint(LIST,VAL) vacall_return_uint(LIST,VAL) +#define va_return_long(LIST,VAL) vacall_return_long(LIST,VAL) +#define va_return_ulong(LIST,VAL) vacall_return_ulong(LIST,VAL) + +extern void vacall_return_longlong (va_alist /* LIST */, long long /* VAL */); +extern void vacall_return_ulonglong (va_alist /* LIST */, unsigned long long /* VAL */); +#define va_return_longlong(LIST,VAL) vacall_return_longlong(LIST,VAL) +#define va_return_ulonglong(LIST,VAL) vacall_return_ulonglong(LIST,VAL) + +extern void vacall_return_float (va_alist /* LIST */, float /* VAL */); +extern void vacall_return_double (va_alist /* LIST */, double /* VAL */); +#define va_return_float(LIST,VAL) vacall_return_float(LIST,VAL) +#define va_return_double(LIST,VAL) vacall_return_double(LIST,VAL) + +extern void vacall_return_ptr (va_alist /* LIST */, void* /* VAL */); +#define va_return_ptr(LIST,TYPE,VAL) vacall_return_ptr(LIST,(void*)(TYPE)(VAL)) + +extern void vacall_return_struct (va_alist /* LIST */, size_t /* TYPE_SIZE */, size_t /* TYPE_ALIGN */, const void* /* VAL_ADDR */); + +#define va_return_struct(LIST,TYPE,VAL) \ + _va_return_struct(LIST,sizeof(TYPE),__VA_alignof(TYPE),&(VAL)) +/* Undocumented, but used by GNU clisp. */ +#define _va_return_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL_ADDR) \ + vacall_return_struct(LIST,TYPE_SIZE,TYPE_ALIGN,VAL_ADDR) + + +/* Determine whether a struct type is word-splittable, i.e. whether each of + * its components fit into a register. + * The entire computation is done at compile time. + */ +#define va_word_splittable_1(slot1) \ + (__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) +#define va_word_splittable_2(slot1,slot2) \ + ((__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) \ + && (__va_offset2(slot1,slot2)/sizeof(__vaword) == (__va_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__vaword)) \ + ) +#define va_word_splittable_3(slot1,slot2,slot3) \ + ((__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) \ + && (__va_offset2(slot1,slot2)/sizeof(__vaword) == (__va_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__vaword)) \ + && (__va_offset3(slot1,slot2,slot3)/sizeof(__vaword) == (__va_offset3(slot1,slot2,slot3)+sizeof(slot3)-1)/sizeof(__vaword)) \ + ) +#define va_word_splittable_4(slot1,slot2,slot3,slot4) \ + ((__va_offset1(slot1)/sizeof(__vaword) == (__va_offset1(slot1)+sizeof(slot1)-1)/sizeof(__vaword)) \ + && (__va_offset2(slot1,slot2)/sizeof(__vaword) == (__va_offset2(slot1,slot2)+sizeof(slot2)-1)/sizeof(__vaword)) \ + && (__va_offset3(slot1,slot2,slot3)/sizeof(__vaword) == (__va_offset3(slot1,slot2,slot3)+sizeof(slot3)-1)/sizeof(__vaword)) \ + && (__va_offset4(slot1,slot2,slot3,slot4)/sizeof(__vaword) == (__va_offset4(slot1,slot2,slot3,slot4)+sizeof(slot4)-1)/sizeof(__vaword)) \ + ) +#define __va_offset1(slot1) \ + 0 +#define __va_offset2(slot1,slot2) \ + ((__va_offset1(slot1)+sizeof(slot1)+__VA_alignof(slot2)-1) & -(long)__VA_alignof(slot2)) +#define __va_offset3(slot1,slot2,slot3) \ + ((__va_offset2(slot1,slot2)+sizeof(slot2)+__VA_alignof(slot3)-1) & -(long)__VA_alignof(slot3)) +#define __va_offset4(slot1,slot2,slot3,slot4) \ + ((__va_offset3(slot1,slot2,slot3)+sizeof(slot3)+__VA_alignof(slot4)-1) & -(long)__VA_alignof(slot4)) + + +/* + * Miscellaneous declarations. + */ +#ifdef __cplusplus +extern "C" void (*vacall) (); /* the return type is variable, not void! */ +#else +extern void (*vacall) (); /* the return type is variable, not void! */ +#endif +extern void (* vacall_function) (va_alist); + + +#ifdef __cplusplus +} +#endif + +#endif /* _VACALL_H */ diff --git a/vacall/vacall.html b/vacall/vacall.html new file mode 100644 index 0000000..fa61554 --- /dev/null +++ b/vacall/vacall.html @@ -0,0 +1,315 @@ + + + + VACALL manual page + + +

VACALL manual page

+ + +

+ +


+ + +

Name

+
+ +vacall - C functions called with variable arguments + + +

Synopsis

+
+ +
+#include <vacall.h>
+
+

+

+extern void* vacall_function;
+
+

+

+void function (va_alist alist)
+{
+  va_start_type(alist[, return_type]);
+  arg = va_arg_type(alist[, arg_type]);
+  va_return_type(alist[[, return_type], return_value]);
+}
+
+

+

+vacall_function = &function;
+
+

+

+val = ((return_type (*) ()) vacall) (arg1,arg2,...);
+
+ + +

Description

+
+ +This set of macros permit a C function function to be +called with variable arguments and to return variable +return values. This is much like the stdarg(3) facility, +but also allows the return value to be specified at run +time. +

+Function calling conventions differ considerably on different +machines, and vacall attempts to provide some +degree of isolation from such architecture dependencies. +

+The function that can be called with any number and type +of arguments and which will return any type of return +value is vacall. It will do some magic and call the function +stored in the variable vacall_function. If you want +to make more than one use of vacall, +use the trampoline(3) +facility to store &function + into vacall_function just +before calling vacall. +

+Within function, the following macros can be used to walk +through the argument list and specify a return value: +

+

+va_start_type(alist[, return_type]);
+
+starts the walk through the argument list and specifies the return type. +

+

+arg = va_arg_type(alist[, arg_type]);
+
+fetches the next argument from the argument list. +

+

+va_return_type(alist[[, return_type], return_value]);
+
+ends the walk through the argument list and specifies the return value. +

+The type in va_start_type + and va_return_type shall be one +of void, int, uint, long, +ulong, longlong, ulonglong, +double, struct, ptr +or +(for ANSI C calling conventions only) +char, schar, uchar, +short, ushort, float, +depending on the class of return_type. +

+The type specifiers in +va_start_type and va_return_type + must be the same. +The return_type specifiers passed to +va_start_type and va_return_type + must be the same. +

+The type in va_arg_type +shall be one of int, uint, long, +ulong, longlong, ulonglong, +double, struct, ptr +or (for ANSI C calling conventions only) +char, schar, uchar, +short, ushort, float, +depending on the class of arg_type. +

+In va_start_struct(alist, return_type, splittable); the +splittable flag specifies whether the struct return_type can +be returned in registers such that every struct field fits +entirely in a single register. This needs to be specified +for structs of size 2*sizeof(long). For structs of size +<= sizeof(long), splittable is ignored and assumed to be 1. +For structs of size > 2*sizeof(long), splittable is +ignored and assumed to be 0. There are some handy macros +for this: +

+va_word_splittable_1 (type1)
+va_word_splittable_2 (type1, type2)
+va_word_splittable_3 (type1, type2, type3)
+va_word_splittable_4 (type1, type2, type3, type4)
+
+For a struct with three slots +
+struct { type1 id1; type2 id2; type3 id3; }
+
+you can specify splittable as +va_word_splittable_3 (type1, type2, type3). + + +

Notes

+
+ +
    +
  1. Functions which want to emulate Kernighan & Ritchie style +functions (i.e., in ANSI C, functions without a typed +argument list) cannot use the type values +char, schar, uchar, +short, ushort, float. +As prescribed by the default +K&R C expression promotions, they have to use int instead +of char, schar, uchar, +short, ushort and double instead of +float. +

    +

  2. The macros va_start_longlong(), +va_start_ulonglong(), va_return_longlong(), +va_return_ulonglong(), va_arg_longlong() and +va_arg_ulonglong() work only if the C compiler has a working +long long 64-bit integer type. +

    +

  3. The struct types used in va_start_struct() and +va_struct() must only contain (signed or unsigned) int, +long, long long or pointer fields. Struct types containing +(signed or unsigned) char, short, float, double or other +structs are not supported. +

    +

+ + +

Example

+
+ +This example, a possible implementation of execl(3) on top +of execv(2) using stdarg(3), +
#include <stdarg.h>
+#define MAXARGS 100
+/* execl is called by execl(file, arg1, arg2, ..., (char *)0); */
+int execl (...)
+{
+  va_list ap;
+  char* file;
+  char* args[MAXARGS];
+  int argno = 0;
+  va_start (ap);
+  file = va_arg(ap, char*);
+  while ((args[argno] = va_arg(ap, char*)) != (char *)0)
+    argno++;
+  va_end (ap);
+  return execv(file, args);
+}
+
+looks like this using vacall(3): +
#include <vacall.h>
+#define MAXARGS 100
+/* execl is called by vacall(file, arg1, arg2, ..., (char *)0); */
+void execl (va_alist ap)
+{
+  char* file;
+  char* args[MAXARGS];
+  int argno = 0;
+  int retval;
+  va_start_int (ap);
+  file = va_arg_ptr(ap, char*);
+  while ((args[argno] = va_arg_ptr(ap, char*)) != (char *)0)
+    argno++;
+  retval = execv(file, args);
+  va_return_int (ap, retval);
+}
+vacall_function = &execl;
+
+

+ + +

See also

+ + +stdarg(3), trampoline(3), callback(3). + + +

Bugs

+
+ +The current implementations have been tested on a selection +of common cases but there are probably still many +bugs. +

+There are typically built-in limits on the size of the +argument-list, which may also include the size of any +structure arguments. +

+The decision whether a struct is to be returned in registers or in memory +considers only the struct's size and alignment. This is inaccurate: for +example, gcc on m68k-next returns +struct { char a,b,c; } +in registers and +struct { char a[3]; } +in memory, although both types have the same size and the same alignment. +

+The argument list can only be walked once. +

+The use of the global variable vacall_function is not +reentrant. This is fixed in the callback(3) package. + + +

Porting

+ + +Knowledge about argument passing conventions can be found +in the gcc source, file +gcc-2.6.3/config/cpu/cpu.h, +section "Stack layout; function entry, exit and calling." +

+The implementation of varargs for gcc can be found in the +gcc source, files gcc-2.6.3/ginclude/va*.h. +

+gcc's __builtin_saveregs() function is defined in the gcc +source, file gcc-2.6.3/libgcc2.c. +

+ + +

Author

+ + +Bruno Haible <bruno@clisp.org> + + +

Acknowledgements

+
+ +Many ideas and a lot of code were cribbed from the gcc +source. +

+ +


+ +
VACALL manual page
+Bruno Haible <bruno@clisp.org> +
+

+Last modified: 1 January 2017. + + + diff --git a/vacall/vacall.man b/vacall/vacall.man new file mode 100644 index 0000000..b69c7fb --- /dev/null +++ b/vacall/vacall.man @@ -0,0 +1,192 @@ +VACALL(3) Library Functions Manual VACALL(3) + + + +NAME + vacall - C functions called with variable arguments + +SYNOPSIS + #include  + + extern void* vacall_function; + + void function (va_alistalist) + { + va_start_type(alist[, return_type]); + arg = va_arg_type(alist[, arg_type]); + va_return_type(alist[[, return_type], return_value]); + } + + vacall_function = &function; + + val = ((return_type (*) ()) vacall) (arg1,arg2,...); + +DESCRIPTION + This set of macros permit a C function function to be called with vari‐ + able arguments and to return variable return values. This is much like + the stdarg(3) facility, but also allows the return value to be speci‐ + fied at run time. + + Function calling conventions differ considerably on different machines, + and vacall attempts to provide some degree of isolation from such + architecture dependencies. + + The function that can be called with any number and type of arguments + and which will return any type of return value is vacall. It will do + some magic and call the function stored in the variable vacall_func‐ + tion. If you want to make more than one use of vacall, use the trampo‐ + line(3) facility to store &function into vacall_function just before + calling vacall. + + Within function, the following macros can be used to walk through the + argument list and specify a return value: + + va_start_type(alist[, return_type]); + starts the walk through the argument list and specifies the + return type. + + arg = va_arg_type(alist[, arg_type]); + fetches the next argument from the argument list. + + va_return_type(alist[[, return_type], return_value]); + ends the walk through the argument list and specifies the return + value. + + The type in va_start_type and va_return_type shall be one of void, int, + uint, long, ulong, longlong, ulonglong, double, struct, ptr or (for + ANSI C calling conventions only) char, schar, uchar, short, ushort, + float, depending on the class of return_type. + + The type specifiers in va_start_type and va_return_type must be the + same. The return_type specifiers passed to va_start_type and + va_return_type must be the same. + + The type in va_arg_type shall be one of int, uint, long, ulong, long‐ + long, ulonglong, double, struct, ptr or (for ANSI C calling conventions + only) char, schar, uchar, short, ushort, float, depending on the class + of arg_type. + + In va_start_struct(alist, return_type, splittable); the splittable flag + specifies whether the struct return_type can be returned in registers + such that every struct field fits entirely in a single register. This + needs to be specified for structs of size 2*sizeof(long). For structs + of size <= sizeof(long), splittable is ignored and assumed to be 1. For + structs of size > 2*sizeof(long), splittable is ignored and assumed to + be 0. There are some handy macros for this: + va_word_splittable_1 (type1) + va_word_splittable_2 (type1, type2) + va_word_splittable_3 (type1, type2, type3) + va_word_splittable_4 (type1, type2, type3, type4) + For a struct with three slots + struct { type1 id1; type2 id2; type3 id3; } + you can specify splittable as va_word_splittable_3 (type1, type2, + type3) . + + +NOTES + Functions which want to emulate Kernighan & Ritchie style functions + (i.e., in ANSI C, functions without a typed argument list) cannot use + the type values char, schar, uchar, short, ushort, float. As pre‐ + scribed by the default K&R C expression promotions, they have to use + int instead of char, schar, uchar, short, ushort and double instead of + float. + + The macros va_start_longlong(), va_start_ulonglong(), va_return_long‐ + long(), va_return_ulonglong(), va_arg_longlong() and va_arg_ulonglong() + work only if the C compiler has a working long long 64-bit integer + type. + + The struct types used in va_start_struct() and va_struct() must only + contain (signed or unsigned) int, long, long long or pointer fields. + Struct types containing (signed or unsigned) char, short, float, double + or other structs are not supported. + + +EXAMPLE + This example, a possible implementation of execl(3) on top of execv(2) + using stdarg(3), + + #include  + #define MAXARGS 100 + /* execl is called by execl(file, arg1, arg2, ..., (char *)0); */ + int execl (...) + { + va_list ap; + char* file; + char* args[MAXARGS]; + int argno = 0; + va_start (ap); + file = va_arg(ap, char*); + while ((args[argno] = va_arg(ap, char*)) != (char *)0) + argno++; + va_end (ap); + return execv(file, args); + } + + looks like this using vacall(3): + + #include  + #define MAXARGS 100 + /* execl is called by vacall(file, arg1, arg2, ..., (char *)0); */ + void execl (va_alist ap) + { + char* file; + char* args[MAXARGS]; + int argno = 0; + int retval; + va_start_int (ap); + file = va_arg_ptr(ap, char*); + while ((args[argno] = va_arg_ptr(ap, char*)) != (char *)0) + argno++; + retval = execv(file, args); + va_return_int (ap, retval); + } + vacall_function = &execl; + + +SEE ALSO + stdarg(3), trampoline(3), callback(3). + + +BUGS + The current implementations have been tested on a selection of common + cases but there are probably still many bugs. + + There are typically built-in limits on the size of the argument-list, + which may also include the size of any structure arguments. + + The decision whether a struct is to be returned in registers or in mem‐ + ory considers only the struct's size and alignment. This is inaccurate: + for example, gcc on m68k-next returns struct { char a,b,c; } in regis‐ + ters and struct { char a[3]; } in memory, although both types have the + same size and the same alignment. + + The argument list can only be walked once. + + The use of the global variable vacall_function is not reentrant. This + is fixed in the callback(3) package. + + +PORTING + Knowledge about argument passing conventions can be found in the gcc + source, file gcc-2.6.3/config/cpu/cpu.h, section "Stack layout; func‐ + tion entry, exit and calling." + + The implementation of varargs for gcc can be found in the gcc source, + files gcc-2.6.3/ginclude/va*.h. + + gcc's __builtin_saveregs() function is defined in the gcc source, file + gcc-2.6.3/libgcc2.c. + + +AUTHOR + Bruno Haible + + +ACKNOWLEDGEMENTS + Many ideas and a lot of code were cribbed from the gcc source. + + + + + 1 January 2017 VACALL(3)